aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2015-05-05 13:57:22 +0200
committerLuc Donnet2015-05-05 13:57:22 +0200
commitd916153cb423178e6d144fe954497d7bfeb8192f (patch)
tree7f1232e135b95bceb60d04062dbc118c1116b107
parent344b6ba4629845f390c079d69697ef75ac3beb15 (diff)
downloadchouette-core-d916153cb423178e6d144fe954497d7bfeb8192f.tar.bz2
Unused helper now use reference_ids_input.rb
-rw-r--r--app/helpers/type_ids_models_helper.rb75
1 files changed, 0 insertions, 75 deletions
diff --git a/app/helpers/type_ids_models_helper.rb b/app/helpers/type_ids_models_helper.rb
deleted file mode 100644
index 3d1c54a5b..000000000
--- a/app/helpers/type_ids_models_helper.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-module TypeIdsModelsHelper
-
- def type_ids_model_references_type( type_ids_model_class, type)
- ReferencesTypeHelper.new( type_ids_model_class, type)
- end
-
- class ReferencesTypeHelper
-
- attr_accessor :type_ids_model_class, :type
-
- def initialize( type_ids_model_class, type)
- @type_ids_model_class, @type = type_ids_model_class, type
- end
- def model_class
- type_ids_model_class.to_s.underscore
- end
- def input_id
- "#{model_class}_reference_#{relation_name}_ids"
- end
- def input_class
- "#{model_class}_#{relation_name}_reference_ids"
- end
- def relation_name
- type_ids_model_class.references_relation(type)
- end
- end
-
- def type_ids_model_references_input( form, type_ids_model, model_class, type)
- cct_type_helper = type_ids_model_references_type( model_class, type)
- ReferencesInput.new form, type_ids_model, type, cct_type_helper
- end
-
- class ReferencesInput
-
- attr_accessor :form, :type_ids_model, :type, :type_helper
- def initialize(form, type_ids_model, type, type_helper)
- @form, @type_ids_model, @type, @type_helper = form, type_ids_model, type, type_helper
- end
-
- delegate :input_id, :input_class, :model_class, :to => :type_helper
-
- def current?
- type_ids_model.references_type == type
- end
-
- def references_map
- references.collect { |child| { :id => child.id, :name => child.name } }
- end
-
- def wrapper_html_options
- {
- :class => "#{model_class}_reference_ids",
- :id => "#{input_id}_input",
- :"data-type" => type,
- :style => ("display: none" unless current?)
- }
- end
-
- def input_html_options
- {
- :id => input_id,
- :class => input_class,
- :"data-pre" => ( references_map.to_json if current? ),
- :disabled => (true unless current?)
- }
- end
-
- def input
- form.input :reference_ids, :as => :text, :wrapper_html => wrapper_html_options, :input_html => input_html_options
- end
-
- end
-
-end
-