From 0654b36ca18fe2da06258cb692389cc907df8def Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 6 Aug 2016 01:58:52 -0500 Subject: [PATCH] Allow linking content to universes --- app/views/content/_form.html.erb | 6 +++++- app/views/layouts/application.html.erb | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/content/_form.html.erb b/app/views/content/_form.html.erb index 137c5158..ba6ff17d 100644 --- a/app/views/content/_form.html.erb +++ b/app/views/content/_form.html.erb @@ -31,11 +31,15 @@
<% data[:attributes].each do |attribute| %>
- <%# TODO: not this lol %> <% value = content.send(attribute) %> <% if value.is_a?(ActiveRecord::Associations::CollectionProxy) %> <% through_class = content.class.reflect_on_association(attribute).options[:through].to_s %> <%= render 'content/form/relation_input', f: f, attribute: attribute, relation: through_class %> + <% elsif attribute == 'universe_id' %> +
+ <%= f.label attribute %>
+ <%= f.select attribute, current_user.universes.sort_by(&:name).map { |u| [u.name, u.id] }.compact, include_blank: true %> +
<% else %> <%= render 'content/form/text_input', f: f, attribute: attribute %> <% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 905a2a3b..99bc0350 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -36,6 +36,10 @@