From f72e87c4e351e2a7b19639742f7b4dd4eef99ef5 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Thu, 1 Oct 2020 16:36:52 -0700 Subject: [PATCH] new collection design with tiles --- app/views/page_collections/_tiles.html.erb | 45 ++++++++ app/views/page_collections/show.html.erb | 24 +--- ...046_add_reference_code_to_notifications.rb | 5 + db/schema.rb | 103 +++++++++++++++++- 4 files changed, 155 insertions(+), 22 deletions(-) create mode 100644 app/views/page_collections/_tiles.html.erb create mode 100644 db/migrate/20201001195046_add_reference_code_to_notifications.rb diff --git a/app/views/page_collections/_tiles.html.erb b/app/views/page_collections/_tiles.html.erb new file mode 100644 index 00000000..ba3fbd83 --- /dev/null +++ b/app/views/page_collections/_tiles.html.erb @@ -0,0 +1,45 @@ +
+ <% pages.each do |page| %> +
+ <% content = page.content %> + <% next unless (current_user || User.new).can_read?(content) %> +
+
+ <%= image_tag content.random_public_image, class: 'activator' %> +
+
+ + <%= link_to content.name, content %> + more_vert + +

+ Submitted by + <%= link_to content.user, class: "#{User.color}-text" do %> + <%= content.user.display_name %> + <% end %> +

+
+
+ + <%= link_to content.name, content %> + close + + <% if page.explanation? %> +
+ <%= simple_format page.explanation %> +
+ <% end %> +
    +
  • <%= link_to 'View more submissions from this user', page_collection_submissions_by_user_path(page_collection_id: @page_collection.id, user_id: page.user_id) %>
  • + <% if user_signed_in? && current_user == @page_collection.user %> +
  •  
  • +
  • +
  •  
  • +
  • <%= link_to 'Remove from collection', page_collection_submission_path(page), method: :delete, class: 'red-text', data: { confirm: "Are you sure you want to remove this page from this collection?" } %>
  • + <% end %> +
+
+
+
+ <% end %> +
\ No newline at end of file diff --git a/app/views/page_collections/show.html.erb b/app/views/page_collections/show.html.erb index eba9e18d..66601980 100644 --- a/app/views/page_collections/show.html.erb +++ b/app/views/page_collections/show.html.erb @@ -85,6 +85,7 @@ <% if @page_collection.contributors.any? %> +
Contributors
<% @page_collection.contributors.each do |user| %>
@@ -110,26 +111,7 @@ <% if !!@show_contributor_highlight %> <%= render partial: 'page_collections/contributor_highlight_bar', locals: { contributor: @highlighted_contributor } %> <% end %> - <%= render partial: 'page_collections/stream', locals: { pages: @pages } %> + <%= render partial: 'page_collections/tiles', locals: { pages: @pages } %> <% end %> -<% end %> - -
-
- <% if @pages.empty? %> -
- This collection doesn't have any approved public pages yet. Please check back later! -
- <% else %> - <%= render partial: 'page_collections/sort_bar' %> - <% if !!@show_contributor_highlight %> - <%= render partial: 'page_collections/contributor_highlight_bar', locals: { contributor: @highlighted_contributor } %> - <% end %> - <%= render partial: 'page_collections/stream', locals: { pages: @pages } %> - <% end %> -
-
- <%= render partial: 'page_collections/sidebar' %> -
-
\ No newline at end of file +<% end %> \ No newline at end of file diff --git a/db/migrate/20201001195046_add_reference_code_to_notifications.rb b/db/migrate/20201001195046_add_reference_code_to_notifications.rb new file mode 100644 index 00000000..5709c826 --- /dev/null +++ b/db/migrate/20201001195046_add_reference_code_to_notifications.rb @@ -0,0 +1,5 @@ +class AddReferenceCodeToNotifications < ActiveRecord::Migration[6.0] + def change + add_column :notifications, :reference_code, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 2aeb90eb..d0236548 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_08_29_011900) do +ActiveRecord::Schema.define(version: 2020_10_01_195046) do create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false @@ -41,6 +41,18 @@ ActiveRecord::Schema.define(version: 2020_08_29_011900) do t.index ["user_id"], name: "index_api_keys_on_user_id" end + create_table "api_requests", force: :cascade do |t| + t.integer "application_integration_id" + t.integer "integration_authorization_id" + t.string "result" + t.integer "updates_used", default: 0 + t.string "ip_address" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["application_integration_id"], name: "index_api_requests_on_application_integration_id" + t.index ["integration_authorization_id"], name: "index_api_requests_on_integration_authorization_id" + end + create_table "application_integrations", force: :cascade do |t| t.integer "user_id", null: false t.string "name" @@ -1040,6 +1052,19 @@ ActiveRecord::Schema.define(version: 2020_08_29_011900) do t.integer "interrogative_count" t.integer "proper_noun_count" t.datetime "queued_at" + t.float "linsear_write_grade" + t.float "dale_chall_grade" + t.integer "unique_complex_words_count" + t.integer "unique_simple_words_count" + t.boolean "hate_content_flag", default: false + t.string "hate_trigger_words" + t.boolean "profanity_content_flag", default: false + t.string "profanity_trigger_words" + t.boolean "sex_content_flag", default: false + t.string "sex_trigger_words" + t.boolean "violence_content_flag", default: false + t.string "violence_trigger_words" + t.boolean "adult_content_flag", default: false t.index ["document_id"], name: "index_document_analyses_on_document_id" end @@ -1081,6 +1106,19 @@ ActiveRecord::Schema.define(version: 2020_08_29_011900) do t.index ["entity_type", "entity_id"], name: "index_document_entities_on_entity_type_and_entity_id" end + create_table "document_revisions", force: :cascade do |t| + t.integer "document_id", null: false + t.string "title" + t.string "body" + t.string "synopsis" + t.integer "universe_id" + t.string "notes_text" + t.datetime "deleted_at" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["document_id"], name: "index_document_revisions_on_document_id" + end + create_table "documents", force: :cascade do |t| t.integer "user_id" t.text "body" @@ -1098,6 +1136,61 @@ ActiveRecord::Schema.define(version: 2020_08_29_011900) do t.index ["user_id"], name: "index_documents_on_user_id" end + create_table "end_of_day_analytics_reports", force: :cascade do |t| + t.date "day" + t.integer "user_signups" + t.integer "new_monthly_subscriptions" + t.integer "ended_monthly_subscriptions" + t.integer "new_trimonthly_subscriptions" + t.integer "ended_trimonthly_subscriptions" + t.integer "new_annual_subscriptions" + t.integer "ended_annual_subscriptions" + t.integer "paid_paypal_invoices" + t.integer "buildings_created" + t.integer "characters_created" + t.integer "conditions_created" + t.integer "continents_created" + t.integer "countries_created" + t.integer "creatures_created" + t.integer "deities_created" + t.integer "floras_created" + t.integer "foods_created" + t.integer "governments_created" + t.integer "groups_created" + t.integer "items_created" + t.integer "jobs_created" + t.integer "landmarks_created" + t.integer "languages_created" + t.integer "locations_created" + t.integer "lores_created" + t.integer "magics_created" + t.integer "planets_created" + t.integer "races_created" + t.integer "religions_created" + t.integer "scenes_created" + t.integer "schools_created" + t.integer "sports_created" + t.integer "technologies_created" + t.integer "towns_created" + t.integer "traditions_created" + t.integer "universes_created" + t.integer "vehicles_created" + t.integer "documents_created" + t.integer "documents_edited" + t.integer "timelines_created" + t.integer "stream_shares_created" + t.integer "stream_comments" + t.integer "collections_created" + t.integer "collection_submissions_created" + t.integer "thredded_threads_created" + t.integer "thredded_replies_created" + t.integer "thredded_private_messages_created" + t.integer "thredded_private_replies_created" + t.integer "document_analyses_created" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + create_table "famous_figureships", force: :cascade do |t| t.integer "user_id" t.integer "race_id" @@ -1446,6 +1539,10 @@ ActiveRecord::Schema.define(version: 2020_08_29_011900) do t.string "ip_address" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.string "origin" + t.string "content_type" + t.string "user_agent" + t.string "user_token" t.index ["application_integration_id"], name: "index_integration_authorizations_on_application_integration_id" t.index ["user_id"], name: "index_integration_authorizations_on_user_id" end @@ -2143,6 +2240,7 @@ ActiveRecord::Schema.define(version: 2020_08_29_011900) do t.datetime "updated_at", precision: 6, null: false t.string "icon_color", default: "blue" t.string "passthrough_link" + t.string "reference_code" t.index ["user_id"], name: "index_notifications_on_user_id" end @@ -3435,6 +3533,8 @@ ActiveRecord::Schema.define(version: 2020_08_29_011900) do add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "api_keys", "users" + add_foreign_key "api_requests", "application_integrations" + add_foreign_key "api_requests", "integration_authorizations" add_foreign_key "application_integrations", "users" add_foreign_key "buildings", "universes" add_foreign_key "buildings", "users" @@ -3567,6 +3667,7 @@ ActiveRecord::Schema.define(version: 2020_08_29_011900) do add_foreign_key "document_categories", "document_analyses" add_foreign_key "document_concepts", "document_analyses" add_foreign_key "document_entities", "document_analyses" + add_foreign_key "document_revisions", "documents" add_foreign_key "documents", "universes" add_foreign_key "documents", "users" add_foreign_key "floras", "universes"