mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-06 05:04:35 +08:00
styled step comments
This commit is contained in:
parent
0ca65aeca5
commit
da86208441
3 changed files with 13 additions and 15 deletions
|
@ -946,6 +946,7 @@ ul.content-module-activities {
|
|||
.content-comments {
|
||||
max-height: 250px;
|
||||
overflow: auto;
|
||||
padding: 0 15px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
class StepCommentsController < ApplicationController
|
||||
before_action :load_vars
|
||||
|
||||
before_action :check_view_permissions, only: [ :index ]
|
||||
before_action :check_add_permissions, only: [ :new, :create ]
|
||||
before_action :check_view_permissions, only: [:index]
|
||||
before_action :check_add_permissions, only: [:new, :create]
|
||||
before_action :check_edit_permissions, only: [:edit, :update]
|
||||
before_action :check_destroy_permissions, only: [:destroy]
|
||||
|
||||
|
@ -10,31 +10,27 @@ class StepCommentsController < ApplicationController
|
|||
@comments = @step.last_comments(@last_comment_id, @per_page)
|
||||
|
||||
respond_to do |format|
|
||||
format.json {
|
||||
format.json do
|
||||
# 'index' partial includes header and form for adding new
|
||||
# messages. 'list' partial is used for showing more
|
||||
# comments.
|
||||
partial = "index.html.erb"
|
||||
partial = "list.html.erb" if @last_comment_id > 0
|
||||
more_url = ""
|
||||
partial = 'index.html.erb'
|
||||
partial = 'list.html.erb' if @last_comment_id > 0
|
||||
more_url = ''
|
||||
if @comments.count > 0
|
||||
more_url = url_for(step_step_comments_path(@step,
|
||||
format: :json,
|
||||
from: @comments.first.id))
|
||||
end
|
||||
render :json => {
|
||||
render json: {
|
||||
per_page: @per_page,
|
||||
results_number: @comments.length,
|
||||
more_url: more_url,
|
||||
html: render_to_string({
|
||||
partial: partial,
|
||||
locals: {
|
||||
comments: @comments,
|
||||
more_comments_url: more_url
|
||||
}
|
||||
})
|
||||
html: render_to_string(partial: partial,
|
||||
locals: { comments: @comments,
|
||||
more_comments_url: more_url })
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<hr>
|
||||
<h5 class="text-center"><%= t('protocols.steps.comments_tab') %></h5>
|
||||
<hr>
|
||||
<ul class="no-style double-line content-comments">
|
||||
|
|
Loading…
Add table
Reference in a new issue