-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #206, makes scope tagging available on both scope and blacklist pages. Tried to make some code cleanup while I was at it, as well as improve other inconsistencies with tags.
- Loading branch information
Showing
6 changed files
with
44 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
$('#tagmodal').on('show.bs.modal', function (event) { | ||
var button = $(event.relatedTarget) // Button that triggered the modal | ||
var scopeid = button.data('scopeid') // Extract info from data-* attributes | ||
var scopetarget = button.data('scopetarget') // Extract info from data-* attributes | ||
var tagaction = button.data('action') | ||
var tagstr = $('#scopeTags-'+scopeid).text().trim() // Trim whitespace in jinja formatting leaves whitespace | ||
var tags = tagstr.split(', ') | ||
var modal = $(this) | ||
if (tagaction == 'add') { | ||
modal.find('.modal-title').text('Add tag to ' + scopetarget) | ||
modal.find('#tagScopeForm').attr('action', "/admin/scope/"+scopeid+"/tag") | ||
modal.find('#tagScopeSubmit').text('Add Tag') | ||
if (tagstr != ''){ | ||
tags.forEach(function(item) { | ||
$("option[value=" + item.trim() + "]").attr('hidden', '') // hide this option because it's already added | ||
$("option[value=" + item.trim() + "]").attr('disabled', '') // disable this option because it's hidden | ||
}); | ||
} | ||
|
||
|
||
} else { | ||
modal.find('.modal-title').text('Remove tag from ' + scopetarget) | ||
modal.find('#tagScopeForm').attr('action', "/admin/scope/"+scopeid+"/untag") | ||
modal.find('#tagScopeSubmit').text('Remove Tag') | ||
$("select[name='tagname']")[0].options.length = 0; | ||
|
||
tags.forEach(function(item) { | ||
$("#tagname").append( | ||
$('<option>', { | ||
value: item.trim(), | ||
text: item.trim() | ||
}) | ||
); | ||
}); | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters