mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
User preference for issue history default tab (#3058).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18277 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d3e51b4235
commit
04b8be1d5b
@ -562,4 +562,19 @@ module IssuesHelper
|
|||||||
tabs
|
tabs
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
@ -33,6 +33,15 @@ module UsersHelper
|
|||||||
[[l(:label_font_default), '']] + UserPreference::TEXTAREA_FONT_OPTIONS.map {|o| [l("label_font_#{o}"), o]}
|
[[l(:label_font_default), '']] + UserPreference::TEXTAREA_FONT_OPTIONS.map {|o| [l("label_font_#{o}"), o]}
|
||||||
end
|
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)
|
def change_status_link(user)
|
||||||
url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
|
url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,8 @@ class UserPreference < ActiveRecord::Base
|
|||||||
'warn_on_leaving_unsaved',
|
'warn_on_leaving_unsaved',
|
||||||
'no_self_notified',
|
'no_self_notified',
|
||||||
'textarea_font',
|
'textarea_font',
|
||||||
'recently_used_projects'
|
'recently_used_projects',
|
||||||
|
'history_default_tab'
|
||||||
|
|
||||||
TEXTAREA_FONT_OPTIONS = ['monospace', 'proportional']
|
TEXTAREA_FONT_OPTIONS = ['monospace', 'proportional']
|
||||||
|
|
||||||
@ -93,6 +94,8 @@ class UserPreference < ActiveRecord::Base
|
|||||||
|
|
||||||
def recently_used_projects; (self[:recently_used_projects] || 3).to_i; 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 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
|
# Returns the names of groups that are displayed on user's page
|
||||||
# Example:
|
# Example:
|
||||||
|
|||||||
@ -124,7 +124,7 @@ end %>
|
|||||||
|
|
||||||
<div id="history">
|
<div id="history">
|
||||||
<h3><%=l(:label_history)%></h3>
|
<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>
|
</div>
|
||||||
|
|
||||||
<%= render partial: 'action_menu_edit' unless User.current.wants_comments_in_reverse_order? %>
|
<%= render partial: 'action_menu_edit' unless User.current.wants_comments_in_reverse_order? %>
|
||||||
|
|||||||
@ -5,4 +5,5 @@
|
|||||||
<p><%= pref_fields.check_box :warn_on_leaving_unsaved %></p>
|
<p><%= pref_fields.check_box :warn_on_leaving_unsaved %></p>
|
||||||
<p><%= pref_fields.select :textarea_font, textarea_font_options %></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.text_field :recently_used_projects, :size => 2 %></p>
|
||||||
|
<p><%= pref_fields.select :history_default_tab, history_default_tab_options %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@ -383,6 +383,7 @@ en:
|
|||||||
field_digest: Checksum
|
field_digest: Checksum
|
||||||
field_default_assigned_to: Default assignee
|
field_default_assigned_to: Default assignee
|
||||||
field_recently_used_projects: Number of recently used projects in jump box
|
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_app_title: Application title
|
||||||
setting_welcome_text: Welcome text
|
setting_welcome_text: Welcome text
|
||||||
@ -1058,6 +1059,7 @@ en:
|
|||||||
label_preferred_body_part_html: HTML (experimental)
|
label_preferred_body_part_html: HTML (experimental)
|
||||||
label_issue_history_properties: Property changes
|
label_issue_history_properties: Property changes
|
||||||
label_issue_history_notes: Notes
|
label_issue_history_notes: Notes
|
||||||
|
label_last_tab_visited: Last visited tab
|
||||||
|
|
||||||
button_login: Login
|
button_login: Login
|
||||||
button_submit: Submit
|
button_submit: Submit
|
||||||
|
|||||||
@ -929,6 +929,11 @@ function toggleNewObjectDropdown() {
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('#content').on('change', 'input[data-disables], input[data-enables], input[data-shows]', toggleDisabledOnChange);
|
$('#content').on('change', 'input[data-disables], input[data-enables], input[data-shows]', toggleDisabledOnChange);
|
||||||
toggleDisabledInit();
|
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(){
|
$(document).ready(function(){
|
||||||
|
|||||||
@ -292,7 +292,8 @@ class UsersControllerTest < Redmine::ControllerTest
|
|||||||
'time_zone' => 'Paris',
|
'time_zone' => 'Paris',
|
||||||
'comments_sorting' => 'desc',
|
'comments_sorting' => 'desc',
|
||||||
'warn_on_leaving_unsaved' => '0',
|
'warn_on_leaving_unsaved' => '0',
|
||||||
'textarea_font' => 'proportional'
|
'textarea_font' => 'proportional',
|
||||||
|
'history_default_tab' => 'history'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -303,6 +304,7 @@ class UsersControllerTest < Redmine::ControllerTest
|
|||||||
assert_equal 'desc', user.pref[:comments_sorting]
|
assert_equal 'desc', user.pref[:comments_sorting]
|
||||||
assert_equal '0', user.pref[:warn_on_leaving_unsaved]
|
assert_equal '0', user.pref[:warn_on_leaving_unsaved]
|
||||||
assert_equal 'proportional', user.pref[:textarea_font]
|
assert_equal 'proportional', user.pref[:textarea_font]
|
||||||
|
assert_equal 'history', user.pref[:history_default_tab]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create_with_generate_password_should_email_the_password
|
def test_create_with_generate_password_should_email_the_password
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user