diff options
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/breadcrumb_helper.rb | 7 | ||||
| -rw-r--r-- | app/helpers/pagination_helper.rb | 2 | ||||
| -rw-r--r-- | app/helpers/validations_helper.rb | 36 |
3 files changed, 45 insertions, 0 deletions
diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb index 89cb92633..34e013f8d 100644 --- a/app/helpers/breadcrumb_helper.rb +++ b/app/helpers/breadcrumb_helper.rb @@ -34,6 +34,8 @@ module BreadcrumbHelper import_breadcrumb action when "Export" export_breadcrumb action + when "Validation" + validation_breadcrumb action when "ComplianceCheckTask" compliance_breadcrumb action when "RuleParameterSet" @@ -142,6 +144,11 @@ module BreadcrumbHelper add_breadcrumb Referential.human_attribute_name("exports"), referential_exports_path(@referential) unless action == :index end + def validation_breadcrumb (action) + referential_breadcrumb + add_breadcrumb Referential.human_attribute_name("validations"), referential_validations_path(@referential) unless action == :index + end + def compliance_breadcrumb (action) referential_breadcrumb add_breadcrumb Referential.human_attribute_name("compliance_check_tasks"), referential_compliance_check_tasks_path(@referential) unless action == :index diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb index 68c3d462f..c0e28ab56 100644 --- a/app/helpers/pagination_helper.rb +++ b/app/helpers/pagination_helper.rb @@ -1,3 +1,4 @@ +# coding: utf-8 module PaginationHelper def paginated_content(models, default_partial_name = nil, options = {}) default_options = {:delete => true, :edit => true} @@ -14,6 +15,7 @@ module PaginationHelper end html += '</div>' end + html.html_safe end end diff --git a/app/helpers/validations_helper.rb b/app/helpers/validations_helper.rb new file mode 100644 index 000000000..b655d238d --- /dev/null +++ b/app/helpers/validations_helper.rb @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +module ValidationsHelper + + def fields_for_validation_task_format(form) + begin + render :partial => validation_partial_name(form), :locals => { :form => form } + rescue ActionView::MissingTemplate + "" + end + end + + def validation_partial_name(form) + "fields_#{form.object.format.underscore}_validation" + end + + def compliance_icon( validation_task) + return nil unless validation_task.compliance_check_task + validation_task.compliance_check_task.tap do |cct| + if cct.failed? || cct.any_error_severity_failure? + return 'icons/link_page_alert.png' + else + return 'icons/link_page.png' + end + end + end + + def validation_progress_bar_tag(validation) + div_class = "" + content_tag :div, :class => "progress" do + content_tag :div, :class => div_class, role: "progressbar", :'aria-valuenow' => "#{validation.percentage_progress}", :'aria-valuemin' => "0", :'aria-valuemax' => "100", :style => "width: #{validation.percentage_progress}%;" do + "#{validation.percentage_progress}% " + I18n.t("validation_tasks.statuses.#{validation.status}") + end + end + end + +end |
