Add (design challenged) comment bar to news feed

This commit is contained in:
Kyle Drake 2016-10-27 09:17:31 -05:00
parent 882d2fb4b2
commit 411bf26347
4 changed files with 33 additions and 30 deletions

View file

@ -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|

View file

@ -36,6 +36,9 @@
Below are some website suggestions for you. For more, <a href="/browse">check out all the sites on Neocities</a>!
</p>
</div>
<% else %>
<%== erb :'site/_profile_comments', locals: {site: site} %>
<div style="margin-bottom: 15px"></div>
<% end %>
<% if !@events.empty? %>

View file

@ -64,34 +64,7 @@
<div class="container site-profile">
<div class="content misc-page columns right-col"><div class="col-left">
<div class="col col-66">
<% if current_site && site.profile_comments_enabled %>
<div class="post-comment">
<form method="POST" action="/site/<%= site.username %>/comment">
<input name="csrf_token" type="hidden" value="<%= csrf_token %>">
<input name="message"
type="text"
placeholder="Post a message..."
autocomplete="off"
maxlength="<%= Site::MAX_COMMENT_SIZE %>"
<% unless current_site.commenting_allowed? %>disabled<% end %>
>
<button class="btn-Action"
<% unless current_site.commenting_allowed? %>disabled<% end %>
>Post</button>
</form>
<% unless current_site.commenting_allowed? %>
<p class="comment-policy">
<% 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 <strong><%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> times</strong> (on <%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> separate days), and your account is one week old. While waiting, now is a great time to <a href="/dashboard">start building your awesome site!</a>
<% end %>
</p>
<% end %>
</div>
<% end %>
<%== erb :'site/_profile_comments', locals: {site: site} %>
<% if @latest_events.empty? %>
<div class="site-profile-padding">

View file

@ -0,0 +1,27 @@
<% if current_site && site.profile_comments_enabled %>
<div class="post-comment">
<form method="POST" action="/site/<%= site.username %>/comment">
<input name="csrf_token" type="hidden" value="<%= csrf_token %>">
<input name="message"
type="text"
placeholder="Post a message..."
autocomplete="off"
maxlength="<%= Site::MAX_COMMENT_SIZE %>"
<% unless current_site.commenting_allowed? %>disabled<% end %>
>
<button class="btn-Action"
<% unless current_site.commenting_allowed? %>disabled<% end %>
>Post</button>
</form>
<% unless current_site.commenting_allowed? %>
<p class="comment-policy">
<% 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 <strong><%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> times</strong> (on <%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> separate days), and your account is one week old. While waiting, now is a great time to <a href="/dashboard">start building your awesome site!</a>
<% end %>
</p>
<% end %>
</div>
<% end %>