Skip to content

Commit

Permalink
Revert "Test_results visual refactor to avoid duplicated logic in tem…
Browse files Browse the repository at this point in the history
…plate and to avoid rendering hidden details"

This reverts commit 6d6244c.
  • Loading branch information
flbulgarelli committed Jul 31, 2020
1 parent 0ce9492 commit 3608981
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
11 changes: 1 addition & 10 deletions app/helpers/contextualization_result_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,8 @@ def contextualization_status(contextualization)
end
end

def render_test_result_title(test_result)
[test_result[:title].presence, test_result[:summary]].compact.join(': ')
end

def render_test_result_header(test_result)
%Q{
<span class="text-#{status_class_for(test_result[:status])} mu-test-result-header">
#{status_icon(test_result[:status])}
#{render_test_result_title test_result}
</span>
}.html_safe
[test_result[:title].presence, test_result[:summary]].compact.join(': ').html_safe
end

def render_test_results(contextualization)
Expand Down
4 changes: 0 additions & 4 deletions app/helpers/icons_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ def class_for_exercise(exercise)
icon_class_for(exercise.assignment_for(current_user))
end

def status_class_for(status_like)
icon_class_for(status_like.to_submission_status)
end

def icon_class_for(iconizable)
iconizable.iconize[:class].to_s
end
Expand Down
23 changes: 16 additions & 7 deletions app/views/layouts/_test_results.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,24 @@
<ul class="results-list mu-multiple-test-results">
<% contextualization.affable_test_results.each_with_index do |test_result, index| %>
<li>
<%= render_test_result_header test_result %>
<% if test_result[:status].failed? %>
<% unless contextualization.visible_success_output? %>
<a data-toggle="collapse" href="#example-result-<%= index %>" class="example-see-more"><%= t :view_details %></a>
<div class="example-result collapse <%= 'in' if contextualization.visible_success_output? %>" id="example-result-<%= index %>">
<%= contextualization.test_result_html test_result %>
</div>
<% end %>
<span class="text-danger mu-test-result-header">
<%= status_icon(test_result[:status]) %>
<%= render_test_result_header test_result %>
<% unless contextualization.visible_success_output? %>
<a data-toggle="collapse" href="#example-result-<%= index %>" class="example-see-more"><%= t :view_details %></a>
<% end %>
</span>
<% else %>
<span class="text-success mu-test-result-header">
<%= status_icon(test_result[:status]) %>
<%= render_test_result_header test_result %>
</span>
<% end %>

<div class="example-result collapse <%= 'in' if contextualization.visible_success_output? %>" id="example-result-<%= index %>">
<%= contextualization.test_result_html test_result %>
</div>
</li>
<% end %>
</ul>
Expand Down

0 comments on commit 3608981

Please sign in to comment.