PluginProbe
Happyforms – Form Builder for WordPress: Drag & Drop Contact Forms, Surveys, Payments & Multipurpose Forms / trunk
Happyforms – Form Builder for WordPress: Drag & Drop Contact Forms, Surveys, Payments & Multipurpose Forms vtrunk
1.26.15 trunk 1.0 1.10.0 1.11.0 1.11.1 1.12.0 1.12.1 1.12.10 1.12.11 1.12.12 1.12.2 1.12.3 1.12.4 1.12.5 1.12.6 1.12.7 1.12.8 1.12.9 1.13.0 1.13.1 1.13.10 1.13.11 1.13.12 1.13.2 All 194 releases
happyforms / core / assets / js / admin / shortcode.js

shortcode.js in Happyforms – Form Builder for WordPress: Drag & Drop Contact Forms, Surveys, Payments & Multipurpose Forms trunk, at core/assets/js/admin/shortcode.js

43 lines 950 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ( function( window, views, $, settings ) {
2
3 var happyforms = {
4 template: wp.media.template( 'happyforms-shortcode' ),
5
6 getTitle: function( id ) {
7 var title = 'Form';
8
9 if ( settings.forms[id] ) {
10 title += ': ' + settings.forms[id].post_title;
11 }
12
13 return title;
14 },
15
16 getId: function() {
17 return this.shortcode.attrs.named.id;
18 },
19
20 initialize: function() {
21 var id = this.getId();
22 var title = this.getTitle( id );
23
24 this.render( this.template( {
25 id: id,
26 title: title,
27 } ) );
28 },
29
30 edit: function() {
31 var id = this.getId();
32 var returnUrl = encodeURIComponent( document.location.href );
33 var link = settings.editLink.replace( 'ID', id ).replace( 'URL', returnUrl );
34
35 document.location.href = link;
36 },
37 }
38
39 views.register( 'happyforms', _.extend( {}, happyforms ) );
40 views.register( 'form', _.extend( {}, happyforms ) );
41
42 } )( window, window.wp.mce.views, window.jQuery, _happyFormsAdmin );
43