This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OrderLineInline(admin.StackedInline): | |
model = OrderLine | |
readonly_fields = ('line_price',) | |
extra = 0 | |
fields=('ticket','quantity', 'guests') | |
def guests(self, obj): | |
return obj.guest_set.join(', ') | |
class OrderAdmin(admin.ModelAdmin): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function ( $, window, document, undefined ) { | |
$.fn.labelForPlaceholder = function(){ | |
return $(this).each(function(){ | |
if(!$(this).hasClass('has-label-for-placeholder')){ | |
$(this).keypress(function(){ | |
if(!$(this).parents('.control-group').hasClass('has-had-keypress')){ | |
$(this).parents('.control-group').addClass('has-had-keypress'); | |
} | |
}); | |
$(this).addClass('has-label-for-placeholder'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function ( $, window, document, undefined ) { | |
$.fn.labelForPlaceholder = function(){ | |
return $(this).each(function(){ | |
if(!$(this).hasClass('has-label-for-placeholder')){ | |
$(this).keypress(function(){ | |
if(!$(this).parents('.control-group').hasClass('has-had-keypress')){ | |
$(this).parents('.control-group').addClass('has-had-keypress'); | |
} | |
}); | |
$(this).addClass('has-label-for-placeholder'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# i ran git pull master topic. This is how my branches look | |
master | |
* topic | |
remotes/origin/HEAD -> origin/master | |
remotes/origin/master | |
remotes/origin/topic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.post($form.prop('action'), $form.serialize(), function(data){ | |
var $booking_dialog = $('<div class="dialog-wrap">' + data + '</div>'); /* first instance needs to be wrappe | |
$dialog_header = $booking_dialog.find('.dialog-header'); | |
$dialog_header.hide(); | |
var $submit = $booking_dialog.find('input[type="submit"]'); | |
var submit_text = $submit.prop('value'); | |
$submit.hide(); | |
if($booking_dialog.is(':data(dialog)')){ | |
console.log('nope'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var TicketViewModel = function(tickets){ // must be ko-friendly tickets | |
var self = this; | |
self.tickets = tickets | |
this.next = function(){ | |
// How can we let other views subscribe to this method? | |
console.log(JSON.stringify(ko.toJS(self.tickets))); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array[2] | |
0: Object | |
desired_quantity: function d(){if(0<arguments.length){if(!d.equalityComparer||!d.equalityComparer(c,arguments[0]))d.H(),c=arguments[0],d.G();return this}b.r.Va(d);return c} | |
id: "1" | |
name: "Early Bird" | |
price: "5" | |
quantity: 10 | |
resource_uri: "/api/v1/ticket/1/" | |
__proto__: Object | |
1: Object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Uncaught Error: Unable to parse bindings. | |
Message: ReferenceError: desired_quantity is not defined; | |
Bindings value: text: desired_quantity knockback-full-stack.min.js:104 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
the_event.fetch({success: function(){ | |
var tickets = the_event.get('tickets'); | |
var guestlist = new GuestList(); | |
for(i=0; i<tickets.length; i++){ | |
tickets[i]['desired_quantity'] = ko.observable(0); | |
guestlist.add(tickets[i]); | |
} | |
console.dir(tickets); | |
var viewModels = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var GuestView = function(){ | |
this.guestlist = ko.observableArray(ko.utils.arrayMap(tickets, function(ticket) { | |
return { | |
// How do i sync up guests and tickets, and ensure that when | |
// the num_of_guests increases, new guest input fields are created? | |
})) | |
} | |
var TicketView = function(){ | |
this.tickets = ko.observableArray() |