Fixed merge conflicts

This commit is contained in:
Fergal Moran
2014-05-14 20:27:39 +01:00
7 changed files with 60 additions and 109 deletions

View File

@@ -18,8 +18,7 @@ class ShowResource(BackboneCompatibleResource):
class Meta:
queryset = Show.objects.all()
authorization = Authorization()
resource_name = 'show'
always_return_data = True
resource_name = 'shows'
def obj_create(self, bundle, **kwargs):
try:

View File

@@ -5,7 +5,7 @@ define ['backbone', 'models/show/showItem', 'app.lib/backbone.dss.model.collecti
page: 0
limit: 20
url: ->
com.podnoms.settings.urlRoot + "show/?limit=" + @limit + "&offset=" + Math.max(@page-1, 0) * @limit
com.podnoms.settings.urlRoot + "shows/?limit=" + @limit + "&offset=" + Math.max(@page-1, 0) * @limit
initialize: ->
if not ShowItem

View File

@@ -20,7 +20,7 @@
ScheduleCollection.prototype.limit = 20;
ScheduleCollection.prototype.url = function() {
return com.podnoms.settings.urlRoot + "show/?limit=" + this.limit + "&offset=" + Math.max(this.page - 1, 0) * this.limit;
return com.podnoms.settings.urlRoot + "shows/?limit=" + this.limit + "&offset=" + Math.max(this.page - 1, 0) * this.limit;
};
ScheduleCollection.prototype.initialize = function() {

View File

@@ -2,4 +2,4 @@ define ['app.lib/backbone.dss.model'],
(DssModel) ->
class ShowItem extends DssModel
urlRoot: com.podnoms.settings.urlRoot + "show/"
ShowItem
ShowItem

View File

@@ -1,11 +1,11 @@
define ['app', 'vent', 'utils', 'marionette', 'fullcalendar',
define ['app', 'vent', 'marionette', 'fullcalendar',
'views/show/scheduleShowMixListView',
'models/show/showCollection', 'models/show/showItem',
'models/show/showCollection',
'models/mix/mixCollection',
'text!/tpl/ShowScheduleLayout'],
(App, vent, utils, Marionette, fullcalendar,
(App, vent, Marionette, fullcalendar,
ScheduleShowMixList,
ShowCollection, ShowItem,
ScheduleCollection,
MixCollection,
Template)->
class ScheduleShowLayout extends Marionette.Layout
@@ -14,17 +14,17 @@ define ['app', 'vent', 'utils', 'marionette', 'fullcalendar',
availableMixes: "#external-events"
initialize: (options)->
@collection = new ShowCollection()
@collection = new ScheduleCollection()
@options = options
@mixCollection = new MixCollection()
@mixCollection.fetch
data: {for_show: true, order_by: 'latest'}
@collection = new MixCollection()
@collection.fetch
data: options
success: (collection)=>
@availableMixes.show(new ScheduleShowMixList({collection: collection}))
return
onShow: =>
onShow: ->
@calendar = $("#calendar").fullCalendar(
editable: true
droppable: true
@@ -57,6 +57,20 @@ define ['app', 'vent', 'utils', 'marionette', 'fullcalendar',
utils.showError(response.responseText)
return
selectable: true
selectHelper: true
select: (start, end, allDay) ->
calendar.fullCalendar "renderEvent",
title: title
start: start
end: end
allDay: allDay
, true # make the event "stick"
calendar.fullCalendar "unselect"
return
eventClick: (calEvent, jsEvent, view) ->
#display a modal
@@ -82,26 +96,21 @@ define ['app', 'vent', 'utils', 'marionette', 'fullcalendar',
return
)
@_fetchEvents()
_fetchEvents: ->
@collection.fetch(
data: @options
success: =>
console.log("ScheduleView: Collection fetched")
@collection.each (model) =>
@_renderEvent(model)
@collection.each (model, index, context) =>
$("#calendar").fullCalendar("renderEvent", {
title: model.get("description"),
start: model.get("start"),
end: model.get("end"),
allDay: false,
className: "label-important"
})
return
)
_renderEvent: (model) ->
$("#calendar").fullCalendar("renderEvent", {
title: model.get("description").substring(0, 15),
start: model.get("start"),
end: model.get("end"),
allDay: false,
className: "label-important"
})
true
ScheduleShowLayout

View File

@@ -1,17 +1,15 @@
// Generated by CoffeeScript 1.4.0
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['app', 'vent', 'utils', 'marionette', 'fullcalendar', 'views/show/scheduleShowMixListView', 'models/show/showCollection', 'models/show/showItem', 'models/mix/mixCollection', 'text!/tpl/ShowScheduleLayout'], function(App, vent, utils, Marionette, fullcalendar, ScheduleShowMixList, ShowCollection, ShowItem, MixCollection, Template) {
define(['app', 'vent', 'marionette', 'fullcalendar', 'views/show/scheduleShowMixListView', 'models/show/showCollection', 'models/mix/mixCollection', 'text!/tpl/ShowScheduleLayout'], function(App, vent, Marionette, fullcalendar, ScheduleShowMixList, ScheduleCollection, MixCollection, Template) {
var ScheduleShowLayout;
ScheduleShowLayout = (function(_super) {
__extends(ScheduleShowLayout, _super);
function ScheduleShowLayout() {
this.onShow = __bind(this.onShow, this);
return ScheduleShowLayout.__super__.constructor.apply(this, arguments);
}
@@ -23,14 +21,11 @@
ScheduleShowLayout.prototype.initialize = function(options) {
var _this = this;
this.collection = new ShowCollection();
this.collection = new ScheduleCollection();
this.options = options;
this.mixCollection = new MixCollection();
this.mixCollection.fetch({
data: {
for_show: true,
order_by: 'latest'
},
this.collection = new MixCollection();
this.collection.fetch({
data: options,
success: function(collection) {
return _this.availableMixes.show(new ScheduleShowMixList({
collection: collection
@@ -75,6 +70,17 @@
}
});
},
selectable: true,
selectHelper: true,
select: function(start, end, allDay) {
calendar.fullCalendar("renderEvent", {
title: title,
start: start,
end: end,
allDay: allDay
}, true);
calendar.fullCalendar("unselect");
},
eventClick: function(calEvent, jsEvent, view) {
var modal;
modal = "<div class=\"modal fade\">\t\t\t <div class=\"modal-dialog\">\t\t\t <div class=\"modal-content\">\t\t\t\t <div class=\"modal-body\">\t\t\t\t <button type=\"button\" class=\"close\" data-dismiss=\"modal\" style=\"margin-top:-10px;\">&times;</button>\t\t\t\t <form class=\"no-margin\">\t\t\t\t\t <label>Change event name &nbsp;</label>\t\t\t\t\t <input class=\"middle\" autocomplete=\"off\" type=\"text\" value=\"" + calEvent.title + "\" />\t\t\t\t\t <button type=\"submit\" class=\"btn btn-sm btn-success\"><i class=\"ace-icon fa fa-check\"></i> Save</button>\t\t\t\t </form>\t\t\t\t </div>\t\t\t\t <div class=\"modal-footer\">\t\t\t\t\t<button type=\"button\" class=\"btn btn-sm btn-danger\" data-action=\"delete\"><i class=\"ace-icon fa fa-trash-o\"></i> Delete Event</button>\t\t\t\t\t<button type=\"button\" class=\"btn btn-sm\" data-dismiss=\"modal\"><i class=\"ace-icon fa fa-times\"></i> Cancel</button>\t\t\t\t </div>\t\t\t </div>\t\t\t </div>\t\t\t</div>";
@@ -96,32 +102,23 @@
});
}
});
return this._fetchEvents();
};
ScheduleShowLayout.prototype._fetchEvents = function() {
var _this = this;
return this.collection.fetch({
data: this.options,
success: function() {
console.log("ScheduleView: Collection fetched");
_this.collection.each(function(model) {
return _this._renderEvent(model);
_this.collection.each(function(model, index, context) {
return $("#calendar").fullCalendar("renderEvent", {
title: model.get("description"),
start: model.get("start"),
end: model.get("end"),
allDay: false,
className: "label-important"
});
});
}
});
};
ScheduleShowLayout.prototype._renderEvent = function(model) {
return $("#calendar").fullCalendar("renderEvent", {
title: model.get("description").substring(0, 15),
start: model.get("start"),
end: model.get("end"),
allDay: false,
className: "label-important"
});
};
true;
return ScheduleShowLayout;

View File

@@ -1,54 +0,0 @@
// Generated by CoffeeScript 1.4.0
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['app', 'vent', 'marionette', 'fullcalendar', 'models/show/showCollection', 'models/mix/mixCollection', 'text!/tpl/ShowScheduleMixItem'], function(App, vent, Marionette, fullcalendar, ScheduleCollection, MixCollection, Template) {
var ScheduleShowMixItem, ScheduleShowMixList;
ScheduleShowMixItem = (function(_super) {
__extends(ScheduleShowMixItem, _super);
function ScheduleShowMixItem() {
return ScheduleShowMixItem.__super__.constructor.apply(this, arguments);
}
ScheduleShowMixItem.prototype.template = _.template(Template);
return ScheduleShowMixItem;
})(Marionette.ItemView);
ScheduleShowMixList = (function(_super) {
__extends(ScheduleShowMixList, _super);
function ScheduleShowMixList() {
return ScheduleShowMixList.__super__.constructor.apply(this, arguments);
}
ScheduleShowMixList.prototype.itemView = ScheduleShowMixItem;
ScheduleShowMixList.prototype.initialize = function(options) {
console.log("ScheduleShowMixList: initialize");
return true;
};
ScheduleShowMixList.prototype.onShow = function() {
return $("#external-events div.external-event").each(function() {
$(this).draggable({
zIndex: 999,
revert: true,
revertDuration: 0
});
});
};
true;
return ScheduleShowMixList;
})(Marionette.CollectionView);
return ScheduleShowMixList;
});
}).call(this);