pconkie Posted July 23, 2017 Share Posted July 23, 2017 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 More sharing options...
Graham Quince Posted July 24, 2017 Share Posted July 24, 2017 Hi Paul, I've just learnt that @Chris.Smith is poorly at the moment. It might be next week before he can reply. And I'm fairly certain I don't have an answer myself. sorry Link to comment Share on other sites More sharing options...
adamw Posted July 25, 2017 Share Posted July 25, 2017 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 } }, 2 Link to comment Share on other sites More sharing options...
pconkie Posted July 25, 2017 Author Share Posted July 25, 2017 Thanks @adamw That did the trick! Would be good to add that one to the official docs https://froglearn.backwellschool.net/app/lib/packaging/docs/Preferences.Upload.html On to the next problem.... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now