btn actions

This commit is contained in:
Ezequiel Bergamaschi 2014-02-01 14:06:41 -03:00 committed by Ezequiel Bergamaschi
parent 0eaa8c8638
commit 8936ef5008
2 changed files with 18 additions and 11 deletions

View File

@ -147,6 +147,7 @@ MIND_FILE=File
PARENT_LABEL=Nest label under PARENT_LABEL=Nest label under
CHOOSE_COLOR=Choose a color CHOOSE_COLOR=Choose a color
CHOOSE_LABEL=Choose a label CHOOSE_LABEL=Choose a label
CREATE_NEW_LABEL=Create a new label..
SELECT_LABEL=Please select a label SELECT_LABEL=Please select a label
NO_SEARCH_RESULT=No mindmap available for the selected filter criteria NO_SEARCH_RESULT=No mindmap available for the selected filter criteria
SEARCH=Search SEARCH=Search

View File

@ -1,6 +1,6 @@
$(function () { $(function () {
// Creation buttons actions ... // Creation buttons actions ...
$("#newMapBtn").click( $("#newBtn").click(
function () { function () {
$("#new-dialog-modal").dialogForm({ $("#new-dialog-modal").dialogForm({
redirect:"c/maps/{header.resourceId}/edit", redirect:"c/maps/{header.resourceId}/edit",
@ -9,7 +9,7 @@ $(function () {
} }
); );
$("#newFolderBtn").click( $(document).on('click', '#createLabelBtn',
function () { function () {
$("#new-folder-dialog-modal").dialogForm({ $("#new-folder-dialog-modal").dialogForm({
url:"c/restful/labels", url:"c/restful/labels",
@ -18,7 +18,7 @@ $(function () {
} }
); );
$("#linkBtn").click( function () { $("#addLabelButton").click( function () {
var labels; var labels;
fetchLabels({ fetchLabels({
postUpdate: function(data) { postUpdate: function(data) {
@ -27,20 +27,26 @@ $(function () {
}); });
if (labels) { if (labels) {
var labelList = $("#labelId"); var labelList = $("#labelList");
var defaultValue = labelList.find("li[id=\"createLabelBtn\"]");
//clear dropdown... //clear dropdown...
labelList.find("option").remove(); labelList.find('li').remove();
if (labels.length == 0) {
window.alert('no hay labels, como resolvemos esto?');
return;
}
//append items to dropdown //append items to dropdown
$.each(labels, function(index, value) { $.each(labels, function(index, value) {
labelList.append($('<option></option>').val(value.id).html(value.title).attr('color', value.color)); labelList.append(
$('<li></li>')
.append('<a href="#" onclick="return false">' +
'<i class="icon-tag"></i>' +
'<span style="margin-left: 5px">'+ value.title +
'</span>' +
'</a>'));
}); });
//add the defaultValue
labelList.append('<li><div style="height: 1px; background-color: #d5d3d4"></div></li>')
labelList.append(defaultValue);
var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds(); var mapIds = $('#mindmapListTable').dataTableExt.getSelectedMapsIds();
$("#add-label-dialog-modal").dialogForm({ $("#add-label-dialog-modal").dialogForm({