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