Modify toolbar options

42 views
Skip to first unread message

oste

unread,
Nov 9, 2013, 1:05:39 AM11/9/13
to crea...@googlegroups.com
What is the proper way to edit toolbar options? It gets instantiated here https://github.com/bergie/create/blob/master/dist/create.js#L401-L403

and I would like to edit the options found here https://github.com/bergie/create/blob/master/dist/create.js#L2245-L2251

I am just not sure how this can be done. 

I am using the plugin like below, but how can I modify the midgard.midgardToolbar options from this point.

    jQuery('body').midgardCreate({
        toolbar: 'minimized'
    });

Thanks for the help!

oste

unread,
Nov 9, 2013, 12:27:11 PM11/9/13
to crea...@googlegroups.com
Spent some time on the jQuery IRC channel and came up with this 

    var toolbarOptions = jQuery('body').midgardToolbar('option');

    toolbarOptions.templates.toolcontainer = 'this is cool';

    jQuery('body').midgardToolbar('destroy').midgardToolbar(toolbarOptions);

If there is a better way, please do tell :) Thinking adding more options to midgardCreate might be the way to go... Can put together a pull request for that if that is correct.

oste

unread,
Nov 9, 2013, 7:43:57 PM11/9/13
to crea...@googlegroups.com
This is actually not a solution, it creates a second .create-ui-toolbar-wrapper element :(


On Saturday, November 9, 2013 1:05:39 AM UTC-5, oste wrote:

oste

unread,
Nov 9, 2013, 8:17:13 PM11/9/13
to crea...@googlegroups.com
Maybe this is the way to do it

    $.extend($.Midgard.midgardToolbar.prototype.options, {
          templates: {
            minimized: '<div class="create-ui-logo"><a class="create-ui-toggle" id="create-ui-toggle-toolbar"></a></div>',
            full: '<div class="create-ui-toolbar-wrapper"><div class="create-ui-toolbar-toolarea"><%= dynamic %><%= status %></div></div>',
            toolcontainer: '<div class="create-ui-toolbar-<%= name %>toolarea"><ul class="create-ui-<%= name %>tools"><%= content %></ul></div>',
            toolarea: '<li class="create-ui-tool-<%= name %>area"></li>'
          }
    });

It's working for me so far. Taken from this SO answer http://stackoverflow.com/a/2389092/429909

On Saturday, November 9, 2013 1:05:39 AM UTC-5, oste wrote:

oste

unread,
Nov 9, 2013, 11:00:14 PM11/9/13
to crea...@googlegroups.com
After all of that I was able to get the desired results using the buttonContainer option. Doh!

the $.extend method below does still seem kinda nice and could be useful...


On Saturday, November 9, 2013 1:05:39 AM UTC-5, oste wrote:
Reply all
Reply to author
Forward
0 new messages