Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Attach static methods to reservation selection react class
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krienbühl committed Apr 20, 2016
1 parent fe2becc commit 63248e9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions onegov/town/assets/js/reservationcalendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,21 +368,20 @@ rc.setupReservationSelect = function(fcOptions) {

calendar.on('rc-reservations-changed', function() {
$.getJSON(fcOptions.reservations, function(reservations) {
rc.renderReservationSelection(selection.get(0), calendar, reservations);
ReservationSelection.render(selection.get(0), calendar, reservations);
});
});

rc.resizeReservationSelection(selection);
ReservationSelection.resize(selection);
calendar.trigger('rc-reservations-changed');
});

fcOptions.windowResize = function() {
rc.resizeReservationSelection(selection);
var resize = function() {
ReservationSelection.resize(selection);
};

fcOptions.viewRenderers.push(function() {
rc.resizeReservationSelection(selection);
});
fcOptions.windowResize = resize;
fcOptions.viewRenderers.push(resize);
};

// renders the occupied partitions on an event
Expand Down Expand Up @@ -526,6 +525,9 @@ rc.sumPartitions = function(partitions) {
}, 0);
};

/*
Shows the list of reservations to be confirmed.
*/
ReservationSelection = React.createClass({
handleClick: function(reservation) {
var calendar = $(this.props.calendar);
Expand Down Expand Up @@ -570,11 +572,11 @@ ReservationSelection = React.createClass({
}
});

rc.renderReservationSelection = function(element, calendar, reservations) {
ReservationSelection.render = function(element, calendar, reservations) {
React.render(<ReservationSelection calendar={calendar} reservations={reservations} />, element);
};

rc.resizeReservationSelection = function(selection) {
ReservationSelection.resize = function(selection) {
var element = $(selection);
var view = element.parent().find('.fc-view-container');

Expand Down

0 comments on commit 63248e9

Please sign in to comment.