From e6254da3f1c16aa956c5932ad7e98234d4c19227 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 7 Feb 2017 22:05:05 +1300 Subject: [PATCH] Haml clean up for Roles views --- app/views/roles/_form.html.haml | 4 +++- app/views/roles/index.html.haml | 7 ++++--- app/views/roles/show.html.haml | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/views/roles/_form.html.haml b/app/views/roles/_form.html.haml index 0d307d999..785590a18 100644 --- a/app/views/roles/_form.html.haml +++ b/app/views/roles/_form.html.haml @@ -1,7 +1,9 @@ = form_for @role do |f| - if @role.errors.any? #error_explanation - %h2= "#{pluralize(@role.errors.size, "error")} prohibited this role from being saved:" + %h2 + = pluralize(@role.errors.size, "error") + prohibited this role from being saved: %ul - @role.errors.full_messages.each do |msg| %li= msg diff --git a/app/views/roles/index.html.haml b/app/views/roles/index.html.haml index 8548645c4..b8f27feaa 100644 --- a/app/views/roles/index.html.haml +++ b/app/views/roles/index.html.haml @@ -1,7 +1,7 @@ - content_for :title, "Listing roles" - if can? :create, Role - %p= link_to 'New Role', new_role_path, :class => 'btn btn-primary' + %p= link_to 'New Role', new_role_path, class: 'btn btn-primary' %table %tr @@ -16,6 +16,7 @@ %td= link_to role.name, role %td= role.description - if can? :edit, role - %td= link_to 'Edit', edit_role_path(role), :class => 'btn btn-default btn-xs' + %td= link_to 'Edit', edit_role_path(role), class: 'btn btn-default btn-xs' - if can? :destroy, role - %td= link_to 'Delete', role, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-default btn-xs' + %td= link_to 'Delete', role, method: :delete, + data: { confirm: 'Are you sure?' }, class: 'btn btn-default btn-xs' diff --git a/app/views/roles/show.html.haml b/app/views/roles/show.html.haml index 1814cbbca..54d229012 100644 --- a/app/views/roles/show.html.haml +++ b/app/views/roles/show.html.haml @@ -7,6 +7,6 @@ %b Description: = @role.description -= link_to 'Edit', edit_role_path(@role), :class => 'btn btn-default btn-xs' += link_to 'Edit', edit_role_path(@role), class: 'btn btn-default btn-xs' \| = link_to 'Back', roles_path