Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert for accepted answer #1051

Merged
merged 7 commits into from
Dec 6, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions app/views/questions/_answer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@
<% if current_user %>
<%= render :partial => "comments/edit", :locals => { title: "Edit answer", comment: answer, placeholder: "Help users by posting an answer to this question" } %>
<% end %>
<% if current_user && current_user.uid == answer.author.uid %>
<% if answer.accepted %>
<div class="alert alert-success">Your answer was accepted! If it would be helpful, consider expanding on this answer by <a href="/post?template=activity,tags=response:<%= answer.nid %>">posting a step-by-step activity</a></div>
<% end %>
<% end %>
<hr />
<div style="padding: 0px 20px 10px 20px;">
<% if current_user && current_user.uid == answer.node.uid || answer.accepted %>
<a <% if current_user && current_user.uid == answer.node.uid %> href="/answers/accept/<%= answer.id %>" <% end %> data-remote="true" id="answer-<%= answer.id %>-accept" class="answer-accept btn btn-sm <% if answer.accepted %>btn-success<% else %>btn-default<% end%>"><% if answer.accepted %><p class="alert alert-success">Your answer was accepted! If it would be helpful, consider expanding on this answer by <a href="/post?template=activity,tags=response:<question-nid>">posting a step-by-step activity</a></p><% else %>Accept this answer<% end %></a>
<% if current_user && current_user.uid == answer.author.uid || answer.accepted %>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line should have answer.node.uid so that the person who asks the questions can choose to accept it.
What do you think?

<a <% if current_user && current_user.uid == answer.author.uid %> href="/answers/accept/<%= answer.id %>" <% end %> data-remote="true" id="answer-<%= answer.id %>-accept" class="answer-accept btn btn-sm <% if answer.accepted %>btn-success<% else %>btn-default<% end%>"><% if answer.accepted %>Accepted<% else %>Accept this answer<% end %></a>
<% end %>
<a href=<% if current_user %>"/answer_like/likes/<%= answer.id %>"<% else %>"#"<% end %>data-remote ="true" tooltip-title="Helpful? Like it" class="btn btn-default btn-sm btn-like" id="answer-like-button-<%= answer.id %>" <% unless current_user %> popover-content="You must be logged in to Like the answer" <% end %> ><span id="answer-like-star-<%= answer.id %>" class="fa fa-star<% if current_user && !answer.liked_by(current_user.uid) %>-o<% end %>"></span> <span id="answer-like-count-<%= answer.id %>"><%= answer.likers.length %></span> Likes</a>
<a href="#a<%= answer.id %>" class="btn btn-default btn-sm "><i class="fa fa-share-alt"></i></a> &nbsp;
Expand Down