Created
April 22, 2015 15:11
-
-
Save linxlad/42336ca8e6c16f1bb6a0 to your computer and use it in GitHub Desktop.
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
/** | |
* hs.property-questionnaire.js | |
* | |
* Property questionnaire scripts. | |
*/ | |
(function($) { | |
// Set-up questionnaire namespace. | |
Hs.questionnaire = {}; | |
/** | |
* Behaviours for the questionnaire form item. | |
*/ | |
Hs.behaviors.questionnaire = { | |
attach: function (context, settings) { | |
// Initialise questionnaire form. | |
Hs.questionnaire.formItemInit($('.Form--editProperty')); | |
// Re-initialise questionnaire form for AJAX submissions. | |
$(document).on('HsFormAjax', function(event) { | |
Hs.questionnaire.formItemInit(event.form); | |
}); | |
} | |
}; | |
/** | |
* Initialise questionnaire form items. | |
* | |
* @param object formItems | |
* The form items to initialise. | |
*/ | |
Hs.questionnaire.formItemInit = function(form) { | |
// Attach event watchers | |
Hs.questionnaire.attachEventWatchers(form); | |
}; | |
/** | |
* Event Watcher Method | |
*. | |
* @param form | |
*/ | |
Hs.questionnaire.attachEventWatchers = function (form) { | |
// Add room click event | |
form.find('#room-add_room').on('click', Hs.questionnaire.addRoomElements); | |
} | |
/** | |
* Add room elements with new 2.x markup. | |
* | |
* @param event | |
*/ | |
Hs.questionnaire.addRoomElements = function (event) { | |
event.preventDefault(); | |
console.log(event); | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment