| 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(); |
| 12 | |
| 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 () { |
| 19 | $('.crm-profile-selector-preview-pane > *').each(function () { |
| 20 | var parent = $(this).parent(); |
| 21 | CRM.designerApp.DetachedProfiles.push({ |
| 22 | parent: parent, |
| 23 | item: $(this).detach() |
| 24 | }); |
| 25 | }); |
| 26 | }; |
| 27 | CRM.designerApp.restorePreviewArea = function () { |
| 28 | $.each(CRM.designerApp.DetachedProfiles, function () { |
| 29 | $(this.parent).append(this.item); |
| 30 | }); |
| 31 | }; |
| 32 | }); |
| 33 | })(CRM.$, CRM._); |