Added the start of the deliverable form. #1135
This commit is contained in:
@@ -18,11 +18,18 @@ class DeliverablesController < ApplicationController
|
|||||||
:limit => limit,
|
:limit => limit,
|
||||||
:offset => @deliverable_pages.current.offset)
|
:offset => @deliverable_pages.current.offset)
|
||||||
|
|
||||||
|
@deliverable = Deliverable.new
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :action => 'index', :layout => !request.xhr? }
|
format.html { render :action => 'index', :layout => !request.xhr? }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def preview
|
||||||
|
@text = params[:deliverable][:description]
|
||||||
|
render :partial => 'common/preview'
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def find_project
|
def find_project
|
||||||
@project = Project.find(params[:id])
|
@project = Project.find(params[:id])
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
class Deliverable < ActiveRecord::Base
|
class Deliverable < ActiveRecord::Base
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
|
|
||||||
|
attr_accessor :overhead
|
||||||
|
attr_accessor :materials
|
||||||
|
attr_accessor :profit
|
||||||
|
|
||||||
# TODO: mocked
|
# TODO: mocked
|
||||||
def score
|
def score
|
||||||
0
|
0
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<h2>New Deliverable</h2>
|
||||||
|
|
||||||
|
<% labelled_tabular_form_for :deliverable, @deliverable,
|
||||||
|
:html => {:multipart => true, :id => 'deliverable-form'} do |f| %>
|
||||||
|
<%= error_messages_for 'deliverable' %>
|
||||||
|
<div class="box">
|
||||||
|
<div class="splitcontentleft">
|
||||||
|
<p><%= f.text_field :subject, :size => 80, :required => true %></p>
|
||||||
|
<p><%= f.text_area :description, :required => true,
|
||||||
|
:cols => 60,
|
||||||
|
:rows => (@deliverable.description.blank? ? 10 : [[10, @deliverable.description.length / 50].max, 100].min),
|
||||||
|
:accesskey => accesskey(:edit),
|
||||||
|
:class => 'wiki-edit' %></p>
|
||||||
|
<p><%= f.text_field :due_date, :size => 10 %><%= calendar_for('deliverable_due_date') %></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="splitcontentright">
|
||||||
|
<p>TODO: Fixed cost</p>
|
||||||
|
<p><%= f.text_field :cost, :size => 5 %></p>
|
||||||
|
<p>TODO: Total hours</p>
|
||||||
|
<p><%= f.text_field :overhead, :size => 5 %></p>
|
||||||
|
<p><%= f.text_field :materials, :size => 5 %></p>
|
||||||
|
<p><%= f.text_field :profit, :size => 5 %></p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="clear:both;"> </div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<%= submit_tag l(:button_create) %>
|
||||||
|
<%= link_to_remote l(:label_preview),
|
||||||
|
{ :url => { :controller => 'deliverables', :action => 'preview', :id => @project },
|
||||||
|
:method => 'post',
|
||||||
|
:update => 'preview',
|
||||||
|
:with => "Form.serialize('deliverable-form')",
|
||||||
|
:complete => "Element.scrollTo('preview')"
|
||||||
|
}, :accesskey => accesskey(:preview) %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= wikitoolbar_for 'deliverable_description' %>
|
||||||
|
|
||||||
|
<div id="preview" class="wiki"></div>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="new-deliverable" style="display:none;">
|
<div id="new-deliverable" style="display:none;">
|
||||||
TODO
|
<%= render :partial => 'form' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="budget-list">
|
<div id="budget-list">
|
||||||
|
|||||||
@@ -6,3 +6,6 @@ tr.deliverable { text-align: center; white-space: nowrap; }
|
|||||||
tr.deliverable td.subject, tr.deliverable td.category { white-space: normal; }
|
tr.deliverable td.subject, tr.deliverable td.category { white-space: normal; }
|
||||||
tr.deliverable td.subject { text-align: left; }
|
tr.deliverable td.subject { text-align: left; }
|
||||||
tr.deliverable td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
|
tr.deliverable td.done_ratio table.progress { margin-left:auto; margin-right: auto;}
|
||||||
|
|
||||||
|
#deliverable-form .splitcontentleft { width: 72% }
|
||||||
|
#deliverable-form .splitcontentright { width: 27% }
|
||||||
@@ -17,7 +17,7 @@ Redmine::Plugin.register :budget_plugin do
|
|||||||
|
|
||||||
project_module :budget_module do
|
project_module :budget_module do
|
||||||
permission :view_budget, { :deliverables => [:index]}
|
permission :view_budget, { :deliverables => [:index]}
|
||||||
permission :manage_budget, { :deliverables => [:new, :edit, :create, :update, :destroy]}
|
permission :manage_budget, { :deliverables => [:new, :edit, :create, :update, :destroy, :preview]}
|
||||||
end
|
end
|
||||||
|
|
||||||
menu :project_menu, :budget, :controller => "deliverables", :action => 'index'
|
menu :project_menu, :budget, :controller => "deliverables", :action => 'index'
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
field_cost: Cost per hour
|
||||||
|
field_overhead: Overhead
|
||||||
|
field_materials: Material costs
|
||||||
|
field_profit: Profit
|
||||||
|
|||||||
Reference in New Issue
Block a user