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!

diff --git a/app/views/content/_form.html.erb b/app/views/content/_form.html.erb index 5a2fe4f2..9fbdb587 100644 --- a/app/views/content/_form.html.erb +++ b/app/views/content/_form.html.erb @@ -1,72 +1,12 @@ -<%= render 'content/form/errors', content: content %> -
-
-
-
-
- <%= content.class.icon %> -
-
- <% if content.persisted? %> - <%= link_to '#', - class: "share tooltipped #{content.class.color}-text", - data: { position: 'bottom', delay: '500', tooltip: 'Share this page with others'} do - %> - share - <% end %> - <% end %> +
- <%= link_to '#', - class: "expand tooltipped #{content.class.color}-text", - data: { position: 'bottom', delay: '500', tooltip: 'Expand all tabs vertically'} do - %> - format_line_spacing - <% end %> - - <%= render 'content/form/actions_dropdown', content: content %> -
-
- <%= render 'content/form/title', content: content %> -
- - <%# Tabs %> - - - - -
- - <%# Content panels %> - <% content.class.attribute_categories(current_user).each do |category| %> - <%= render 'content/form/panel', category: category, f: f, content: content %> - <% end %> -
- -
- -
-
-
+ <%# Content panels %> + <% content.class.attribute_categories(current_user).each do |category| %> + <%= render 'content/form/panel', category: category, f: f, content: content %> + <% end %>
+ +
+ Tip: You don't need to save before changing categories (on the right). Just remember to save when you're done! +
\ No newline at end of file diff --git a/app/views/content/display/_floating_action_buttons.html.erb b/app/views/content/display/_floating_action_buttons.html.erb index 899b5239..f86268ca 100644 --- a/app/views/content/display/_floating_action_buttons.html.erb +++ b/app/views/content/display/_floating_action_buttons.html.erb @@ -1,16 +1,57 @@ -<%= link_to edit_polymorphic_path(@content), - class: "btn-floating btn-large halfway-fab waves-effect waves-light #{@content.class.color}", - style: 'z-index: 500;' do %> - edit +<% + editing = defined?(editing) && editing + personal_content = user_signed_in? && current_user.id == @content.user_id +%> + +<%# Primary FAB %> +<% if personal_content %> + <% if editing %> + + <% else %> + <%= link_to edit_polymorphic_path(@content), + class: "btn-floating btn-large halfway-fab waves-effect waves-light #{@content.class.color}", + style: 'z-index: 500;' do %> + edit + <% end %> + <% end %> +<% elsif @content.persisted? %> + <%= link_to '#', + class: "btn-floating btn-large halfway-fab waves-effect waves-light #{@content.class.color} share", + style: 'z-index: 500;' do %> + share + <% end %> +<% else %> + <%= link_to '#', + class: "btn-floating btn-large halfway-fab waves-effect waves-light #{@content.class.color} expand", + style: 'z-index: 500;' do %> + format_line_spacing + <% end %> <% end %> -<%= link_to '#', - class: "btn-floating btn-small halfway-fab waves-effect waves-light white expand", - style: 'z-index: 500; margin-right: 61px;' do %> - <%#data: { position: 'bottom', delay: '500', tooltip: 'Expand all tabs vertically'}%> - format_line_spacing +<% if @content.persisted? %> + <%# Hidden on new-content forms (not yet persisted) because it's moved to the primary FAB %> + <%= link_to '#', + class: "btn-floating btn-small halfway-fab waves-effect waves-light white expand", + style: 'z-index: 500; margin-right: 61px;' do %> + <%#data: { position: 'bottom', delay: '500', tooltip: 'Expand all tabs vertically'}%> + format_line_spacing + <% end %> <% end %> - - share - \ No newline at end of file +<% if personal_content && @content.persisted? %> + + share + +<% end %> + +<% if @content.persisted? && editing %> + <%= link_to @content, + class: 'btn-floating btn-small halfway-fab waves-effect waves-light white delete left', + style: 'z-index: 500;', + method: :delete, + data: { confirm: "Are you sure? Deleting this #{@content.class.name.downcase} cannot be undone!" } do %> + delete sip + <% end %> +<% end %> diff --git a/app/views/content/display/_image_card_header.html.erb b/app/views/content/display/_image_card_header.html.erb index 05e7635b..bffc8dc9 100644 --- a/app/views/content/display/_image_card_header.html.erb +++ b/app/views/content/display/_image_card_header.html.erb @@ -1,4 +1,3 @@ -
    @@ -16,13 +15,10 @@
  • <%= image_tag "card-headers/#{@content.class.name.downcase.pluralize}" %>
    -

    <%= @content.name %>

    +

    <%= @content.persisted? ? @content.name : "New #{@content.class.name}" %>

    <%= @content.description %>
  • <% end %>
-
- - <%= render partial: 'content/display/floating_action_buttons' %> -
\ No newline at end of file +
\ 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 +%> + \ No newline at end of file diff --git a/app/views/content/edit.html.erb b/app/views/content/edit.html.erb index 228213ff..f7a6cb16 100644 --- a/app/views/content/edit.html.erb +++ b/app/views/content/edit.html.erb @@ -1,9 +1,32 @@ -<%= form_for @content, multipart: true do |form| %> - <%= render partial: 'content/form', locals: { f: form, content: @content } %> -<% end %> +
+ <%= form_for @content, multipart: true do |form| %> +
+ <%= render 'content/form/errors', content: content %> +
+
+ <%= render partial: 'content/display/image_card_header' %> + <%= render partial: 'content/display/floating_action_buttons', locals: { editing: true } %> +
+ <%= render partial: 'content/form', locals: { f: form, content: @content } %> +
+
-<%= render 'attribute_fields/modal', content: @content %> +
+ <%= render partial: 'content/display/sidelinks', locals: { editing: true } %> +
+ <% end %> +
+ + <% if @content.persisted? %> <%= render partial: 'content/share', locals: { shared_content: @content} %> <% end %> +<%= render partial: 'attribute_fields/modal', locals: { content: @content, safe_mode: true } %> diff --git a/app/views/content/form/_actions_dropdown.html.erb b/app/views/content/form/_actions_dropdown.html.erb deleted file mode 100644 index 4dc91ab6..00000000 --- a/app/views/content/form/_actions_dropdown.html.erb +++ /dev/null @@ -1,23 +0,0 @@ - - more_vert - - - diff --git a/app/views/content/new.html.erb b/app/views/content/new.html.erb index b18f622e..92a9f8c1 100644 --- a/app/views/content/new.html.erb +++ b/app/views/content/new.html.erb @@ -1,5 +1,34 @@ -<%= form_for @content do |form| %> - <%= render partial: 'content/form', locals: { f: form, content: @content } %> -<% end %> - <%= render 'attribute_fields/modal', content: @content %> + +
+ <%= form_for @content, multipart: true do |form| %> +
+ <%= render 'content/form/errors', content: content %> +
+
+ <%= render partial: 'content/display/image_card_header' %> + <%= render partial: 'content/display/floating_action_buttons', locals: { creating: true } %> +
+ <%= render partial: 'content/form', locals: { f: form, content: @content } %> +
+
+ +
+ <%= render partial: 'content/display/sidelinks', locals: { creating: true } %> +
+ <% end %> +
+ + + +<% if @content.persisted? %> + <%= render partial: 'content/share', locals: { shared_content: @content} %> +<% end %> +<%= render partial: 'attribute_fields/modal', locals: { content: @content, safe_mode: true } %> diff --git a/app/views/content/show.html.erb b/app/views/content/show.html.erb index a48e0d75..c8420b8e 100644 --- a/app/views/content/show.html.erb +++ b/app/views/content/show.html.erb @@ -14,7 +14,10 @@
- <%= render partial: 'content/display/image_card_header' %> +
+ <%= render partial: 'content/display/image_card_header' %> + <%= render partial: 'content/display/floating_action_buttons', locals: { editing: false } %> +
<% content.class.attribute_categories(current_user).each do |category| %> @@ -71,6 +74,16 @@
<% end %>
+ + <% if current_user.nil? || current_user.id != @content.user_id %> +
+

+ <%= @content.user.name %> created and maintains this universe on Notebook.ai. +

+ <%= link_to "See more from #{@content.user.name}", @content.user %> + <%= link_to "Create your own universe", root_url %> +
+ <% end %>
@@ -90,7 +103,7 @@ <%= render partial: 'content/share', locals: { shared_content: @content} %> -<%= render partial: 'attribute_fields/modal', locals: { content: @content, safe_mode: true } %> +<%= render partial: 'attribute_fields/modal', locals: { content: @content, safe_mode: true } if user_signed_in? %> <%# TODO: not this %> <% if @content.is_a? Universe %> diff --git a/app/views/layouts/_sidebar.html.erb b/app/views/layouts/_sidebar.html.erb index 4de54ae6..302398e3 100644 --- a/app/views/layouts/_sidebar.html.erb +++ b/app/views/layouts/_sidebar.html.erb @@ -1,5 +1,4 @@ -<%= render 'cards/ui/alert' %> -<%= render 'cards/ui/notice' %> + <% if user_signed_in? %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 0b66e1f1..065624a5 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -23,6 +23,13 @@
+
+
+ <%# todo: move these to toasts and/or make dismissable %> + <%= render 'cards/ui/alert' %> + <%= render 'cards/ui/notice' %> +
+
<%= yield %>