Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Separate JavaScript resources. #168
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrommen committed Dec 23, 2015
1 parent bb7ca44 commit 582e90d
Show file tree
Hide file tree
Showing 12 changed files with 258 additions and 195 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Expand Up @@ -39,14 +39,14 @@ module.exports = function( grunt ) {
admin: {
src: [
'<%= config.scripts.src %>admin.js',
'<%= config.scripts.src %>admin/*.js'
'<%= config.scripts.src %>admin/**/*.js'
],
dest: '<%= config.scripts.dest %>admin.js'
},
frontend: {
src: [
'<%= config.scripts.src %>frontend.js',
'<%= config.scripts.src %>frontend/*.js'
'<%= config.scripts.src %>frontend/**/*.js'
],
dest: '<%= config.scripts.dest %>frontend.js'
}
Expand Down
7 changes: 4 additions & 3 deletions resources/js/admin.js
@@ -1,4 +1,4 @@
/* global Backbone, mlpSettings */
/* global _, Backbone, mlpSettings */
(function( $ ) {
'use strict';

Expand Down Expand Up @@ -46,9 +46,10 @@
*/
registerModule: function( routes, name, Module, options ) {
if ( _.isFunction( Module ) ) {
$.each( Array === routes.constructor ? routes : [ routes ], function( index, route ) {
options = options || {};
$.each( _.isArray( routes ) ? routes : [ routes ], function( index, route ) {
Router.route( route, name, function() {
Modules[ name ] = new Module( options || {} );
Modules[ name ] = new Module( options );
} );
} );
}
Expand Down
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions resources/js/admin/post-translator/RelationshipControl.js
@@ -0,0 +1,30 @@
/* global MultilingualPress */
(function( $ ) {
'use strict';

/**
* Settings for the MultilingualPress RelationshipControl module. Only available on the targeted admin pages.
* @type {Object}
*/
var moduleSettings = MultilingualPress.getSettings( 'RelationshipControl' );

/**
* Constructor for the MultilingualPress RelationshipControl module.
* @constructor
*/
var RelationshipControl = Backbone.View.extend( {
el: '',

events: {
},

/**
* Initializes the RelationshipControl module.
*/
initialize: function() {
}
} );

// Register the RelationshipControl module for the Add New Post and the Edit Post admin pages.
//MultilingualPress.registerModule( [ 'post.php', 'post-new.php' ], 'RelationshipControl', RelationshipControl );
})( jQuery );

0 comments on commit 582e90d

Please sign in to comment.