Custom Fields for equipments
muhgatus opened this issue · comments
patch :)
diff -ur redmine_equipment_status_viewer.orig/app/controllers/equipment_assets_controller.rb redmine_equipment_status_viewer/app/controllers/equipment_assets_controller.rb
--- redmine_equipment_status_viewer.orig/app/controllers/equipment_assets_controller.rb 2012-03-09 17:49:52.995062050 +0000
+++ redmine_equipment_status_viewer/app/controllers/equipment_assets_controller.rb 2012-03-09 17:16:52.715060834 +0000
@@ -19,6 +19,8 @@
unloadable
helper :equipment_assets, :iphone
- helper CustomFieldsHelper
include EquipmentAssetsHelper
before_filter :require_login, :except => [ :index, :show, :print ]
diff -ur redmine_equipment_status_viewer.orig/app/models/equipment_asset.rb redmine_equipment_status_viewer/app/models/equipment_asset.rb
--- redmine_equipment_status_viewer.orig/app/models/equipment_asset.rb 2012-03-09 17:49:52.995062050 +0000
+++ redmine_equipment_status_viewer/app/models/equipment_asset.rb 2012-03-09 16:15:34.471060343 +0000
@@ -18,8 +18,18 @@
class EquipmentAsset < ActiveRecord::Base
unloadable
- acts_as_customizable
has_many :asset_check_ins, :limit => 50, :dependent => :destroy
validates_presence_of :name
validates_uniqueness_of :serial_number, :allow_nil => true, :allow_blank => true
diff -ur redmine_equipment_status_viewer.orig/app/views/equipment_assets/_form.rhtml redmine_equipment_status_viewer/app/views/equipment_assets/_form.rhtml
--- redmine_equipment_status_viewer.orig/app/views/equipment_assets/_form.rhtml2012-03-09 17:49:52.999060635 +0000
+++ redmine_equipment_status_viewer/app/views/equipment_assets/_form.rhtml 2012-03-09 17:10:48.147062050 +0000
@@ -12,6 +12,11 @@
<%= f.label :serial_number %>
<%= f.text_field :serial_number %>
- <% @equipment_asset.custom_field_values.each do |value| %>
-
- <%= custom_field_tag_with_label :equipment_asset, value %>
-
- <% end %>
<%= f.label :comment %>
<%= f.text_area :comment, :size => "30x5" %>
diff -ur redmine_equipment_status_viewer.orig/app/views/equipment_assets/index.rhtml redmine_equipment_status_viewer/app/views/equipment_assets/index.rhtml
diff -ur redmine_equipment_status_viewer.orig/app/views/equipment_assets/show.rhtml redmine_equipment_status_viewer/app/views/equipment_assets/show.rhtml
--- redmine_equipment_status_viewer.orig/app/views/equipment_assets/show.rhtml 2012-03-09 17:49:52.999060635 +0000
+++ redmine_equipment_status_viewer/app/views/equipment_assets/show.rhtml 2012-03-09 16:35:54.431061859 +0000
@@ -39,6 +39,12 @@
<%=t :field_resource_url %>:
<%=h @equipment_asset.resource_url %>
- <% @equipment_asset.custom_values.each do |custom_value| %>
- <% if !custom_value.value.blank? %>
- <%= custom_value.custom_field.name%>
- <%=h show_value(custom_value) %>
- <% end %>
- <% end %>
<% end %>
<% if @equipment_asset.comment %>
diff -ur redmine_equipment_status_viewer.orig/init.rb redmine_equipment_status_viewer/init.rb
--- redmine_equipment_status_viewer.orig/init.rb 2012-03-09 17:49:53.003060886 +0000
+++ redmine_equipment_status_viewer/init.rb 2012-03-09 17:42:09.039060828 +0000
@@ -40,4 +40,31 @@
:if => Proc.new {
User.current.allowed_to?(:view_equipment_assets, nil, :global => true)
}
+
+
+
end
+
+require_dependency 'custom_fields_helper'
+module CustomFieldsHelperPatch
- def self.included(base) # :nodoc:
- base.send(:include, InstanceMethods)
+
- base.class_eval do
- alias_method_chain :custom_fields_tabs, :EquipmentAsset_tab
- end
- end
+
- module InstanceMethods
- # Adds a rates tab to the user administration page
- def custom_fields_tabs_with_EquipmentAsset_tab
- tabs = custom_fields_tabs_without_EquipmentAsset_tab
- tabs << {:name => 'EquipmentAssetCustomField', :partial => 'custom_fields/index', :label => :label_EquipmentAsset}
- return tabs
- end
- end
+end
+
+CustomFieldsHelper.send(:include, CustomFieldsHelperPatch)
Great! I want to get this into the next release. However the content has been buggered by posting into an issue. Are you able to make a pull request (Your name gets into the history) or email the patch? Otherwise I will need to go through this line by line.
Great :)
I'll send you an pm, so i can send you the patch via email.
Closed. Now duplicate of pull Request #36