Redmine 4.1.1

This commit is contained in:
Manuel Cillero 2020-11-22 21:20:06 +01:00
parent 33e7b881a5
commit 3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
# Redmine - project management software
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2006-2019 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -15,22 +17,25 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'redmine/my_page'
class UserPreference < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :user
serialize :others
attr_protected :others, :user_id
before_save :set_others_hash, :clear_unused_block_settings
safe_attributes 'hide_mail',
safe_attributes(
'hide_mail',
'time_zone',
'comments_sorting',
'warn_on_leaving_unsaved',
'no_self_notified',
'textarea_font'
'textarea_font',
'recently_used_projects',
'history_default_tab')
TEXTAREA_FONT_OPTIONS = ['monospace', 'proportional']
@ -88,6 +93,11 @@ class UserPreference < ActiveRecord::Base
def textarea_font; self[:textarea_font] end
def textarea_font=(value); self[:textarea_font]=value; end
def recently_used_projects; (self[:recently_used_projects] || 3).to_i; end
def recently_used_projects=(value); self[:recently_used_projects] = value.to_i; end
def history_default_tab; self[:history_default_tab]; end
def history_default_tab=(value); self[:history_default_tab]=value; end
# Returns the names of groups that are displayed on user's page
# Example:
# preferences.my_page_groups
@ -122,7 +132,7 @@ class UserPreference < ActiveRecord::Base
# preferences.remove_block('news')
def remove_block(block)
block = block.to_s.underscore
my_page_layout.keys.each do |group|
my_page_layout.each_key do |group|
my_page_layout[group].delete(block)
end
my_page_layout