mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 14:45:56 +08:00
removed comments tab in protocol step
This commit is contained in:
parent
ea898ed3ce
commit
e3ae22763e
|
@ -1,2 +1,56 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
||||
|
||||
(function(){
|
||||
|
||||
function initializeComments(){
|
||||
var steps = $(".step-comment");
|
||||
$.each(steps, function(){
|
||||
var that = $(this);
|
||||
var link = that.attr("data-href");
|
||||
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: link,
|
||||
beforeSend: animateSpinner(that, true),
|
||||
success: function(data){
|
||||
$(that.children()[0]).html(data.html);
|
||||
animateSpinner(that, false);
|
||||
},
|
||||
complete: animateSpinner(that, false)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function refreshComments(child){
|
||||
var parent = chils.closest(".step-comment");
|
||||
var link = parent.attr("data-href");
|
||||
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: link,
|
||||
beforeSend: animateSpinner(parent, true),
|
||||
success: function(data){
|
||||
$(parent.children()[0]).html(data.html);
|
||||
animateSpinner(parent, false);
|
||||
},
|
||||
complete: animateSpinner(parent, false)
|
||||
});
|
||||
}
|
||||
|
||||
function commentFormOnSubmitAction(){
|
||||
$(".comment-form")
|
||||
.each(function() {
|
||||
var obj = $(this);
|
||||
debugger;
|
||||
obj
|
||||
.on('submit', function(){
|
||||
refreshComments(obj);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
initializeComments();
|
||||
commentFormOnSubmitAction();
|
||||
})();
|
||||
|
|
|
@ -44,3 +44,4 @@
|
|||
|
||||
<%= stylesheet_link_tag 'datatables' %>
|
||||
<%= javascript_include_tag("my_modules/protocols") %>
|
||||
<%= javascript_include_tag("step_comments") %>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<h5 class="text-center"><%= t('protocols.steps.comments_tab') %></h5>
|
||||
<h5 class="text-center">
|
||||
<span class="glyphicon glyphicon-comment"></span>
|
||||
<%= t('protocols.steps.comments_tab') %></h5>
|
||||
<hr>
|
||||
<ul class="no-style double-line content-comments">
|
||||
<% if @comments.size == 0 then %>
|
||||
|
@ -18,7 +20,7 @@
|
|||
<ul class="no-style double-line">
|
||||
<li>
|
||||
<hr>
|
||||
<%= bootstrap_form_for :comment, url: { format: :json }, method: :post, remote: true do |f| %>
|
||||
<%= bootstrap_form_for :comment, url: { format: :json }, html: { class: 'comment-form' }, method: :post, remote: true do |f| %>
|
||||
<%= f.text_field :message, hide_label: true, placeholder: t("general.comment_placeholder"), append: f.submit("+"), help: '.' %>
|
||||
<% end %>
|
||||
</li>
|
||||
|
|
|
@ -31,23 +31,17 @@
|
|||
</div>
|
||||
<div class="panel-collapse collapse" id="step-panel-<%= step.id %>" role="tabpanel">
|
||||
<div class="panel-body">
|
||||
<% if @protocol.in_module? %>
|
||||
<% if @protocol.in_module? %>
|
||||
<ul class="nav nav-tabs">
|
||||
<li role="presentation" class="active">
|
||||
<a class="step-info-tab" href="#step-info-<%= step.id %>" data-toggle="tab"><span class="glyphicon glyphicon-info-sign"></span>
|
||||
<%= t("protocols.steps.info_tab") %></a>
|
||||
</li>
|
||||
<% if can_view_step_comments(@protocol) %>
|
||||
<li role="presentation">
|
||||
<a class="comment-tab-link" href="<%= url_for step_step_comments_path(step_id: step.id, format: :json) %>" aria-controls="step-comments-<%= step.id %>" data-remote="true">
|
||||
<span class="glyphicon glyphicon-comment"></span>
|
||||
<%= t("protocols.steps.comments_tab") %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" role="tabpanel" id="step-info-<%= step.id %>">
|
||||
<% end %>
|
||||
<div class="col-md-9">
|
||||
<% end %>
|
||||
<% if step.description.blank? %>
|
||||
<em><%= t("protocols.steps.no_description") %></em>
|
||||
<% else %>
|
||||
|
@ -132,8 +126,13 @@
|
|||
<% end %>
|
||||
<% if @protocol.in_module? %>
|
||||
</div>
|
||||
<div class="tab-pane" role="tabpanel" id="step-comments-<%= step.id %>"></div>
|
||||
<% if can_view_step_comments(@protocol) %>
|
||||
<div class="col-md-3 step-comment" data-href="<%= url_for step_step_comments_path(step_id: step.id, format: :json) %>">
|
||||
<div id="step-comments-<%= step.id %>"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -59,3 +59,4 @@ Rails.application.config.assets.precompile += %w( assets.js )
|
|||
Rails.application.config.assets.precompile += %w( comments.js )
|
||||
Rails.application.config.assets.precompile += %w( projects/show.js )
|
||||
Rails.application.config.assets.precompile += %w( projects/introdutory_popup.js )
|
||||
Rails.application.config.assets.precompile += %w( step_comments.js )
|
||||
|
|
Loading…
Reference in a new issue