From 411bf263476b782c0dda78d7faac8f2eb1cfe262 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Thu, 27 Oct 2016 09:17:31 -0500 Subject: [PATCH] Add (design challenged) comment bar to news feed --- app/site.rb | 4 ++-- views/home.erb | 3 +++ views/site.erb | 29 +---------------------------- views/site/_profile_comments.erb | 27 +++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 30 deletions(-) create mode 100644 views/site/_profile_comments.erb diff --git a/app/site.rb b/app/site.rb index a6d0e397..91f88ec7 100644 --- a/app/site.rb +++ b/app/site.rb @@ -134,7 +134,7 @@ post '/site/:username/comment' do |username| site.is_blocking?(current_site) || current_site.is_blocking?(site) || current_site.commenting_allowed? == false) - redirect "/site/#{username}" + redirect request.referrer end site.add_profile_comment( @@ -142,7 +142,7 @@ post '/site/:username/comment' do |username| message: params[:message] ) - redirect "/site/#{username}" + redirect request.referrer end get '/site/:username/tip' do |username| diff --git a/views/home.erb b/views/home.erb index 61926895..6bfdea6d 100644 --- a/views/home.erb +++ b/views/home.erb @@ -36,6 +36,9 @@ Below are some website suggestions for you. For more, check out all the sites on Neocities!

+ <% else %> + <%== erb :'site/_profile_comments', locals: {site: site} %> +
<% end %> <% if !@events.empty? %> diff --git a/views/site.erb b/views/site.erb index 2a095281..c8d67edb 100644 --- a/views/site.erb +++ b/views/site.erb @@ -64,34 +64,7 @@
- <% if current_site && site.profile_comments_enabled %> - -
-
- - disabled<% end %> - > - -
- - <% unless current_site.commenting_allowed? %> -

- <% if current_site.commenting_too_much? %> - To prevent spam, we have a <%= Site::MAX_COMMENTS_PER_DAY %> comment per day limit. Please try commenting again tomorrow! - <% else %> - To prevent spam, you cannot comment until you have updated your site <%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> times (on <%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> separate days), and your account is one week old. While waiting, now is a great time to start building your awesome site! - <% end %> -

- <% end %> -
- <% end %> + <%== erb :'site/_profile_comments', locals: {site: site} %> <% if @latest_events.empty? %>
diff --git a/views/site/_profile_comments.erb b/views/site/_profile_comments.erb new file mode 100644 index 00000000..45f43488 --- /dev/null +++ b/views/site/_profile_comments.erb @@ -0,0 +1,27 @@ +<% if current_site && site.profile_comments_enabled %> +
+
+ + disabled<% end %> + > + +
+ + <% unless current_site.commenting_allowed? %> +

+ <% if current_site.commenting_too_much? %> + To prevent spam, we have a <%= Site::MAX_COMMENTS_PER_DAY %> comment per day limit. Please try commenting again tomorrow! + <% else %> + To prevent spam, you cannot comment until you have updated your site <%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> times (on <%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> separate days), and your account is one week old. While waiting, now is a great time to start building your awesome site! + <% end %> +

+ <% end %> +
+<% end %>