Skip to content

Commit

Permalink
Removing all IIFEs and fixing style-guide warnings
Browse files Browse the repository at this point in the history
related to #23 #27
  • Loading branch information
felquis committed Jul 4, 2015
1 parent 4097694 commit 4dfbe48
Show file tree
Hide file tree
Showing 24 changed files with 500 additions and 519 deletions.
35 changes: 16 additions & 19 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
(function() {
'use strict';
angular.module('starter', [
'ionic',
'starter.configureKeyBoard',
'starter.configureStatusBar',
'starter.state.sidemenu',
'starter.state.search',
'starter.state.browse',
'starter.state.playlists',
'starter.state.single',
'starter.state.index',
'starter.state.infinite-scroll',
'starter.state.refresher',
'starter.state.spinners',
'starter.state.come-back',
'starter.state.loading'
]);
})();
angular.module('starter', [
'ionic',
'starter.configureKeyBoard',
'starter.configureStatusBar',
'starter.state.sidemenu',
'starter.state.search',
'starter.state.browse',
'starter.state.playlists',
'starter.state.single',
'starter.state.index',
'starter.state.infinite-scroll',
'starter.state.refresher',
'starter.state.spinners',
'starter.state.come-back',
'starter.state.loading'
]);
30 changes: 14 additions & 16 deletions src/shared/configure-keyboard.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
(function() {
'use strict';

angular.module('starter.configureKeyBoard', [
'ionic'
])

angular
.module('starter.configureKeyBoard', [])
.run(configKeyBoard);

/**
* Configure Keyboard
*/
function configKeyBoard($ionicPlatform) {
$ionicPlatform.ready(platformReady);

/**
* Configure Keyboard
* Configure Keyboard plugin
*/
function configKeyBoard($ionicPlatform) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
});
function platformReady() {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
}

})();
}
29 changes: 14 additions & 15 deletions src/shared/configure-status-bar.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
(function() {
'use strict';

angular.module('starter.configureStatusBar', [
'ionic'
])

angular
.module('starter.configureStatusBar', [])
.run(configStatusBar);

/**
* Configure Status Bar style
*/
function configStatusBar($ionicPlatform) {
$ionicPlatform.ready(platformReady);

/**
* Configure Status Bar style
* Configure StatusBar plugin
*/
function configStatusBar($ionicPlatform) {
$ionicPlatform.ready(function() {
if (window.StatusBar) {
StatusBar.styleDefault();
}
});
function platformReady() {
if (window.StatusBar) {
StatusBar.styleDefault()
}
}
})();
}
72 changes: 36 additions & 36 deletions src/shared/ig-button-loading/ig-button-loading.controller.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
(function() {
'use strict';
angular
.module('starter.shared.ig-button-loading.controller', [])
.controller('IGButtonLoadingController', IGButtonLoadingController);

IGButtonLoadingController.$inject = ['$scope', '$state', '$timeout', '$ionicLoading'];

var DEFAULT_LOADING_OPTIONS = {
noBackdrop: false,
hideOnStateChange: false,
delay: 0,
duration: undefined
angular
.module('starter.shared.ig-button-loading.controller', [])
.controller('IGButtonLoadingController', IGButtonLoadingController);

IGButtonLoadingController.$inject = ['$scope', '$state', '$timeout', '$ionicLoading'];

var DEFAULT_LOADING_OPTIONS = {
noBackdrop: false,
hideOnStateChange: false,
delay: 0,
duration: undefined
}

/**
* Controller Definition
*/
function IGButtonLoadingController($scope, $state, $timeout, $ionicLoading) {

console.log($scope.ig);
$scope.ig = ionic.extend(DEFAULT_LOADING_OPTIONS, $scope.ig);
console.log($scope.ig);

$scope.$on('$destroy', function () {
console.log('igLoading $destroy');
});

function show() {
$ionicLoading.show(DEFAULT_LOADING_OPTIONS);
}

function IGButtonLoadingController($scope, $state, $timeout, $ionicLoading) {

console.log($scope.ig);
$scope.ig = ionic.extend(DEFAULT_LOADING_OPTIONS, $scope.ig)
console.log($scope.ig);

$scope.$on('$destroy', function () {
console.log('igLoading $destroy');
function showNoBackdrop() {
$ionicLoading.show({
template: $scope.title,
noBackdrop: true
});
}

function show() {
$ionicLoading.show(DEFAULT_LOADING_OPTIONS);
}

function showNoBackdrop() {
$ionicLoading.show({
template: $scope.title,
noBackdrop: true
});
}

function hideLoading() {
$ionicLoading.show();
}
function hideLoading() {
$ionicLoading.show();
}
})();
}
60 changes: 33 additions & 27 deletions src/shared/ig-button-loading/ig-button-loading.directive.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
(function () {
angular
.module('starter.shared.ig-button-loading', ['starter.shared.ig-button-loading.controller'])
.directive('igLoading', igLoading);
angular
.module('starter.shared.ig-button-loading', ['starter.shared.ig-button-loading.controller'])
.directive('igLoading', igLoading);

function igLoading() {
var directive = {
restrict: 'E',
scope: {
duration: '=duration',
noBackdrop: '=noBackdrop',
hideOnStateChange: '=hideOnStateChange'
},
link: link,
controller: 'IGButtonLoadingController',
controllerAs: 'ig',
bindToController: true
};
/**
* Directive Definition
*/
function igLoading() {
var directive = {
restrict: 'E',
scope: {
duration: '=duration',
noBackdrop: '=noBackdrop',
hideOnStateChange: '=hideOnStateChange'
},
link: link,
controller: 'IGButtonLoadingController',
controllerAs: 'ig',
bindToController: true
};

return directive;
return directive;

function link(scope, element, attr, controller) {
scope.ig.count = 0;
scope.ig.time = Date.now();
/**
* Directive Link Function
*/
function link(scope, element, attr, controller) {
scope.ig.count = 0;
scope.ig.time = Date.now();

// console.log(scope.ig)
element.on('click', click);

element.on('click', function () {
console.log('igLoading click ', scope.ig.time, scope.ig.count++);
})
/**
* Click in the directive's element
*/
function click() {
console.log('igLoading click ', scope.ig.time, scope.ig.count++);
}
}

}())
}
34 changes: 15 additions & 19 deletions src/states/browse/route.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
(function() {
'use strict';

angular.module('starter.state.browse', [])

angular
.module('starter.state.browse', [])
.config(configBrowse);

/**
* Define Browse Route
*/
function configBrowse($stateProvider) {
$stateProvider
.state('app.browse', {
url: '/browse',
views: {
'menuContent': {
templateUrl: 'states/browse/template.html'
}
/**
* Define Browse Route
*/
function configBrowse($stateProvider) {
$stateProvider
.state('app.browse', {
url: '/browse',
views: {
'menuContent': {
templateUrl: 'states/browse/template.html'
}
});
}
})();
}
});
}
38 changes: 20 additions & 18 deletions src/states/come-back/controller.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
(function() {
'use strict';
angular
.module('starter.state.come-back.controller', [])
.controller('ComeBackController', ComeBackController);
angular
.module('starter.state.come-back.controller', [])
.controller('ComeBackController', ComeBackController);

ComeBackController.$inject = ['$timeout', '$ionicHistory'];
ComeBackController.$inject = ['$timeout', '$ionicHistory'];

/**
* Define Come Back Controller
*/
function ComeBackController($timeout, $ionicHistory) {
var vm = this;
vm.title = 'Wait a second';

vm.$on('$ionicView.enter', returnAfter2Seconds);

/**
* Define Come Back Controller
* Return to previous view after two seconds in the current view
*/
function ComeBackController($timeout, $ionicHistory) {
var vm = this;
vm.title = 'Wait a second';

vm.$on('$ionicView.enter', returnAfter2Seconds);
function returnAfter2Seconds() {
$timeout(next, 2000);

/**
* Return to previous view after two seconds in the current view
* Navigate to previous view
*/
function returnAfter2Seconds() {
$timeout(function() {
$ionicHistory.goBack();
}, 2000);
function next() {
$ionicHistory.goBack();
}
}
})();
}
33 changes: 15 additions & 18 deletions src/states/come-back/route.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
(function() {
'use strict';
angular.module('starter.state.come-back', ['starter.state.come-back.controller'])

angular
.module('starter.state.come-back', ['starter.state.come-back.controller'])
.config(configComeBack);

/**
* Define Come Back Route
*/
function configComeBack($stateProvider) {
$stateProvider.state('app.comeBack', {
url: '/come-back',
views: {
'menuContent': {
templateUrl: 'states/come-back/template.html',
controller: 'ComeBackController as vm'
}
/**
* Define Come Back Route
*/
function configComeBack($stateProvider) {
$stateProvider.state('app.comeBack', {
url: '/come-back',
views: {
'menuContent': {
templateUrl: 'states/come-back/template.html',
controller: 'ComeBackController as vm'
}
});
}
})();
}
});
}
19 changes: 8 additions & 11 deletions src/states/index/route.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
(function() {
'use strict';
angular.module('starter.state.index', [])

angular
.module('starter.state.index', [])
.config(configIndex);

/**
* Define default/index route
*/
function configIndex($urlRouterProvider) {
$urlRouterProvider.otherwise('/app/playlists');
}
})();
/**
* Define default/index route
*/
function configIndex($urlRouterProvider) {
$urlRouterProvider.otherwise('/app/playlists');
}
Loading

0 comments on commit 4dfbe48

Please sign in to comment.