| 1 | cj(function($) { |
| 2 | /** |
| 3 | * FIXME we depend on this being a global singleton, mainly to facilitate vents |
| 4 | * |
| 5 | * vents: |
| 6 | * - resize: the size/position of widgets should be adjusted |
| 7 | * - ufUnsaved: any part of a UFGroup was changed; args: (is_changed:bool) |
| 8 | * - formOpened: a toggleable form (such as a UFFieldView or a UFGroupView) has been opened |
| 9 | */ |
| 10 | CRM.designerApp = new Backbone.Marionette.Application(); |
| 11 | |
| 12 | /** |
| 13 | * FIXME: Workaround for problem that having more than one instance |
| 14 | * of a profile on the page will result in duplicate DOM ids. |
| 15 | * @see CRM-12188 |
| 16 | */ |
| 17 | CRM.designerApp.clearPreviewArea = function() { |
| 18 | $('.crm-profile-selector-preview-pane > .crm-form-block').each(function() { |
| 19 | var parent = $(this).parent(); |
| 20 | CRM.designerApp.DetachedProfiles.push({ |
| 21 | parent: parent, |
| 22 | item: $(this).detach() |
| 23 | }); |
| 24 | }); |
| 25 | }; |
| 26 | CRM.designerApp.restorePreviewArea = function() { |
| 27 | $.each(CRM.designerApp.DetachedProfiles, function() { |
| 28 | $(this.parent).append(this.item); |
| 29 | }); |
| 30 | }; |
| 31 | }); |