diff --git a/app/assets/javascripts/costs/editinplace.js b/app/assets/javascripts/costs/editinplace.js
index 54e20d23b1..9e75845922 100644
--- a/app/assets/javascripts/costs/editinplace.js
+++ b/app/assets/javascripts/costs/editinplace.js
@@ -46,19 +46,23 @@ function edit(obj, name, obj_value) {
var obj_value = typeof(obj_value) != 'undefined' ? obj_value : obj.innerHTML;
var parsed = getCurrencyValue(obj_value);
var value = parsed[0];
- var currency = parsed[1]
+ var currency = parsed[1];
- var span_in = ''
- var text = ' '+currency;
- var button = ' ';
- var span_end = '';
+ var button = '';
+ var span = '';
+ span += ' ';
+ span += '';
- new Insertion.After(obj, span_in+text+button+span_end);
+ var affix = '' + currency + '';
+
+ new Insertion.After(obj, button + span + affix);
Event.observe(obj.id+'_cancel', 'click', function(){cleanUp(obj)});
}
function cleanUp(obj){
Element.remove(obj.id+'_editor');
+ Element.remove(obj.id+'_affix');
+ Element.remove(obj.id+'_cancel');
Element.show(obj);
}
diff --git a/app/assets/stylesheets/costs/_summarized_cost_entries.css.sass b/app/assets/stylesheets/costs/_summarized_cost_entries.css.sass
index ad6d4e0ca8..2ac0367dcc 100644
--- a/app/assets/stylesheets/costs/_summarized_cost_entries.css.sass
+++ b/app/assets/stylesheets/costs/_summarized_cost_entries.css.sass
@@ -1,7 +1,7 @@
/*-- copyright
* OpenProject Costs Plugin
*
- * Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)
+ * Copyright (C) 2009 - 2015 the OpenProject Foundation (OPF)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -11,7 +11,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/app/assets/stylesheets/costs/costs.css.sass b/app/assets/stylesheets/costs/costs.css.sass
index d385c9f5c6..140338e657 100644
--- a/app/assets/stylesheets/costs/costs.css.sass
+++ b/app/assets/stylesheets/costs/costs.css.sass
@@ -1,7 +1,7 @@
/*-- copyright
* OpenProject Costs Plugin
*
- * Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)
+ * Copyright (C) 2009 - 2015 the OpenProject Foundation (OPF)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -20,3 +20,4 @@
@import costs/costs_legacy
@import costs/summarized_cost_entries
+@import costs/settings
diff --git a/app/assets/stylesheets/costs/settings.sass b/app/assets/stylesheets/costs/settings.sass
new file mode 100644
index 0000000000..486b9d11dd
--- /dev/null
+++ b/app/assets/stylesheets/costs/settings.sass
@@ -0,0 +1,23 @@
+/*-- copyright
+ * OpenProject Costs Plugin
+ *
+ * Copyright (C) 2009 - 2015 the OpenProject Foundation (OPF)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+table.list.members
+ .form--text-field.-tiny
+ min-width: 60px
diff --git a/app/views/costlog/edit.html.erb b/app/views/costlog/edit.html.erb
index 5df11e6260..910baf0f78 100644
--- a/app/views/costlog/edit.html.erb
+++ b/app/views/costlog/edit.html.erb
@@ -34,44 +34,70 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<%= back_url_hidden_field_tag %>
<% else %>
diff --git a/app/views/hooks/costs/_view_work_packages_form_details_bottom.html.erb b/app/views/hooks/costs/_view_work_packages_form_details_bottom.html.erb
deleted file mode 100644
index 6253f212ca..0000000000
--- a/app/views/hooks/costs/_view_work_packages_form_details_bottom.html.erb
+++ /dev/null
@@ -1,25 +0,0 @@
-<%#-- copyright
-OpenProject Costs Plugin
-
-Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-version 3.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-++#%>
-
-<% if @project && @project.module_enabled?(:costs_module) %>
-
<% end %>
diff --git a/lib/open_project/costs/engine.rb b/lib/open_project/costs/engine.rb
index 4393236e37..8101669e33 100644
--- a/lib/open_project/costs/engine.rb
+++ b/lib/open_project/costs/engine.rb
@@ -101,7 +101,7 @@ module OpenProject::Costs
end
patches [:WorkPackage, :Project, :Query, :User, :TimeEntry, :PermittedParams,
- :ProjectsController, :ApplicationHelper, :UsersHelper]
+ :ProjectsController, :ApplicationHelper, :UsersHelper, :WorkPackagesHelper]
patch_with_namespace :API, :V3, :WorkPackages, :Schema, :WorkPackageSchema
allow_attribute_update :work_package, :cost_object_id
diff --git a/lib/open_project/costs/hooks/work_package_hook.rb b/lib/open_project/costs/hooks/work_package_hook.rb
index ccf725bc8e..f8efdfa8bb 100644
--- a/lib/open_project/costs/hooks/work_package_hook.rb
+++ b/lib/open_project/costs/hooks/work_package_hook.rb
@@ -22,9 +22,6 @@ class OpenProject::Costs::Hooks::WorkPackageHook < Redmine::Hook::ViewListener
# Renders the Cost Object subject and basic costs information
# render_on :view_work_packages_show_details_bottom, :partial => 'hooks/costs/view_work_packages_show_details_bottom'
- # Renders a select tag with all the Cost Objects
- render_on :view_work_packages_form_details_bottom, :partial => 'hooks/costs/view_work_packages_form_details_bottom'
-
# Renders a select tag with all the Cost Objects for the bulk edit page
render_on :view_work_packages_bulk_edit_details_bottom, :partial => 'hooks/costs/view_work_packages_bulk_edit_details_bottom'
diff --git a/lib/open_project/costs/patches/work_packages_helper_patch.rb b/lib/open_project/costs/patches/work_packages_helper_patch.rb
new file mode 100644
index 0000000000..d18cdc6d76
--- /dev/null
+++ b/lib/open_project/costs/patches/work_packages_helper_patch.rb
@@ -0,0 +1,51 @@
+#-- copyright
+# OpenProject Costs Plugin
+#
+# Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# version 3.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#++
+
+module OpenProject::Costs::Patches::WorkPackagesHelperPatch
+ def self.included(base)
+ base.class_eval do
+ unloadable
+
+ def work_package_form_all_middle_attributes_with_costs(form, work_package, locals = {})
+ attributes = work_package_form_all_middle_attributes_without_costs(form, work_package, locals)
+
+ if work_package.project.module_enabled?(:costs_module)
+ attributes << work_package_form_budget_attribute(form, work_package, locals)
+ end
+
+ attributes.compact
+ end
+
+ def work_package_form_budget_attribute(form, work_package, locals)
+ field = work_package_form_field do
+ options = CostObject.find_all_by_project_id(@project, :order => 'subject ASC').collect { |d| [d.subject, d.id] }
+ form.select(:cost_object_id, options, include_blank: true)
+ end
+
+ WorkPackagesHelper::WorkPackageAttribute.new(:cost_object_id, field)
+ end
+
+
+ alias_method_chain :work_package_form_all_middle_attributes, :costs
+ end
+ end
+
+end
+
+WorkPackagesHelper.send(:include, OpenProject::Costs::Patches::WorkPackagesHelperPatch)