Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[#6311] Add user preference to override the pane order
- Loading branch information
Showing
9 changed files
with
119 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<% fields_for :pref, user.pref, :builder => TabularFormBuilder, :lang => current_language do |pref_fields| %> | ||
<p><%= pref_fields.check_box :kanban_reverse_pane_order %></p> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module RedmineKanban | ||
module Hooks | ||
class ViewMyAccountHook < Redmine::Hook::ViewListener | ||
|
||
render_on(:view_my_account, :partial => 'my/kanban', :layout => false) | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module RedmineKanban | ||
module Patches | ||
module UserPreferencePatch | ||
def self.included(base) | ||
base.extend(ClassMethods) | ||
|
||
base.send(:include, InstanceMethods) | ||
base.class_eval do | ||
unloadable | ||
|
||
def kanban_reverse_pane_order | ||
self[:kanban_reverse_pane_order] | ||
end | ||
|
||
def kanban_reverse_pane_order=(value) | ||
self[:kanban_reverse_pane_order] = (value == "1") # convert to bool | ||
end | ||
end | ||
end | ||
|
||
module ClassMethods | ||
end | ||
|
||
module InstanceMethods | ||
end | ||
end | ||
end | ||
end |
23 changes: 23 additions & 0 deletions
23
test/integration/redmine_kanban/hooks/view_my_account_hook_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require File.dirname(__FILE__) + '/../../../test_helper' | ||
|
||
class RedmineKanban::Hooks::ViewMyAccountTest < ActionController::IntegrationTest | ||
include Redmine::Hook::Helper | ||
|
||
context "#view_my_account" do | ||
setup do | ||
configure_plugin | ||
@user = User.generate_with_protected!(:login => 'existing', :password => 'existing', :password_confirmation => 'existing') | ||
login_as | ||
end | ||
|
||
should "allow changing the user's Kanban pane order" do | ||
click_link "My account" | ||
check "Reverse Kanban pane order" | ||
click_button "Save" | ||
|
||
assert_response :success | ||
assert_equal true, @user.reload.pref.kanban_reverse_pane_order # check it's forced to bool | ||
assert KanbanPane.pane_order_reversed? | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
test/unit/lib/redmine_kanban/patches/user_preference_patch_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require File.dirname(__FILE__) + '/../../../../test_helper' | ||
|
||
class RedmineKanban::Patches::UserPreferenceTest < ActionController::TestCase | ||
|
||
should "be tested" | ||
end |