diff options
| author | Marc Florisson | 2015-06-24 16:15:00 +0200 |
|---|---|---|
| committer | Marc Florisson | 2015-06-24 16:15:00 +0200 |
| commit | 43d0c1cb2bb0bdb1f30e2614f2753523ce0ef108 (patch) | |
| tree | f19d9d1917034f2137906530f5a90241cdea5979 | |
| parent | 1b64825fbfbbfd0c1639c9d3d9421516c412d555 (diff) | |
| parent | 90ce4edf936519ba787e4536f1f1480e7782c5c2 (diff) | |
| download | chouette-core-43d0c1cb2bb0bdb1f30e2614f2753523ce0ef108.tar.bz2 | |
Merge branch 'master' of github.com:afimb/chouette2
| -rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
| -rw-r--r-- | app/helpers/history_helper.rb | 44 | ||||
| -rw-r--r-- | app/models/concerns/job_concern.rb | 38 | ||||
| -rw-r--r-- | app/models/import.rb | 6 | ||||
| -rw-r--r-- | app/views/compliance_checks/_compliance_check_results.erb | 23 | ||||
| -rw-r--r-- | app/views/compliance_checks/report.html.erb | 5 | ||||
| -rw-r--r-- | config/locales/compliance_check_results.yml | 2 | ||||
| -rw-r--r-- | config/locales/compliance_checks.yml | 3 | ||||
| -rw-r--r-- | config/locales/imports.fr.yml | 2 | ||||
| -rw-r--r-- | config/locales/layouts.yml | 38 |
10 files changed, 88 insertions, 75 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 811ea6f4c..d3e9655b9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3,7 +3,7 @@ module ApplicationHelper def font_awesome_classic_tag(name) name = "fa-file-text-o" if name == "fa-file-csv-o" name = "fa-file-code-o" if name == "fa-file-xml-o" - content_tag(:id, nil, {class: "fa #{name}"}) + content_tag(:i, nil, {class: "fa #{name}"}) end def stop_area_picture_url(stop_area) diff --git a/app/helpers/history_helper.rb b/app/helpers/history_helper.rb index 02a39a3d3..6557257e9 100644 --- a/app/helpers/history_helper.rb +++ b/app/helpers/history_helper.rb @@ -4,22 +4,22 @@ module HistoryHelper field_set_tag t("layouts.history_tag.title"), :class => "history_tag" do content_tag :ul do [(content_tag :li do - if object.has_attribute?(:creation_time) + if object.has_attribute?(:creation_time) object.human_attribute_name('creation_time') + ' : ' + l(object.creation_time, :format => :short) - else + else object.class.human_attribute_name('created_at') + ' : ' + l(object.created_at, :format => :short) end - end), + end), (content_tag :li do if object.has_attribute?(:creator_id) object.human_attribute_name('creator_id') + ' : ' + object.creator_id if object.creator_id end - end), + end), (content_tag :li do if object.has_attribute?(:objectid) object.human_attribute_name('objectid') + ' : ' + object.objectid if object.objectid end - end), + end), (content_tag :li do if object.has_attribute?(:object_version) object.human_attribute_name('object_version') + ' : ' + object.object_version.to_s if object.object_version @@ -28,26 +28,26 @@ module HistoryHelper end end end - + def history_tag(object) - field_set_tag t("layouts.history_tag.title"), :class => "history_tag" do + field_set_tag t("layouts.history_tag.title"), class: "history_tag" do content_tag :ul do - [(content_tag :li do - if object.created_at - t('layouts.history_tag.created_at') + ' : ' + l(object.created_at, :format => :short) - end - end), - (content_tag :li do - if object.updated_at - t('layouts.history_tag.updated_at') + ' : ' + l(object.updated_at, :format => :short) - end - end), - (content_tag :li do - if object.user_name - t('layouts.history_tag.user_name') + ' : ' + object.user_name - end - end)].join.html_safe + [:created_at, :updated_at, :user_name, :name, :organisation_name, + :referential_name, :no_save, :clean_repository].each do |field| + concat history_tag_li(object, field) + end end end end + + protected + + def history_tag_li(object, field) + if object.respond_to?(field) + key = t("layouts.history_tag.#{field}") + value = object.public_send(field) + value = l(value, format: :short) if value.is_a?(Time) + content_tag(:li, "#{key} : #{value}") + end + end end diff --git a/app/models/concerns/job_concern.rb b/app/models/concerns/job_concern.rb index b0c26baa9..4054a4cef 100644 --- a/app/models/concerns/job_concern.rb +++ b/app/models/concerns/job_concern.rb @@ -3,8 +3,8 @@ module JobConcern extend ActiveModel::Naming extend ActiveModel::Translation include ActiveModel::Model - - included do + + included do attr_reader :datas end @@ -13,9 +13,9 @@ module JobConcern def links {}.tap do |links| - datas.links.each do |link| - links[link["rel"]] = link["href"] - end + datas['links'].each do |link| + links[link["rel"]] = link["href"] + end end end @@ -32,9 +32,9 @@ module JobConcern end def cache_expiration - started? ? 10.seconds : 1.hours + started? ? 10.seconds : 1.hours end - + def id datas.id end @@ -46,16 +46,16 @@ module JobConcern def referential_name datas.referential end - + def name datas.action_parameters.name end - - def user_name + + def user_name datas.action_parameters.user_name end - - def created_at + + def created_at Time.at(datas.created.to_i / 1000) if datas.created end @@ -66,5 +66,17 @@ module JobConcern def format datas.type end - + + def organisation_name + datas.action_parameters.organisation_name + end + + def no_save + datas.action_parameters.no_save + end + alias_method :no_save?, :no_save + + def clean_repository + datas.action_parameters.clean_repository + end end diff --git a/app/models/import.rb b/app/models/import.rb index b7cfd5a24..078f1698e 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -84,10 +84,4 @@ class Import def filename_extension File.extname(filename).gsub(".", "") if filename end - - def no_save - datas.action_parameters.no_save - end - alias_method :no_save?, :no_save - end diff --git a/app/views/compliance_checks/_compliance_check_results.erb b/app/views/compliance_checks/_compliance_check_results.erb index 78c29aaff..ab8d283eb 100644 --- a/app/views/compliance_checks/_compliance_check_results.erb +++ b/app/views/compliance_checks/_compliance_check_results.erb @@ -23,7 +23,7 @@ </div> </form> </p> -<table class="table table-hover toggle-square" +<table class="table table-hover toggle-circle toggle-medium" data-filter="#filter" data-page-size="20" data-title-nok="<%=t('compliance_check_result.statuses.nok') %>" @@ -31,12 +31,12 @@ data-title-ok="<%=t('compliance_check_result.statuses.ok') %>"> <thead> <tr> - <th class="col-md-1" data-sort-ignore="true"><%= ComplianceCheckResult.human_attribute_name(:status) %></th> + <th data-sort-ignore="true"><%= ComplianceCheckResult.human_attribute_name(:status) %></th> <th class="col-md-1" data-sort-ignore="true"><%= ComplianceCheckResult.human_attribute_name(:severity) %></th> - <th class="col-md-2"><%= ComplianceCheckResult.human_attribute_name(:rule_code) %></th> - <th class="col-md-2" data-toggle="true" data-sort-ignore="true"><%= ComplianceCheckResult.human_attribute_name(:detail) %></th> + <th class="col-md-3"><%= ComplianceCheckResult.human_attribute_name(:rule_code) %></th> + <th class="col-md-2"><%=t('compliance_check_results.errors') %></th> + <th class="col-md-6" data-toggle="true" data-sort-ignore="true"><%= ComplianceCheckResult.human_attribute_name(:detail) %></th> <th data-hide="all" data-sort-ignore="true"></th> - <th class="col-md-6" data-sort-ignore="true"></th> </tr> </thead> <tbody> @@ -51,6 +51,9 @@ <%= ("#{test.error_count || 0} #{ComplianceCheckResult.human_attribute_name(:violation_count)}") if test.errors.present? %> </td> <td> + <%= truncate(t("activemodel.attributes.compliance_check_result.#{test.test_id}"), length: 50)%> + </td> + <td> <p><b><%=t("activemodel.attributes.compliance_check_result.#{test.test_id}")%></b></p> <% if test.errors.present? %> <% test.errors.first(10).each do |error| %> @@ -81,16 +84,6 @@ <% end %> <% end %> </td> - <td> - <button data-content='<%=t("activemodel.attributes.compliance_check_result.#{test.test_id}")%>' - data-title='<%=t("activemodel.attributes.compliance_check_result.title")%>' - rel="popover" - data-toggle="popover" - class="notice btn btn-info btn-xs"> - <i class="fa fa-info"></i> - </button> - <%= truncate(t("activemodel.attributes.compliance_check_result.#{test.test_id}"), length: 59)%> - </td> </tr> <% end %> </tbody> diff --git a/app/views/compliance_checks/report.html.erb b/app/views/compliance_checks/report.html.erb index 24cffab38..28abd4cbb 100644 --- a/app/views/compliance_checks/report.html.erb +++ b/app/views/compliance_checks/report.html.erb @@ -2,10 +2,11 @@ <div class="compliance_check_show"> <div class="links"> - <%= link_to(font_awesome_classic_tag('fa-eye') + t("compliance_checks.index.title"), referential_compliance_check_path(@referential, @compliance_check.id)) %> <% if @compliance_check.class == Import %> + <%= link_to(font_awesome_classic_tag('fa-eye') + t("compliance_checks.report.action_report"), referential_import_path(@referential, @compliance_check.id)) %> <%= link_to font_awesome_classic_tag("fa-external-link") + t("compliance_checks.rule_parameter_set"), rule_parameter_set_referential_import_path(@referential, @compliance_check.id) if @compliance_check.rule_parameter_set? %> <% else %> + <%= link_to(font_awesome_classic_tag('fa-eye') + t("compliance_checks.report.action_report"), referential_compliance_check_path(@referential, @compliance_check.id)) %> <%= link_to font_awesome_classic_tag("fa-external-link") + t("compliance_checks.rule_parameter_set"), rule_parameter_set_referential_compliance_check_path(@referential, @compliance_check.id) if @compliance_check.rule_parameter_set? %> <% end %> <div class="btn-group pull-right"> @@ -14,7 +15,7 @@ </button> <ul class="dropdown-menu" role="menu"> <li> - <% if @compliance_check.class == Import %> + <% if @compliance_check.class == Import %> <%= link_to t("compliance_checks.show.export_csv"), export_referential_import_path(@referential, @compliance_check.id) %> <% else %> <%= link_to t("compliance_checks.show.export_csv"), export_referential_compliance_check_path(@referential, @compliance_check.id) %> diff --git a/config/locales/compliance_check_results.yml b/config/locales/compliance_check_results.yml index aa219dbaf..acbaa6826 100644 --- a/config/locales/compliance_check_results.yml +++ b/config/locales/compliance_check_results.yml @@ -1,5 +1,6 @@ en: compliance_check_results: + errors: 'Errors' file: zip_name_prefix: "compliance_check_results" summary_errors_file_prefix: "summary_of_tests.csv" @@ -344,6 +345,7 @@ en: first_violations: "First violations" fr: compliance_check_results: + errors: 'Erreurs' file: zip_name_prefix: "resultats_de_validation" summary_errors_file_prefix: "sommaire_des_tests.csv" diff --git a/config/locales/compliance_checks.yml b/config/locales/compliance_checks.yml index 1d2331bcb..b94e66d92 100644 --- a/config/locales/compliance_checks.yml +++ b/config/locales/compliance_checks.yml @@ -87,11 +87,12 @@ fr: export_csv: "Format CSV" report: validation_success: "La validation est passé avec succès." + action_report: "Rapport d'action" actions: destroy_confirm: "Voulez-vous supprimer ce résultat de validation ?" destroy: "Supprimer cette validation" edit: "Editer cette validation" - report: "Rapport" + report: "Test de conformité" rule_parameter_set: "Jeu de paramètres" download: "Télécharger" statuses: diff --git a/config/locales/imports.fr.yml b/config/locales/imports.fr.yml index bc9fbbae3..0eee4fc02 100644 --- a/config/locales/imports.fr.yml +++ b/config/locales/imports.fr.yml @@ -11,7 +11,7 @@ fr: report: "Rapport" imported_file: "Fichier source" rule_parameter_set: "Jeu de paramètres" - compliance_check: "Rapport de validation" + compliance_check: "Test de conformité" compliance_check_of: "Validation de l'import : " import_of_validation: "L'import de la validation" compliance_check_task: "Validation" diff --git a/config/locales/layouts.yml b/config/locales/layouts.yml index d679fc01f..7435f93c4 100644 --- a/config/locales/layouts.yml +++ b/config/locales/layouts.yml @@ -2,7 +2,7 @@ en: layouts: back_to_dashboard: "Back to Dashboard" help: "Help" - home: "Home" + home: "Home" user: profile: "My Profile" sign_out: "Sign out" @@ -13,15 +13,20 @@ en: return_to_dashboard: "Return to Dashboard" referential_datas: "Datas" history_tag: - title: "Metadatas" + title: "Metadatas" created_at: "Created at" updated_at: "Updated at" user_name: "User" + name: "Name" + organisation_name: "Organisation name" + referential_name: "Referential name" + clean_repository: "Clean Repository" + no_save: "No save" flash_messages: success: "Success" error: "Error" alert: "Alert" - notice: "Info" + notice: "Info" footer: support: title: "Support" @@ -35,16 +40,16 @@ en: user_group: "User group" contact: title: "Contact" - mail: "Contact us" - newsletter: "Newsletter" - forum: "Forum" + mail: "Contact us" + newsletter: "Newsletter" + forum: "Forum" fr: layouts: back_to_dashboard: "Retour au Tableau de Bord" help: "Aide" home: "Accueil" user: - profile: "Mon Profil" + profile: "Mon Profil" sign_out: "Déconnexion" navbar: return_to_referentials: "Retour à la liste des espaces de données" @@ -53,10 +58,15 @@ fr: return_to_dashboard: "Retour au Tableau de Bord" referential_datas: "Données" history_tag: - title: "Métadonnées" + title: "Métadonnées" created_at: "Créé le" updated_at: "Mise à jour le" user_name: "Auteur" + name: "Name" + organisation_name: "Organisation name" + referential_name: "Referential name" + clean_repository: "Clean Repository" + no_save: "No save" flash_messages: success: "Succès" error: "Erreur" @@ -75,19 +85,19 @@ fr: user_group: "Club utilisateur" contact: title: "Contact" - mail: "Contactez nous" - newsletter: "Lettre d'information" - forum: "Forum" + mail: "Contactez nous" + newsletter: "Lettre d'information" + forum: "Forum" true: "oui" false: "non" or: "ou" back: "Revenir" today: "Aujourd'hui" yesterday: "Hier" - edit_periods: "Editer Périodes" - delete_periods: "Supprimer Périodes" + edit_periods: "Editer Périodes" + delete_periods: "Supprimer Périodes" attributes: author: "Modifié par" created_at: "Créé le" updated_at: "Modifié le" - + |
