Jump to content

Bug or by design?


pconkie

Recommended Posts

Very simple test case - skeleton widget with one widget preference defined.

Com.Frog.Utils.require(
    '//package/widgets/66B544F32001B847B89EDFF5526AEC0B4851A10C0C50286B/assets/styles/main.css',
    '//package/widgets/66B544F32001B847B89EDFF5526AEC0B4851A10C0C50286B/assets/views/main.ejs',
    '//package/widgets/66B544F32001B847B89EDFF5526AEC0B4851A10C0C50286B/widget.ejs'
).then(function() {
    Com.Frog.Controllers.Widget.extend('Widget.Test', {
    }, {
         prefs: {
            file: {
                type: 'upload',
                label: "Select a File to Display",
                showDiscover: false,
                showClipboard: false,
                filter: ['image'],
                view: 'mini',
                sources: ['native']
            }
        },
        packageID: '66B544F32001B847B89EDFF5526AEC0B4851A10C0C50286B',
        /**
         * Constructor. Runs when the widget is first loaded.
         *
         * @method init
         */
        init: function() {},
        /**
         * Event fired by the Site Controller.
         *
         * @event 'widget.live'
         */
        'widget.live': function(el, ev, data) {
            this.element.html(
                this.view('main.ejs')
            );
            
        },
        /**
         * Event fired by the Site Controller. Tells the widget that the site is in Edit Mode.
         *
         * @event 'widget.edit'
         */
        'widget.edit': function(el, ev, data) {
            this.element.html(
                this.view('./widget.ejs')
            );        
        }
    });
});

When dragged on to a site the site fails to save unless a file has previously been selected.

Is there a way around this?

I would like to give teachers the option of loading a file into the widget, but if they want to start "with a clean slate" that would be fine too.....

 

Thanks

Paul

Link to comment
Share on other sites

If you add a defaultValue param to your prefs and set it to null, you may find that this works. Like below:

prefs: {
            file: {
                type: 'upload',
                label: "Select a File to Display",
                showDiscover: false,
                showClipboard: false,
                filter: ['image'],
                view: 'mini',
                sources: ['native'],
                defaultValue: null
            }
        },
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...