From 73e2d3cc7d17e4bd391b849cdd109fdbb0183192 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 4 Dec 2018 16:18:17 -0600 Subject: [PATCH 01/90] Fix sidenav hamburger menu and hiding and stuff --- app/assets/javascripts/navbar.js.coffee | 1 - app/views/layouts/_navbar.html.erb | 7 +++++++ app/views/layouts/_sidenav.html.erb | 14 ++++---------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/navbar.js.coffee b/app/assets/javascripts/navbar.js.coffee index 1c2ac0229..e69de29bb 100644 --- a/app/assets/javascripts/navbar.js.coffee +++ b/app/assets/javascripts/navbar.js.coffee @@ -1 +0,0 @@ -$( -> $(".button-collapse").sidenav() ) diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb index 765da2fe0..fb0c00c56 100644 --- a/app/views/layouts/_navbar.html.erb +++ b/app/views/layouts/_navbar.html.erb @@ -157,6 +157,13 @@ <% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 152363895..2ce23e941 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -12,7 +12,6 @@
- <%# todo: move these to toasts and/or make dismissable %> <%= render 'cards/ui/alert' %> <%= render 'cards/ui/notice' %>
diff --git a/app/views/main/dashboard.html.erb b/app/views/main/dashboard.html.erb index 1df7bb440..bb32e3936 100644 --- a/app/views/main/dashboard.html.erb +++ b/app/views/main/dashboard.html.erb @@ -1,5 +1,5 @@
-
+
<%= link_to documents_path do %>
@@ -12,7 +12,7 @@ <% end %>
-
+
<%= link_to thredded_path do %>
@@ -27,7 +27,7 @@ <% end %>
-
+
<%= link_to prompts_path do %>
@@ -40,19 +40,6 @@ <% end %>
-
- <%= link_to current_user do %> -
-
- -   - Profile - -
-
- <% end %> -
- <% if @content %>
<%= render partial: 'cards/serendipitous/content_question', locals: { content: @content } %> From e7706b7d0a661bcf2fa825fb40078a909da91c44 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Wed, 2 Jan 2019 23:17:48 -0600 Subject: [PATCH 62/90] add last login time/ip --- .../devise/registrations/panes/_information.html.erb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/views/devise/registrations/panes/_information.html.erb b/app/views/devise/registrations/panes/_information.html.erb index 4847967e5..d5e820ee5 100644 --- a/app/views/devise/registrations/panes/_information.html.erb +++ b/app/views/devise/registrations/panes/_information.html.erb @@ -39,6 +39,15 @@
+
+
+
+ Last login + <%= time_ago_in_words current_user.current_sign_in_at %> ago + from IP <%= current_user.current_sign_in_ip %>. +
+
+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> From d42a495d0cdf8f14a7840e226122cc5fcce18cdb Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Wed, 2 Jan 2019 23:51:39 -0600 Subject: [PATCH 63/90] exclude documents from export controller logic --- app/controllers/export_controller.rb | 6 +++--- app/views/main/prompts.html.erb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index 0e41291d6..de3a3f171 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -29,13 +29,13 @@ def outline def notebook_json report_to_mixpanel 'json', 'notebook' - json_dump = current_user.content.map { |category, content| {"#{category}": fill_relations(category.constantize, content)} }.to_json + json_dump = current_user.content.except('Document').map { |category, content| {"#{category}": fill_relations(category.constantize, content)} }.to_json send_data json_dump, filename: "notebook-#{Date.today}.json" end def notebook_xml report_to_mixpanel 'xml', 'notebook' - xml_dump = current_user.content.map { |category, content| {"#{category}": fill_relations(category.constantize, content)}}.to_xml + xml_dump = current_user.content.except('Document').map { |category, content| {"#{category}": fill_relations(category.constantize, content)}}.to_xml send_data xml_dump, filename: "notebook-#{Date.today}.xml" end @@ -120,7 +120,7 @@ def fill_relations(ar_class, ar_relation) end def content_to_outline - content_types = current_user.content.keys + content_types = current_user.content.except('Document').keys text = "" content_types.each do |content_type| diff --git a/app/views/main/prompts.html.erb b/app/views/main/prompts.html.erb index 83959bdc8..2f1a04d3b 100644 --- a/app/views/main/prompts.html.erb +++ b/app/views/main/prompts.html.erb @@ -31,7 +31,7 @@ <% if @serendipitous_asking_question %>
- <%= link_to documents_path do %> + <%= link_to @content do %>
From a0e87a57ddea1579363d880644ba1f46bbed94ef Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Thu, 3 Jan 2019 01:59:03 -0600 Subject: [PATCH 64/90] recent content page --- .../content/components/_parallax_header.html.erb | 5 ++++- app/views/content/index.html.erb | 2 +- app/views/main/recent_content.html.erb | 12 +++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/views/content/components/_parallax_header.html.erb b/app/views/content/components/_parallax_header.html.erb index 8f7676283..781735fe2 100644 --- a/app/views/content/components/_parallax_header.html.erb +++ b/app/views/content/components/_parallax_header.html.erb @@ -3,7 +3,10 @@
  • <%= image_tag "card-headers/#{content_type.downcase.pluralize}.jpg" %>
    -

    <%= content_type.titleize.pluralize %>

    +

    + <%= content_class.icon %> + <%= content_type.titleize.pluralize %> +

    <%= t("content_oneliners.#{content_type.downcase}") %>
  • diff --git a/app/views/content/index.html.erb b/app/views/content/index.html.erb index efc8cd679..a9bad32a8 100644 --- a/app/views/content/index.html.erb +++ b/app/views/content/index.html.erb @@ -3,7 +3,7 @@ %> <%= content_for :full_width_page_header do %> - <%= render partial: 'content/components/parallax_header', locals: { content_type: content_type } %> + <%= render partial: 'content/components/parallax_header', locals: { content_type: content_type, content_class: @content_type_class } %> <% end %> <% if @content.any? %> diff --git a/app/views/main/recent_content.html.erb b/app/views/main/recent_content.html.erb index 5f6670b4f..2031ceefc 100644 --- a/app/views/main/recent_content.html.erb +++ b/app/views/main/recent_content.html.erb @@ -1,6 +1,8 @@ -
    - <%= render partial: 'cards/user/recent_activity', locals: { title: 'Recently-updated pages', content_list: @recent_edits } %> -
    -
    - <%= render partial: 'cards/user/recent_activity', locals: { title: 'Recently-created pages', content_list: @recent_creates } %> +
    +
    + <%= render partial: 'cards/user/recent_activity', locals: { title: 'Recently-updated pages', content_list: @recent_edits } %> +
    +
    + <%= render partial: 'cards/user/recent_activity', locals: { title: 'Recently-created pages', content_list: @recent_creates } %> +
    From 6c52e3edfbe6da5f8aee841a0788963e485d6d3d Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Thu, 3 Jan 2019 02:50:13 -0600 Subject: [PATCH 65/90] make some room on profiles --- .../components/_list_filter_bar.html.erb | 12 +- app/views/users/profile/_actions.html.erb | 16 ++ app/views/users/profile/_avatar.html.erb | 13 ++ app/views/users/profile/_name.html.erb | 13 ++ .../users/profile/_public_activity.html.erb | 59 ++++++++ .../users/profile/_public_pages.html.erb | 18 +++ app/views/users/show.html.erb | 137 ++---------------- 7 files changed, 137 insertions(+), 131 deletions(-) create mode 100644 app/views/users/profile/_actions.html.erb create mode 100644 app/views/users/profile/_avatar.html.erb create mode 100644 app/views/users/profile/_name.html.erb create mode 100644 app/views/users/profile/_public_activity.html.erb create mode 100644 app/views/users/profile/_public_pages.html.erb diff --git a/app/views/content/components/_list_filter_bar.html.erb b/app/views/content/components/_list_filter_bar.html.erb index dd9e3fa8c..8953900f2 100644 --- a/app/views/content/components/_list_filter_bar.html.erb +++ b/app/views/content/components/_list_filter_bar.html.erb @@ -1,4 +1,4 @@ -
    + +
    - +   @@ -79,4 +79,4 @@
    -
    +
    --> diff --git a/app/views/users/profile/_actions.html.erb b/app/views/users/profile/_actions.html.erb new file mode 100644 index 000000000..d0f036296 --- /dev/null +++ b/app/views/users/profile/_actions.html.erb @@ -0,0 +1,16 @@ +<% if user_signed_in? && current_user != @user %> +
    +
    +
    + Actions +
    +
    + + <%= link_to Thredded::UrlsHelper.send_private_message_path(current_user: current_user, to: @user), class: 'collection-item' do %> + Send a message + + forum + + <% end %> +
    +<% end %> diff --git a/app/views/users/profile/_avatar.html.erb b/app/views/users/profile/_avatar.html.erb new file mode 100644 index 000000000..73753bcff --- /dev/null +++ b/app/views/users/profile/_avatar.html.erb @@ -0,0 +1,13 @@ +
    +
    + <%= image_tag @user.image_url(250).html_safe, class: 'activator', style: 'width: 100%' %> +
    + + <% if user_signed_in? && current_user == @user %> +
    + close +

    Profile pictures are powered by <%= link_to 'Gravatar', 'https://gravatar.com/', target: "_blank" %>, using the email you provided in your <%= link_to 'account settings', edit_user_registration_path %>.

    +

    For the prettiest profile, please use an avatar at least 250 pixels wide.

    +
    + <% end %> +
    diff --git a/app/views/users/profile/_name.html.erb b/app/views/users/profile/_name.html.erb new file mode 100644 index 000000000..7bc450bd9 --- /dev/null +++ b/app/views/users/profile/_name.html.erb @@ -0,0 +1,13 @@ +

    + <% if user_signed_in? && current_user.id == @user.id %> + + <%= link_to 'Edit your profile', edit_user_registration_path(current_user), style: 'padding: 0 10px;', class: 'waves-effect' %> + + <% end %> + <%= @user.name %> + <% if @user.username.present? %> + + <%= link_to "@#{@user.username}", thredded_path %> + + <% end %> +

    diff --git a/app/views/users/profile/_public_activity.html.erb b/app/views/users/profile/_public_activity.html.erb new file mode 100644 index 000000000..787ef022e --- /dev/null +++ b/app/views/users/profile/_public_activity.html.erb @@ -0,0 +1,59 @@ +<% if @stream.any? %> +
    +
    +
    Recent activity
    +
    + <% @stream.each do |entity_id, change_events| %> + <% change_event = change_events.first %> + <% next unless change_event.present? && change_event.content.present? %> + <% + if change_event.content_type == 'Attribute' + content_type_class = change_event.content.entity_type.constantize + content = content_type_class.find_by(id: change_event.content.entity_id) + else + content_type_class = change_event.content_type.constantize + content = content_type_class.find_by(id: change_event.content_id) + end + %> + <% next if content.nil? %> + <% next unless content.readable_by?(user_signed_in? ? current_user : User.new) %> + +
    +
    + <%= content_type_class.icon %> +
    + +
    +
    + <%= link_to content.name, content, class: 'white-text' %> +
    + <% if content.description.present? %> +
    + <%= truncate(content.description, length: 300) %> +
    + <% end %> + <% if content.respond_to?(:universe_id) && content.universe_id.present? && content.universe_id > 0 %> +
    + + <%= Universe.icon %> + + <%= link_to content.universe.name, content.universe %> +
    + <% end %> +
    + access_time + <%= change_event.action %> + <%= time_ago_in_words change_event.created_at %> ago +
    + + + +
    +
    + <% end %> +
    +
    +
    +<% else %> + It seems <%= @user.name %> isn't sharing any public activity. +<% end %> diff --git a/app/views/users/profile/_public_pages.html.erb b/app/views/users/profile/_public_pages.html.erb new file mode 100644 index 000000000..1a26f6e4d --- /dev/null +++ b/app/views/users/profile/_public_pages.html.erb @@ -0,0 +1,18 @@ +<% if @content.any? %> +
    +
    +
    + Public pages +
    +
    + <% @tabs.each do |tab| %> + <% content_type_class = @user.send(tab).build.class %> + <%= link_to send("#{tab}_user_path"), class: "collection-item #{content_type_class.color}-text" do %> + <%= pluralize @content[tab].length, tab.to_s.singularize %> + + <%= content_type_class.icon %> + + <% end %> + <% end %> +
    +<% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 615434387..dac2fb75c 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -16,135 +16,22 @@
    -
    -

    - <% if user_signed_in? && current_user.id == @user.id %> - - <%= link_to 'Edit your profile', edit_user_registration_path(current_user), style: 'padding: 0 10px;', class: 'waves-effect' %> - - <% end %> - <%= @user.name %> - <% if @user.username.present? %> - - <%= link_to "@#{@user.username}", thredded_path %> - - <% end %> -

    +
    + <%= render partial: 'users/profile/avatar' %> + <%= render partial: 'users/profile/public_pages' %> + <%= render partial: 'users/profile/actions' %>
    -
    - -
    -
    -
    -
    - <%= image_tag @user.image_url(250).html_safe, class: 'activator', style: 'width: 100%' %> -
    - <% if user_signed_in? && current_user == @user %> -
    - close -

    Profile pictures are powered by <%= link_to 'Gravatar', 'https://gravatar.com/', target: "_blank" %>, using the email you provided in your <%= link_to 'account settings', edit_user_registration_path %>.

    -

    For the prettiest profile, please use an avatar at least 250 pixels wide.

    -
    - <% end %> +
    + <%= render partial: 'users/profile/name' %> +
    + Joined <%= time_ago_in_words @user.created_at %> ago.
    - - <% if @content.any? %> -
    -
    -
    - Public pages -
    -
    - <% @tabs.each do |tab| %> - <% content_type_class = @user.send(tab).build.class %> - <%= link_to send("#{tab}_user_path"), class: "collection-item #{content_type_class.color}-text" do %> - <%= pluralize @content[tab].length, tab.to_s.singularize %> - - <%= content_type_class.icon %> - - <% end %> - <% end %> -
    - <% end %> - - <% if user_signed_in? && current_user != @user %> -
    -
    -
    - Actions -
    -
    - - <%= link_to Thredded::UrlsHelper.send_private_message_path(current_user: current_user, to: @user), class: 'collection-item' do %> - Send a message - - forum - - <% end %> -
    - <% end %>
    +
    -
    - <% if @stream.any? %> -
    -
    -
    Recent activity
    -
    - <% @stream.each do |entity_id, change_events| %> - <% change_event = change_events.first %> - <% next unless change_event.present? && change_event.content.present? %> - <% - if change_event.content_type == 'Attribute' - content_type_class = change_event.content.entity_type.constantize - content = content_type_class.find_by(id: change_event.content.entity_id) - else - content_type_class = change_event.content_type.constantize - content = content_type_class.find_by(id: change_event.content_id) - end - %> - <% next if content.nil? %> - <% next unless content.readable_by?(user_signed_in? ? current_user : User.new) %> - -
    -
    - <%= content_type_class.icon %> -
    - -
    -
    - <%= link_to content.name, content, class: 'white-text' %> -
    - <% if content.description.present? %> -
    - <%= truncate(content.description, length: 300) %> -
    - <% end %> - <% if content.respond_to?(:universe_id) && content.universe_id.present? && content.universe_id > 0 %> -
    - - <%= Universe.icon %> - - <%= link_to content.universe.name, content.universe %> -
    - <% end %> -
    - access_time - <%= change_event.action %> - <%= time_ago_in_words change_event.created_at %> ago -
    - - - -
    -
    - <% end %> -
    -
    -
    - <% else %> - It seems <%= @user.name %> isn't sharing any public activity. - <% end %> +
    +
    + <%= render partial: 'users/profile/public_activity' %>
    From e3e994b18e586bd77adb566ad800cc279dc8e576 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Thu, 3 Jan 2019 03:10:43 -0600 Subject: [PATCH 66/90] dont stretch images on dashboard --- .../cards/serendipitous/_content_question.html.erb | 2 +- .../cards/_in_universe_content_list.html.erb | 14 +++++++++----- app/views/main/prompts.html.erb | 5 ++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/views/cards/serendipitous/_content_question.html.erb b/app/views/cards/serendipitous/_content_question.html.erb index eece30762..d875411f9 100644 --- a/app/views/cards/serendipitous/_content_question.html.erb +++ b/app/views/cards/serendipitous/_content_question.html.erb @@ -41,7 +41,7 @@ <% if @serendipitous_asking_question %>
    - <%= content.class.icon %> + <%= content.class.icon %> <%= t( diff --git a/app/views/content/cards/_in_universe_content_list.html.erb b/app/views/content/cards/_in_universe_content_list.html.erb index ecc4b9366..b1f1d17f1 100644 --- a/app/views/content/cards/_in_universe_content_list.html.erb +++ b/app/views/content/cards/_in_universe_content_list.html.erb @@ -22,11 +22,15 @@
    <% images = ImageUpload.where(content_type: content_type_name, content_id: content_list.pluck(:id)) %> - <% if rand(3) < 2 && images.any? %> - <%= image_tag images.sample.src(:large), class: 'activator', style: 'height: 265px' %> - <% else %> - <%= image_tag "card-headers/#{content_type_pluralized}.jpg", class: 'activator', style: 'height: 265px' %> - <% end %> + <% + category_image = if rand(3) < 2 && images.any? + images.sample.src(:large) + else + asset_path("card-headers/#{content_type_pluralized}.jpg") + end + %> +
    +
    <% if defined?(card_title) && !card_title.blank? %> <%= card_title %> diff --git a/app/views/main/prompts.html.erb b/app/views/main/prompts.html.erb index 2f1a04d3b..686dc44ff 100644 --- a/app/views/main/prompts.html.erb +++ b/app/views/main/prompts.html.erb @@ -18,6 +18,9 @@

    This writing prompt was generated automatically from the pages in your notebook.

    +

    + More types of prompts are coming soon. +

    diff --git a/app/views/content/display/_quick_reference.html.erb b/app/views/content/display/_quick_reference.html.erb index 4ed8a472f..bf7b29425 100644 --- a/app/views/content/display/_quick_reference.html.erb +++ b/app/views/content/display/_quick_reference.html.erb @@ -1,7 +1,6 @@ <%# Usage: render partial: 'content/display/quick_reference', locals: { content: @content } %> -<%# - TODO: this needs optimized. Last count it was doing 55 SQL queries, so it has been temporarily - disabled (not called from dashboard.html.erb). +<% + serialized_content = ContentSerializer.new(content) %>

    @@ -15,43 +14,29 @@ <% end %> <% end %>

    -
    <%= content.description %>
    -<% all_categories = content.class.attribute_categories(current_user) %> -<% found_attributes = 0 %> -<% attributes_to_find = 5 %> - - - <% all_categories.each do |category| %> - <% break if found_attributes >= attributes_to_find %> - <% category.attribute_fields.each do |attribute_field| %> - <% break if found_attributes >= attributes_to_find %> - - <% next unless attribute_field.name.present? %> - <% next if attribute_field.name.end_with? '_id' %> - <% next if attribute_field.name == 'privacy' %> - <% next if ['name', 'description'].include?(attribute_field.name) %> - - <% next unless content.respond_to? attribute_field.name %> - <% next unless content.send(attribute_field.name).present? %> - <% next if content.send(attribute_field.name).is_a?(ActiveRecord::Associations::CollectionProxy) %> - - <% found_attributes += 1 %> - - - - - <% end %> - <% end %> - <% if found_attributes < attributes_to_find %> - - - +
      + <% serialized_content.data[:categories].each do |category| %> + <% next if ['changelog'].include?(category[:name]) %> + <% next unless category[:fields].any? { |field| field[:value].present? } %> +
    • +
      + <%= category[:icon] %> + <%= category[:label] %> +
      +
      + +
    -
    - <%= attribute_field.label %> -
    -
    <%= content.send(attribute_field.name) %>
    - More information will automatically appear here as you add it to <%= content.name %>. -
    + <% category[:fields].each do |field| %> + <% next unless field[:value].present? %> + + + + + <% end %> +
    <%= field[:label] %><%= field[:value] %>
    + +
    + <% end %> - + diff --git a/config/routes.rb b/config/routes.rb index 98368d769..dd50f2893 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -81,6 +81,7 @@ Rails.application.config.content_types[:all_non_universe].each do |content_type| get content_type.name.downcase.pluralize.to_sym, on: :member end + get :changelog, on: :member end Rails.application.config.content_types[:all_non_universe].each do |content_type| # resources :characters do From 42491107e6319541ea67973548ecb0649d807ddc Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 5 Jan 2019 16:26:24 -0600 Subject: [PATCH 72/90] add these stupid badges because ie doesn't support filters --- app/assets/javascripts/content_types.js | 3 +++ app/assets/stylesheets/content_types.scss | 8 ++++++++ app/views/customization/content_types.html.erb | 1 + 3 files changed, 12 insertions(+) diff --git a/app/assets/javascripts/content_types.js b/app/assets/javascripts/content_types.js index 548c2e442..83fd6f2bc 100644 --- a/app/assets/javascripts/content_types.js +++ b/app/assets/javascripts/content_types.js @@ -3,6 +3,7 @@ $(document).ready(function() { var content_type = $(this).data('content-type'); var related_card = $(this).children('.card').first(); var is_currently_active = related_card.hasClass('active'); + var ie_badge = $(this).find('.enabled-badge'); $.post('/customization/toggle_content_type', { content_type: content_type, @@ -11,8 +12,10 @@ $(document).ready(function() { if (is_currently_active) { related_card.removeClass('active'); + ie_badge.attr('data-badge-caption', 'hidden'); } else { related_card.addClass('active'); + ie_badge.attr('data-badge-caption', 'active'); } // Return false so we don't jump to the top of the page on link click diff --git a/app/assets/stylesheets/content_types.scss b/app/assets/stylesheets/content_types.scss index 9d4c83e29..a5460d313 100644 --- a/app/assets/stylesheets/content_types.scss +++ b/app/assets/stylesheets/content_types.scss @@ -17,3 +17,11 @@ filter: blur(0px); } } + +.js-enable-content-type .enabled-badge { + float: right; + position: relative; + top: -51px; + right: 7px; + z-index: 3; +} diff --git a/app/views/customization/content_types.html.erb b/app/views/customization/content_types.html.erb index 6e1c79b14..76067b527 100644 --- a/app/views/customization/content_types.html.erb +++ b/app/views/customization/content_types.html.erb @@ -77,6 +77,7 @@ style="border-bottom: 10px solid <%= content_type.hex_color %>">
    <%= image_tag "card-headers/#{content_type.name.downcase.pluralize}.jpg", height: 180, width: 200 %> + <%= content_type.icon %> <%= content_type.name.pluralize %> From ed47d6b277457f459d17471bde8ca27f8802b18e Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 5 Jan 2019 16:27:34 -0600 Subject: [PATCH 73/90] fix image issues on login --- app/views/devise/sessions/new.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 31dde5ce1..00cb9cbf2 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,8 +1,8 @@
    - <%= image_tag 'logos/both-small.png', class: 'hide-on-small-only' %> - <%= image_tag 'logos/book-small.png', class: 'hide-on-med-and-up' %> + <%= image_tag 'logos/both-small.png', class: 'hide-on-small-only', style: 'width: 100%' %> + <%= image_tag 'logos/book-small.png', class: 'hide-on-med-and-up', style: 'width: 100%' %>
    <%= render 'devise/sessions/form' %>
    From 6686fb0efbebfae58539edd4c4561891f52ddf7b Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 5 Jan 2019 17:10:57 -0600 Subject: [PATCH 74/90] add new forum links --- app/services/forums_linkbuilder_service.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/services/forums_linkbuilder_service.rb b/app/services/forums_linkbuilder_service.rb index 44748a6fc..156d90fc7 100644 --- a/app/services/forums_linkbuilder_service.rb +++ b/app/services/forums_linkbuilder_service.rb @@ -6,15 +6,21 @@ def self.worldbuilding_url(page_type) def self.content_to_url_map { 'Character': '/forum/characters-board', + 'Condition': '/forum/conditions', 'Creature': '/forum/characters', # [sic] 'Flora': '/forum/flora', 'Government': '/forum/governments', + 'Item': '/forum/items', + 'Job': '/forum/jobs', + 'Landmark': '/forum/landmarks', 'Language': '/forum/general-worldbuilding', # wtf did I do 'Location': '/forum/locations', 'Magic': '/forum/magic', 'Planet': '/forum/planets', + 'Race': '/forum/races', 'Religion': '/forum/religions', - 'Technology': '/forum/technology' + 'Technology': '/forum/technology', + 'Tradition': '/forum/traditions' } end end From ed232b337359acbdb94d4d8a25f54051b96fe496 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 5 Jan 2019 17:30:40 -0600 Subject: [PATCH 75/90] always cache user universes --- app/controllers/application_controller.rb | 3 ++- app/models/concerns/has_content.rb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c2c6cbe9b..1a31a429b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -48,7 +48,8 @@ def cache_most_used_page_information current_user.user_content_type_activators.pluck(:content_type) ) - @current_user_content = current_user.content(content_types: @activated_content_types) + # We always want to cache Universes, even if they aren't explicitly turned on. + @current_user_content = current_user.content(content_types: @activated_content_types + ['Universe']) @current_user_content['Document'] = current_user.documents end diff --git a/app/models/concerns/has_content.rb b/app/models/concerns/has_content.rb index 1ac4897e0..ff3991256 100644 --- a/app/models/concerns/has_content.rb +++ b/app/models/concerns/has_content.rb @@ -28,7 +28,7 @@ def content( polymorphic_content_fields = [:id, :name, :page_type, :user_id, :created_at, :updated_at, :deleted_at, :privacy] where_conditions = page_scoping.map { |key, value| "#{key} = #{value}" }.join(' AND ') + ' AND deleted_at IS NULL' - sql = content_types.map do |page_type| + sql = content_types.uniq.map do |page_type| "SELECT #{polymorphic_content_fields.join(',')} FROM #{page_type.downcase.pluralize} WHERE #{where_conditions}" end.join(' UNION ALL ') + ' ORDER BY page_type, id' @@ -53,7 +53,7 @@ def content_list( polymorphic_content_fields = [:id, :name, :page_type, :user_id, :created_at, :updated_at, :deleted_at, :privacy] where_conditions = page_scoping.map { |key, value| "#{key} = #{value}" }.join(' AND ') + ' AND deleted_at IS NULL' - sql = content_types.map do |page_type| + sql = content_types.uniq.map do |page_type| "SELECT #{polymorphic_content_fields.join(',')} FROM #{page_type.downcase.pluralize} WHERE #{where_conditions}" end.join(' UNION ALL ') From 8c9b0fa19603b0609cd98bc6645de1f2acbf8066 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 5 Jan 2019 19:28:37 -0600 Subject: [PATCH 76/90] show log in/up links on mobile --- app/views/layouts/_navbar.html.erb | 6 +++--- app/views/layouts/navbar/_recent_content_dropdown.html.erb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb index 6d4f0c13a..0a43c5f78 100644 --- a/app/views/layouts/_navbar.html.erb +++ b/app/views/layouts/_navbar.html.erb @@ -21,10 +21,10 @@ <% else %> -
  • +
  • <%= link_to 'Sign in', main_app.new_user_session_path %>
  • -
  • +
  • <%= link_to 'Sign up', main_app.new_user_registration_path %>
  • <% end %> @@ -39,7 +39,7 @@ <% else %>
  • <%= link_to 'Home', main_app.root_path %> -
  • + <% end %>
    diff --git a/app/views/layouts/navbar/_recent_content_dropdown.html.erb b/app/views/layouts/navbar/_recent_content_dropdown.html.erb index 1a586a1f2..73c55f6c1 100644 --- a/app/views/layouts/navbar/_recent_content_dropdown.html.erb +++ b/app/views/layouts/navbar/_recent_content_dropdown.html.erb @@ -11,7 +11,7 @@ <% end %> <% if current_user.content_count > 0 %>
  • -
  • +
  • <%= link_to 'More...', main_app.recent_content_path, class: 'blue-text' %>
  • <% end %> From db9015667f3b64105c4f8154d9add173865459c1 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 5 Jan 2019 19:32:24 -0600 Subject: [PATCH 77/90] remove redundant ui --- .../content/cards/_mobile_links.html.erb | 28 ------------------- app/views/main/dashboard.html.erb | 4 --- 2 files changed, 32 deletions(-) delete mode 100644 app/views/content/cards/_mobile_links.html.erb diff --git a/app/views/content/cards/_mobile_links.html.erb b/app/views/content/cards/_mobile_links.html.erb deleted file mode 100644 index e7007dbbe..000000000 --- a/app/views/content/cards/_mobile_links.html.erb +++ /dev/null @@ -1,28 +0,0 @@ -
    -
    - - - forum - - Visit the forums - - -

    - There have been <%= Thredded::Topic.where('created_at > ?', DateTime.current - 1.week).count %> new threads created in the past week on the forums. - Share your characters, talk about worlbuilding, find a collaborator or two, or just, well, chat! There's threads for everyone. -


    - -
    - <%= link_to main_app.thredded_path, class: 'btn white black-text' do %> - View discussions - <% if @unread_threads > 0 || @unread_private_messages > 0 %> - - <%= @unread_threads %><%= "/#{@unread_private_messages}" if @unread_private_messages > 0 %> - - <% end %> - <% end %> -
    -
    - -
    -
    diff --git a/app/views/main/dashboard.html.erb b/app/views/main/dashboard.html.erb index 1df7bb440..763b117f6 100644 --- a/app/views/main/dashboard.html.erb +++ b/app/views/main/dashboard.html.erb @@ -100,10 +100,6 @@
    <% end %>
    - -
    hide-on-med-and-up"> - <%= render partial: 'content/cards/mobile_links' %> -
    <% 5.times do %> From 85ef9cb8a1e526579cc5689ccb05b76b333db1b9 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 5 Jan 2019 19:53:35 -0600 Subject: [PATCH 78/90] fix universe linking in quick reference --- app/views/content/display/_quick_reference.html.erb | 8 +++++++- app/views/main/dashboard.html.erb | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/content/display/_quick_reference.html.erb b/app/views/content/display/_quick_reference.html.erb index bf7b29425..d6e628c88 100644 --- a/app/views/content/display/_quick_reference.html.erb +++ b/app/views/content/display/_quick_reference.html.erb @@ -31,7 +31,13 @@ <% next unless field[:value].present? %> <%= field[:label] %> - <%= field[:value] %> + + <% if field[:type] == 'universe' %> + <%= link_to serialized_content.data[:universe][:name], universe_path(field[:value]) %> + <% else %> + <%= field[:value] %> + <% end %> + <% end %> diff --git a/app/views/main/dashboard.html.erb b/app/views/main/dashboard.html.erb index 763b117f6..3aeeed09a 100644 --- a/app/views/main/dashboard.html.erb +++ b/app/views/main/dashboard.html.erb @@ -32,7 +32,6 @@
    -   Prompts
    @@ -45,7 +44,6 @@
    -   Profile
    From e431220be4e039d0bd1330e38a87e9c1c78dac58 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 5 Jan 2019 19:53:45 -0600 Subject: [PATCH 79/90] add dashboard link to mobile/tablet navbar --- app/views/layouts/_navbar.html.erb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb index 0a43c5f78..1aa11b68f 100644 --- a/app/views/layouts/_navbar.html.erb +++ b/app/views/layouts/_navbar.html.erb @@ -36,6 +36,11 @@ menu +
  • + <%= link_to main_app.root_path, class: 'tooltipped', data: { tooltip: 'Your dashboard' } do %> + dashboard + <% end %> +
  • <% else %>
  • <%= link_to 'Home', main_app.root_path %> From 3e40d2a8e2c6988ded72b4b72008c49ecbf0d452 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 5 Jan 2019 20:09:23 -0600 Subject: [PATCH 80/90] fix discussions link activeness in navbar --- app/services/forums_linkbuilder_service.rb | 4 ++++ app/views/layouts/_navbar.html.erb | 2 +- config/initializers/thredded.rb | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/services/forums_linkbuilder_service.rb b/app/services/forums_linkbuilder_service.rb index 156d90fc7..32ec8e7d5 100644 --- a/app/services/forums_linkbuilder_service.rb +++ b/app/services/forums_linkbuilder_service.rb @@ -23,4 +23,8 @@ def self.content_to_url_map 'Tradition': '/forum/traditions' } end + + def self.is_discussions_page?(url) + return url.start_with?('/forum/') + end end diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb index 1aa11b68f..cf0c547c8 100644 --- a/app/views/layouts/_navbar.html.erb +++ b/app/views/layouts/_navbar.html.erb @@ -59,7 +59,7 @@