From 23f8c24ef4fa8a180d0dce07f290d180fdf87faa Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 7 Feb 2017 07:40:10 +1300 Subject: [PATCH] Haml clean up for notifications --- app/views/notifications/_form.html.haml | 14 ++++++++------ app/views/notifications/index.html.haml | 8 ++++---- app/views/notifications/new.html.haml | 2 +- app/views/notifications/reply.html.haml | 2 +- app/views/notifications/show.html.haml | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/views/notifications/_form.html.haml b/app/views/notifications/_form.html.haml index 094be410d..23c844813 100644 --- a/app/views/notifications/_form.html.haml +++ b/app/views/notifications/_form.html.haml @@ -1,22 +1,24 @@ = form_for @notification do |f| - if @notification.errors.any? #error_explanation - %h2= "#{pluralize(@post.errors.size, "error")} prohibited this message from being sent:" + %h2 + = pluralize(@post.errors.size, "error") + prohibited this message from being sent: %ul - @notification.errors.full_messages.each do |msg| %li= msg .field - = f.hidden_field :recipient_id, :value => @recipient.id + = f.hidden_field :recipient_id, value: @recipient.id %p To: = link_to @recipient, @recipient = label_tag :notification, "Subject:" - = f.text_field :subject, :value => @subject, :class => 'form-control', :maxlength => 255 + = f.text_field :subject, value: @subject, class: 'form-control', maxlength: 255 = label_tag :body, "Type your message here:" - = f.text_area :body, :rows => 12, :class => 'form-control' + = f.text_area :body, rows: 12, class: 'form-control' %span.help-block - = render :partial => "shared/markdown_help" + = render partial: "shared/markdown_help" - = f.submit "Send", :class => 'btn btn-primary' + = f.submit "Send", class: 'btn btn-primary' diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index e5352ad26..81e88c010 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -1,6 +1,8 @@ - content_for :title, "Inbox" -- if @notifications.size > 0 +- if @notifications.empty? + You have no messages. +- else = paginate @notifications, theme: 'twitter-bootstrap-3' %table.table.table-striped %tr @@ -28,7 +30,5 @@ - else %strong= n.created_at %td - = link_to 'Delete', n, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-default btn-xs' + = link_to 'Delete', n, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-default btn-xs' = paginate @notifications, theme: 'twitter-bootstrap-3' -- else - You have no messages. diff --git a/app/views/notifications/new.html.haml b/app/views/notifications/new.html.haml index f34343133..633e26193 100644 --- a/app/views/notifications/new.html.haml +++ b/app/views/notifications/new.html.haml @@ -1,4 +1,4 @@ = content_for :title, "Send a message to #{@recipient}" -=render 'form' += render 'form' diff --git a/app/views/notifications/reply.html.haml b/app/views/notifications/reply.html.haml index 808985265..a363fe8bc 100644 --- a/app/views/notifications/reply.html.haml +++ b/app/views/notifications/reply.html.haml @@ -2,5 +2,5 @@ = render @sender_notification -=render 'form' += render 'form' diff --git a/app/views/notifications/show.html.haml b/app/views/notifications/show.html.haml index d6cd49472..e506f3bac 100644 --- a/app/views/notifications/show.html.haml +++ b/app/views/notifications/show.html.haml @@ -3,5 +3,5 @@ = render @notification %p - =link_to 'Delete', @notification, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-default' - =link_to 'Reply', @reply_link, :class => 'btn btn-primary' + = link_to 'Delete', @notification, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-default' + = link_to 'Reply', @reply_link, class: 'btn btn-primary'