Hooked up the edit form. #1190
This commit is contained in:
@@ -54,6 +54,26 @@ class DeliverablesController < ApplicationController
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@deliverable = Deliverable.find_by_id_and_project_id(params[:deliverable_id], params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
# TODO: Handle type change
|
||||
@deliverable = Deliverable.find(params[:deliverable_id])
|
||||
|
||||
respond_to do |format|
|
||||
if @deliverable.update_attributes(params[:deliverable])
|
||||
@flash = l(:notice_successful_create)
|
||||
format.html { redirect_to :action => 'index', :id => @project.id }
|
||||
else
|
||||
format.html { render :action => 'edit', :id => @project.id}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
# Create a query in the session and redirects to the issue list with that query
|
||||
def issues
|
||||
@query = Query.new(:name => "_")
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
|
||||
<%= content_tag(
|
||||
:td,
|
||||
content_tag(:p,link_to("Assigned Issues", :action => 'issues', :id => @project.id, :deliverable_id => deliverable.id)),
|
||||
content_tag(:p,"Edit TODO"),
|
||||
content_tag(:p,link_to("Assigned Issues", :action => 'issues', :id => @project.id, :deliverable_id => deliverable.id)) +
|
||||
content_tag(:p,link_to("Edit", :action => 'edit', :id => @project.id, :deliverable_id => deliverable.id)) +
|
||||
content_tag(:p,link_to("Delete", :action => 'destroy', :id => @project.id, :deliverable_id => deliverable.id)),
|
||||
:colspan => 4) %>
|
||||
</tr>
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
<h2>New Deliverable</h2>
|
||||
|
||||
<% remote_form_for :deliverable, @deliverable, :url => {:controller => 'deliverables', :action => 'create', :id => @project },
|
||||
:method => :post, :builder => TabularFormBuilder, :lang => current_language,
|
||||
:html => {:multipart => true, :id => 'deliverable-form', :class => 'tabular'} do |f| %>
|
||||
<%= error_messages_for 'deliverable' %>
|
||||
<div class="box">
|
||||
<div class="splitcontentleft">
|
||||
@@ -48,14 +43,15 @@
|
||||
:class => "total-budget") %>
|
||||
|
||||
<p><%= f.hidden_field :budget %></p>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">new Budget.updateAmounts();</script>
|
||||
<div style="clear:both;"> </div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= mode == :create ? submit_tag(l(:button_create)) : submit_tag(l(:button_update)) %>
|
||||
<%= link_to_remote l(:label_preview),
|
||||
{ :url => { :controller => 'deliverables', :action => 'preview', :id => @project },
|
||||
:method => 'post',
|
||||
@@ -63,7 +59,6 @@
|
||||
:with => "Form.serialize('deliverable-form')",
|
||||
:complete => "Element.scrollTo('preview')"
|
||||
}, :accesskey => accesskey(:preview) %>
|
||||
<% end %>
|
||||
|
||||
<%# Same as `wikitoolbar_for 'deliverable_description'` but without the help link %>
|
||||
<%= javascript_include_tag('jstoolbar/jstoolbar') %>
|
||||
|
||||
7
app/views/deliverables/edit.html.erb
Normal file
7
app/views/deliverables/edit.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<h2>Update Deliverable</h2>
|
||||
<% form_for :deliverable, @deliverable, :url => {:controller => 'deliverables', :action => 'update', :id => @project, :deliverable_id => @deliverable.id },
|
||||
:method => :post, :builder => TabularFormBuilder, :lang => current_language,
|
||||
:html => {:multipart => true, :id => 'deliverable-form', :class => 'tabular'} do |f| %>
|
||||
|
||||
<%= render :partial => 'form', :locals => { :mode => :update, :f => f } %>
|
||||
<% end %>
|
||||
@@ -31,7 +31,12 @@
|
||||
</div>
|
||||
|
||||
<div id="new-deliverable" style="display:none;">
|
||||
<%= render :partial => 'form' %>
|
||||
<h2>New Deliverable</h2>
|
||||
<% remote_form_for :deliverable, @deliverable, :url => {:controller => 'deliverables', :action => 'create', :id => @project },
|
||||
:method => :post, :builder => TabularFormBuilder, :lang => current_language,
|
||||
:html => {:multipart => true, :id => 'deliverable-form', :class => 'tabular'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => { :mode => :create, :f => f } %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="budget-list">
|
||||
|
||||
Reference in New Issue
Block a user