[#4180] Hide the total field on Hourly forms.
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
<% form.inputs do %>
|
<% form.inputs do %>
|
||||||
<%= form.input :title, :required => true %>
|
<%= form.input :title, :required => true %>
|
||||||
<%= form.input(:type, :required => true, :as => :select, :collection => [["Fixed", "FixedDeliverable"],["Hourly", "HourlyDeliverable"]], :include_blank => false) if resource.new_record? %>
|
<% if resource.new_record? %>
|
||||||
|
<%= form.input(:type, :required => true, :as => :select, :collection => [["Fixed", "FixedDeliverable"],["Hourly", "HourlyDeliverable"]], :include_blank => false, :input_html => {:class => 'type'}) %>
|
||||||
|
<% else %>
|
||||||
|
<%= form.input :type, :as => :hidden, :class => 'type' %>
|
||||||
|
<% end %>
|
||||||
<%= form.input :manager, :required => true, :collection => @project.users %>
|
<%= form.input :manager, :required => true, :collection => @project.users %>
|
||||||
<%= form.input :start_date, :as => :string, :input_html => {:size => 10}, :hint => calendar_for('deliverable_start_date') %>
|
<%= form.input :start_date, :as => :string, :input_html => {:size => 10}, :hint => calendar_for('deliverable_start_date') %>
|
||||||
<%= form.input :end_date, :as => :string, :input_html => {:size => 10}, :hint => calendar_for('deliverable_end_date') %>
|
<%= form.input :end_date, :as => :string, :input_html => {:size => 10}, :hint => calendar_for('deliverable_end_date') %>
|
||||||
@@ -17,7 +21,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= form.input :total, :input_html => {:size => 10} %>
|
<%= form.input :total, :input_html => {:size => 10}, :wrapper_html => {:class => 'deliverable_total_input'} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% form.buttons do %>
|
<% form.buttons do %>
|
||||||
<%= form.commit_button :label => l(:button_save) %>
|
<%= form.commit_button :label => l(:button_save) %>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<%= content_tag(:h2, h(resource.title)) %>
|
<%= content_tag(:h2, h(resource.title)) %>
|
||||||
|
|
||||||
<% semantic_form_for [@project, @contract, resource], :url => contract_deliverable_path(@project, @contract, resource), :html => {:class => 'tabular'} do |form| %>
|
<% semantic_form_for [@project, @contract, resource], :url => contract_deliverable_path(@project, @contract, resource), :html => {:class => 'deliverable tabular'} do |form| %>
|
||||||
<%= render :partial => 'form', :object => form, :locals => {:cancel_path => contract_path(@project, @contract)} %>
|
<%= render :partial => 'form', :object => form, :locals => {:cancel_path => contract_path(@project, @contract)} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<%= content_tag(:h2, l(:text_new_deliverable)) %>
|
<%= content_tag(:h2, l(:text_new_deliverable)) %>
|
||||||
|
|
||||||
<% semantic_form_for [@project, @contract, resource], :url => contract_deliverables_path(@project, @contract), :html => {:class => 'tabular'} do |form| %>
|
<% semantic_form_for [@project, @contract, resource], :url => contract_deliverables_path(@project, @contract), :html => {:class => 'deliverable tabular'} do |form| %>
|
||||||
<%= render :partial => 'form', :object => form, :locals => {:cancel_path => contract_path(@project, @contract)} %>
|
<%= render :partial => 'form', :object => form, :locals => {:cancel_path => contract_path(@project, @contract)} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
jQuery(function($) {
|
jQuery(function($) {
|
||||||
toggleSpecificDeliverableFields = function() {
|
toggleSpecificDeliverableFields = function(form) {
|
||||||
var deliverableType = $('select#deliverable_type option:selected').val();
|
var deliverableType = form.find('.type').val();
|
||||||
|
|
||||||
if (deliverableType == 'FixedDeliverable') {
|
if (deliverableType == 'FixedDeliverable') {
|
||||||
$('#deliverable_total_input').show();
|
$('.deliverable_total_input').show();
|
||||||
} else {
|
} else {
|
||||||
$('#deliverable_total_input').
|
$('.deliverable_total_input').
|
||||||
children('#deliverable_total').val('').end().
|
children('input').val('').end().
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleSpecificDeliverableFields();
|
toggleSpecificDeliverableFields($('form.deliverable'));
|
||||||
|
|
||||||
$('select#deliverable_type').change(function() {
|
$('select#deliverable_type').change(function() {
|
||||||
toggleSpecificDeliverableFields();
|
toggleSpecificDeliverableFields($('form.deliverable'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ html>body .tabular li {overflow:hidden;}
|
|||||||
.tabular li.required label { color: #484848; }
|
.tabular li.required label { color: #484848; }
|
||||||
.tabular li.required label span.required {color: #bb0000;}
|
.tabular li.required label span.required {color: #bb0000;}
|
||||||
|
|
||||||
|
.tabular li.hidden { height: 0; padding: 0; margin: 0; }
|
||||||
/* End tabular */
|
/* End tabular */
|
||||||
|
|
||||||
a.contract-delete {color: red; }
|
a.contract-delete {color: red; }
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ class DeliverablesEditTest < ActionController::IntegrationTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
assert_select "select#fixed_deliverable_type", :count => 0 # Not editable
|
assert_select "select#fixed_deliverable_type", :count => 0 # Not editable
|
||||||
|
assert js("jQuery('#fixed_deliverable_total_input').is(':visible')"), "Total is hidden when it should be visible"
|
||||||
|
|
||||||
|
|
||||||
fill_in "Title", :with => 'An updated title'
|
fill_in "Title", :with => 'An updated title'
|
||||||
check "Feature Sign Off"
|
check "Feature Sign Off"
|
||||||
@@ -52,6 +54,7 @@ class DeliverablesEditTest < ActionController::IntegrationTest
|
|||||||
end
|
end
|
||||||
|
|
||||||
assert_select "select#hourly_deliverable_type", :count => 0 # Not editable
|
assert_select "select#hourly_deliverable_type", :count => 0 # Not editable
|
||||||
|
assert js("jQuery('#hourly_deliverable_total_input').is(':hidden')"), "Total is visible when it should be hidden"
|
||||||
|
|
||||||
fill_in "Title", :with => 'An updated title'
|
fill_in "Title", :with => 'An updated title'
|
||||||
check "Feature Sign Off"
|
check "Feature Sign Off"
|
||||||
|
|||||||
Reference in New Issue
Block a user