From 246dae4f46be17ccccc76d7aaea11e16337ff7af Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Tue, 4 Oct 2016 14:16:18 +0200 Subject: [PATCH] Code style improvements according to hound [SCI-442] --- app/assets/stylesheets/notifications.scss | 81 +++++++++---------- .../user_notifications_controller.rb | 27 ++++--- app/views/user_notifications/_list.html.erb | 2 +- app/views/user_notifications/index.html.erb | 1 + 4 files changed, 56 insertions(+), 55 deletions(-) diff --git a/app/assets/stylesheets/notifications.scss b/app/assets/stylesheets/notifications.scss index 7c7d54d63..c03893c81 100644 --- a/app/assets/stylesheets/notifications.scss +++ b/app/assets/stylesheets/notifications.scss @@ -2,6 +2,7 @@ @import "mixins"; .notifications-container { + margin-bottom: 20px; margin-top: 20px; } @@ -17,52 +18,50 @@ padding: 8px; } -.notifications-body { +.notifications-list { + background-color: $color-white; + border: 1px solid $color-alto; + list-style: none; + margin-bottom: 0; + padding: 0; - .notifications-list { - background-color: $color-white; - border: 1px solid $color-alto; - list-style: none; - margin-bottom: 0px; - padding: 0; + .notification { + border-bottom: 1px solid $color-alto; + padding-bottom: 10px; + padding-top: 10px; - .notification { - border-bottom: 1px solid $color-alto; - padding-bottom: 10px; - padding-top: 10px; - - &:hover { - background-color: #ECF5FC; - } - } - - .unseen { - border-left: 4px solid $color-theme-primary; - } - - .text-center { - margin-left: 10px; - padding-top: 10px; - } - - .assignment { - background-color: $color-theme-primary; - border-radius: 50%; - color: $color-wild-sand; - font-size: 15px; - padding: 7px; - } - - .system_message { - background-color: $color-theme-secondary; - border-radius: 50%; - color: $color-wild-sand; - font-size: 13px; - padding: 7px 10px; + &:hover { + background-color: #ECF5FC; } } + + .unseen { + border-left: 4px solid $color-theme-primary; + } + + .text-center { + margin-left: 10px; + padding-top: 10px; + } + + .assignment { + background-color: $color-theme-primary; + border-radius: 50%; + color: $color-wild-sand; + font-size: 15px; + padding: 7px; + } + + .system-message { + background-color: $color-theme-secondary; + border-radius: 50%; + color: $color-wild-sand; + font-size: 13px; + padding: 7px 10px; + } } + .notifications-footer { background-color: $color-mystic; @@ -71,7 +70,7 @@ border-bottom: 1px solid $color-alto; border-left: 1px solid $color-alto; border-right: 1px solid $color-alto; - margin: 0px; + margin: 0; padding: 8px; text-align: center; diff --git a/app/controllers/user_notifications_controller.rb b/app/controllers/user_notifications_controller.rb index 6530e3dde..b5bf2616f 100644 --- a/app/controllers/user_notifications_controller.rb +++ b/app/controllers/user_notifications_controller.rb @@ -10,33 +10,34 @@ class UserNotificationsController < ApplicationController @last_notification_id, @per_page + 1) - @more_notifications_url = "" + @more_notifications_url = '' @overflown = @notifications.length > @per_page - @notifications = UserNotification - .last_notifications(@current_user, @last_notification_id, @per_page) + @notifications = + UserNotification.last_notifications(@current_user, + @last_notification_id, + @per_page) if @notifications.count > 0 @more_notifications_url = url_for( controller: 'user_notifications', action: 'index', format: :json, - from: @notifications.last.id) + from: @notifications.last.id + ) end respond_to do |format| format.html - format.json { - render :json => { - :per_page => @per_page, - :results_number => @notifications.length, - :more_notifications_url => @more_notifications_url, - :html => render_to_string({ - :partial => 'list.html.erb' - }) + format.json do + render json: { + per_page: @per_page, + results_number: @notifications.length, + more_notifications_url: @more_notifications_url, + html: render_to_string(partial: 'list.html.erb') } - } + end end mark_seen_notification @notifications end diff --git a/app/views/user_notifications/_list.html.erb b/app/views/user_notifications/_list.html.erb index 906bb0fa9..a571c07a5 100644 --- a/app/views/user_notifications/_list.html.erb +++ b/app/views/user_notifications/_list.html.erb @@ -14,7 +14,7 @@ <% end %> <% if notification.type_of == 'system_message' %>
- +
<% end %> diff --git a/app/views/user_notifications/index.html.erb b/app/views/user_notifications/index.html.erb index 18c4b3f3f..3a20af3b0 100644 --- a/app/views/user_notifications/index.html.erb +++ b/app/views/user_notifications/index.html.erb @@ -1,3 +1,4 @@ +<% provide(:head_title, raw(t("notifications.title"))) %>
<%= t('notifications.title') %><%= t('nav.user.settings') %>