changing to context menu single edit/delete.
This commit is contained in:
parent
9b45b9dc72
commit
09693ef174
11 changed files with 609 additions and 311 deletions
120
airtime_mvc/public/css/history_styles.css
Normal file
120
airtime_mvc/public/css/history_styles.css
Normal file
|
@ -0,0 +1,120 @@
|
|||
#history_template h4, #configure_item_template h4 { font-size: 14px; margin-top: 0px; }
|
||||
|
||||
#history_template ul, #configure_item_template ul { list-style: none; padding-left: 0px; }
|
||||
|
||||
#history_template li, #configure_item_template li {
|
||||
clear: both;
|
||||
background: #AAAAAA;
|
||||
margin: 2px 0 4px 0;
|
||||
padding: 4px 8px 4px 8px;
|
||||
position: relative;
|
||||
border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border: 1px solid #9F9F9F;
|
||||
min-height: 15px;
|
||||
}
|
||||
|
||||
#history_template li a, #configure_item_template li a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#history_template li a:hover, #configure_item_template li a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#history_template li .template_name {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#history_template li.template_configured {
|
||||
background: #9A9A9A;
|
||||
border: 1px solid #858585;
|
||||
}
|
||||
|
||||
#history_template .template_remove, #history_template .template_default {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#history_template .template_default {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
#history_template .icon-ok {
|
||||
right: 10px;
|
||||
margin-left: 10px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#configure_item_template li span {
|
||||
cursor: move;
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
#configure_item_template li .template_item_remove, #configure_item_template li .field_add {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
#configure_item_template li .template_item_remove:hover, #configure_item_template li .field_add:hover {
|
||||
opacity:0.7;
|
||||
filter:alpha(opacity=70);
|
||||
}
|
||||
|
||||
#configure_item_template #template_name {
|
||||
min-width: 230px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
#configure_item_template .template_name_wrap {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#configure_item_template label {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#configure_item_template .template_item_add {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#configure_item_template .template_item_add .btn {
|
||||
padding: 2px 14px 1px;
|
||||
}
|
||||
|
||||
#configure_item_template .template_item_list li {
|
||||
background-image: url('../css/images/drag.png');
|
||||
background-repeat: no-repeat;
|
||||
background-position: 4px 5px;
|
||||
}
|
||||
|
||||
/* Bootstrap calendar
|
||||
|
||||
.bootstrap-datetimepicker-widget ul {
|
||||
padding-left: 0px !important;
|
||||
}
|
||||
|
||||
.bootstrap-datetimepicker-widget td, .bootstrap-datetimepicker-widget th {
|
||||
-webkit-border-radius: 2px !important;
|
||||
-moz-border-radius: 2px !important;
|
||||
border-radius: 2px !important;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/* Edit History Record */
|
||||
|
||||
.ui-dialog form.ui-widget-content dd {
|
||||
margin-left: 0px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.ui-dialog form.ui-widget-content dt {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.ui-dialog form.ui-widget-content dd input {
|
||||
width: 190px;
|
||||
}
|
BIN
airtime_mvc/public/css/images/drag.png
Normal file
BIN
airtime_mvc/public/css/images/drag.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 B |
|
@ -32,7 +32,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
">" +
|
||||
"<span><%= label %></span>" +
|
||||
"<span><%= type %></span>" +
|
||||
"<span class='template_item_remove'>Remove</span>" +
|
||||
"<span class='template_item_remove'><i class='icon icon-trash'></i></span>" +
|
||||
"</li>";
|
||||
|
||||
var template = (config.required) === true ? templateRequired : templateOptional;
|
||||
|
@ -65,9 +65,9 @@ var AIRTIME = (function(AIRTIME) {
|
|||
$templateList = $(".template_item_list");
|
||||
$fileMDList = $(".template_file_md");
|
||||
|
||||
$fileMDList.on("dblclick", "li", function(){
|
||||
$fileMDList.on("click", "i.icon-plus", function(){
|
||||
|
||||
var $li = $(this);
|
||||
var $li = $(this).parents("li");
|
||||
var config = {
|
||||
name: $li.data("name"),
|
||||
type: $li.data("type"),
|
||||
|
|
|
@ -93,6 +93,36 @@ var AIRTIME = (function(AIRTIME) {
|
|||
} );
|
||||
}
|
||||
|
||||
function createToolbarButtons ($el) {
|
||||
var $menu = $("<div class='btn-toolbar' />");
|
||||
|
||||
$menu.append("<div class='btn-group'>" +
|
||||
"<button class='btn btn-small dropdown-toggle' data-toggle='dropdown'>" +
|
||||
$.i18n._("Select")+" <span class='caret'></span>" +
|
||||
"</button>" +
|
||||
"<ul class='dropdown-menu'>" +
|
||||
"<li id='sb-select-page'><a href='#'>"+$.i18n._("Select this page")+"</a></li>" +
|
||||
"<li id='sb-dselect-page'><a href='#'>"+$.i18n._("Deselect this page")+"</a></li>" +
|
||||
"<li id='sb-dselect-all'><a href='#'>"+$.i18n._("Deselect all")+"</a></li>" +
|
||||
"</ul>" +
|
||||
"</div>");
|
||||
|
||||
$menu.append("<div class='btn-group'>" +
|
||||
"<button class='btn btn-small' id='his_create'>" +
|
||||
"<i class='icon-white icon-plus'></i>" +
|
||||
$.i18n._("Create Entry") +
|
||||
"</button>" +
|
||||
"</div>");
|
||||
|
||||
$menu.append("<div class='btn-group'>" +
|
||||
"<button class='btn btn-small' id='his_trash'>" +
|
||||
"<i class='icon-white icon-trash'></i>" +
|
||||
"</button>" +
|
||||
"</div>");
|
||||
|
||||
$el.append($menu);
|
||||
}
|
||||
|
||||
function aggregateHistoryTable() {
|
||||
var oTable,
|
||||
$historyTableDiv = $historyContentDiv.find("#history_table_aggregate"),
|
||||
|
@ -134,6 +164,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
function itemHistoryTable() {
|
||||
var oTable,
|
||||
$historyTableDiv = $historyContentDiv.find("#history_table_list"),
|
||||
$toolbar,
|
||||
columns,
|
||||
fnRowCallback,
|
||||
booleans = {},
|
||||
|
@ -157,9 +188,13 @@ var AIRTIME = (function(AIRTIME) {
|
|||
b,
|
||||
text,
|
||||
$nRow = $(nRow);
|
||||
|
||||
// add checkbox
|
||||
$nRow.find('td.his_checkbox').html("<input type='checkbox' name='cb_"+aData.history_id+"'>");
|
||||
|
||||
nRow.setAttribute('url-edit', editUrl);
|
||||
nRow.setAttribute('url-delete', deleteUrl);
|
||||
nRow.setAttribute('his-id', aData.history_id);
|
||||
//nRow.setAttribute('url-edit', editUrl);
|
||||
//nRow.setAttribute('url-delete', deleteUrl);
|
||||
|
||||
for (b in booleans) {
|
||||
|
||||
|
@ -189,6 +224,9 @@ var AIRTIME = (function(AIRTIME) {
|
|||
"oTableTools": oTableTools
|
||||
});
|
||||
oTable.fnSetFilteringDelay(350);
|
||||
|
||||
$toolbar = $historyTableDiv.parents(".dataTables_wrapper").find(".fg-toolbar:first");
|
||||
createToolbarButtons($toolbar);
|
||||
|
||||
return oTable;
|
||||
}
|
||||
|
@ -313,6 +351,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
$historyContentDiv.on("click", "#history_table_list tr", function(ev) {
|
||||
openRow(oTableItem, this);
|
||||
});
|
||||
|
@ -320,6 +359,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
$historyContentDiv.on("click", "#history_table_aggregate tr", function(ev) {
|
||||
openRow(oTableAgg, this);
|
||||
});
|
||||
*/
|
||||
|
||||
$("#his_create").click(function(e) {
|
||||
var url = baseUrl+"playouthistory/edit-list-item/format/json" ;
|
||||
|
@ -434,6 +474,72 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
$historyContentDiv.find("#his-tabs").tabs();
|
||||
|
||||
// begin context menu initialization.
|
||||
$.contextMenu({
|
||||
selector: '#history_table_list td:not(.library_checkbox)',
|
||||
trigger: "left",
|
||||
ignoreRightClick: true,
|
||||
|
||||
build: function($el, e) {
|
||||
var items,
|
||||
callback,
|
||||
$tr,
|
||||
id;
|
||||
|
||||
$tr = $el.parents("tr");
|
||||
id = $tr.get(0).getAttribute("his-id");
|
||||
|
||||
function processMenuItems(oItems) {
|
||||
|
||||
// define an edit callback.
|
||||
if (oItems.edit !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
$.post(oItems.edit.url, {format: "json"}, function(json) {
|
||||
|
||||
makeHistoryDialog(json.dialog);
|
||||
|
||||
}, "json");
|
||||
};
|
||||
|
||||
oItems.edit.callback = callback;
|
||||
}
|
||||
|
||||
// define a delete callback.
|
||||
if (oItems.del !== undefined) {
|
||||
|
||||
callback = function() {
|
||||
var c = confirm("Delete this entry?");
|
||||
|
||||
if (c) {
|
||||
$.post(oItems.del.url, {format: "json"}, function(json) {
|
||||
oTableItem.fnDraw();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
oItems.del.callback = callback;
|
||||
}
|
||||
|
||||
items = oItems;
|
||||
}
|
||||
|
||||
request = $.ajax({
|
||||
url: baseUrl+"playouthistory/context-menu",
|
||||
type: "GET",
|
||||
data: {id : id, format: "json"},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json){
|
||||
processMenuItems(json.items);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
items: items
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return AIRTIME;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue