Feature #3058 » 0007-user-preference-for-issue-history-default-tab.patch
| app/helpers/issues_helper.rb | ||
|---|---|---|
|
tabs
|
||
|
end
|
||
|
def issue_history_default_tab
|
||
|
# tab params overrides user default tab preference
|
||
|
return params[:tab] if params[:tab].present?
|
||
|
user_default_tab = User.current.pref.history_default_tab
|
||
|
case user_default_tab
|
||
|
when 'last_tab_visited'
|
||
|
cookies['history_last_tab'].present? ? cookies['history_last_tab'] : 'notes'
|
||
|
when ''
|
||
|
'notes'
|
||
|
else
|
||
|
user_default_tab
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| app/helpers/users_helper.rb | ||
|---|---|---|
|
[[l(:label_font_default), '']] + UserPreference::TEXTAREA_FONT_OPTIONS.map {|o| [l("label_font_#{o}"), o]}
|
||
|
end
|
||
|
def history_default_tab_options
|
||
|
[[l('label_issue_history_notes'), 'notes'],
|
||
|
[l('label_history'), 'history'],
|
||
|
[l('label_issue_history_properties'), 'properties'],
|
||
|
[l('label_time_entry_plural'), 'time_entries'],
|
||
|
[l('label_associated_revisions'), 'changesets'],
|
||
|
[l('label_last_tab_visited'), 'last_tab_visited']]
|
||
|
end
|
||
|
def change_status_link(user)
|
||
|
url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
|
||
| app/models/user_preference.rb | ||
|---|---|---|
|
'warn_on_leaving_unsaved',
|
||
|
'no_self_notified',
|
||
|
'textarea_font',
|
||
|
'recently_used_projects'
|
||
|
'recently_used_projects',
|
||
|
'history_default_tab'
|
||
|
TEXTAREA_FONT_OPTIONS = ['monospace', 'proportional']
|
||
| ... | ... | |
|
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:
|
||
| app/views/issues/show.html.erb | ||
|---|---|---|
|
<div id="history">
|
||
|
<h3><%=l(:label_history)%></h3>
|
||
|
<%= render_tabs issue_history_tabs, params[:tab] ? params[:tab] : 'notes' %>
|
||
|
<%= render_tabs issue_history_tabs, issue_history_default_tab %>
|
||
|
</div>
|
||
|
<%= render partial: 'action_menu_edit' unless User.current.wants_comments_in_reverse_order? %>
|
||
| app/views/users/_preferences.html.erb | ||
|---|---|---|
|
<p><%= pref_fields.check_box :warn_on_leaving_unsaved %></p>
|
||
|
<p><%= pref_fields.select :textarea_font, textarea_font_options %></p>
|
||
|
<p><%= pref_fields.text_field :recently_used_projects, :size => 2 %></p>
|
||
|
<p><%= pref_fields.select :history_default_tab, history_default_tab_options %></p>
|
||
|
<% end %>
|
||
| config/locales/en.yml | ||
|---|---|---|
|
field_digest: Checksum
|
||
|
field_default_assigned_to: Default assignee
|
||
|
field_recently_used_projects: Number of recently used projects in jump box
|
||
|
field_history_default_tab: Issue's history default tab
|
||
|
setting_app_title: Application title
|
||
|
setting_welcome_text: Welcome text
|
||
| ... | ... | |
|
label_preferred_body_part_html: HTML (experimental)
|
||
|
label_issue_history_properties: Property changes
|
||
|
label_issue_history_notes: Notes
|
||
|
label_last_tab_visited: Last visited tab
|
||
|
button_login: Login
|
||
|
button_submit: Submit
|
||
| public/javascripts/application.js | ||
|---|---|---|
|
$(document).ready(function(){
|
||
|
$('#content').on('change', 'input[data-disables], input[data-enables], input[data-shows]', toggleDisabledOnChange);
|
||
|
toggleDisabledInit();
|
||
|
$('#history .tabs').on('click', 'a', function(e){
|
||
|
var tab = $(e.target).attr('id').replace('tab-','');
|
||
|
document.cookie = 'history_last_tab=' + tab
|
||
|
});
|
||
|
});
|
||
|
$(document).ready(function(){
|
||
| test/functional/users_controller_test.rb | ||
|---|---|---|
|
'time_zone' => 'Paris',
|
||
|
'comments_sorting' => 'desc',
|
||
|
'warn_on_leaving_unsaved' => '0',
|
||
|
'textarea_font' => 'proportional'
|
||
|
'textarea_font' => 'proportional',
|
||
|
'history_default_tab' => 'history'
|
||
|
}
|
||
|
}
|
||
|
end
|
||
| ... | ... | |
|
assert_equal 'desc', user.pref[:comments_sorting]
|
||
|
assert_equal '0', user.pref[:warn_on_leaving_unsaved]
|
||
|
assert_equal 'proportional', user.pref[:textarea_font]
|
||
|
assert_equal 'history', user.pref[:history_default_tab]
|
||
|
end
|
||
|
def test_create_with_generate_password_should_email_the_password
|
||
- « Previous
- 1
- …
- 26
- 27
- 28
- Next »