fixed type, fixed settings controller, fixes setting view on mobile devices

This commit is contained in:
zmagod 2016-10-05 14:33:22 +02:00
parent 6229e6a3a1
commit 9c7a690944
4 changed files with 14 additions and 24 deletions

View file

@ -555,15 +555,11 @@ a[data-toggle="tooltip"] {
}
.notification-settings-container {
margin-top: 50px;
margin-bottom: 50px;
margin-top: 50px;
.col-xs-2 {
padding-top: 20px;
}
.col-xs-3 {
padding-top: 30px;
.col-md-4 {
margin-top: 25px;
}
.btn-group {

View file

@ -458,16 +458,8 @@ class Users::SettingsController < ApplicationController
end
def notifications_settings
if params[:assignments_notification]
@user.assignments_notification = true
else
@user.assignments_notification = false
end
if params[:recent_notification]
@user.recent_notification = true
else
@user.recent_notification = false
end
@user.assignments_notification = params[:assignments_notification]
@user.recent_notification = params[:recent_notification]
if @user.save
respond_to do |format|
@ -575,7 +567,7 @@ class Users::SettingsController < ApplicationController
message:
ActionController::Base.helpers.sanitize(message),
)
if target_user.assignments_notification
UserNotification.create(notification: notification, user: target_user)
end

View file

@ -42,17 +42,19 @@
html: { method: :post, id: 'notifications-settings-panel' },
remote: true) do |f| %>
<div class="row">
<div class="col-xs-3">
<div class="col-md-4 col-sm-3 hidden-sm hidden-xs">
<div class="notification-settings-labels">
<%= image_tag 'icon_small/missing.png', class: 'img-circle' %>
<%= image_tag 'icon_small/missing.png', class: 'img-circle ' %>
<%= f.label t('notifications.form.recent_notification') %> <br>
<span class="assignment"><%= fa_icon 'newspaper-o' %></span>
<span class="assignment hidden-sm"><%= fa_icon 'newspaper-o' %></span>
<%= f.label t('notifications.form.assignments') %>
</div>
</div>
<div class="col-xs-2 text-center">
<h5><%= t('notifications.title') %></h5>
<div class="col-md-3 col-sm-3 col-text-center">
<h5 class="hidden-sm hidden-xs"><%= t('notifications.title') %></h5>
<%= f.label t('notifications.form.recent_notification'), class: 'visible-sm visible-xs'%> <br>
<%= check_box_tag :recent_notification, @user.recent_notification %> <br>
<%= f.label t('notifications.form.assignments'), class: 'visible-sm visible-xs' %>
<%= check_box_tag :assignments_notification, @user.assignments_notification %>
</div>
</div>

View file

@ -1,4 +1,4 @@
class AddNotifivationsSettingsToUser < ActiveRecord::Migration
class AddNotificationsSettingsToUser < ActiveRecord::Migration
def up
add_column :users, :assignments_notification, :boolean, default: true
add_column :users, :recent_notification, :boolean, default: true