diff --git a/public/initializer.js b/public/initializer.js index a3f0674..c60e043 100644 --- a/public/initializer.js +++ b/public/initializer.js @@ -8,39 +8,23 @@ var dependencies = [ ]; -modulejs.define('Initializer', dependencies, function(cp, es, ns, uep, ci, cr) { +modulejs.define('Initializer', dependencies, function() { 'use strict'; + var __dependencies = arguments; - return { - init: function() { - if( cp.isControlPanel() ) { - cp.init(); - } - - - if( es.isEditSoftware() ) { - es.init(); - } - - - if( ns.isNewSoftware() ) { - ns.init(); - } - - if( uep.isUserEditProfile() ) { - uep.init(); - } - - - if( ci.isCreateInstitution() ) { - ci.init(); - } + function call_dependency(dependency) { + if( dependency.isCurrentPage() ) { + dependency.init(); + } + } - if( cr.isCompleteRegistration() ) { - cr.init(); + return { + init: function() { + for(var i=0, len = __dependencies.length; i < len; i++) { + call_dependency(__dependencies[i]); } } }; diff --git a/public/views/complete-registration.js b/public/views/complete-registration.js index 2d4686e..6fe903e 100644 --- a/public/views/complete-registration.js +++ b/public/views/complete-registration.js @@ -44,7 +44,7 @@ modulejs.define('CompleteRegistration', ['jquery', 'NoosferoRoot'], function($, return { - isCompleteRegistration: function() { + isCurrentPage: function() { return $("#complete_registration").length === 1; }, diff --git a/public/views/control-panel.js b/public/views/control-panel.js index b3cabdb..6fe50ad 100644 --- a/public/views/control-panel.js +++ b/public/views/control-panel.js @@ -42,7 +42,7 @@ modulejs.define('ControlPanel', ['jquery'], function($) { return { - isControlPanel: function() { + isCurrentPage: function() { return $("#profile-editor-index").length === 1; }, diff --git a/public/views/create-institution.js b/public/views/create-institution.js index c7fab1d..f909bc4 100644 --- a/public/views/create-institution.js +++ b/public/views/create-institution.js @@ -299,7 +299,7 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement'] return { - isCreateInstitution: function() { + isCurrentPage: function() { return $("#institution_form").length === 1; }, diff --git a/public/views/edit-software.js b/public/views/edit-software.js index 3c2b6ea..50c95c4 100644 --- a/public/views/edit-software.js +++ b/public/views/edit-software.js @@ -65,7 +65,7 @@ modulejs.define('EditSoftware', ['jquery', 'NoosferoRoot', 'AutoComplete', 'NewS return { - isEditSoftware: function() { + isCurrentPage: function() { return $("#especific-info").length === 1; }, diff --git a/public/views/new-software.js b/public/views/new-software.js index 196b69e..c6d8d60 100644 --- a/public/views/new-software.js +++ b/public/views/new-software.js @@ -40,13 +40,13 @@ modulejs.define('NewSoftware', ['jquery', 'NoosferoRoot', 'AutoComplete'], funct return { - init: function() { - license_info_autocomplete(); + isCurrentPage: function() { + return $('#new-software-page').length === 1; }, - isNewSoftware: function() { - return $('#new-software-page').length === 1; + init: function() { + license_info_autocomplete(); } } }); diff --git a/public/views/user-edit-profile.js b/public/views/user-edit-profile.js index eaedc8b..2bd7914 100644 --- a/public/views/user-edit-profile.js +++ b/public/views/user-edit-profile.js @@ -196,7 +196,7 @@ modulejs.define('UserEditProfile', ['jquery', 'SelectElement', 'SelectFieldChoic return { - isUserEditProfile: function() { + isCurrentPage: function() { return $('#profile_data_email').length === 1; }, -- libgit2 0.21.2