finish gui changes

This commit is contained in:
Reinier Balt 2011-08-02 17:25:45 +02:00
parent 977b57dbb2
commit 89ec9898a3
15 changed files with 2459 additions and 2124 deletions

View file

@ -11,7 +11,7 @@ module PreferencesHelper
pref(model, pref_name) { select(model, pref_name, collection) }
end
def pref_with_text_field(model, pref_name, nowrap_label = false)
def pref_with_text_field(model, pref_name)
pref(model, pref_name) { text_field(model, pref_name) }
end

View file

@ -0,0 +1,26 @@
<label><%= t('preferences.token_header') %></label><br/><br/>
<%= t('preferences.token_description') %>: <span class="highlight"><%= current_user.token %></span>
<% # TODO: make remote AJAX call for new token %>
<%= button_to t('preferences.generate_new_token'), refresh_token_user_path(current_user),
:confirm => t('preferences.generate_new_token_confirm') %>
<br/>
<% if Tracks::Config.auth_schemes.length > 1 %>
<label for="user_auth_type"><%= t('users.label_auth_type') %>:</label><br/>
<% Tracks::Config.auth_schemes.each do |scheme| %>
<%= radio_button_tag('user[auth_type]', scheme, current_user.auth_type == scheme) %><%=scheme%> <br/>
<% end %>
<br/>
<div id="open_id" style="display:<%= current_user.auth_type == 'open_id' ? 'block' : 'none' %>">
<label for="openid_url"><%= t('users.identity_url') %>:</label><br/>
<input type="text" name="user[open_id_url]" value="<%= current_user.open_id_url %>" class="open_id" />
</div>
<div id="database" style="display:<%= current_user.auth_type == 'database' ? 'block' : 'none' %>">
<%= render :partial => 'users/update_password' %>
</div>
<% end %>

View file

@ -0,0 +1,7 @@
<%= pref_with_text_field('prefs', 'date_format') %>
<%= pref_with_text_field('prefs', 'title_date_format') %>
<%= pref('prefs', 'time_zone') { time_zone_select('prefs','time_zone') } %>
<%= pref_with_select_field('prefs', "week_starts", (0..6).to_a.map {|num| [t('date.day_names')[num], num] }) %>

View file

@ -0,0 +1,6 @@
<%= pref_with_text_field 'user', 'first_name' %>
<%= pref_with_text_field 'user', 'last_name' %>
<%= pref_with_select_field('prefs', 'locale', I18n.available_locales.map {|l| l.to_s}) %>
<% if current_user.is_admin? %>
<%= pref_with_text_field('prefs', 'admin_email') %>
<% end %>

View file

@ -0,0 +1,13 @@
<%= pref_with_select_field('prefs', "due_style", [[t('models.preference.due_styles')[0],Preference.due_styles[:due_in_n_days]],[t('models.preference.due_styles')[1],Preference.due_styles[:due_on]]]) %>
<%= pref_with_select_field('prefs', "show_completed_projects_in_sidebar") %>
<%= pref_with_select_field('prefs', "show_hidden_projects_in_sidebar") %>
<%= pref_with_select_field('prefs', "show_hidden_contexts_in_sidebar") %>
<%= pref_with_select_field('prefs', "show_project_on_todo_done") %>
<%= pref_with_text_field('prefs', 'staleness_starts') %>
<%= pref_with_text_field('prefs', 'show_number_completed') %>
<%= pref_with_text_field('prefs', 'refresh') %>
<%= pref_with_select_field('prefs', "verbose_action_descriptors") %>
<%= pref_with_text_field('prefs', "mobile_todos_per_page") %>
<%= pref_with_text_field('prefs', "sms_email") %>
<%= pref('prefs', "sms_context") { select('prefs', 'sms_context_id', current_user.contexts.map{|c| [c.name, c.id]}) } %>

View file

@ -1,79 +1,29 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1">Profile</a></li>
<li><a href="#tabs-2">Authentication</a></li>
<li><a href="#tabs-3">Date and time</a></li>
<li><a href="#tabs-4">Tracks behavior</a></li>
</ul>
<div id="tabs-1">
<h2>Profile</h2>
<% form_tag :action => 'update' do %>
<%= pref_with_text_field 'user', 'first_name' %>
<%= pref_with_text_field 'user', 'last_name' %>
<%= pref_with_select_field('prefs', 'locale', I18n.available_locales.map {|l| l.to_s}) %>
<% if current_user.is_admin? %> <%= pref_with_text_field('prefs', 'admin_email') %> <% end %>
<% end %>
</div>
<div id="tabs-2">
<h2>Authentication</h2>
<br/>
<label><%= t('preferences.token_header') %></label><br/>
<%= t('preferences.token_description') %>: <span class="highlight"><%= current_user.token %></span>
<%= button_to t('preferences.generate_new_token'), refresh_token_user_path(current_user),
:confirm => t('preferences.generate_new_token_confirm') %>
<br/>
<label><%= t('preferences.authentication_header') %></label><br/>
<% if Tracks::Config.auth_schemes.length > 1 %>
<% form_tag :action => 'update_auth_type' do %>
<label for="user_auth_type"><%= t('users.label_auth_type') %>:</label><br/>
<% Tracks::Config.auth_schemes.each do |scheme| %>
<%= radio_button_tag('user[auth_type]', scheme, current_user.auth_type == scheme) %><%=scheme%> <br/>
<% end %>
<div id="open_id" style="display:<%= current_user.auth_type == 'open_id' ? 'block' : 'none' %>">
<label for="openid_url"><%= t('users.identity_url') %>:</label><br/>
<input type="text" name="openid_url" value="<%= current_user.open_id_url %>" class="open_id" />
</div>
<%= submit_tag t('users.auth_change_submit') %> <%= link_to t('common.cancel'), preferences_path %>
<%= observe_field( :user_auth_type, :function => "$('#open_id')[0].style.display = value == 'open_id' ? 'block' : 'none'") %>
<% end %>
<% end %>
<% if current_user.auth_type == 'database' %>
<%= link_to(t('preferences.change_password') + ' &raquo;', change_password_user_path(current_user)) %>
<% end %>
<% if current_user.auth_type == 'open_id' %>
<p><%= t('preferences.open_id_url') %> <span class="highlight"><%= current_user.open_id_url %></span>.</p>
<%= link_to(t('preferences.change_identity_url') + ' &raquo;', change_auth_type_user_path(current_user)) %>
<% end %>
<div id="display_box">
<% form_tag :action => 'update' do %>
<div id="tabs">
<ul>
<li><a href="#tabs-1"><%= t('preferences.tabs.profile')%></a></li>
<li><a href="#tabs-2"><%= t('preferences.tabs.authentication')%></a></li>
<li><a href="#tabs-3"><%= t('preferences.tabs.date_and_time')%></a></li>
<li><a href="#tabs-4"><%= t('preferences.tabs.tracks_behavior')%></a></li>
</ul>
<div id="tabs-1">
<%= render :partial => 'profile'%>
</div>
<div id="tabs-2">
<%= render :partial => 'authentication'%>
</div>
<div id="tabs-3">
<%= render :partial => 'date_and_time'%>
</div>
<div id="tabs-4">
<%= render :partial => 'tracks_behavior'%>
</div>
</div>
<div id="tabs-3">
<h2>Date and time</h2>
<%= pref_with_text_field('prefs', 'date_format') %>
<%= pref_with_text_field('prefs', 'title_date_format') %>
<%= pref('prefs', 'time_zone') { time_zone_select('prefs','time_zone') } %>
<%= pref_with_select_field('prefs', "week_starts", (0..6).to_a.map {|num| [t('date.day_names')[num], num] }) %>
<br/>
</div>
<div id="tabs-4">
<h2>Tracks behavior</h2>
<%= pref_with_select_field('prefs', "due_style", [[t('models.preference.due_styles')[0],Preference.due_styles[:due_in_n_days]],[t('models.preference.due_styles')[1],Preference.due_styles[:due_on]]]) %>
<%= pref_with_select_field('prefs', "show_completed_projects_in_sidebar") %>
<%= pref_with_select_field('prefs', "show_hidden_projects_in_sidebar") %>
<%= pref_with_select_field('prefs', "show_hidden_contexts_in_sidebar") %>
<%= pref_with_select_field('prefs', "show_project_on_todo_done") %>
<%= pref_with_text_field('prefs', 'staleness_starts') %>
<%= pref_with_text_field('prefs', 'show_number_completed') %>
<%= pref_with_text_field('prefs', 'refresh') %>
<%= pref_with_select_field('prefs', "verbose_action_descriptors") %>
<%= pref_with_text_field('prefs', "mobile_todos_per_page") %>
<%= pref_with_text_field('prefs', "sms_email") %>
<%= pref('prefs', "sms_context") { select('prefs', 'sms_context_id', current_user.contexts.map{|c| [c.name, c.id]}) } %>
</div>
</div>
<button type="submit" id="prefs_submit"><%= t('common.update') %></button>
<% end %>
</div>

View file

@ -0,0 +1,4 @@
<label for="user[password]"><%= t('users.new_password_label') %>:</label><br/>
<%= password_field "user", "password", :size => 40 %><br/>
<label for="user[password_confirmation]"><%= t('users.password_confirmation_label') %>:</label><br/>
<%= password_field "user", "password_confirmation", :size => 40 %><br/>

View file

@ -1,5 +1,5 @@
<div id="single_box" class="container context">
<h2><%= @page_title %></h2>
<%= error_messages_for 'user' %>
@ -7,20 +7,10 @@
<p><%= t('users.change_password_prompt') %></p>
<% form_tag :action => 'update_password' do %>
<table width="440px">
<tr>
<td><label for="updateuser_password"><%= t('users.new_password_label') %>:</label></td>
<td><%= password_field "updateuser", "password", :size => 40 %></td>
</tr>
<tr>
<td><label for="updateuser_password_confirmation"><%= t('users.password_confirmation_label') %>:</label></td>
<td><%= password_field "updateuser", "password_confirmation", :size => 40 %></td>
</tr>
<tr>
<td><%= link_to t('common.cancel'), preferences_path %></td>
<td><%= submit_tag t('users.change_password_submit') %></td>
</tr>
</table>
<%= render :partial => 'update_password' %>
<br/>
<%= link_to t('common.cancel'), preferences_path %>
<%= submit_tag t('users.change_password_submit') %>
<% end %>
</div>