aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/networks
diff options
context:
space:
mode:
authorXinhui2016-10-10 12:35:15 +0200
committerXinhui2016-10-10 12:35:15 +0200
commitab695004ec171a5730bf0cd0431084c76986742e (patch)
tree493dbb349eda8a912579e3e35ee91a4f4c04541d /app/views/networks
parent1cd01cc22e45710adf2efa080662d919daaaeed3 (diff)
downloadchouette-core-ab695004ec171a5730bf0cd0431084c76986742e.tar.bz2
Fix views spec pundit
Diffstat (limited to 'app/views/networks')
-rw-r--r--app/views/networks/_network.html.slim13
-rw-r--r--app/views/networks/show.html.slim17
2 files changed, 17 insertions, 13 deletions
diff --git a/app/views/networks/_network.html.slim b/app/views/networks/_network.html.slim
index ed216c4c7..94745ca3d 100644
--- a/app/views/networks/_network.html.slim
+++ b/app/views/networks/_network.html.slim
@@ -2,13 +2,14 @@
.panel-heading
.panel-title.clearfix
span.pull-right
- = link_to edit_line_referential_network_path(@line_referential, network), class: 'btn btn-default btn-sm' do
- span.fa.fa-pencil
-
- = link_to line_referential_network_path(@line_referential, network), method: :delete, :data => { :confirm => t('networks.actions.destroy_confirm') }, class: 'btn btn-danger btn-sm' do
- span.fa.fa-trash-o
+ - if policy(network).update?
+ = link_to edit_line_referential_network_path(@line_referential, network), class: 'btn btn-default btn-sm' do
+ span.fa.fa-pencil
+ - if policy(network).destroy?
+ = link_to line_referential_network_path(@line_referential, network), method: :delete, :data => { :confirm => t('networks.actions.destroy_confirm') }, class: 'btn btn-danger btn-sm' do
+ span.fa.fa-trash-o
h5
= link_to [@line_referential, network], class: 'preview', title: "#{Chouette::Network.model_name.human.capitalize} #{network.name}" do
span.name
- = truncate(network.name, :length => 20) \ No newline at end of file
+ = truncate(network.name, :length => 20)
diff --git a/app/views/networks/show.html.slim b/app/views/networks/show.html.slim
index e6bf4e399..5d5b1cd74 100644
--- a/app/views/networks/show.html.slim
+++ b/app/views/networks/show.html.slim
@@ -36,12 +36,15 @@
- content_for :sidebar do
ul.actions
- li
- = link_to t('networks.actions.new'), new_line_referential_network_path(@line_referential), class: 'add'
- li
- = link_to t('networks.actions.edit'), edit_line_referential_network_path(@line_referential, @network), class: 'edit'
- li
- = link_to t('networks.actions.destroy'), line_referential_network_path(@line_referential, @network), method: :delete, data: { :confirm => t('networks.actions.destroy_confirm')}, class: 'remove'
+ - if policy(Chouette::Network).create?
+ li
+ = link_to t('networks.actions.new'), new_line_referential_network_path(@line_referential), class: 'add'
+ - if policy(@network).update?
+ li
+ = link_to t('networks.actions.edit'), edit_line_referential_network_path(@line_referential, @network), class: 'edit'
+ - if policy(@network).destroy?
+ li
+ = link_to t('networks.actions.destroy'), line_referential_network_path(@line_referential, @network), method: :delete, data: { :confirm => t('networks.actions.destroy_confirm')}, class: 'remove'
br
- = creation_tag(@network) \ No newline at end of file
+ = creation_tag(@network)