From e734c7dc756502313ddf7b76ddb8c04b0ba77dc5 Mon Sep 17 00:00:00 2001
From: Andrew Brown
- You have <%= (current_user.upload_bandwidth_kb) > 0 ? Filesize.from("#{current_user.upload_bandwidth_kb}KB").pretty : '-' + Filesize.from("#{current_user.upload_bandwidth_kb.abs}KB").pretty %> of bandwidth remaining. -
-- This bandwidth can be used to upload images to your content anywhere on the site. Deleting an uploaded image frees - up the same amount of bandwidth. - <% unless on_premium_plan %> - To get more bandwidth, upgrade to our Premium plan. - <% end %> -
-+ Get your referral code, browse potential rewards, and invite your friends! +
+- <%= simple_format share.message %> ++ <%= + simple_format ContentFormatterService.show( + text: share.message, + viewing_user: current_user + ) + %><% end %> diff --git a/app/views/content_page_shares/_stream_page_share.html.erb b/app/views/content_page_shares/_stream_page_share.html.erb index 71aff342..b2752486 100644 --- a/app/views/content_page_shares/_stream_page_share.html.erb +++ b/app/views/content_page_shares/_stream_page_share.html.erb @@ -47,8 +47,13 @@ <%= link_to [share.user, share] do %><%= time_ago_in_words share.shared_at %> ago<% end %>:
- <%= simple_format share.message %> ++ <%= + simple_format ContentFormatterService.show( + text: share.message, + viewing_user: current_user + ) + %><% end %> diff --git a/app/views/content_page_shares/show.html.erb b/app/views/content_page_shares/show.html.erb index f6f7f67d..534cb2c2 100644 --- a/app/views/content_page_shares/show.html.erb +++ b/app/views/content_page_shares/show.html.erb @@ -102,8 +102,13 @@ <% if @share.message.present? %> -- <%= simple_format @share.message %> ++ <%= + simple_format ContentFormatterService.show( + text: @share.message, + viewing_user: current_user + ) + %><% end %> From f54e87467b8c2c170c2b271a56e5707db438e140 Mon Sep 17 00:00:00 2001 From: Andrew BrownDate: Fri, 28 Aug 2020 14:21:17 -0700 Subject: [PATCH 10/16] force word wrapping on nonbreaking lines on profile fields --- app/assets/stylesheets/layout.scss | 4 ++++ app/views/users/profile/_info.html.erb | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 3c1eaa66..41ca8190 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -1,3 +1,7 @@ .container-fluid { margin: 0 30px; } + +.force-word-wrap { + overflow-wrap: break-word; +} \ No newline at end of file diff --git a/app/views/users/profile/_info.html.erb b/app/views/users/profile/_info.html.erb index 6b0906f8..6f852a8d 100644 --- a/app/views/users/profile/_info.html.erb +++ b/app/views/users/profile/_info.html.erb @@ -51,7 +51,7 @@ Username-+<% if shared_content.is_a?(Universe) %> @@ -84,12 +87,29 @@<%= link_to "@#{@user.username}", profile_by_username_path(username: @user.username) %>
@@ -61,7 +61,7 @@Also known as-+<% end %> - -<%= @user.other_names %>
@@ -76,7 +76,7 @@Website-+<%= link_to @user.website, @user.website, target: '_new', data: { confirm: "You are about to visit an external website not owned by Notebook.ai. Please only continue if you trust this user." }, ref: 'nofollow' %>
@@ -111,7 +111,7 @@Bio-+@@ -126,7 +126,7 @@<%= simple_format truncate(@user.bio, length: 500) %><%= field.titleize %>-+From 5493f115ee543ad1c228640320480692f61f8dd5 Mon Sep 17 00:00:00 2001 From: Andrew Brown<%= simple_format @user.send(field) %>Date: Fri, 28 Aug 2020 15:24:51 -0700 Subject: [PATCH 11/16] Allow removing published submissions from a collection --- .../page_collection_submissions_controller.rb | 8 +++++++- app/controllers/page_collections_controller.rb | 5 +++++ app/views/page_collections/_stream.html.erb | 11 +++++++++++ app/views/page_collections/show.html.erb | 3 +-- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/controllers/page_collection_submissions_controller.rb b/app/controllers/page_collection_submissions_controller.rb index 0d21120a..ca3e069f 100644 --- a/app/controllers/page_collection_submissions_controller.rb +++ b/app/controllers/page_collection_submissions_controller.rb @@ -46,8 +46,14 @@ class PageCollectionSubmissionsController < ApplicationController # DELETE /page_collection_submissions/1 def destroy + unless user_signed_in? && current_user == @page_collection_submission.page_collection.user + raise "Not allowed" + return + end + + page_collection = @page_collection_submission.page_collection @page_collection_submission.destroy - redirect_to page_collection_submissions_url, notice: 'Page collection submission was successfully destroyed.' + redirect_to page_collection, notice: 'The page was successfully removed from this collection.' end def approve diff --git a/app/controllers/page_collections_controller.rb b/app/controllers/page_collections_controller.rb index 74647d09..3e299ebd 100644 --- a/app/controllers/page_collections_controller.rb +++ b/app/controllers/page_collections_controller.rb @@ -79,6 +79,11 @@ class PageCollectionsController < ApplicationController # DELETE /page_collections/1 def destroy + unless user_signed_in? && current_user == @page_collection.user + raise "Permission denied" + return + end + @page_collection.destroy redirect_to page_collections_url, notice: 'Page collection was successfully destroyed.' end diff --git a/app/views/page_collections/_stream.html.erb b/app/views/page_collections/_stream.html.erb index 46eb0432..d3053fea 100644 --- a/app/views/page_collections/_stream.html.erb +++ b/app/views/page_collections/_stream.html.erb @@ -11,6 +11,17 @@ <%= link_to content.name, content %> + + <% if user_signed_in? && current_user == @page_collection.user %> + + more_vert + +<% if page.explanation? %>+
+ <% end %>- + <%= link_to 'Remove from collection', page_collection_submission_path(page), method: :delete %> +
+diff --git a/app/views/page_collections/show.html.erb b/app/views/page_collections/show.html.erb index 26280773..bbc13320 100644 --- a/app/views/page_collections/show.html.erb +++ b/app/views/page_collections/show.html.erb @@ -10,9 +10,8 @@<% else %> <%= render partial: 'page_collections/sort_bar' %> + <%= render partial: 'page_collections/stream', locals: { pages: @pages } %> <% end %> - - <%= render partial: 'page_collections/stream', locals: { pages: @pages } %><%= render partial: 'page_collections/sidebar' %> From 8ef6ee66b8492cc0581c8f6c0d557b9f94e30e7e Mon Sep 17 00:00:00 2001 From: Andrew Browndiff --git a/config/routes.rb b/config/routes.rb index a86332c7..02822aea 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,6 +16,8 @@ Rails.application.routes.draw do get 'follow', on: :member get 'unfollow', on: :member get 'report', on: :member + + get 'by/:user_id', to: 'page_collections#by_user', as: :submissions_by_user end resources :page_collection_submissions do get 'approve', on: :member From 335397c8bbaa883a0fed82baf4e2c1bbfbaec586 Mon Sep 17 00:00:00 2001 From: Andrew BrownDate: Fri, 28 Aug 2020 15:38:45 -0700 Subject: [PATCH 12/16] add pagecollection page to highlight specific contributors --- .../page_collections_controller.rb | 21 +++++++++++++++++++ .../components/_collection_header.html.erb | 10 +++++---- app/views/page_collections/_stream.html.erb | 4 ++++ app/views/page_collections/show.html.erb | 6 ++++++ config/routes.rb | 2 ++ 5 files changed, 39 insertions(+), 4 deletions(-) diff --git a/app/controllers/page_collections_controller.rb b/app/controllers/page_collections_controller.rb index 3e299ebd..ba13c0ad 100644 --- a/app/controllers/page_collections_controller.rb +++ b/app/controllers/page_collections_controller.rb @@ -118,6 +118,27 @@ class PageCollectionsController < ApplicationController redirect_to root_path, notice: "That Collection has been reported to site administration. Thank you!" end + def by_user + @page_collection = PageCollection.find(params[:page_collection_id]) + + unless (@page_collection.privacy == 'public' || (user_signed_in? && @page_collection.user == current_user)) + return redirect_to page_collections_path, notice: "That Collection is not public." + end + + @pages = @page_collection.accepted_submissions.where(user_id: params[:user_id]) + sort_pages + + @submittable_content = if user_signed_in? + @current_user_content.slice(*@page_collection.page_types) + else + [] + end + + @show_contributor_highlight = true + @highlighted_contributor = User.find_by(id: params[:user_id].to_i) + render :show + end + private # Use callbacks to share common setup or constraints between actions. diff --git a/app/views/content/components/_collection_header.html.erb b/app/views/content/components/_collection_header.html.erb index 658621a1..fc9de293 100644 --- a/app/views/content/components/_collection_header.html.erb +++ b/app/views/content/components/_collection_header.html.erb @@ -3,10 +3,12 @@ <%= image_tag(collection.random_public_image) %> -<% else %> <%= render partial: 'page_collections/sort_bar' %> + <% if !!@show_contributor_highlight %> +- <%= PageCollection.icon %> - <%= collection.title %> -
+ <%= link_to collection, class: 'white-text' do %> ++ <%= PageCollection.icon %> + <%= collection.title %> +
+ <% end %><% if collection.subtitle? %> <%= collection.subtitle %> diff --git a/app/views/page_collections/_stream.html.erb b/app/views/page_collections/_stream.html.erb index d3053fea..4f28ad74 100644 --- a/app/views/page_collections/_stream.html.erb +++ b/app/views/page_collections/_stream.html.erb @@ -17,6 +17,10 @@ more_vert
+
- + <%= link_to 'All pages from this user', page_collection_submissions_by_user_path(page_collection_id: @page_collection.id, user_id: page.user_id) %> +
+- <%= link_to 'Remove from collection', page_collection_submission_path(page), method: :delete %>
diff --git a/app/views/page_collections/show.html.erb b/app/views/page_collections/show.html.erb index bbc13320..77c0bbdd 100644 --- a/app/views/page_collections/show.html.erb +++ b/app/views/page_collections/show.html.erb @@ -10,6 +10,12 @@+ Showing all submitted pages from <%= link_to @highlighted_contributor.display_name, @highlighted_contributor, class: "#{User.color}-text" %>. + Click <%= link_to 'here', @page_collection, class: 'blue-text text-lighten-3' %> to see all pages regardless of author. ++ <% end %> <%= render partial: 'page_collections/stream', locals: { pages: @pages } %> <% end %>Date: Fri, 28 Aug 2020 18:14:31 -0700 Subject: [PATCH 13/16] add twitter/fb share links to stream shares and share modal on content pages --- app/views/content/_share.html.erb | 40 +++++++++++++++------ app/views/content_page_shares/show.html.erb | 25 ++++++++----- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/app/views/content/_share.html.erb b/app/views/content/_share.html.erb index 51276c63..8d835096 100644 --- a/app/views/content/_share.html.erb +++ b/app/views/content/_share.html.erb @@ -16,6 +16,13 @@ @@ -69,10 +76,6 @@To be shared, content must either be public or in a public Universe. + + <%= link_to 'https://medium.com/indent-labs/privacy-on-notebook-ai-how-it-works-c23a59faeae2', class: 'blue-text lighten-1', target: '_new' do %> + Learn more about sharing on Notebook.ai. + <% end %> +++ Changes are saved automatically and can be changed at any time.- Changes are saved automatically and can be changed at any time. -
- <%= link_to 'https://medium.com/indent-labs/privacy-on-notebook-ai-how-it-works-c23a59faeae2', class: 'blue-text lighten-1', target: '_new' do %> - Click here to learn more about sharing pages on Notebook.ai - <% end %> -
+ +