@@ -87,9 +87,18 class BoardsController < ApplicationController | |||||
87 | def update |
|
87 | def update | |
88 | @board.safe_attributes = params[:board] |
|
88 | @board.safe_attributes = params[:board] | |
89 | if @board.save |
|
89 | if @board.save | |
90 | redirect_to_settings_in_projects |
|
90 | respond_to do |format| | |
|
91 | format.html { | |||
|
92 | flash[:notice] = l(:notice_successful_update) | |||
|
93 | redirect_to_settings_in_projects | |||
|
94 | } | |||
|
95 | format.js { render :nothing => true } | |||
|
96 | end | |||
91 | else |
|
97 | else | |
92 | render :action => 'edit' |
|
98 | respond_to do |format| | |
|
99 | format.html { render :action => 'edit' } | |||
|
100 | format.js { render :nothing => true, :status => 422 } | |||
|
101 | end | |||
93 | end |
|
102 | end | |
94 | end |
|
103 | end | |
95 |
|
104 |
@@ -100,6 +100,19 module ProjectsHelper | |||||
100 | l("label_version_sharing_#{sharing}") |
|
100 | l("label_version_sharing_#{sharing}") | |
101 | end |
|
101 | end | |
102 |
|
102 | |||
|
103 | def render_boards_tree(boards, parent=nil, level=0, &block) | |||
|
104 | selection = boards.select {|b| b.parent == parent} | |||
|
105 | return '' if selection.empty? | |||
|
106 | ||||
|
107 | s = ''.html_safe | |||
|
108 | selection.each do |board| | |||
|
109 | node = capture(board, level, &block) | |||
|
110 | node << render_boards_tree(boards, board, level+1, &block) | |||
|
111 | s << content_tag('div', node) | |||
|
112 | end | |||
|
113 | content_tag('div', s, :class => 'sort-level') | |||
|
114 | end | |||
|
115 | ||||
103 | def render_api_includes(project, api) |
|
116 | def render_api_includes(project, api) | |
104 | api.array :trackers do |
|
117 | api.array :trackers do | |
105 | project.trackers.each do |tracker| |
|
118 | project.trackers.each do |tracker| |
@@ -66,4 +66,8 module RoutesHelper | |||||
66 | new_time_entry_path(*args) |
|
66 | new_time_entry_path(*args) | |
67 | end |
|
67 | end | |
68 | end |
|
68 | end | |
|
69 | ||||
|
70 | def board_path(board, *args) | |||
|
71 | project_board_path(board.project, board, *args) | |||
|
72 | end | |||
69 | end |
|
73 | end |
@@ -35,7 +35,7 class Board < ActiveRecord::Base | |||||
35 | where(Project.allowed_to_condition(args.shift || User.current, :view_messages, *args)) |
|
35 | where(Project.allowed_to_condition(args.shift || User.current, :view_messages, *args)) | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 |
safe_attributes 'name', 'description', 'parent_id', ' |
|
38 | safe_attributes 'name', 'description', 'parent_id', 'position' | |
39 |
|
39 | |||
40 | def visible?(user=User.current) |
|
40 | def visible?(user=User.current) | |
41 | !user.nil? && user.allowed_to?(:view_messages, project) |
|
41 | !user.nil? && user.allowed_to?(:view_messages, project) |
@@ -1,32 +1,29 | |||||
1 | <% if @project.boards.any? %> |
|
1 | <% if @project.boards.any? %> | |
2 | <table class="list"> |
|
2 | <div class="table-list boards"> | |
3 | <thead><tr> |
|
3 | <div class="table-list-header"> | |
4 |
< |
|
4 | <div class="table-list-cell"><%= l(:label_board) %></div> | |
5 | <th><%= l(:field_description) %></th> |
|
5 | </div> | |
6 | <th></th> |
|
6 | <%= render_boards_tree(@project.boards) do |board, level| %> | |
7 | <th></th> |
|
7 | <div class="table-list-row <%= cycle 'odd', 'even' %>"> | |
8 | </tr></thead> |
|
8 | <div class="table-list-cell name" style="padding-left: <%= 2 + level * 16 %>px"> | |
9 | <tbody> |
|
9 | <%= link_to board.name, project_board_path(@project, board) %> | |
10 | <% Board.board_tree(@project.boards) do |board, level| |
|
10 | </div> | |
11 | next if board.new_record? %> |
|
11 | <div class="table-list-cell description"><%= board.description %></div> | |
12 | <tr class="<%= cycle 'odd', 'even' %>"> |
|
12 | <div class="table-list-cell buttons"> | |
13 | <td class="name" style="padding-left: <%= level * 18 %>px;"><%= link_to board.name, project_board_path(@project, board) %></td> |
|
|||
14 | <td class="description"><%= board.description %></td> |
|
|||
15 | <td class="reorder"> |
|
|||
16 | <% if authorize_for("boards", "edit") %> |
|
|||
17 | <%= reorder_links('board', {:controller => 'boards', :action => 'update', :project_id => @project, :id => board}, :put) %> |
|
|||
18 | <% end %> |
|
|||
19 | </td> |
|
|||
20 | <td class="buttons"> |
|
|||
21 | <% if User.current.allowed_to?(:manage_boards, @project) %> |
|
13 | <% if User.current.allowed_to?(:manage_boards, @project) %> | |
|
14 | <%= reorder_handle(board) %> | |||
22 | <%= link_to l(:button_edit), edit_project_board_path(@project, board), :class => 'icon icon-edit' %> |
|
15 | <%= link_to l(:button_edit), edit_project_board_path(@project, board), :class => 'icon icon-edit' %> | |
23 | <%= delete_link project_board_path(@project, board) %> |
|
16 | <%= delete_link project_board_path(@project, board) %> | |
24 | <% end %> |
|
17 | <% end %> | |
25 |
</ |
|
18 | </div> | |
26 |
</ |
|
19 | </div> | |
|
20 | <% end %> | |||
|
21 | </div> | |||
|
22 | ||||
|
23 | <%= javascript_tag do %> | |||
|
24 | $(function() { $("div.sort-level").positionedItems(); }); | |||
27 | <% end %> |
|
25 | <% end %> | |
28 | </tbody> |
|
26 | ||
29 | </table> |
|
|||
30 | <% else %> |
|
27 | <% else %> | |
31 | <p class="nodata"><%= l(:label_no_data) %></p> |
|
28 | <p class="nodata"><%= l(:label_no_data) %></p> | |
32 | <% end %> |
|
29 | <% end %> |
@@ -599,7 +599,7 function beforeShowDatePicker(input, inst) { | |||||
599 | return this.sortable($.extend({ |
|
599 | return this.sortable($.extend({ | |
600 | handle: ".sort-handle", |
|
600 | handle: ".sort-handle", | |
601 | helper: function(event, ui){ |
|
601 | helper: function(event, ui){ | |
602 | ui.children().each(function(){ |
|
602 | ui.children('td').each(function(){ | |
603 | $(this).width($(this).width()); |
|
603 | $(this).width($(this).width()); | |
604 | }); |
|
604 | }); | |
605 | return ui; |
|
605 | return ui; |
@@ -138,21 +138,23 a#toggle-completed-versions {color:#999;} | |||||
138 | a.toggle-checkboxes { margin-left: 5px; padding-left: 12px; background: url(../images/toggle_check.png) no-repeat 0% 50%; } |
|
138 | a.toggle-checkboxes { margin-left: 5px; padding-left: 12px; background: url(../images/toggle_check.png) no-repeat 0% 50%; } | |
139 |
|
139 | |||
140 | /***** Tables *****/ |
|
140 | /***** Tables *****/ | |
141 | table.list { border: 1px solid #e4e4e4; border-collapse: collapse; width: 100%; margin-bottom: 4px; } |
|
141 | table.list, .table-list { border: 1px solid #e4e4e4; border-collapse: collapse; width: 100%; margin-bottom: 4px; } | |
142 |
table.list th { |
|
142 | table.list th, .table-list-header { background-color:#EEEEEE; padding: 4px; white-space:nowrap; font-weight:bold; } | |
143 | table.list td {text-align:center; vertical-align:top; padding-right:10px;} |
|
143 | table.list td {text-align:center; vertical-align:top; padding-right:10px;} | |
144 | table.list td.id { width: 2%; text-align: center;} |
|
144 | table.list td.id { width: 2%; text-align: center;} | |
145 | table.list td.name, table.list td.description, table.list td.subject, table.list td.comments, table.list td.roles {text-align: left;} |
|
145 | table.list td.name, table.list td.description, table.list td.subject, table.list td.comments, table.list td.roles {text-align: left;} | |
146 | table.list td.tick {width:15%} |
|
146 | table.list td.tick {width:15%} | |
147 | table.list td.checkbox { width: 15px; padding: 2px 0 0 0; } |
|
147 | table.list td.checkbox { width: 15px; padding: 2px 0 0 0; } | |
148 | table.list td.checkbox input {padding:0px;} |
|
148 | table.list td.checkbox input {padding:0px;} | |
149 | table.list td.buttons { width: 15%; white-space:nowrap; text-align: right; } |
|
149 | table.list td.buttons, div.buttons { width: 15%; white-space:nowrap; text-align: right; } | |
150 | table.list td.buttons a { margin-right: 0.6em; } |
|
150 | table.list td.buttons a, div.buttons a { margin-right: 0.6em; } | |
151 | table.list td.buttons img {vertical-align:middle;} |
|
151 | table.list td.buttons img, div.buttons img {vertical-align:middle;} | |
152 | table.list td.reorder {width:15%; white-space:nowrap; text-align:center; } |
|
152 | table.list td.reorder {width:15%; white-space:nowrap; text-align:center; } | |
153 | table.list table.progress td {padding-right:0px;} |
|
153 | table.list table.progress td {padding-right:0px;} | |
154 | table.list caption { text-align: left; padding: 0.5em 0.5em 0.5em 0; } |
|
154 | table.list caption { text-align: left; padding: 0.5em 0.5em 0.5em 0; } | |
155 |
|
155 | |||
|
156 | .table-list-cell {display: table-cell; vertical-align: top; padding:2px; } | |||
|
157 | ||||
156 | tr.project td.name a { white-space:nowrap; } |
|
158 | tr.project td.name a { white-space:nowrap; } | |
157 | tr.project.closed, tr.project.archived { color: #aaa; } |
|
159 | tr.project.closed, tr.project.archived { color: #aaa; } | |
158 | tr.project.closed a, tr.project.archived a { color: #aaa; } |
|
160 | tr.project.closed a, tr.project.archived a { color: #aaa; } | |
@@ -272,6 +274,8 a.sort.desc { background-image: url(../images/sort_desc.png); } | |||||
272 | table.boards a.board, h3.comments { background: url(../images/comment.png) no-repeat 0% 50%; padding-left: 20px; } |
|
274 | table.boards a.board, h3.comments { background: url(../images/comment.png) no-repeat 0% 50%; padding-left: 20px; } | |
273 | table.boards td.last-message {text-align:left;font-size:80%;} |
|
275 | table.boards td.last-message {text-align:left;font-size:80%;} | |
274 |
|
276 | |||
|
277 | div.table-list.boards .table-list-cell.name {width: 30%;} | |||
|
278 | ||||
275 | table.messages td.last_message {text-align:left;} |
|
279 | table.messages td.last_message {text-align:left;} | |
276 |
|
280 | |||
277 | #query_form_content {font-size:90%;} |
|
281 | #query_form_content {font-size:90%;} |
@@ -197,7 +197,7 class BoardsControllerTest < ActionController::TestCase | |||||
197 |
|
197 | |||
198 | def test_update_position |
|
198 | def test_update_position | |
199 | @request.session[:user_id] = 2 |
|
199 | @request.session[:user_id] = 2 | |
200 |
put :update, :project_id => 1, :id => 2, :board => { : |
|
200 | put :update, :project_id => 1, :id => 2, :board => { :position => 1} | |
201 | assert_redirected_to '/projects/ecookbook/settings/boards' |
|
201 | assert_redirected_to '/projects/ecookbook/settings/boards' | |
202 | board = Board.find(2) |
|
202 | board = Board.find(2) | |
203 | assert_equal 1, board.position |
|
203 | assert_equal 1, board.position |
General Comments 0
You need to be logged in to leave comments.
Login now