mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-10 23:25:31 +08:00
Merge pull request #377 from Ducz0r/lm-sci-820-fix
Fix 2 bugs with comments editing [SCI-820]
This commit is contained in:
commit
6402acc102
9 changed files with 48 additions and 13 deletions
|
@ -310,8 +310,11 @@ var Comments = (function() {
|
|||
.on('ajax:send', function() {
|
||||
input.attr('readonly', true);
|
||||
})
|
||||
.on('ajax:success', function() {
|
||||
.on('ajax:success', function(ev, data) {
|
||||
var newMessage = input.val();
|
||||
if (!_.isUndefined(data.comment)) {
|
||||
newMessage = data.comment;
|
||||
}
|
||||
oldMessage.html(newMessage);
|
||||
|
||||
form.off('ajax:send ajax:success ajax:error ajax:complete');
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
class MyModuleCommentsController < ApplicationController
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
before_action :load_vars
|
||||
before_action :check_view_permissions, only: :index
|
||||
before_action :check_add_permissions, only: [:create]
|
||||
|
@ -112,7 +114,13 @@ class MyModuleCommentsController < ApplicationController
|
|||
module: @my_module.name
|
||||
)
|
||||
)
|
||||
render json: {}, status: :ok
|
||||
render json: {
|
||||
comment: auto_link(
|
||||
simple_format(@comment.message),
|
||||
link: :urls,
|
||||
html: { target: '_blank' }
|
||||
)
|
||||
}, status: :ok
|
||||
else
|
||||
render json: { errors: @comment.errors.to_hash(true) },
|
||||
status: :unprocessable_entity
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
class ProjectCommentsController < ApplicationController
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
before_action :load_vars
|
||||
before_action :check_view_permissions, only: :index
|
||||
before_action :check_add_permissions, only: [:create]
|
||||
|
@ -109,7 +111,13 @@ class ProjectCommentsController < ApplicationController
|
|||
project: @project.name
|
||||
)
|
||||
)
|
||||
render json: {}, status: :ok
|
||||
render json: {
|
||||
comment: auto_link(
|
||||
simple_format(@comment.message),
|
||||
link: :urls,
|
||||
html: { target: '_blank' }
|
||||
)
|
||||
}, status: :ok
|
||||
else
|
||||
render json: { errors: @comment.errors.to_hash(true) },
|
||||
status: :unprocessable_entity
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
class ResultCommentsController < ApplicationController
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
before_action :load_vars
|
||||
|
||||
before_action :check_view_permissions, only: [:index]
|
||||
|
@ -110,7 +112,13 @@ class ResultCommentsController < ApplicationController
|
|||
result: @result.name
|
||||
)
|
||||
)
|
||||
render json: {}, status: :ok
|
||||
render json: {
|
||||
comment: auto_link(
|
||||
simple_format(@comment.message),
|
||||
link: :urls,
|
||||
html: { target: '_blank' }
|
||||
)
|
||||
}, status: :ok
|
||||
else
|
||||
render json: { errors: @comment.errors.to_hash(true) },
|
||||
status: :unprocessable_entity
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
class StepCommentsController < ApplicationController
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
before_action :load_vars
|
||||
|
||||
before_action :check_view_permissions, only: [:index]
|
||||
|
@ -115,7 +117,13 @@ class StepCommentsController < ApplicationController
|
|||
)
|
||||
)
|
||||
end
|
||||
render json: {}, status: :ok
|
||||
render json: {
|
||||
comment: auto_link(
|
||||
simple_format(@comment.message),
|
||||
link: :urls,
|
||||
html: { target: '_blank' }
|
||||
)
|
||||
}, status: :ok
|
||||
else
|
||||
render json: { errors: @comment.errors.to_hash(true) },
|
||||
status: :unprocessable_entity
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
<strong><%= comment.user.full_name %>:</strong>
|
||||
<div data-role="comment-message-container">
|
||||
<p data-role="comment-message"><%= auto_link(simple_format(comment.message),
|
||||
<div data-role="comment-message"><%= auto_link(simple_format(comment.message),
|
||||
link: :urls,
|
||||
html: { target: '_blank' }) %></p>
|
||||
html: { target: '_blank' }) %></div>
|
||||
</div>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
<strong><%= comment.user.full_name %>:</strong>
|
||||
<div data-role="comment-message-container">
|
||||
<p data-role="comment-message"><%= auto_link(simple_format(comment.message),
|
||||
<div data-role="comment-message"><%= auto_link(simple_format(comment.message),
|
||||
link: :urls,
|
||||
html: { target: '_blank' }) %></p>
|
||||
html: { target: '_blank' }) %></div>
|
||||
</div>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div data-role="comment-message-container">
|
||||
<p data-role="comment-message"><%= auto_link(simple_format(comment.message),
|
||||
<div data-role="comment-message"><%= auto_link(simple_format(comment.message),
|
||||
link: :urls,
|
||||
html: { target: '_blank' }) %></p>
|
||||
html: { target: '_blank' }) %></div>
|
||||
</div>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div data-role="comment-message-container">
|
||||
<p data-role="comment-message"><%= auto_link(simple_format(comment.message),
|
||||
<div data-role="comment-message"><%= auto_link(simple_format(comment.message),
|
||||
link: :urls,
|
||||
html: { target: '_blank' }) %></p>
|
||||
html: { target: '_blank' }) %></div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue