aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpl2017-03-30 11:28:50 +0200
committerjpl2017-03-30 11:28:50 +0200
commit12d6190cdb1be1f7a5f6249a19e43743630d24a8 (patch)
tree4948adf437856920228ee80d2e1fc581a7db30fe
parent297d71c3c76365fa6539b375acc681ea27e9aa39 (diff)
downloadchouette-core-12d6190cdb1be1f7a5f6249a19e43743630d24a8.tar.bz2
Refs #2901: fixing edit policy implementation on view
-rw-r--r--app/views/referentials/show.html.slim3
-rw-r--r--app/views/referentials/show.js.slim19
2 files changed, 1 insertions, 21 deletions
diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim
index 9ed63d516..e50872b0e 100644
--- a/app/views/referentials/show.html.slim
+++ b/app/views/referentials/show.html.slim
@@ -3,12 +3,11 @@
@referential.name,
'Lorem ipsum dolor sit amet',
t('last_update', time: l(@referential.updated_at, format: :short)),
- @referential.archived? ? nil : link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default') do
+ ((@referential.archived? || !policy(@referential).edit?) ? '' : link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default')) do
/ Below is secundary actions & optional contents (filters, ...)
.row.mb-sm
.col-lg-12.text-right
- / Actions are: controler, rapport de controle, dupliquer, purger, conserver, supprimer
- if policy(@referential).new?
= link_to t('actions.clone'), new_referential_path(from: @referential.id), class: 'btn btn-primary'
diff --git a/app/views/referentials/show.js.slim b/app/views/referentials/show.js.slim
deleted file mode 100644
index 5e47bf935..000000000
--- a/app/views/referentials/show.js.slim
+++ /dev/null
@@ -1,19 +0,0 @@
-| $(function() {
-| var ref, update_infos, update_referential_details, _i, _len, _ref, _results;
-| update_infos = function(json) {
-| var info, update_info;
-| info = $('#referential_' + json.referential_id);
-| update_info = function(key, value) {
-| if (key.match(/_count$/)) {
-| return $(info.find('.' + key)[0]).text(value);
-| }
-| };
-| return $.each(json, update_info);
-| };
-| update_referential_details = function() {
-| return $.getJSON("#{referential_path(@referential, format: :json)}", update_infos);
-| };
-| _results = [];
-| _results.push(update_referential_details());
-| return _results;
-| });