diff options
| author | jpl | 2017-02-08 17:54:48 +0100 |
|---|---|---|
| committer | jpl | 2017-02-08 17:54:48 +0100 |
| commit | 2cfafe1c03e9ca1b18e16333d54b91d6e05922a3 (patch) | |
| tree | 12e2edc578f95b5a29f17151631bff1595881668 | |
| parent | 4d29cd1e8dddce08731b7962491d864fdfe0f8f6 (diff) | |
| download | chouette-core-2cfafe1c03e9ca1b18e16333d54b91d6e05922a3.tar.bz2 | |
Refs #2482: updating referentials#show with new layout
| -rw-r--r-- | app/assets/stylesheets/components/_buttons.sass | 13 | ||||
| -rw-r--r-- | app/assets/stylesheets/components/_main_nav.sass | 1 | ||||
| -rw-r--r-- | app/assets/stylesheets/components/_page_header.sass | 30 | ||||
| -rw-r--r-- | app/controllers/referentials_controller.rb | 4 | ||||
| -rw-r--r-- | app/helpers/pagination_helper.rb | 3 | ||||
| -rw-r--r-- | app/views/layouts/navigation/_main_nav_left.html.slim | 4 | ||||
| -rw-r--r-- | app/views/referentials/_reflines.html.slim | 16 | ||||
| -rw-r--r-- | app/views/referentials/show.html.slim | 166 | ||||
| -rw-r--r-- | config/locales/actions.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/actions.fr.yml | 1 | ||||
| -rw-r--r-- | config/locales/referentials.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/referentials.fr.yml | 1 | ||||
| -rw-r--r-- | config/locales/will_paginate.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/will_paginate.fr.yml | 1 |
14 files changed, 160 insertions, 83 deletions
diff --git a/app/assets/stylesheets/components/_buttons.sass b/app/assets/stylesheets/components/_buttons.sass index b57a15994..ac367ded5 100644 --- a/app/assets/stylesheets/components/_buttons.sass +++ b/app/assets/stylesheets/components/_buttons.sass @@ -3,6 +3,17 @@ //-----------// .btn + font-weight: 700 + + &.btn-default + background-color: #fff + border-color: rgba(#fff, 0.5) + color: $blue + + &:hover, &:focus, &.focus, &:active, &.active, + .open > .btn-primary.dropdown-toggle + background-color: darken(#fff, 2.5%) + &.btn-primary background-color: $darkblue border-color: darken($darkblue, 2.5%) @@ -15,7 +26,7 @@ color: #fff + .btn - margin-left: 12px + margin-left: 15px // Table btn-groups table, .table diff --git a/app/assets/stylesheets/components/_main_nav.sass b/app/assets/stylesheets/components/_main_nav.sass index fca6f7769..32a7617c1 100644 --- a/app/assets/stylesheets/components/_main_nav.sass +++ b/app/assets/stylesheets/components/_main_nav.sass @@ -286,6 +286,7 @@ $menuW: 300px word-spacing: normal text-rendering: auto width: $menuW + min-height: $menuW float: right background-color: #fff color: $darkgrey diff --git a/app/assets/stylesheets/components/_page_header.sass b/app/assets/stylesheets/components/_page_header.sass index 4fb4b02c3..2431e5d4d 100644 --- a/app/assets/stylesheets/components/_page_header.sass +++ b/app/assets/stylesheets/components/_page_header.sass @@ -36,4 +36,32 @@ line-height: $line-height + .btn - margin-left: 10px + margin-left: 15px + + .page_metalist + margin: 0 0 25px 0 + padding: 0 0 0 65px + font-size: 0.85em + + .pm-col + display: inline-block + + + .pm-col + margin-left: 15px + padding-left: 15px + border-left: 1px solid rgba(#fff, 0.5) + + .pm-item + margin-top: 0.5em + + &:first-child + margin-top: 0 + + &::before + content: '\f054' + font: normal normal normal 14px/1 FontAwesome + font-size: inherit + text-rendering: auto + -webkit-font-smoothing: antialiased + display: inline + margin-right: 0.5em diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index 5ec4fc2cf..83a56b6e0 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -32,8 +32,8 @@ class ReferentialsController < BreadcrumbController } format.html { build_breadcrumb :show} end - @reflines = lines_collection.paginate(page: params[:page], per_page: 10) - # resource.lines.paginate(page: params[:page], per_page: 10) + @q = lines_collection.ransack(params[:q]) + @reflines = @q.result(distinct: true).paginate(page: params[:page], per_page: 10) end def edit diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb index e604d47c3..ea5902d63 100644 --- a/app/helpers/pagination_helper.rb +++ b/app/helpers/pagination_helper.rb @@ -20,7 +20,8 @@ module PaginationHelper end def new_pagination collection, cls = nil - pinfos = page_entries_info collection, model: t("will_paginate.page_entries_info.#{collection.first.class.name.downcase}"), html: false + k = collection.first.class.name.split('::').last.downcase + pinfos = page_entries_info collection, model: t("will_paginate.page_entries_info.#{k}"), html: false if collection.total_pages > 1 links = content_tag :div, '', class: 'page_links' do diff --git a/app/views/layouts/navigation/_main_nav_left.html.slim b/app/views/layouts/navigation/_main_nav_left.html.slim index 88491635f..d1ab41901 100644 --- a/app/views/layouts/navigation/_main_nav_left.html.slim +++ b/app/views/layouts/navigation/_main_nav_left.html.slim @@ -3,9 +3,7 @@ .menu-content .closeMenu title='Fermer le menu' - .brandname - = "IBOO" - small = "#{params[:controller]}, #{params[:action]}" + .brandname IBOO #menu-items.panel-group .menu-item.panel diff --git a/app/views/referentials/_reflines.html.slim b/app/views/referentials/_reflines.html.slim deleted file mode 100644 index 6b6396d3a..000000000 --- a/app/views/referentials/_reflines.html.slim +++ /dev/null @@ -1,16 +0,0 @@ -- if @reflines && @reflines.any? - p - strong Lignes : - - = table_builder @reflines, - { 'Oid' => Proc.new { |n| n.objectid.local_id }, @reflines.human_attribute_name(:id) => 'id', - @reflines.human_attribute_name(:number) => 'number', @reflines.human_attribute_name(:name) => 'name', @reflines.human_attribute_name(:network) => Proc.new { |n| n.try(:network).try(:name) }, @reflines.human_attribute_name(:company) => Proc.new { |n| n.try(:company).try(:name) } }, - [], - [], - 'table table-bordered' - - .text-center - = will_paginate @reflines, container: false, renderer: BootstrapPagination::Rails - -- else - = replacement_msg t('referential_lines.search_no_results') diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index 4826f9040..270cbd4d1 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -1,59 +1,107 @@ -h2 - = @referential.name - em.small = " (archivé)" if @referential.archived? - -.summary - - if @referential.created_from - p - label = "#{Referential.human_attribute_name('created_from')} : " - = " #{@referential.created_from.name}" - - p - label = "#{Referential.human_attribute_name('slug')} : " - = " #{@referential.slug}" - - p - label = "#{Referential.human_attribute_name('prefix')} : " - = " #{@referential.prefix}" - - p - label = "#{Referential.human_attribute_name('projection_type')} : " - - if !@referential.projection_type_label.empty? - = " #{@referential.projection_type_label} (epsg:#{@referential.projection_type})" - - p - label = "#{Referential.human_attribute_name('time_zone').capitalize} : " - = " #{@referential.time_zone}" - - p - label = "#{Referential.human_attribute_name('validity_period')} : " - - unless period = @referential.metadatas_period - = " #{Referential.human_attribute_name('no_validity_period')}" - - else - => " #{Referential.human_attribute_name('start_validity_period')}" - => l period.begin - => Referential.human_attribute_name("end_validity_period") - = l period.end - - #reflines - = render partial: 'reflines' - - / - if @referential.api_keys.present? - / h3.api_keys = t('.api_keys') - / - / .api_keys.paginated_content - / = paginated_content(@referential.api_keys, "api_keys/api_key") - -- content_for :sidebar do - ul.actions - - if policy(@referential).update? - li = link_to t('referentials.actions.edit'), edit_referential_path(@referential), class: 'edit' - - li = link_to t('referentials.actions.destroy'), referential_path(@referential), method: :delete, data: {:confirm => t('referentials.actions.destroy_confirm')}, class: "remove" - / li = link_to t('api_keys.actions.new'), new_referential_api_key_path(@referential), class: 'add' - li = link_to t('referentials.actions.clone'), new_referential_path(from: @referential.id), class: 'add' - br - - - if policy(@referential).update? - h4 = t('.clean_up') - == render 'clean' +/ PageHeader += pageheader 'map-marker', + @referential.name, + 'Lorem ipsum dolor sit amet', + t('last_update', time: l(@referential.updated_at, format: :short)), + link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default') do + + / Below is secundary actions & optional contents (filters, ...) + .row + .col-lg-12.text-right + / Actions are: controler, rapport de controle, dupliquer, purger, conserver, supprimer + = link_to t('actions.clone'), new_referential_path(from: @referential.id), class: 'btn btn-primary' + + - if @referential.archived? + = link_to t('actions.unarchive'), unarchive_referential_path(@referential.id), class: 'btn btn-primary' + - else + = link_to t('actions.archive'), archive_referential_path(@referential.id), class: 'btn btn-primary' + + = link_to t('actions.destroy'), referential_path(@referential), method: :delete, data: {confirm: t('referentials.actions.destroy_confirm')}, class: 'btn btn-primary' + + .row.mt-xs + .col-lg-12 + .page_metalist + .pm-col + .pm-item + strong = "#{@referential.human_attribute_name(:validity_period)} : " + = t('validity_range', debut: l(@referential.try(:validity_period).try(:begin), format: :short), end: l(@referential.try(:validity_period).try(:end), format: :short)) + + .pm-item + strong = "Organisation : " + = @referential.organisation.name + + .pm-col + .pm-item + strong = "#{@referential.human_attribute_name(:published_at)} : " + = "" + + .pm-item + strong = "#{@referential.human_attribute_name(:archived_at)} : " + = l(@referential.archived_at, format: :short) if @referential.archived? + + .row.mt-xs + .col-lg-5.col-md-6.col-sm-6.col-xs-8 + = search_form_for @q, url: referential_path(@referential.id), html: { method: :get, class: 'form'} do |f| + .input-group.search_bar + = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de ligne' + + span.input-group-btn + button.btn.btn-default type='submit' + span.fa.fa-search + + .row.mt-xs + .col-lg-12 + = render 'filters' + +/ PageContent +.page_content + .container-fluid + .row + .col-lg-12 + - if @reflines.any? + = new_pagination @reflines, 'pull-right' + + = table_builder @reflines, + { 'Oid' => Proc.new { |n| n.objectid.local_id }, @reflines.human_attribute_name(:id) => 'id', + @reflines.human_attribute_name(:number) => 'number', @reflines.human_attribute_name(:name) => 'name', @reflines.human_attribute_name(:network) => Proc.new { |n| n.try(:network).try(:name) }, @reflines.human_attribute_name(:company) => Proc.new { |n| n.try(:company).try(:name) } }, + [], + [], + 'table' + + = new_pagination @reflines, 'pull-right' + + - else + = replacement_msg t('referential_lines.search_no_results') + + / - if @referential.created_from + / p + / label = "#{Referential.human_attribute_name('created_from')} : " + / = " #{@referential.created_from.name}" + / + / p + / label = "#{Referential.human_attribute_name('slug')} : " + / = " #{@referential.slug}" + / + / p + / label = "#{Referential.human_attribute_name('prefix')} : " + / = " #{@referential.prefix}" + / + / p + / label = "#{Referential.human_attribute_name('projection_type')} : " + / - if !@referential.projection_type_label.empty? + / = " #{@referential.projection_type_label} (epsg:#{@referential.projection_type})" + / + / p + / label = "#{Referential.human_attribute_name('time_zone').capitalize} : " + / = " #{@referential.time_zone}" + + / - if @referential.api_keys.present? + / h3.api_keys = t('.api_keys') + / + / .api_keys.paginated_content + / = paginated_content(@referential.api_keys, "api_keys/api_key") + + - content_for :sidebar do + - if policy(@referential).update? + h4 = t('.clean_up') + == render 'clean' diff --git a/config/locales/actions.en.yml b/config/locales/actions.en.yml index f39d6c586..6c9c4c1e0 100644 --- a/config/locales/actions.en.yml +++ b/config/locales/actions.en.yml @@ -8,6 +8,7 @@ en: show: "See" archive: "Archive" unarchive: "Unarchive" + clone: 'Clone' or: "or" cancel: "Cancel" search_hint: "Type in a search term" diff --git a/config/locales/actions.fr.yml b/config/locales/actions.fr.yml index d49c4ef20..d9ec7def5 100644 --- a/config/locales/actions.fr.yml +++ b/config/locales/actions.fr.yml @@ -8,6 +8,7 @@ fr: show: 'Consulter' archive: 'Conserver' unarchive: 'Déconserver' + clone: 'Dupliquer' or: "ou" cancel: "Annuler" search_hint: "Entrez un texte à rechercher" diff --git a/config/locales/referentials.en.yml b/config/locales/referentials.en.yml index 14c7e4d0a..c9fb02ecd 100644 --- a/config/locales/referentials.en.yml +++ b/config/locales/referentials.en.yml @@ -83,6 +83,7 @@ en: validity_period: "Validity period" updated_at: "Updated" published_at: "Integrated" + archived_at: "Archived" formtastic: titles: referential: diff --git a/config/locales/referentials.fr.yml b/config/locales/referentials.fr.yml index f0b6f4924..2eee9fafa 100644 --- a/config/locales/referentials.fr.yml +++ b/config/locales/referentials.fr.yml @@ -83,6 +83,7 @@ fr: validity_period: "Période de validité englobante" updated_at: "Modifié" published_at: "Intégré" + archived_at: "Conservé" formtastic: titles: referential: diff --git a/config/locales/will_paginate.en.yml b/config/locales/will_paginate.en.yml index 52cba8685..0e189ebae 100644 --- a/config/locales/will_paginate.en.yml +++ b/config/locales/will_paginate.en.yml @@ -20,3 +20,4 @@ en: multi_page_html: "%{model} %{from} to %{to} of %{count}" referential: 'data spaces' + line: 'lines' diff --git a/config/locales/will_paginate.fr.yml b/config/locales/will_paginate.fr.yml index 4f8bc4895..3a22176f9 100644 --- a/config/locales/will_paginate.fr.yml +++ b/config/locales/will_paginate.fr.yml @@ -20,3 +20,4 @@ fr: multi_page_html: "Liste des %{model} %{from} à %{to} sur %{count}" referential: 'jeux de données' + line: 'lignes' |
