Merge pull request #68 from openHPI/solved-attribute-for-rfc
Solved attribute for rfc
This commit is contained in:
@@ -4,18 +4,28 @@ h1 = RequestForComment.model_name.human(count: 2)
|
||||
table.table.sortable
|
||||
thead
|
||||
tr
|
||||
th
|
||||
i class="fa fa-lightbulb-o" aria-hidden="true" title = t('request_for_comments.solved') align="right"
|
||||
th = t('activerecord.attributes.request_for_comments.exercise')
|
||||
th = t('activerecord.attributes.request_for_comments.question')
|
||||
th
|
||||
i class="fa fa-comment" aria-hidden="true" title = t('request_for_comments.comments') align="center"
|
||||
th = t('activerecord.attributes.request_for_comments.username')
|
||||
th = t('activerecord.attributes.request_for_comments.requested_at')
|
||||
tbody
|
||||
- @request_for_comments.each do |request_for_comment|
|
||||
tr data-id=request_for_comment.id
|
||||
- if request_for_comment.solved?
|
||||
td
|
||||
span class="fa fa-check" aria-hidden="true"
|
||||
- else
|
||||
td = ''
|
||||
td = link_to(request_for_comment.exercise.title, request_for_comment)
|
||||
- if request_for_comment.has_attribute?(:question) && request_for_comment.question
|
||||
td = truncate(request_for_comment.question, length: 200)
|
||||
- else
|
||||
td = '-'
|
||||
td = request_for_comment.comments_count
|
||||
td = request_for_comment.user.displayname
|
||||
td = t('shared.time.before', time: distance_of_time_in_words_to_now(request_for_comment.requested_at))
|
||||
|
||||
|
@@ -14,13 +14,24 @@
|
||||
%>
|
||||
<%= user.displayname %> | <%= @request_for_comment.requested_at %>
|
||||
</p>
|
||||
<h5>
|
||||
<u><%= t('activerecord.attributes.exercise.instructions') %>:</u> "<%= @request_for_comment.exercise.description %>"
|
||||
</h5>
|
||||
|
||||
<h5>
|
||||
<% if @request_for_comment.question and not @request_for_comment.question == '' %>
|
||||
<%= t('activerecord.attributes.request_for_comments.question')%>: "<%= @request_for_comment.question %>"
|
||||
<u><%= t('activerecord.attributes.request_for_comments.question')%>:</u> "<%= @request_for_comment.question %>"
|
||||
<% else %>
|
||||
<%= t('request_for_comments.no_question') %>
|
||||
<u><%= t('activerecord.attributes.request_for_comments.question')%>:</u> <%= t('request_for_comments.no_question') %>
|
||||
<% end %>
|
||||
</h5>
|
||||
<% if (policy(@request_for_comment).mark_as_solved? and not @request_for_comment.solved?) %>
|
||||
<button class="btn btn-default" id="mark-as-solved-button"><%= t('request_for_comments.mark_as_solved') %></button>
|
||||
<% elsif (@request_for_comment.solved?) %>
|
||||
<button type="button" class="btn btn-success"><%= t('request_for_comments.solved') %></button>
|
||||
<% else %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
@@ -37,6 +48,22 @@ also, all settings from the rails model needed for the editor configuration in t
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var solvedButton = $('#mark-as-solved-button');
|
||||
|
||||
solvedButton.on('click', function(event){
|
||||
var jqrequest = $.ajax({
|
||||
dataType: 'json',
|
||||
method: 'GET',
|
||||
url: location + '/mark_as_solved'
|
||||
});
|
||||
|
||||
jqrequest.done(function(response){
|
||||
if(response.solved){
|
||||
solvedButton.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// set file paths for ace
|
||||
var ACE_FILES_PATH = '/assets/ace/';
|
||||
_.each(['modePath', 'themePath', 'workerPath'], function(attribute) {
|
||||
|
@@ -1 +1 @@
|
||||
json.extract! @request_for_comment, :id, :user_id, :exercise_id, :file_id, :requested_at, :created_at, :updated_at, :user_type
|
||||
json.extract! @request_for_comment, :id, :user_id, :exercise_id, :file_id, :requested_at, :created_at, :updated_at, :user_type, :solved
|
||||
|
Reference in New Issue
Block a user