diff options
| -rw-r--r-- | app/assets/stylesheets/application.sass | 1 | ||||
| -rw-r--r-- | app/assets/stylesheets/components/_buttons.sass | 3 | ||||
| -rw-r--r-- | app/assets/stylesheets/components/_pagination.sass | 47 | ||||
| -rw-r--r-- | app/helpers/pagination_helper.rb | 13 | ||||
| -rw-r--r-- | app/views/workbenches/show.html.slim | 25 | ||||
| -rw-r--r-- | config/locales/will_paginate.fr.yml | 4 |
6 files changed, 78 insertions, 15 deletions
diff --git a/app/assets/stylesheets/application.sass b/app/assets/stylesheets/application.sass index 74919f7b4..48d053a4c 100644 --- a/app/assets/stylesheets/application.sass +++ b/app/assets/stylesheets/application.sass @@ -10,5 +10,6 @@ @import 'layout' @import 'components/buttons' +@import 'components/pagination' @import 'components/main_nav' @import 'components/page_header' diff --git a/app/assets/stylesheets/components/_buttons.sass b/app/assets/stylesheets/components/_buttons.sass index 28f1c996b..cf91d611c 100644 --- a/app/assets/stylesheets/components/_buttons.sass +++ b/app/assets/stylesheets/components/_buttons.sass @@ -13,3 +13,6 @@ background-color: darken($darkblue, 2.5%) border-color: darken($darkblue, 2.5%) color: #fff + + + .btn + margin-left: 12px diff --git a/app/assets/stylesheets/components/_pagination.sass b/app/assets/stylesheets/components/_pagination.sass new file mode 100644 index 000000000..905cd6154 --- /dev/null +++ b/app/assets/stylesheets/components/_pagination.sass @@ -0,0 +1,47 @@ +//--------------// +// Pagination // +//--------------// + +.pagination + margin: 0 0 20px 0 + border-radius: none + + .page_links + display: inline-block + margin-left: 15px + // To avoid white spaces between childrend inline-block + letter-spacing: -0.31em + text-rendering: optimizespeed + font-weight: 300 + + > * + display: inline-block + font: normal normal normal 14px/1 FontAwesome + font-size: inherit + text-rendering: auto + -webkit-font-smoothing: antialiased + // To avoid white spaces between children inline-block + letter-spacing: normal + word-spacing: normal + text-rendering: auto + overflow: hidden + vertical-align: middle + padding: 4px 10px + color: $blue + text-decoration: none + + + * + border-left: 1px solid $darkgrey + + &:first-child + padding-left: 0 + &:last-child + padding-right: 0 + + &.disabled + color: $grey + + &.previous_page:before + content: '\f053' + &.next_page:before + content: '\f054' diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb index e373629af..43bd48796 100644 --- a/app/helpers/pagination_helper.rb +++ b/app/helpers/pagination_helper.rb @@ -1,5 +1,5 @@ -# coding: utf-8 module PaginationHelper + def paginated_content(models, default_partial_name = nil, options = {}) default_options = {:delete => true, :edit => true} options = default_options.merge(options) @@ -18,4 +18,15 @@ module PaginationHelper return html.html_safe unless models.blank? end + + def new_pagination collection, cls = nil + pinfos = page_entries_info collection, html: false + + links = content_tag :div, '', class: 'page_links' do + will_paginate collection, container: false, page_links: false, previous_label: '', next_label: '' + end + + content_tag :div, pinfos.concat(links).html_safe, class: "pagination #{cls}" + end + end diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index 193344572..7400c0329 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -1,24 +1,26 @@ +/ PageHeader = pageheader 'map-marker', - 'Jeux de données', - 'Lorem ipsum dolor sit amet', - 'Dernière mise à jour <br> le 22/12/2016' do + 'Jeux de données', + 'Lorem ipsum dolor sit amet', + 'Dernière mise à jour <br> le 22/12/2016' do / Below is secundary actions & optional contents (filters, ...) .row .col-lg-12.col-md-12.col-sm-12.col-xs-12.text-right - = link_to t('referentials.actions.new'), new_referential_path(workbench_id: @workbench), class: 'btn btn-default btn-primary' + - if params[:show_all] + = link_to t('referentials.show.from_this_workbench'), workbench_path(@workbench.id), class: 'btn btn-primary', disabled: params[:archived] + - else + = link_to t('referentials.show.show_all_referentials'), workbench_path(@workbench.id, show_all: true), class: 'btn btn-primary' + = link_to t('referentials.actions.new'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary' + +/ PageContent .page_content .container-fluid .row .col-lg-12 .referentials.paginated_content - h4 = "Liste des jeux de données#{' (tous)' if params[:show_all]}" - h5 - - if params[:show_all] - = link_to t('referentials.show.from_this_workbench'), workbench_path(@workbench.id), class: 'button', disabled: params[:archived] - - else - = link_to t('referentials.show.show_all_referentials'), workbench_path(@workbench.id, show_all: true), class: 'btn btn-default' + = new_pagination @wbench_refs, 'pull-right' table.table.table-bordered.table-hover thead @@ -83,5 +85,4 @@ li = link_to "Supprimer", referential_path(referential), method: :delete, :data => {:confirm => t('referentials.actions.destroy_confirm')} - .text-center - = will_paginate @wbench_refs, container: false, renderer: RemoteBootstrapPaginationLinkRenderer + = new_pagination @wbench_refs, 'pull-right' diff --git a/config/locales/will_paginate.fr.yml b/config/locales/will_paginate.fr.yml index 68963ea4a..6705eafea 100644 --- a/config/locales/will_paginate.fr.yml +++ b/config/locales/will_paginate.fr.yml @@ -16,5 +16,5 @@ fr: one: "<b>1</b> %{model} affiché(e)" other: "<b>%{count}</b> %{model} affiché(e)s" - multi_page: "%{model} %{from} - %{to} sur %{count} au total" - multi_page_html: "%{model} <b>%{from} - %{to}</b> sur <b>%{count}</b> au total" + multi_page: "Liste des %{model} %{from} à %{to} sur %{count}" + multi_page_html: "Liste des %{model} <b>%{from} à %{to}</b> sur <b>%{count}</b>" |
