aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcedricnjanga2018-02-13 07:58:47 -0800
committercedricnjanga2018-03-02 08:14:58 -0800
commitc81b219024d1265f4cef0c5eb66fb12364f680be (patch)
tree71b98c061f61525eec8e4844105d84075cea13d5
parent0167831148ef5f60f27e9bd7e2d6bfaab33e87c6 (diff)
downloadchouette-core-c81b219024d1265f4cef0c5eb66fb12364f680be.tar.bz2
Refs #3562 add workbench edit button on workbench#show
-rw-r--r--app/policies/workbench_policy.rb11
-rw-r--r--app/views/workbenches/show.html.slim2
-rw-r--r--config/locales/workbenches.en.yml15
-rw-r--r--config/locales/workbenches.fr.yml15
-rw-r--r--config/routes.rb2
5 files changed, 40 insertions, 5 deletions
diff --git a/app/policies/workbench_policy.rb b/app/policies/workbench_policy.rb
new file mode 100644
index 000000000..7b925e91a
--- /dev/null
+++ b/app/policies/workbench_policy.rb
@@ -0,0 +1,11 @@
+class WorkbenchPolicy < ApplicationPolicy
+ class Scope < Scope
+ def resolve
+ scope
+ end
+ end
+
+ def update?
+ true
+ end
+end
diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim
index 159aa8ea2..5c2468296 100644
--- a/app/views/workbenches/show.html.slim
+++ b/app/views/workbenches/show.html.slim
@@ -3,6 +3,8 @@
- content_for :page_header_content do
.row.mb-sm
.col-lg-12.text-right
+ - if policy(Workbench).update?
+ = link_to t('workbenches.actions.configure'), edit_workbench_path(@workbench), class: 'btn btn-primary'
- if policy(Referential).create?
= link_to t('actions.import'), workbench_imports_path(@workbench), class: 'btn btn-primary'
= link_to t('actions.add'), new_workbench_referential_path(@workbench), class: 'btn btn-primary'
diff --git a/config/locales/workbenches.en.yml b/config/locales/workbenches.en.yml
index 7f21f47a0..6e4c9b567 100644
--- a/config/locales/workbenches.en.yml
+++ b/config/locales/workbenches.en.yml
@@ -2,6 +2,14 @@ en:
workbenches:
show:
title: "%{name}"
+ edit:
+ title: "Configure the workbench"
+ update:
+ title: "Configure the workbench"
+ referential_count:
+ zero: "There is no referential in your workbench"
+ one: "There is one referential in your workbench"
+ other: "There are #{count} referentials in your workbench"
index:
title: "%{organisation} dashboard"
offers:
@@ -12,10 +20,9 @@ en:
calendars: "Calendars"
see: "See the list"
no_content: "No content yet."
- referential_count:
- zero: "There is no referential in your workbench"
- one: "There is one referential in your workbench"
- other: "There are #{count} referentials in your workbench"
+ actions:
+ show_output: "Merge offer"
+ affect_ccset: "Configure"
activerecord:
models:
workbench:
diff --git a/config/locales/workbenches.fr.yml b/config/locales/workbenches.fr.yml
index e7a392e66..72d72fade 100644
--- a/config/locales/workbenches.fr.yml
+++ b/config/locales/workbenches.fr.yml
@@ -2,12 +2,27 @@ fr:
workbenches:
show:
title: "%{name}"
+ edit:
+ title: "Configurer l'espace de travail"
+ update:
+ title: "Configurer l'espace de travail"
referential_count:
zero: "Aucun jeu de données dans cet espace de travail"
one: "1 jeu de données dans cet espace de travail"
other: "#{count} jeux de données dans cet espace de travail"
+ index:
+ title: "%{organisation} dashboard"
+ offers:
+ title: "Transport offers"
+ organisation: "Organisation offers"
+ idf: "IDF offers"
+ referentials: "Referentials"
+ calendars: "Calendars"
+ see: "Voir la liste"
+ no_content: "No content yet."
actions:
show_output: "Finaliser l'Offre"
+ configure: "Configurer"
activerecord:
models:
workbench:
diff --git a/config/routes.rb b/config/routes.rb
index 456cb66f5..33608f3fe 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -174,7 +174,7 @@ ChouetteIhm::Application.routes.draw do
namespace :api do
namespace :v1 do
- resources :workbenches, only: [:index, :show] do
+ resources :workbenches, except: [:destroy] do
resources :imports, only: [:index, :show, :create]
end
resources :access_links, only: [:index, :show]