Split user preferences into a separate page

Refs #3167
This commit is contained in:
Andy Allan 2021-06-30 18:02:42 +01:00
parent 459a798f45
commit 2403630da8
11 changed files with 146 additions and 42 deletions

View file

@ -96,6 +96,7 @@
<% end %>
<%= link_to t("users.show.my profile"), user_path(current_user), :class => "dropdown-item" %>
<%= link_to t("users.show.my settings"), { :controller => "users", :action => "account", :display_name => current_user.display_name }, { :class => "dropdown-item" } %>
<%= link_to t("users.show.my_preferences"), preferences_path, :class => "dropdown-item" %>
<div class="dropdown-divider"></div>
<%= yield :greeting %>
<%= link_to t("layouts.logout"), logout_path(:referer => request.fullpath), :method => "post", :class => "geolink dropdown-item" %>

View file

@ -0,0 +1,12 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<%= bootstrap_form_for current_user, :url => { :action => :update } do |f| %>
<%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{Settings.default_editor}.name")), "default"]] + Editors::AVAILABLE_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %>
<%= f.text_field :languages %>
<%= f.primary t(".save") %>
<%= link_to t(".cancel"), preferences_path, :class => "btn btn-link" %>
<% end %>

View file

@ -0,0 +1,28 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>
<dl class="row">
<dt class="col-sm-4"><%= t ".preferred_editor" %></dt>
<% if current_user.preferred_editor? %>
<dd class="col-sm-8"><%= t("editor.#{current_user.preferred_editor}.description") %></dd>
<% else %>
<dd class="col-sm-8"><%= t("editor.default", :name => t("editor.#{Settings.default_editor}.name")) %></dd>
<% end %>
<dt class="col-sm-4"><%= t ".preferred_languages" %></dt>
<dd class="col-sm-8">
<ul>
<% current_user.preferred_languages.each do |locale| %>
<li><%= locale %></li>
<% end %>
</ul>
</dd>
</dl>
<div>
<%= link_to t(".edit_preferences"), edit_preferences_path, :class => "btn btn-outline-primary" %>
</div>

View file

@ -58,9 +58,7 @@
</span>
</div>
<%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{Settings.default_editor}.name")), "default"]] + Editors::AVAILABLE_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %>
<%= f.richtext_field :description, :cols => 80, :rows => 20 %>
<%= f.text_field :languages %>
<fieldset class="form-group">
<%= f.label t(".image") %>