All files / framework/preferences/js FullPreviewPrefsEditor.js

100% Statements 3/3
50% Branches 1/2
100% Functions 1/1
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90                          3x   3x             3x                                                                                                                                      
/*
Copyright 2011-2016 OCAD University
Copyright 2011 Lucendo Development Ltd.
Copyright 2015 Raising the Floor - International
 
Licensed under the Educational Community License (ECL), Version 2.0 or the New
BSD license. You may not use this file except in compliance with one these
Licenses.
 
You may obtain a copy of the ECL 2.0 License and BSD License at
https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
*/
 
var fluid_3_0_0 = fluid_3_0_0 || {};
 
(function ($, fluid) {
    "use strict";
 
    /***********************************
     * Full Preview Preferences Editor *
     ***********************************/
 
    fluid.defaults("fluid.prefs.fullPreview", {
        gradeNames: ["fluid.prefs.prefsEditorLoader"],
        outerUiEnhancerOptions: "{originalEnhancerOptions}.options.originalUserOptions",
        outerUiEnhancerGrades: "{originalEnhancerOptions}.uiEnhancer.options.userGrades",
        components: {
            prefsEditor: {
                container: "{that}.container",
                options: {
                    components: {
                        preview: {
                            type: "fluid.prefs.preview",
                            createOnEvent: "onReady",
                            container: "{prefsEditor}.dom.previewFrame",
                            options: {
                                listeners: {
                                    "onReady.boilOnPreviewReady": "{fullPreview}.events.onPreviewReady"
                                }
                            }
                        }
                    },
                    listeners: {
                        "onReady.boil": {
                            listener: "{prefsEditorLoader}.events.onPrefsEditorReady"
                        }
                    },
                    distributeOptions: {
                        "fullPreview.prefsEditor.preview": {
                            source: "{that}.options.preview",
                            removeSource: true,
                            target: "{that > preview}.options"
                        }
                    }
                }
            }
        },
        events: {
            onPrefsEditorReady: null,
            onPreviewReady: null,
            onReady: {
                events: {
                    onPrefsEditorReady: "onPrefsEditorReady",
                    onPreviewReady: "onPreviewReady"
                },
                args: "{that}"
            }
        },
        distributeOptions: {
            "fullPreview.enhancer.outerUiEnhancerOptions": {
                source: "{that}.options.outerUiEnhancerOptions",
                target: "{that enhancer}.options"
            },
            "fullPreview.enhancer.previewEnhancer": {
                source: "{that}.options.previewEnhancer",
                target: "{that enhancer}.options"
            },
            "fullPreviw.preview": {
                source: "{that}.options.preview",
                target: "{that preview}.options"
            },
            "fullPreview.enhancer.outerUiEnhancerGrades": {
                source: "{that}.options.outerUiEnhancerGrades",
                target: "{that enhancer}.options.gradeNames"
            }
        }
    });
 
})(jQuery, fluid_3_0_0);