diff --git a/app/models/retainer_deliverable.rb b/app/models/retainer_deliverable.rb index 376e778..fe0e1fe 100644 --- a/app/models/retainer_deliverable.rb +++ b/app/models/retainer_deliverable.rb @@ -1,15 +1,13 @@ # A RetainerDeliverable is an HourlyDeliverable that is renewed at # regular calendar periods. The Company bills a regular number of # hours for a hourly rate whereby the budgets are reset over a -# regular cyclical period (often monthly). +# regular cyclical period (monthly). class RetainerDeliverable < HourlyDeliverable unloadable # Associations # Validations - ValidFrequencies = ["monthly", "quarterly"] - validates_inclusion_of :frequency, :in => ValidFrequencies, :allow_nil => true, :allow_blank => true # Accessors @@ -106,10 +104,6 @@ class RetainerDeliverable < HourlyDeliverable end end - def self.frequencies_to_select - ValidFrequencies.collect {|f| [l("text_#{f}"), f]} - end - private def shrink_budgets_to_new_period diff --git a/app/views/contracts/show.html.erb b/app/views/contracts/show.html.erb index f7a3da4..52aec45 100644 --- a/app/views/contracts/show.html.erb +++ b/app/views/contracts/show.html.erb @@ -130,7 +130,6 @@ <% end %> - <%= show_field(deliverable, :frequency, :html_options => {:class => 'deliverable-frequency'}) if deliverable.retainer? %> <%= show_field(deliverable, :current_period, :html_options => {:class => 'deliverable-current-period'}) if deliverable.retainer? %> <%= show_field(deliverable, :start_date, :format => :format_date, :html_options => {:class => 'deliverable-start-date'}) %> <%= show_field(deliverable, :end_date, :format => :format_date, :html_options => {:class => 'deliverable-end-date'}) %> diff --git a/app/views/deliverables/_form.html.erb b/app/views/deliverables/_form.html.erb index 548aa75..b5f2f28 100644 --- a/app/views/deliverables/_form.html.erb +++ b/app/views/deliverables/_form.html.erb @@ -8,8 +8,6 @@
  • <%= form.label(:type, l(:field_type)) %> <%= form.select(:type, Deliverable.valid_types_to_select, {:include_blank => false}, {:class => 'type'}) %> - - <%= form.select(:frequency, RetainerDeliverable.frequencies_to_select, :include_blank => false) %>
  • <% else %> <%= form.input :type, :as => :hidden, :class => 'type' %> diff --git a/config/locales/en.yml b/config/locales/en.yml index f4c1adb..1b5c2ae 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -61,9 +61,6 @@ en: field_deliverable_title: "Deliverable" field_contract_name: "Contract" field_contract: "Contract" - field_frequency: "Frequency" - text_monthly: "Monthly" - text_quarterly: "Quarterly" text_start_date_empty: "The start date is empty. If this form is submitted, no budget items will be created." text_end_date_empty: "The end date is empty. If this form is submitted, no budget items will be created." text_missing_period: "This deliverable is missing a date range so it cannot have budget items. Please save start and end dates before adding any budget items." diff --git a/db/migrate/014_remove_frequency_from_deliverables.rb b/db/migrate/014_remove_frequency_from_deliverables.rb new file mode 100644 index 0000000..bd8fe26 --- /dev/null +++ b/db/migrate/014_remove_frequency_from_deliverables.rb @@ -0,0 +1,9 @@ +class RemoveFrequencyFromDeliverables < ActiveRecord::Migration + def self.up + remove_column :deliverables, :frequency + end + + def self.down + add_column :deliverables, :frequency, :string + end +end diff --git a/test/integration/deliverables_new_test.rb b/test/integration/deliverables_new_test.rb index 51ced9b..0c2ef2a 100644 --- a/test/integration/deliverables_new_test.rb +++ b/test/integration/deliverables_new_test.rb @@ -122,7 +122,6 @@ class DeliverablesNewTest < ActionController::IntegrationTest fill_in "Title", :with => 'A New Deliverable' select "Retainer", :from => "Type" - select "Monthly", :from => 'deliverable_frequency' select @manager.name, :from => "Manager" fill_in "Start", :with => '2010-01-01' fill_in "End Date", :with => '2010-12-31' @@ -150,7 +149,6 @@ class DeliverablesNewTest < ActionController::IntegrationTest assert_equal '2010-01-01', @deliverable.start_date.to_s assert_equal '2010-12-31', @deliverable.end_date.to_s assert_equal @manager, @deliverable.manager - assert_equal "monthly", @deliverable.frequency # Budget items, one per month labor_budgets = @deliverable.labor_budgets diff --git a/test/unit/retainer_deliverable_test.rb b/test/unit/retainer_deliverable_test.rb index fc43f51..4fbbe73 100644 --- a/test/unit/retainer_deliverable_test.rb +++ b/test/unit/retainer_deliverable_test.rb @@ -5,11 +5,6 @@ class RetainerDeliverableTest < ActiveSupport::TestCase assert_equal HourlyDeliverable, RetainerDeliverable.superclass end - context "#frequency" do - should_allow_values_for(:frequency, nil, '', 'monthly', 'quarterly') - should_not_allow_values_for(:frequency, 'anything', 'else', 'weekly') - end - context "#months" do should "be an array of months the Deliverable is active in" do d = RetainerDeliverable.new(:start_date => Date.today.beginning_of_month,