diff options
| author | Zog | 2018-03-08 15:07:41 +0100 |
|---|---|---|
| committer | Zog | 2018-03-12 12:00:15 +0100 |
| commit | 132db2e97fd6e28105e472ee562062b7ebc07b39 (patch) | |
| tree | 6a1e332e98abd011d0913044e75727ea11a4c3c6 /app/helpers | |
| parent | a4a075f5eec935dd6a0dbf0a861b6ada13b1dcbc (diff) | |
| download | chouette-core-132db2e97fd6e28105e472ee562062b7ebc07b39.tar.bz2 | |
Refs #6133; Sample SimpeImporter Implementation
Still needs to be made asynchronous
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/exports_helper.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/app/helpers/exports_helper.rb b/app/helpers/exports_helper.rb index 8ac494cfc..3a32e4761 100644 --- a/app/helpers/exports_helper.rb +++ b/app/helpers/exports_helper.rb @@ -1,6 +1,20 @@ # -*- coding: utf-8 -*- module ExportsHelper - + def export_option_input form, export, attr, option_def + opts = { required: option_def[:required], input_html: {value: @export.try(attr) || option_def[:default_value]}, as: option_def[:type]} + opts[:collection] = option_def[:collection] if option_def.has_key?(:collection) + opts[:collection] = @export.instance_exec(&option_def[:collection]) if option_def[:collection].is_a?(Proc) + form.input attr, opts + end + + def export_message_content message + if message.message_key == "full_text" + message.message_attributes["text"] + else + t([message.class.name.underscore.gsub('/', '_').pluralize, message.message_key].join('.'), message.message_attributes.symbolize_keys) + end + end + def fields_for_export_task_format(form) begin render :partial => export_partial_name(form), :locals => { :form => form } @@ -8,7 +22,7 @@ module ExportsHelper "" end end - + def export_partial_name(form) "fields_#{form.object.format.underscore}_export" end @@ -22,7 +36,7 @@ module ExportsHelper end.join.html_safe end end - + def compliance_icon( export_task) return nil unless export_task.compliance_check_task export_task.compliance_check_task.tap do |cct| @@ -33,5 +47,5 @@ module ExportsHelper end end end - + end |
