changed schedule page to use better dynamic menu that the playlist builder page is using.
This commit is contained in:
parent
d829813c0b
commit
eaad41ef94
7 changed files with 66 additions and 160 deletions
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
function contextMenu(action, el, pos) {
|
||||
var method = action.split('/').pop(),
|
||||
url, tr_id, id;
|
||||
|
||||
tr_id = $(el).attr('id');
|
||||
id = tr_id.split("_").pop();
|
||||
url = '/'+action;
|
||||
|
||||
if (method === 'delete') {
|
||||
url = url + '/format/json';
|
||||
url = url + '/id/' + id;
|
||||
$.post(url, function(json) {
|
||||
|
||||
if(json.message) {
|
||||
alert(json.message);
|
||||
return;
|
||||
}
|
||||
|
||||
$("#library_display tr#" +tr_id).remove();
|
||||
});
|
||||
}
|
||||
else if (method === 'add-item') {
|
||||
url = url + '/format/json';
|
||||
url = url + '/id/' + id;
|
||||
$.post(url, setSPLContent);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
function contextMenu() {
|
||||
alert("callback");
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
function setUpQuickSearch() {
|
||||
|
||||
$("#library_quick_search input").keyup(function(ev){
|
||||
var url, string;
|
||||
//alert(x);
|
||||
|
||||
url = "/Library/quick-search/format/json";
|
||||
string = $(this).val();
|
||||
|
||||
$.post(url, {search: string}, function(json){
|
||||
var html, data;
|
||||
//hacky way until I can figure out paginator better.
|
||||
html = json.html.replace(/quick-search\/format\/json/g, "index");
|
||||
|
||||
var el = $(html);
|
||||
|
||||
data = el.find("tr:not(:first-child)");
|
||||
setLibraryContents(data);
|
||||
|
||||
var lib = $("#library_content");
|
||||
|
||||
lib.find("div.paginationControl").remove();
|
||||
lib.append(el[2]);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}
|
|
@ -59,20 +59,22 @@ function eventRender(event, element, view) {
|
|||
}
|
||||
|
||||
function eventAfterRender( event, element, view ) {
|
||||
var today = new Date();
|
||||
|
||||
if(event.isHost === true && event.start > today) {
|
||||
$(element).contextMenu(
|
||||
{menu: 'schedule_event_host_menu'}, eventMenu
|
||||
);
|
||||
}
|
||||
else{
|
||||
$(element).contextMenu(
|
||||
{menu: 'schedule_event_default_menu'}, eventMenu
|
||||
);
|
||||
}
|
||||
function getStartTS() {
|
||||
var start = makeTimeStamp(event.start);
|
||||
return start;
|
||||
}
|
||||
|
||||
$(element).data({'event': event});
|
||||
function getEndTS() {
|
||||
var start = makeTimeStamp(event.end);
|
||||
return start;
|
||||
}
|
||||
|
||||
$(element)
|
||||
.jjmenu("rightClick",
|
||||
[{get:"/Schedule/make-context-menu/format/json/id/#id#/start/#start#/end/#end#"}],
|
||||
{id: event.id, start: getStartTS, end: getEndTS},
|
||||
{xposition: "mouse", yposition: "mouse"});
|
||||
}
|
||||
|
||||
function eventClick(event, jsEvent, view) {
|
||||
|
|
|
@ -165,69 +165,29 @@ function makeScheduleDialog(dialog, json) {
|
|||
setScheduleDialogEvents(dialog);
|
||||
}
|
||||
|
||||
function openScheduleDialog(show) {
|
||||
var url, start_date, end_date;
|
||||
function buildScheduleDialog(json){
|
||||
var dialog = $(json.dialog);
|
||||
|
||||
url = '/Schedule/schedule-show-dialog/format/json';
|
||||
|
||||
start_date = makeTimeStamp(show.start);
|
||||
end_date = makeTimeStamp(show.end);
|
||||
makeScheduleDialog(dialog, json);
|
||||
|
||||
$.post(url,
|
||||
{start: start_date, end: end_date, showId: show.id},
|
||||
function(json){
|
||||
var dialog = $(json.dialog);
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: 'Schedule Playlist',
|
||||
width: 1100,
|
||||
height: 500,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
dialog.remove();
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}}
|
||||
});
|
||||
|
||||
makeScheduleDialog(dialog, json, show);
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
title: 'Schedule Playlist',
|
||||
width: 1100,
|
||||
height: 500,
|
||||
modal: true,
|
||||
close: closeDialog,
|
||||
buttons: {"Ok": function() {
|
||||
dialog.remove();
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}}
|
||||
});
|
||||
|
||||
dialog.dialog('open');
|
||||
});
|
||||
dialog.dialog('open');
|
||||
}
|
||||
|
||||
function eventMenu(action, el, pos) {
|
||||
var method, event, start_timestamp, url;
|
||||
|
||||
method = action.split('/').pop();
|
||||
event = $(el).data('event');
|
||||
start_timestamp = makeTimeStamp(event.start);
|
||||
|
||||
if (method === 'delete-show') {
|
||||
|
||||
url = '/Schedule/delete-show';
|
||||
|
||||
$.post(action,
|
||||
{format: "json", showId: event.id, date: start_timestamp},
|
||||
function(json){
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
});
|
||||
}
|
||||
else if (method === 'schedule-show') {
|
||||
|
||||
openScheduleDialog(event);
|
||||
}
|
||||
else if (method === 'clear-show') {
|
||||
|
||||
url = '/Schedule/clear-show';
|
||||
|
||||
$.post(url,
|
||||
{format: "json", start: start_timestamp, showId: event.id},
|
||||
function(json){
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
});
|
||||
}
|
||||
function scheduleRefetchEvents() {
|
||||
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
@ -244,7 +204,7 @@ $(document).ready(function() {
|
|||
|
||||
events: getFullCalendarEvents,
|
||||
|
||||
//callbacks (from full-calendar-functions.js
|
||||
//callbacks (in full-calendar-functions.js)
|
||||
dayClick: dayClick,
|
||||
eventRender: eventRender,
|
||||
eventAfterRender: eventAfterRender,
|
||||
|
@ -253,9 +213,7 @@ $(document).ready(function() {
|
|||
eventMouseout: eventMouseout,
|
||||
eventDrop: eventDrop,
|
||||
eventResize: eventResize
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(window).load(function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue