Add publish button to library table

This commit is contained in:
Duncan Sommerville 2015-11-12 15:29:01 -05:00
parent ea887dd8f6
commit 28e95d5c16
3 changed files with 53 additions and 7 deletions

View File

@ -4139,6 +4139,11 @@ li .ui-state-hover {
/* Publishing Dialog */
.icon-soundcloud-white {
background: url(images/icon_soundcloud_cm_white.png) 0 0 no-repeat;
width: 24px;
}
.source-name {
text-align: left !important;
}

View File

@ -314,9 +314,22 @@ var AIRTIME = (function(AIRTIME) {
}
});
$toolbar.find('#publish-btn').click(function () {
if (AIRTIME.button.isDisabled('btn-group #publish-btn') === true) {
return;
}
var selected = $(".lib-selected");
selected.each(function (i, el) {
var data = $(el).data("aData");
AIRTIME.publish.openPublishDialog(data.id);
});
});
// delete from library.
$toolbar.find('.icon-trash').parent().click(function () {
if (AIRTIME.button.isDisabled('icon-trash') === true) {
$toolbar.find('#sb-delete').click(function () {
if (AIRTIME.button.isDisabled('btn-group #sb-delete') === true) {
return;
}

View File

@ -229,12 +229,23 @@ var AIRTIME = (function(AIRTIME) {
"</div>"
).append(
"<div class='btn-group' title=" + $.i18n._('Delete') + ">" +
"<button class='btn btn-small btn-danger' id='sb-trash'>" +
"<button class='btn btn-small btn-danger' id='sb-delete'>" +
"<i class='icon-white icon-trash'></i>" +
"<span>" + $.i18n._('Delete') + "</span>" +
"</button>" +
"</div>"
);
if (onDashboard) {
$menu.append(
"<div class='btn-group' title=" + $.i18n._('Publish') + ">" +
"<button class='btn btn-small' id='publish-btn'>" +
"<i class='icon-soundcloud-white'></i>" +
"<span>" + $.i18n._('Publish') + "</span>" +
"</button>" +
"</div>"
);
}
};
mod.createToolbarDropDown = function() {
@ -252,10 +263,10 @@ var AIRTIME = (function(AIRTIME) {
}
if (check === true) {
AIRTIME.button.enableButton("btn-group #sb-trash", false);
AIRTIME.button.enableButton("btn-group #sb-delete", false);
}
else {
AIRTIME.button.disableButton("btn-group #sb-trash", false);
AIRTIME.button.disableButton("btn-group #sb-delete", false);
}
};
@ -291,11 +302,28 @@ var AIRTIME = (function(AIRTIME) {
}
};
mod.checkPublishButton = function() {
var selected = mod.getChosenItemsLength(),
mediaType = $(".media_type_selector.selected").data("selection-id"),
check = false;
if (mediaType == AIRTIME.library.MediaTypeIntegerEnum.FILE && selected > 0) {
check = true;
}
if (check === true) {
AIRTIME.button.enableButton("btn-group #publish-btn", false);
} else {
AIRTIME.button.disableButton("btn-group #publish-btn", false);
}
};
mod.checkToolBarIcons = function() {
AIRTIME.library.checkAddButton();
AIRTIME.library.checkDeleteButton();
AIRTIME.library.checkEditButton();
AIRTIME.library.checkNewButton();
AIRTIME.library.checkPublishButton();
};
mod.getSelectedData = function() {
@ -454,7 +482,7 @@ var AIRTIME = (function(AIRTIME) {
mod.fnDeleteItems = function(aMedia) {
//Prevent the user from spamming the delete button while the AJAX request is in progress
AIRTIME.button.disableButton("btn-group #sb-trash", false);
AIRTIME.button.disableButton("btn-group #sb-delete", false);
var openTabObjectIds = $(".obj_id"),
mediaIds = [];
for (var i in aMedia) {
@ -483,7 +511,7 @@ var AIRTIME = (function(AIRTIME) {
}
//Re-enable the delete button
AIRTIME.button.enableButton("btn-group #sb-trash", false);
AIRTIME.button.enableButton("btn-group #sb-delete", false);
});
mod.selectNone();
};