scinote-web/app/views/my_modules/_result.html.erb

59 lines
2.7 KiB
Text

<div class="result">
<div class="result-icon">
<% if result.is_text %>
<span class="sn-icon sn-icon-result-text"></span>
<% elsif result.is_table %>
<span class="sn-icon sn-icon-tables"></span>
<% elsif result.is_asset %>
<span class="sn-icon sn-icon-files"></span>
<% end %>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-options pull-right">
<% if can_manage_my_module?(result.my_module) %>
<a class="btn btn-light icon-btn edit-result-button <%= edit_result_button_class(result) %>" id="<%= result.id %>_edit" href="<%= edit_result_link(result) %>" data-remote="true" title="<%= t'my_modules.results.options.edit_title' %>">
<span class="sn-icon sn-icon-edit"></span>
</a>
<% end %>
<% if can_manage_result?(result) %>
<a href="#"
class="btn btn-light icon-btn form-submit-link"
data-form-id="result-archive-form-<%= result.id %>"
data-confirm-text="<%= t('my_modules.results.archive_confirm') %>"
title="<%= t'my_modules.results.options.archive_title' %>">
<span class="sn-icon sn-icon-archive"></span>
</a>
<%= form_for :result, url: result_path_of_type(result), method: :patch, html: {id: 'result-archive-form-' + result.id.to_s } do |f| %>
<%= f.hidden_field :archived, value: true %>
<% end %>
<% end %>
</div>
<a class="result-panel-collapse-link" href="#result-panel-<%= result.id %>" data-toggle="collapse">
<span class="sn-icon sn-icon-right"></span>
<strong><%= result.name %></strong> |
<span><%= t('my_modules.results.published_on_html', timestamp: l(result.created_at, format: :full), user: h(result.user.full_name)) %></span>
</a>
</div>
<div class="panel-collapse collapse" id="result-panel-<%= result.id %>" role="tabpanel">
<div class="panel-body">
<div class="row">
<div class="col-xs-12" data-hook="result-content">
<%= render partial: 'my_modules/result_user_generated',
locals: { result: result } %>
</div>
</div>
<% if can_read_experiment?(@my_module.experiment) %>
<div class="row">
<div class="result-comment"
id="result-comments-<%= result.id %>"
data-href="<%= result_result_comments_url(result) %>">
<%= render partial: 'result_comments/index',
locals: { result: result, comments: result.last_comments, per_page: Constants::COMMENTS_SEARCH_LIMIT } %>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>