Merge pull request #56 from finnlabs/feature/rails3_fix_ci

Fixed spec failures on ci
pull/6827/head
Christian Rijke 11 years ago
commit b4096677d4
  1. 20
      app/models/journal/cost_object_journal.rb
  2. 34
      app/models/journal/variable_cost_object_journal.rb
  3. 4
      app/views/hooks/_view_work_packages_context_menu_end.html.erb
  4. 4
      lib/open_project/costs/patches/work_package_patch.rb

@ -10,24 +10,6 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
class Journal::CostObjectJournal < ActiveRecord::Base
# include ActiveModel::ForbiddenAttributesProtection
class Journal::CostObjectJournal < Journal::BaseJournal
self.table_name = "cost_object_journals"
belongs_to :journal
# attr_accessible :project_id, :author_id, :subject, :description, :fixed_date, :created_on
@@journaled_attributes = [:project_id,
:author_id,
:subject,
:description,
:fixed_date]
def journaled_attributes
attributes.symbolize_keys.select{|k,_| @@journaled_attributes.include? k}
end
end

@ -1,34 +0,0 @@
#-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
#
# Copyright (C) 2012-2013 the OpenProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
class Journal::VariableCostObjectJournal < Journal::CostObjectJournal
# include ActiveModel::ForbiddenAttributesProtection
# self.table_name = "cost_object_journals"
# belongs_to :journal
# attr_accessible :type, :id, :project_id, :author_id, :subject, :description, :fixed_date, :created_on
# @@journaled_attributes = [:project_id,
# :author_id,
# :subject,
# :description,
# :type,
# :fixed_date]
# def journaled_attributes
# attributes.symbolize_keys.select{|k,_| @@journaled_attributes.include? k}
# end
end

@ -1,7 +1,7 @@
<% if @project && @project.module_enabled?(:costs_module) %>
<%
cost_objects_any = false
possible_cost_objects = work_packages.inject(work_packages.first.project.cost_objects) do |intersect, work_package|
possible_cost_objects = issues.inject(issues.first.project.cost_objects) do |intersect, work_package|
cost_objects_any |= work_package.project.cost_objects.any?
work_package.project.cost_objects & intersect
end
@ -12,7 +12,7 @@
<% unless possible_cost_objects.empty? -%>
<% possible_cost_objects.each do |co| -%>
<li>
<%= context_menu_link co.subject, {:controller => '/work_packages', :action => 'bulk_edit', :ids => work_packages.collect(&:id), 'cost_object_id' => co, :back_url => back}, :method => :post,
<%= context_menu_link co.subject, {:controller => '/issues', :action => 'bulk_edit', :ids => issues.collect(&:id), 'cost_object_id' => co, :back_url => back}, :method => :post,
:selected => (issue && co == issue.cost_object), :disabled => !can[:edit] %>
</li>
<% end -%>

@ -16,8 +16,8 @@ module OpenProject::Costs::Patches::WorkPackagePatch
# disabled for now, implements part of ticket blocking
validate :validate_cost_object
register_journal_formatter(:cost_association) do |value, journaled, field|
association = journaled.class.reflect_on_association(field.to_sym)
register_journal_formatter(:cost_association) do |value, journable, field|
association = journable.class.reflect_on_association(field.to_sym)
if association
record = association.class_name.constantize.find_by_id(value.to_i)
record.subject if record

Loading…
Cancel
Save