Add and fill Settings menu item

pull/3451/head
Alexander Bach 9 years ago committed by Peter Lehwess
parent 9ab4eb3a29
commit 74111e524a
  1. 6
      app/controllers/my_controller.rb
  2. 52
      app/views/my/settings.erb
  3. 8
      app/views/users/_preferences.html.erb
  4. 4
      config/initializers/menus.rb

@ -33,6 +33,7 @@ class MyController < ApplicationController
before_filter :require_login
menu_item :account, only: [:account]
menu_item :settings, only: [:settings]
menu_item :password, only: [:password]
DEFAULT_BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_work_packages,
@ -81,6 +82,11 @@ class MyController < ApplicationController
end
end
#Edit user's settings
def settings
@user = User.current
end
# Manage user's password
def password
@user = User.current # required by "my" layout

@ -0,0 +1,52 @@
<%#-- copyright
OpenProject is a project management system.
Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See doc/COPYRIGHT.rdoc for more details.
++#%>
<% html_title(l(:label_my_account), l(:label_settings)) %>
<% breadcrumb_paths(l(:label_my_account), l(:label_settings)) %>
<%= toolbar title: l(:label_settings) %>
<%= error_messages_for 'user' %>
<%= labelled_tabular_form_for @user, :as => :user, :url => { :action => 'settings' },
:lang => current_language,
:html => { :id => 'my_account_form', class: 'form -wide-labels' } do |f| %>
<section class="form--section">
<div class="form--field"><%= f.select :language, lang_options_for_select %></div>
<section class="form--section">
<%= render :partial => 'users/preferences' %>
</section>
<%= render partial: 'customizable/field',
collection: @user.custom_field_values.select(&:editable?),
as: :value,
locals: { form: f } %>
<%= call_hook(:view_my_account, :user => @user, :form => f) %>
</section>
<% end %>

@ -28,11 +28,11 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<%= fields_for :pref, @user.pref, :builder => TabularFormBuilder, :lang => current_language do |pref_fields| %>
<div class="form--field"><%= pref_fields.check_box :hide_mail %></div>
<div class="form--field"><%= pref_fields.select :time_zone, ActiveSupport::TimeZone.all.collect {|z| [ z.to_s, z.name ]}, :include_blank => true %></div>
<div class="form--field"><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></div>
<% if Setting.user_may_override_theme? %>
<div class="form--field"><%= pref_fields.select :theme, OpenProject::Themes.all.map {|t| [t.name, t.identifier]}, :label => :label_theme %></div>
<% end %>
<div class="form--field"><%= pref_fields.check_box :warn_on_leaving_unsaved %></div>
<% if Setting.user_may_override_theme? %>
<div class="form--field"><%= pref_fields.select :theme, OpenProject::Themes.all.map {|t| [t.name, t.identifier]}, :label => :label_theme %></div>
<% end %>
<div class="form--field"><%= pref_fields.check_box :impaired %></div>
<% end %>

@ -85,6 +85,10 @@ Redmine::MenuManager.map :my_menu do |menu|
{ controller: '/my', action: 'account' },
caption: :label_profile,
html: { class: 'icon2 icon-user1' }
menu.push :settings,
{ controller: '/my', action: 'settings' },
caption: :label_settings,
html: { class: 'icon2 icon-settings2' }
menu.push :password,
{ controller: '/my', action: 'password' },
caption: :button_change_password,

Loading…
Cancel
Save