From cd3b606741ee95a5901eb6f697c486a45b25683c Mon Sep 17 00:00:00 2001
From: Andrew Brown
Date: Thu, 23 Feb 2017 16:55:43 +0000
Subject: [PATCH] Style content#new and content#edit to use the same design as
content#show
---
app/views/attribute_fields/_modal.html.erb | 2 +-
app/views/content/_form.html.erb | 78 +++----------------
.../display/_floating_action_buttons.html.erb | 65 +++++++++++++---
.../display/_image_card_header.html.erb | 8 +-
app/views/content/display/_sidelinks.html.erb | 34 ++++++--
app/views/content/edit.html.erb | 31 +++++++-
.../content/form/_actions_dropdown.html.erb | 23 ------
app/views/content/new.html.erb | 37 ++++++++-
app/views/content/show.html.erb | 17 +++-
app/views/layouts/_sidebar.html.erb | 3 +-
app/views/layouts/application.html.erb | 7 ++
11 files changed, 174 insertions(+), 131 deletions(-)
delete mode 100644 app/views/content/form/_actions_dropdown.html.erb
diff --git a/app/views/attribute_fields/_modal.html.erb b/app/views/attribute_fields/_modal.html.erb
index f10b0a09..a1535d29 100644
--- a/app/views/attribute_fields/_modal.html.erb
+++ b/app/views/attribute_fields/_modal.html.erb
@@ -27,7 +27,7 @@
this category by resubmitting this form.
- Examples of fields may be "Height", "Age married", "List of Adventures", etc. Anything you want to track!
+ Examples of fields may be "Height", "Age married", or "List of Adventures". Anything you want to track!
\ No newline at end of file
diff --git a/app/views/content/display/_sidelinks.html.erb b/app/views/content/display/_sidelinks.html.erb
index b2d3da3b..a99b8aa4 100644
--- a/app/views/content/display/_sidelinks.html.erb
+++ b/app/views/content/display/_sidelinks.html.erb
@@ -1,14 +1,31 @@
+<%
+ creating = defined?(creating) && creating
+ editing = defined?(editing) && editing
+%>
+
<%= @content.class.name %>
+ <% if creating || editing %>
+
+
+
+ <% end %>
+
<% @content.class.attribute_categories(current_user).each do |category| %>
<% fields = category.attribute_fields %>
<%
- if category.name == 'gallery'
+ if creating || editing
+ # Show everything on create/edit forms
+ elsif category.name == 'gallery'
+ # Only show gallery tab if the content has any images
next if @content.image_uploads.empty?
else
+ # Only show other tabs if it has at least one piece of data in it, or it's a custom tab
next if fields.all? do |field|
if @content.respond_to?(field.name.to_sym)
value = @content.send(field.name.to_sym)
@@ -25,15 +42,16 @@
_panel" class="<%= 'red-text' if category.label == 'Overview' %>">
<%= category.icon %>
<%= category.label.capitalize %>
-
<% end %>
-