Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-03-09-21-44-34
[civicrm-core.git] / js / crm.designerapp.js
CommitLineData
c9204702
CW
1(function ($, _) {
2 $(function () {
3 /**
4 * FIXME we depend on this being a global singleton, mainly to facilitate vents
5 *
6 * vents:
7 * - resize: the size/position of widgets should be adjusted
8 * - ufUnsaved: any part of a UFGroup was changed; args: (is_changed:bool)
9 * - formOpened: a toggleable form (such as a UFFieldView or a UFGroupView) has been opened
10 */
11 CRM.designerApp = new Backbone.Marionette.Application();
6a488035 12
c9204702
CW
13 /**
14 * FIXME: Workaround for problem that having more than one instance
15 * of a profile on the page will result in duplicate DOM ids.
16 * @see CRM-12188
17 */
18 CRM.designerApp.clearPreviewArea = function () {
10455c5f 19 $('.crm-profile-selector-preview-pane > *').each(function () {
c9204702
CW
20 var parent = $(this).parent();
21 CRM.designerApp.DetachedProfiles.push({
22 parent: parent,
23 item: $(this).detach()
24 });
4151fff2 25 });
c9204702
CW
26 };
27 CRM.designerApp.restorePreviewArea = function () {
28 $.each(CRM.designerApp.DetachedProfiles, function () {
29 $(this.parent).append(this.item);
30 });
31 };
32 });
33})(CRM.$, CRM._);