frame.js
6 years ago
item-preview.js
8 years ago
item-setting-field.js
8 years ago
item-settings.js
8 years ago
sidebar.js
8 years ago
item-setting-field.js
39 lines
| 1 | var $ = jQuery, |
| 2 | MenuIconsItemSettingField; |
| 3 | |
| 4 | /** |
| 5 | * wp.media.view.MenuIconsItemSettingField |
| 6 | * |
| 7 | * @class |
| 8 | * @augments wp.media.View |
| 9 | * @augments wp.Backbone.View |
| 10 | * @augments Backbone.View |
| 11 | */ |
| 12 | MenuIconsItemSettingField = wp.media.View.extend({ |
| 13 | tagName: 'label', |
| 14 | className: 'setting', |
| 15 | events: { |
| 16 | 'change :input': '_update' |
| 17 | }, |
| 18 | |
| 19 | initialize: function() { |
| 20 | wp.media.View.prototype.initialize.apply( this, arguments ); |
| 21 | |
| 22 | this.template = wp.media.template( 'menu-icons-settings-field-' + this.model.get( 'type' ) ); |
| 23 | this.model.on( 'change', this.render, this ); |
| 24 | }, |
| 25 | |
| 26 | prepare: function() { |
| 27 | return this.model.toJSON(); |
| 28 | }, |
| 29 | |
| 30 | _update: function( e ) { |
| 31 | var value = $( e.currentTarget ).val(); |
| 32 | |
| 33 | this.model.set( 'value', value ); |
| 34 | this.options.item.set( this.model.id, value ); |
| 35 | } |
| 36 | }); |
| 37 | |
| 38 | module.exports = MenuIconsItemSettingField; |
| 39 |