From 8e281d442ca046877dc761d340586bc07e2f1f93 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 10 Sep 2018 17:04:39 -0500 Subject: [PATCH] move js to end-of-page --- .../content/display/_category_panel.html.erb | 43 ++++++++----------- app/views/content/show.html.erb | 8 ++-- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/app/views/content/display/_category_panel.html.erb b/app/views/content/display/_category_panel.html.erb index 64a75f58..0034455e 100644 --- a/app/views/content/display/_category_panel.html.erb +++ b/app/views/content/display/_category_panel.html.erb @@ -5,21 +5,15 @@ <% category.attribute_fields.where(hidden: [false, nil]).eager_load(:attribute_values).sort do |a, b| a_value = case a.field_type - when 'name' - 0 - when 'universe' - 1 - else # link, textarea - 2 + when 'name' then 0 + when 'universe' then 1 + else 2 end b_value = case b.field_type - when 'name' - 0 - when 'universe' - 1 - else - 2 + when 'name' then 0 + when 'universe' then 1 + else 2 end a_value <=> b_value @@ -59,11 +53,15 @@ <% next if value.blank? %>
-
<%= attribute.label %>
+
+ <%= attribute.label %> +
+ <% if attribute.field_type == 'universe' %>
- <%= link_to value.name, value if value.is_a?(Universe) %> + <%= link_to value.name_field_value, value if value.is_a?(Universe) %>
+ <% elsif attribute.field_type == 'link' %> <% klass = content.send(attribute.old_column_source).klass %>
@@ -80,16 +78,13 @@
<% end %>
- <% else %> - <% if attribute.name == 'attribute_category_id' %> -
- <%= link_to content.attribute_category.label, content.attribute_category if content.attribute_category %> -
- <% else %> -
- <%= simple_format Rails.application.config.markdown.render(value.is_a?(Attribute) ? value.value.presence || '' : value).html_safe %>  -
- <% end %> + + <% else # field_type == text %> +
+ <%= + simple_format(Rails.application.config.markdown.render(value.presence || '').html_safe) + %>  +
<% end %> <% end %> diff --git a/app/views/content/show.html.erb b/app/views/content/show.html.erb index e7f6e756..c89f2e39 100644 --- a/app/views/content/show.html.erb +++ b/app/views/content/show.html.erb @@ -16,24 +16,24 @@ <% end %> - <%# render partial: 'content/display/visitor_cta', locals: { content: @content } %> + <%= render partial: 'content/display/visitor_cta', locals: { content: @content } %>
- <%# render partial: 'content/display/sidelinks', locals: { categories_cache: categories } %> + <%= render partial: 'content/display/sidelinks', locals: { categories_cache: categories } %>
- +<% end %> <%= render partial: 'content/share', locals: { shared_content: @content} %>