Conflicts:
	app/controllers/deliverables_controller.rb
This commit is contained in:
Richard Říman
2012-11-23 15:06:54 +01:00
20 changed files with 179 additions and 141 deletions
@@ -2,5 +2,5 @@
<td colspan="9" style="text-align: left;">
<%= l(:field_description) %>: <%= textilizable deliverable.description %>
</td>
<%= Redmine::Hook.call_hook(:plugin_budget_view_deliverable_description_row, { :deliverable => deliverable }) %>
<% Redmine::Hook.call_hook(:plugin_budget_view_deliverable_description_row, { :deliverable => deliverable }) %>
</tr>
@@ -1,12 +1,11 @@
<tr id="deliverable-details-<%= deliverable.id %>" class="deliverable deliverable-details <%= css %>" style="display:none;">
<td class="deliverable-actions">
<%= content_tag(:p,link_to(l(:button_edit), :action => 'edit', :id => @project.id, :deliverable_id => deliverable.id)) if allowed_management? -%>
<%= content_tag(:p,link_to(l(:button_delete), { :action => 'destroy', :id => @project.id, :deliverable_id => deliverable.id}, :confirm => l(:text_are_you_sure))) if allowed_management? %>
<%= content_tag(:p,link_to(l(:label_issue_plural), :action => 'issues', :id => @project.id, :deliverable_id => deliverable.id)) -%>
<%= content_tag(:p,link_to(l(:button_edit), :action => 'edit', :id => @project.identifier, :deliverable_id => deliverable.id)) if allowed_management? -%>
<%= content_tag(:p,link_to(l(:button_delete), { :action => 'destroy', :id => @project.identifier, :deliverable_id => deliverable.id}, :confirm => l(:text_are_you_sure))) if allowed_management? %>
<%= content_tag(:p,link_to(l(:label_issue_plural), :action => 'issues', :id => @project.identifier, :deliverable_id => deliverable.id)) -%>
<% if allowed_management? && @project.versions.size > 0 %>
<div>
<% form_for :deliverable, deliverable, :url => { :action => "bulk_assign_issues", :id => @project.id, :deliverable_id => deliverable.id} do |f| %>
<%= form_tag({ :action => "bulk_assign_issues", :id => @project.identifier, :deliverable_id => deliverable.id}) do %>
<%= select("version", "id", @project.versions.sort.collect {|v| [v.name, v.id ] }, { :prompt => '-- Version --' }) %><br />
<%= submit_tag(l(:label_bulk_assign)) %>
<% end %>
@@ -18,9 +17,8 @@
<table class="progress-table">
<%= row_with_double_data l(:label_progress), number_to_percentage(deliverable.progress, :precision => 0), '' %>
<% if allowed_management? %>
<% if deliverable.hourly? %>
<%= row_with_double_data l(:label_hours_estimated), number_with_precision(deliverable.total_hours, 0), '' %>
<%= row_with_double_data l(:label_hours_estimated), number_with_precision(deliverable.total_hours, :precision => 0), '' %>
<% end %>
<% if deliverable.fixed? %>
<%= row_with_double_data l(:label_fixed_amount), '', number_to_currency(deliverable.fixed_cost, :unit => l(:label_currency), :precision => 0) %>
@@ -61,5 +59,5 @@
<% end %>
</table>
</td>
<%= Redmine::Hook.call_hook(:plugin_budget_view_deliverable_details_row, { :deliverable => deliverable }) %>
<% Redmine::Hook.call_hook(:plugin_budget_view_deliverable_details_row, { :deliverable => deliverable }) %>
</tr>
@@ -11,5 +11,5 @@
<%= content_tag(:td, number_to_currency(deliverable.spent, :unit => l(:label_currency), :precision => 0), :class => 'spent') if allowed_management? %>
<%= content_tag(:td, format_date(deliverable.due), :class => 'due_date') %>
<%= content_tag(:td, progress_bar(deliverable.progress, :width => '100%', :class => 'done_ratio')) %>
<%= Redmine::Hook.call_hook(:plugin_budget_view_deliverable_summary_row, { :deliverable => deliverable }) %>
<% Redmine::Hook.call_hook(:plugin_budget_view_deliverable_summary_row, { :deliverable => deliverable }) %>
</tr>
+14 -12
View File
@@ -23,7 +23,11 @@
</td>
<td>
<%= check_box(:deliverable, :type, {}, FixedDeliverable.name, HourlyDeliverable.name) %>
<%= observe_field('deliverable_type', :function => "new Budget.changeType();") %>
<script type="text/javascript">
$("#deliverable_type").change(function() {
new Budget.changeType();
});
</script>
</td>
<td class="calculation-column">
</td>
@@ -75,12 +79,10 @@
<%= content_tag(:span, 0, :id => 'total-budget-calculation', :class => "budget-calculation") %>
</td>
</tr>
</table>
<%= f.hidden_field :budget %>
<%= observe_form('deliverable-form', :function => "new Budget.updateAmounts();", :on => 'blur') %>
</div>
<script type="text/javascript">new Budget.changeType();</script>
<script type="text/javascript">new Budget.updateAmounts();</script>
@@ -93,18 +95,18 @@
</div>
<%= 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',
:update => 'preview',
:with => "Form.serialize('deliverable-form')",
:complete => "Element.scrollTo('preview')"
}, :accesskey => accesskey(:preview) %>
<%= link_to l(:label_preview), preview_deliverable_path(:id => @project), :id => "budget_preview_link", :accesskey => accesskey(:preview) %>
<script type="text/javascript">
$("#budget_preview_link").click(function() {
$.post($(this).attr("href"), $("#deliverable-form").serializeArray(), 'script');
return false;
});
</script>
<%# Same as `wikitoolbar_for 'deliverable_description'` but without the help link %>
<%= javascript_include_tag('jstoolbar/jstoolbar') %>
<%= javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language}") %>
<%= javascript_tag("var toolbar = new jsToolBar($('deliverable_description'));toolbar.draw();") %>
<%= javascript_tag("var toolbar = new jsToolBar($('#deliverable_description')[0]);toolbar.draw();") %>
<div id="preview" class="wiki"></div>
+1 -1
View File
@@ -9,7 +9,7 @@
<%= sort_header_tag("spent", :caption => l(:caption_spent)) if allowed_management? %>
<%= sort_header_tag("#{Deliverable.table_name}.due", :caption => l(:caption_due)) %>
<%= sort_header_tag("progress", :caption => l(:caption_progress)) %>
<%= Redmine::Hook.call_hook(:plugin_budget_view_deliverable_list_header, { }) %>
<% Redmine::Hook.call_hook(:plugin_budget_view_deliverable_list_header, { }) %>
</tr></thead>
<tbody>
<% deliverables.each do |deliverable| -%>
+1 -1
View File
@@ -1,3 +1,3 @@
<h3><%= l(:budget_title) %></h3>
<%= link_to_function l(:label_new_deliverable), "$('new-deliverable').toggle();" if allowed_management? %><br />
<%= link_to_function l(:label_new_deliverable), "$('#new-deliverable').toggle();" if allowed_management? %><br />
<%= link_to_function l(:label_toggle_all), "toggleAll();" if allowed_management? %><br />
+24
View File
@@ -0,0 +1,24 @@
# If there is no deliverable list, refresh the page
if ($('#deliverable-list').length == 0) { document.location.reload() }
# Add deliverable to list
$("#deliverable-list").prepend("<%= escape_javascript render(:partial => 'deliverable', :locals => {:deliverable => @deliverable}) %>");
# Update budget
$('#budget-summary').html("<%= escape_javascript render(:partial => 'budget', :object => @budget) %>");
$("#budget-summary").effect("highlight", {}, 300);
# Remove errors if found
$("#errorExplanation").remove();
var form = $('#deliverable-form');
form.find('input:text, input:password, input:file, select, textarea').val('');
form.find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected');
Budget.updateAmounts();
# Add a fading out flash
$('#new-deliverable').before('<%= escape_javascript content_tag(:div, @flash, :class => "flash notice", :id => "rjs-flash") %>');
setTimeout(function() { $("#rjs-flash").effect("fade", {}, 300) }, 3000);
$("#preview").remove();
-26
View File
@@ -1,26 +0,0 @@
# If there is no deliverable list, refresh the page
page << "if ($('deliverable-list') == null) {document.location.reload()}"
# Add deliverable to list
page.insert_html :top, 'deliverable-list', :partial => 'deliverable', :locals => {:deliverable => @deliverable}
# Update budget
page.replace_html 'budget-summary', :partial => 'budget', :object => @budget
page.visual_effect :highlight, 'budget-summary'
# Remove errors if found
page.select('#errorExplanation').each do |value|
page.remove value
end
page << "Form.reset($('deliverable-form'))"
page << "Budget.updateAmounts()"
# Add a fading out flash
page.insert_html :before, 'new-deliverable', content_tag(:div, @flash, :class => "flash notice", :id => 'rjs-flash')
page.delay(3) do
page.visual_effect :fade, 'rjs-flash'
end
# Clear preview
page.replace_html 'preview', ''
@@ -0,0 +1,2 @@
$('#new-deliverable').html("<%= escape_javascript render(:partial => 'form') %>");
Budget.updateAmounts();
@@ -1,2 +0,0 @@
page.replace_html 'new-deliverable', :partial => 'form'
page << "Budget.updateAmounts()"
+2 -2
View File
@@ -1,6 +1,6 @@
<h2><%= l(:label_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,
<%= form_for @deliverable, :url => {:controller => 'deliverables', :action => 'update', :id => @project, :deliverable_id => @deliverable.id },
:method => :put, :builder => Redmine::Views::LabelledFormBuilder, :lang => current_language,
:html => {:multipart => true, :id => 'deliverable-form', :class => 'tabular'} do |f| %>
<%= render :partial => 'form', :locals => { :mode => :update, :f => f } %>
+1 -3
View File
@@ -5,9 +5,7 @@
<% if allowed_management? %>
<div id="new-deliverable" style="<%= @display_form ? '' : 'display:none;' -%>">
<h2><%= l(:label_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| %>
<%= form_for @deliverable, :url => create_deliverable_path(params[:id]), :method => :post, :builder => Redmine::Views::LabelledFormBuilder, :remote => true, :lang => current_language, :html => {:multipart => true, :id => 'deliverable-form', :class => 'tabular'} do |f| %>
<%= render :partial => 'form', :locals => { :mode => :create, :f => f } %>
<% end %>
</div>
+1
View File
@@ -0,0 +1 @@
$("#preview").html("<%= escape_javascript render(:partial => 'common/preview') %>");
@@ -1,5 +1,5 @@
<p>
<%= l(:message_budget_settings) %>
<%= l(:message_budget_settings).html_safe %>
</p>
<p>