diff options
| -rw-r--r-- | app/controllers/referentials_controller.rb | 18 | ||||
| -rw-r--r-- | app/controllers/workbenches_controller.rb | 2 | ||||
| -rw-r--r-- | app/views/referentials/show.html.slim | 12 | ||||
| -rw-r--r-- | app/views/workbenches/show.html.slim | 31 | ||||
| -rw-r--r-- | config/locales/referentials.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/referentials.fr.yml | 1 |
6 files changed, 30 insertions, 35 deletions
diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index ab494ac2e..74eb36aa6 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -15,10 +15,9 @@ class ReferentialsController < BreadcrumbController end end - def create - - create! - end + # def create + # create! + # end def show resource.switch @@ -34,13 +33,20 @@ class ReferentialsController < BreadcrumbController end end + def destroy + workbench = referential.workbench_id + + referential.destroy! + redirect_to workbench_path(workbench), notice: t('notice.referential.deleted') + end + def archive referential.archive! - redirect_to referential_path, notice: t('notice.referential.archived') + redirect_to workbench_path(referential.workbench_id), notice: t('notice.referential.archived') end def unarchive referential.unarchive! - redirect_to referential_path, notice: t('notice.referential.unarchived') + redirect_to workbench_path(referential.workbench_id), notice: t('notice.referential.unarchived') end protected diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb index b23e9202e..b2bf5eab8 100644 --- a/app/controllers/workbenches_controller.rb +++ b/app/controllers/workbenches_controller.rb @@ -4,7 +4,7 @@ class WorkbenchesController < BreadcrumbController respond_to :html, :only => [:show] def show - @wbench_refs = Workbench.find(params[:id]).referentials.paginate(page: params[:page], per_page: 2) + @wbench_refs = Workbench.find(params[:id]).referentials.paginate(page: params[:page], per_page: 20) show! do build_breadcrumb :show diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index 56d7bd728..ac119bf29 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -57,18 +57,6 @@ h2 ul.actions li = link_to t('referentials.actions.edit'), edit_referential_path(@referential), class: 'edit' - li - - if @referential.archived? - = link_to unarchive_referential_path(@referential), method: :put do - span.fa-stack - span.fa.fa-archive.fa-stack-1x - span.fa.fa-ban.fa-stack-2x - = " Désarchiver cet espace de données" - - else - = link_to archive_referential_path(@referential), method: :put do - span.fa.fa-archive - = " Archiver cet espace de données" - 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' diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index cb83b028c..c2d6a71c8 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -2,7 +2,7 @@ .referentials.paginated_content h4 Liste des jeux de données - + table.table.table-bordered.table-hover thead tr @@ -43,23 +43,22 @@ / Actions td.text-center .btn-group.btn-group-xs - = link_to referential_path(referential), class: 'btn btn-default' do - span.fa.fa-eye - - = link_to edit_referential_path(referential), class: 'btn btn-default' do - span.fa.fa-pencil + .btn-primary.btn.dropdown-toggle data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" + span.fa.fa-bars + span.caret - - if referential.archived? - = link_to unarchive_referential_path(referential), class: 'btn btn-default', method: :put do - span.fa-stack title="Désarchiver" - span.fa.fa-archive.fa-stack-1x - span.fa.fa-ban.fa-stack-2x - - else - = link_to archive_referential_path(referential), class: 'btn btn-default', method: :put do - span.fa.fa-archive title="Archiver" + ul.dropdown-menu + li = link_to "Voir", referential_path(referential) + + li = link_to "Editer", edit_referential_path(referential) + + li + - if referential.archived? + = link_to "Désarchiver", unarchive_referential_path(referential), method: :put + - else + = link_to "Archiver", archive_referential_path(referential), method: :put - = link_to referential_path(referential), method: :delete, :data => {:confirm => t('referentials.actions.destroy_confirm')}, class: 'btn btn-danger' do - span.fa.fa-trash-o + 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 diff --git a/config/locales/referentials.en.yml b/config/locales/referentials.en.yml index 4609069c7..09ddc7131 100644 --- a/config/locales/referentials.en.yml +++ b/config/locales/referentials.en.yml @@ -83,3 +83,4 @@ en: referential: archived: "The data space has been successfully archived" unarchived: "The data space has been successfully unarchived" + deleted: "The data space has been successfully destroyed" diff --git a/config/locales/referentials.fr.yml b/config/locales/referentials.fr.yml index 18ef4e8da..d9a9fc4ce 100644 --- a/config/locales/referentials.fr.yml +++ b/config/locales/referentials.fr.yml @@ -83,3 +83,4 @@ fr: referential: archived: "L'espace de données a été correctement archivé" unarchived: "L'espace de données a été correctement désarchivé" + deleted: "L'espace de données a été correctement supprimé" |
