mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-31 03:59:51 +08:00
Merge pull request #1816 from aignatov-bio/ai-sci-3525-fix-nil-error-in-module-tag-controller
Fix nil issue in tags_my_module controller [SCI-3525]
This commit is contained in:
commit
4f851b0995
3 changed files with 14 additions and 1 deletions
|
@ -108,6 +108,11 @@ function bindEditTagsAjax() {
|
|||
// tag.
|
||||
function initAddTagForm() {
|
||||
manageTagsModalBody.find('.add-tag-form')
|
||||
.submit(function() {
|
||||
var selectOptions = manageTagsModalBody.find('.add-tag-form .dropdown-menu li').length;
|
||||
if (selectOptions === 0) return false;
|
||||
return true;
|
||||
})
|
||||
.on('ajax:success', function(e, data) {
|
||||
initTagsModalBody(data);
|
||||
});
|
||||
|
|
|
@ -796,6 +796,11 @@ function bindEditTagsAjax(elements) {
|
|||
// tag.
|
||||
function initAddTagForm() {
|
||||
manageTagsModalBody.find(".add-tag-form")
|
||||
.submit(function() {
|
||||
var selectOptions = manageTagsModalBody.find('.add-tag-form .dropdown-menu li').length;
|
||||
if (selectOptions === 0) return false;
|
||||
return true;
|
||||
})
|
||||
.on("ajax:success", function (e, data) {
|
||||
initTagsModalBody(data);
|
||||
});
|
||||
|
|
|
@ -55,7 +55,7 @@ class MyModuleTagsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
return render_403 unless mt_params[:tag_id]
|
||||
return render_403 unless params[:my_module_tag] && mt_params[:tag_id]
|
||||
|
||||
@mt = MyModuleTag.new(mt_params.merge(my_module: @my_module))
|
||||
@mt.created_by = current_user
|
||||
|
@ -125,6 +125,9 @@ class MyModuleTagsController < ApplicationController
|
|||
|
||||
def destroy_by_tag_id
|
||||
tag = @my_module.my_module_tags.find_by_tag_id(params[:id])
|
||||
|
||||
return render_404 unless tag
|
||||
|
||||
tag.destroy
|
||||
render json: { result: tag }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue