Resourcified boards.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8020 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
1cb7de5b5a
commit
2967023a0e
11 files changed
+87
-57
No files matched your search
@@ -62,23 +62,34 @@ class BoardsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index }
|
||||
|
||||
def new
|
||||
@board = Board.new(params[:board])
|
||||
@board.project = @project
|
||||
if request.post? && @board.save
|
||||
@board = @project.boards.build(params[:board])
|
||||
end
|
||||
|
||||
verify :method => :post, :only => :create, :redirect_to => { :action => :index }
|
||||
def create
|
||||
@board = @project.boards.build(params[:board])
|
||||
if @board.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to_settings_in_projects
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
if request.post? && @board.update_attributes(params[:board])
|
||||
end
|
||||
|
||||
verify :method => :put, :only => :update, :redirect_to => { :action => :index }
|
||||
def update
|
||||
if @board.update_attributes(params[:board])
|
||||
redirect_to_settings_in_projects
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
verify :method => :delete, :only => :destroy, :redirect_to => { :action => :index }
|
||||
def destroy
|
||||
@board.destroy
|
||||
redirect_to_settings_in_projects
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<%= error_messages_for 'board' %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<!--[form:board]-->
|
||||
<div class="box">
|
||||
<div class="box tabular">
|
||||
<p><%= f.text_field :name, :required => true %></p>
|
||||
<p><%= f.text_field :description, :required => true, :size => 80 %></p>
|
||||
</div>
|
||||
<!--[eoform:board]-->
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2><%= l(:label_board) %></h2>
|
||||
|
||||
<% labelled_tabular_form_for :board, @board, :url => {:action => 'edit', :id => @board} do |f| %>
|
||||
<% labelled_form_for @board, :url => project_board_path(@project, @board) do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<% end %>
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2><%= l(:label_board_new) %></h2>
|
||||
|
||||
<% labelled_tabular_form_for :board, @board, :url => {:action => 'new'} do |f| %>
|
||||
<% labelled_form_for @board, :url => project_boards_path(@project) do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<% end %>
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= breadcrumb link_to(l(:label_board_plural), {:controller => 'boards', :action => 'index', :project_id => @project}) %>
|
||||
<%= breadcrumb link_to(l(:label_board_plural), project_boards_path(@project)) %>
|
||||
|
||||
<div class="contextual">
|
||||
<%= link_to_if_authorized l(:label_message_new),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<%= breadcrumb link_to(l(:label_board_plural), {:controller => 'boards', :action => 'index', :project_id => @project}),
|
||||
link_to(h(@board.name), {:controller => 'boards', :action => 'show', :project_id => @project, :id => @board}) %>
|
||||
<%= breadcrumb link_to(l(:label_board_plural), project_boards_path(@project)),
|
||||
link_to(h(@board.name), project_board_path(@project, @board)) %>
|
||||
|
||||
<div class="contextual">
|
||||
<%= watcher_tag(@topic, User.current) %>
|
||||
|
||||
@@ -14,12 +14,14 @@
|
||||
<td><%=h board.description %></td>
|
||||
<td align="center">
|
||||
<% if authorize_for("boards", "edit") %>
|
||||
<%= reorder_links('board', {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board}) %>
|
||||
<%= reorder_links('board', {:controller => 'boards', :action => 'update', :project_id => @project, :id => board}, :put) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<%= link_to_if_authorized l(:button_edit), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board}, :class => 'icon icon-edit' %>
|
||||
<%= link_to_if_authorized l(:button_delete), {:controller => 'boards', :action => 'destroy', :project_id => @project, :id => board}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
|
||||
<% if User.current.allowed_to?(:manage_boards, @project) %>
|
||||
<%= link_to l(:button_edit), edit_project_board_path(@project, board), :class => 'icon icon-edit' %>
|
||||
<%= link_to l(:button_delete), project_board_path(@project, board), :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -29,4 +31,6 @@
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
|
||||
<p><%= link_to_if_authorized l(:label_board_new), {:controller => 'boards', :action => 'new', :project_id => @project}, :class => 'icon icon-add' %></p>
|
||||
<% if User.current.allowed_to?(:manage_boards, @project) %>
|
||||
<p><%= link_to l(:label_board_new), new_project_board_path(@project), :class => 'icon icon-add' %></p>
|
||||
<% end %>
|
||||
Reference in new issue
Block a user