move js to end-of-page

This commit is contained in:
Andrew Brown 2018-09-10 17:04:39 -05:00
parent c1e62a8f7f
commit 8e281d442c
2 changed files with 23 additions and 28 deletions

View File

@ -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? %>
<div class="row">
<div class="col s3 m3 l3 right-align flow-text grey-text"><%= attribute.label %></div>
<div class="col s3 m3 l3 right-align flow-text grey-text">
<%= attribute.label %>
</div>
<% if attribute.field_type == 'universe' %>
<div class="col s9 m9 l9 flow-text">
<%= link_to value.name, value if value.is_a?(Universe) %>
<%= link_to value.name_field_value, value if value.is_a?(Universe) %>
</div>
<% elsif attribute.field_type == 'link' %>
<% klass = content.send(attribute.old_column_source).klass %>
<div class="col s9 m9 l9 flow-text">
@ -80,16 +78,13 @@
</div>
<% end %>
</div>
<% else %>
<% if attribute.name == 'attribute_category_id' %>
<div class="col s9 m9 l9 flow-text">
<%= link_to content.attribute_category.label, content.attribute_category if content.attribute_category %>
</div>
<% else %>
<div class="col s9 m9 l9 markdownable">
<%= simple_format Rails.application.config.markdown.render(value.is_a?(Attribute) ? value.value.presence || '' : value).html_safe %>&nbsp;
</div>
<% end %>
<% else # field_type == text %>
<div class="col s9 m9 l9 markdownable">
<%=
simple_format(Rails.application.config.markdown.render(value.presence || '').html_safe)
%>&nbsp;
</div>
<% end %>
</div>
<% end %>

View File

@ -16,24 +16,24 @@
<% end %>
</div>
<%# render partial: 'content/display/visitor_cta', locals: { content: @content } %>
<%= render partial: 'content/display/visitor_cta', locals: { content: @content } %>
</div>
</div>
<div class="col s3">
<%# render partial: 'content/display/sidelinks', locals: { categories_cache: categories } %>
<%= render partial: 'content/display/sidelinks', locals: { categories_cache: categories } %>
</div>
</div>
<script type="text/javascript">
<%= content_for :javascript do %>
$(document).ready(function(){
$('.slider').slider({
height: 200,
indicators: false
});
});
</script>
<% end %>
<%= render partial: 'content/share', locals: { shared_content: @content} %>