aboutsummaryrefslogtreecommitdiff
path: root/app/helpers/resources_helper.rb
diff options
context:
space:
mode:
authorIN COMMON Collective <collective@incommon.cc>2021-04-08 16:34:15 +0200
committerIN COMMON Collective <collective@incommon.cc>2021-04-08 16:34:15 +0200
commitd14700c51d692335f001a93c2f6b13b135783206 (patch)
tree1204bc1ae744098eba6604a961765187984a90d8 /app/helpers/resources_helper.rb
parentc738e96b2b99bfd92b70d4cec26d6874a7f609e4 (diff)
downloadincommon-map-d14700c51d692335f001a93c2f6b13b135783206.tar.gz
[FIX] Use form model to create/edit resources (fixes #4, fixes #5, refs #3)v0.1.10
Since we must associate other models (e.g., classifications) to a Resource, we use a composite model to save all changes inside a database transaction. This approach makes it simpler to handle resources and their associations. Work remains to fix the geolocation and reverse geolocation to ensure these are in sync.
Diffstat (limited to 'app/helpers/resources_helper.rb')
-rw-r--r--app/helpers/resources_helper.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/helpers/resources_helper.rb b/app/helpers/resources_helper.rb
index a949311..792a78a 100644
--- a/app/helpers/resources_helper.rb
+++ b/app/helpers/resources_helper.rb
@@ -4,13 +4,14 @@
module ResourcesHelper
# Return a SELECT tag to choose a section in a given taxonomy
- def section_select(taxonomy, selected = nil)
+ def section_select(taxonomy, selected = nil, options = {})
grouped_options = []
+ tag_name = options[:name] || 'classification[section_ids]'
taxonomy.categories.each do |c|
grouped_options << [c.name, c.sections.map { |s| [s.name, s.id] }]
end
- select_tag('classification[section_ids]', grouped_options_for_select(grouped_options), selected: selected, multiple: true)
+ select_tag(tag_name, grouped_options_for_select(grouped_options, selected), multiple: true)
end
end