aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorZog2018-03-13 10:41:48 +0100
committerJohan Van Ryseghem2018-04-04 11:10:39 +0200
commitd034376737c27e48a7a3413b82461a65999ee105 (patch)
treec657811ee569ce1f2487c07f921fdae3382eb726 /app/views
parenta77307ca49c57dc18823f6aece2424ccb3c5a7c2 (diff)
downloadchouette-core-d034376737c27e48a7a3413b82461a65999ee105.tar.bz2
Refs #6090; CustomFields inputs made easy
:warning: We'll have to refine this code once StopArea are linked to workgroups
Diffstat (limited to 'app/views')
-rw-r--r--app/views/shared/custom_fields/_attachment.html.slim5
-rw-r--r--app/views/stop_areas/_form.html.slim7
-rw-r--r--app/views/stop_areas/show.html.slim2
3 files changed, 13 insertions, 1 deletions
diff --git a/app/views/shared/custom_fields/_attachment.html.slim b/app/views/shared/custom_fields/_attachment.html.slim
index 2f25b396a..32d0fda4d 100644
--- a/app/views/shared/custom_fields/_attachment.html.slim
+++ b/app/views/shared/custom_fields/_attachment.html.slim
@@ -1 +1,4 @@
-= link_to I18n.t("custom_fields.#{field.owner.class.name.demodulize.underscore}.#{field.code}.link"), field.value.url
+- if field.value.present?
+ = link_to I18n.t("custom_fields.#{field.owner.class.name.demodulize.underscore}.#{field.code}.link"), field.value.url
+- else
+ = "-"
diff --git a/app/views/stop_areas/_form.html.slim b/app/views/stop_areas/_form.html.slim
index 20bdc289f..90dd187ee 100644
--- a/app/views/stop_areas/_form.html.slim
+++ b/app/views/stop_areas/_form.html.slim
@@ -62,6 +62,13 @@
= f.input :stairs_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true
= f.input :lift_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true
+ // XXX filter on the workgroup
+ - if resource.custom_fields.any?
+ .custom_fields
+ h3 = t("stop_areas.stop_area.custom_fields")
+ - resource.custom_fields.each do |code, field|
+ = field.input(f).to_s
+
.separator
= f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'stop_area_form'
diff --git a/app/views/stop_areas/show.html.slim b/app/views/stop_areas/show.html.slim
index a6147b86d..851bd9b82 100644
--- a/app/views/stop_areas/show.html.slim
+++ b/app/views/stop_areas/show.html.slim
@@ -23,4 +23,6 @@
t('activerecord.attributes.stop_area.state') => stop_area_status(@stop_area),
@stop_area.human_attribute_name(:comment) => @stop_area.try(:comment),
})
+ - @stop_area.custom_fields.each do |code, field|
+ - attributes.merge!(field.name => field.display_value)
= definition_list t('metadatas'), attributes