PluginProbe
MaxButtons – Create buttons / 7.13.3
MaxButtons – Create buttons v7.13.3
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
maxbuttons / assets / integrations / shortcake / edit-attribute-field-maxbutton.js

edit-attribute-field-maxbutton.js in MaxButtons – Create buttons 7.13.3, at assets/integrations/shortcake/edit-attribute-field-maxbutton.js

81 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ( function( $ ) {
2
3
4 var sui = window.Shortcode_UI;
5 //var construct = sui.utils.shortcodeViewConstructor;
6
7 sui.views.editAttributeFieldMaxButton = sui.views.editAttributeField.extend( {
8
9 updateButton: function(id)
10 {
11
12 this.setValue(id);
13 var preview = this.$el.find('.button_preview');
14
15 var query = [{
16 counter: 1,
17 post_id: $( '#post_ID' ).val(),
18 shortcode: this.shortcode.formatShortcode(),
19 }];
20
21 // provisional
22 wp.ajax.post( 'bulk_do_shortcode', {
23 queries: query,
24 nonce: shortcodeUIData.nonces.preview,
25 }).done( function( response ) {
26 var button = response[1].response;
27 preview.html(button);
28 })
29
30 },
31
32 render: function ()
33 {
34
35 var self = this;
36 //var maxMedia = window.maxFoundry.maxMedia;
37 this.cake_mm = new window.maxFoundry.maxMedia();
38
39 this.cake_mm.init({callback: $.proxy(this.callback, this), useShortCodeOptions: false});
40 //cake_mm.openModal();
41
42 var data = jQuery.extend( {
43 id: 'shortcode-ui-' + this.model.get( 'attr' ) + '-' + this.model.cid,
44 }, this.model.toJSON() );
45
46 //maxMedia.setCallback( $.proxy(this.updateButton, this) );
47
48 this.$el.html( this.template( data ) );
49 //this.triggerCallbacks();
50
51 $(document).on('click', '.maxbutton_media_button', $.proxy(function(e)
52 {
53 e.preventDefault();
54 this.cake_mm.openModal();
55 $('.media-modal, .media-modal-backdrop').hide();
56 },this));
57
58
59 $(document).on('modal_close', function ()
60 {
61 $('.media-modal, .media-modal-backdrop').show();
62 });
63
64 this.updateButton( this.model.get( 'value' ) );
65
66 return this;
67 },
68
69 callback: function(id)
70 {
71 this.updateButton(id);
72 this.cake_mm.close();
73 $('.media-modal, .media-modal-backdrop').show();
74 }
75
76
77
78 }); // extend
79
80 } )( jQuery );
81