mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-08-20 12:30:44 +02:00
extract method
This commit is contained in:
parent
3cf726f928
commit
ea95ba0ec7
@ -35,35 +35,15 @@ $(function () {
|
||||
});
|
||||
|
||||
if (labels) {
|
||||
var labelList = $("#labelList");
|
||||
|
||||
var defaultValue = labelList.find("li[id=\"createLabelBtn\"]");
|
||||
//clear dropdown...
|
||||
labelList.find('li').remove();
|
||||
//append items to dropdown
|
||||
$.each(labels, function(index, value) {
|
||||
labelList.append(
|
||||
//aca jay codigo repetido
|
||||
$('<li class="chooseLabel"></li>').attr('value', value.id).attr('color', value.color)
|
||||
.append('<a href="#" onclick="return false">' +
|
||||
"<div class='labelColor' style='background: " + value.color + "'></div>" +
|
||||
"<div class='labelName'>" + value.title + "</div>" +
|
||||
|
||||
'</a>'));
|
||||
});
|
||||
|
||||
//add the defaultValue
|
||||
labelList.append('<li><div class="listSeparator"></div></li>')
|
||||
labelList.append(defaultValue);
|
||||
|
||||
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
|
||||
prepareLabelList(labels);
|
||||
|
||||
$(document).one('click', '.chooseLabel',
|
||||
function () {
|
||||
var labelId = $(this).attr('value');
|
||||
var labelName = $(this).text();
|
||||
var labelColor = $(this).attr('color');
|
||||
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
|
||||
if (mapIds.length > 0) {
|
||||
var labelId = $(this).attr('value');
|
||||
var labelName = $(this).text();
|
||||
var labelColor = $(this).attr('color');
|
||||
jQuery.ajax("c/restful/labels/maps?ids=" + jQuery.makeArray(mapIds).join(','), {
|
||||
type:'POST',
|
||||
//dataType: "json",
|
||||
@ -215,16 +195,6 @@ $(function () {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
$("#parentLblCheckbox").click(
|
||||
function () {
|
||||
if ($(this).is(":checked")) {
|
||||
$("#dropdownLabel").prop("disabled", false);
|
||||
} else {
|
||||
$("#dropdownLabel").prop("disabled", true);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$(document).on('click', "#deleteLabelBtn", function() {
|
||||
var me = $(this);
|
||||
$("#delete-label-dialog-modal").dialogForm({
|
||||
|
@ -65,3 +65,27 @@ function tagMindmaps(id, labelName, labelColor) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function prepareLabelList(labels) {
|
||||
var labelList = $("#labelList");
|
||||
var defaultValue = labelList.find("li[id=\"createLabelBtn\"]");
|
||||
|
||||
//clear dropdown...
|
||||
labelList.find('li').remove();
|
||||
|
||||
//append items to dropdown
|
||||
$.each(labels, function(index, value) {
|
||||
labelList.append(
|
||||
$('<li class="chooseLabel"></li>').attr('value', value.id).attr('color', value.color)
|
||||
.append(
|
||||
'<a href="#" onclick="return false">' +
|
||||
"<div class='labelColor' style='background: " + value.color + "'></div>" +
|
||||
"<div class='labelName'>" + value.title + "</div>" +
|
||||
'</a>')
|
||||
);
|
||||
});
|
||||
|
||||
//add the defaultValue
|
||||
labelList.append('<li><div class="listSeparator"></div></li>')
|
||||
labelList.append(defaultValue);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user