Re-design RfC page and make long texts collapsible

This commit is contained in:
Maximilian Grundke
2017-09-27 15:04:20 +02:00
parent 5498269aec
commit 92e523b030
4 changed files with 119 additions and 69 deletions

View File

@@ -12,21 +12,21 @@
testruns = Testrun.where(:submission_id => @request_for_comment.submission)
%>
<%= user.displayname %> | <%= @request_for_comment.created_at.localtime %>
</p>
<div class="rfc">
<div class="description">
<h5>
<%= t('activerecord.attributes.exercise.description') %>:
<%= t('activerecord.attributes.exercise.description') %>
</h5>
<div class="text">
<span class="fa fa-chevron-up collapse-button"></span>
<%= render_markdown(@request_for_comment.exercise.description) %>
</div>
</div>
<div class="question">
<h5>
<%= t('activerecord.attributes.request_for_comments.question')%>:
<%= t('activerecord.attributes.request_for_comments.question')%>
</h5>
<div class="text">
<%= @request_for_comment.question or t('request_for_comments.no_question')%>
@@ -39,13 +39,14 @@
<!-- check cause: assess/run; display success, output (if any), make collapsible-->
<% if testruns.size > 0 %>
<div class="testrun-container">
<div class="testruns">
<% output_runs = testruns.select { |run| run.cause == 'run' } %>
<% if output_runs.size > 0 %>
<h5><%= t('request_for_comments.runtime_output') %></h5>
<div class="testrun-output text">
<span class="fa fa-chevron-up collapse-button"></span>
<% output_runs.each do |testrun| %>
<p><%= testrun.try(:output) or t('request_for_comments.no_output') %></p>
<pre><%= testrun.try(:output) or t('request_for_comments.no_output') %></pre>
<% end %>
</div>
<% end %>
@@ -142,6 +143,12 @@ also, all settings from the rails model needed for the editor configuration in t
thankYouContainer.hide();
});
$('.text > .collapse-button').on('click', function(e) {
$(this).toggleClass('fa-chevron-down');
$(this).toggleClass('fa-chevron-up');
$(this).parent().toggleClass('collapsed');
});
// set file paths for ace
var ACE_FILES_PATH = '/assets/ace/';
_.each(['modePath', 'themePath', 'workerPath'], function(attribute) {