diff options
| author | anicet | 2015-06-24 11:56:53 +0200 | 
|---|---|---|
| committer | anicet | 2015-06-24 11:56:53 +0200 | 
| commit | 90ce4edf936519ba787e4536f1f1480e7782c5c2 (patch) | |
| tree | 511e8bc8281690e6256f855d8ba4171d99cf862e | |
| parent | 8d416883aac459ba610d56876752c98b7b6b8969 (diff) | |
| download | chouette-core-90ce4edf936519ba787e4536f1f1480e7782c5c2.tar.bz2 | |
Import/Export/ComplianceCheck Job : display action_parameters in sidebar
| -rw-r--r-- | app/helpers/history_helper.rb | 44 | ||||
| -rw-r--r-- | app/models/concerns/job_concern.rb | 13 | ||||
| -rw-r--r-- | app/models/import.rb | 6 | ||||
| -rw-r--r-- | config/locales/layouts.yml | 38 | 
4 files changed, 59 insertions, 42 deletions
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 5700be4c0..4054a4cef 100644 --- a/app/models/concerns/job_concern.rb +++ b/app/models/concerns/job_concern.rb @@ -66,4 +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/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" -       +  | 
