when not logged in, show comment box but disabled

This commit is contained in:
joshua stein 2014-04-14 23:12:50 -05:00
parent e152574003
commit 993e1e84ae
3 changed files with 21 additions and 15 deletions

View file

@ -422,7 +422,7 @@ div.voters .downvoter.downvoter_stub {
li.story { li.story {
clear: both; clear: both;
} }
li.story div.story_liner { ol.stories.list li.story div.story_liner {
padding-top: 0.4em; padding-top: 0.4em;
padding-bottom: 0.4em; padding-bottom: 0.4em;
} }

View file

@ -5,8 +5,7 @@
<%= errors_for comment %> <%= errors_for comment %>
<% end %> <% end %>
<%= hidden_field_tag "story_id", <%= hidden_field_tag "story_id", comment.story.short_id %>
comment.story.short_id %>
<% if comment.parent_comment %> <% if comment.parent_comment %>
<%= hidden_field_tag "parent_comment_short_id", <%= hidden_field_tag "parent_comment_short_id",
@ -15,24 +14,29 @@
<div style="width: 100%;"> <div style="width: 100%;">
<%= text_area_tag "comment", comment.comment, :rows => 5, <%= text_area_tag "comment", comment.comment, :rows => 5,
:style => "width: 100%;", :autocomplete => "off" %> :style => "width: 100%;", :autocomplete => "off", :disabled => !@user,
:placeholder => (@user ? "" : "You must be logged in to leave a comment.")
%>
<p></p> <p></p>
<div class="markdown_help_toggler"> <div class="markdown_help_toggler">
<div class="markdown_help_label"> <% if @user %>
Markdown formatting available <div class="markdown_help_label">
</div> Markdown formatting available
<div class="markdown_help_label markdown_help_label_mobile" </div>
style="display: none;"> <div class="markdown_help_label markdown_help_label_mobile"
[M&darr;] style="display: none;">
</div> [M&darr;]
</div>
<% end %>
<%= button_tag "#{comment.new_record?? "Post" : "Update"}", <%= button_tag "#{comment.new_record?? "Post" : "Update"}",
:class => "comment-post", :type => "button" %> :class => "comment-post", :type => "button",
:disabled => !@user %>
&nbsp; &nbsp;
<%= button_tag "Preview", :class => "comment-preview", <%= button_tag "Preview", :class => "comment-preview",
:type => "button" %> :type => "button", :disabled => !@user %>
<% if local_assigns[:cancellable] %> <% if local_assigns[:cancellable] %>
&nbsp; &nbsp;
<%= button_tag "Cancel", :class => "comment-cancel", <%= button_tag "Cancel", :class => "comment-cancel",
@ -41,7 +45,9 @@
<div style="clear: both;"></div> <div style="clear: both;"></div>
<%= render :partial => "global/markdownhelp" %> <% if @user %>
<%= render :partial => "global/markdownhelp" %>
<% end %>
</div> </div>
</div> </div>

View file

@ -13,7 +13,7 @@
<% if !@story.previewing %> <% if !@story.previewing %>
<ol class="comments comments1"> <ol class="comments comments1">
<% if @user && !@story.is_gone? && !@story.previewing %> <% if !@story.is_gone? && !@story.previewing %>
<li><%= render "comments/commentbox", :comment => @comment %></li> <li><%= render "comments/commentbox", :comment => @comment %></li>
<% end %> <% end %>