95 lines
2.9 KiB
JavaScript
95 lines
2.9 KiB
JavaScript
/*
|
|
* Apllication Module
|
|
*
|
|
*/
|
|
|
|
var angularIO = angular.module('angularIOApp', ['ngMaterial'])
|
|
.config(function($mdThemingProvider) {
|
|
$mdThemingProvider.theme('default')
|
|
.primaryPalette('blue', {
|
|
'default': '700', // by default use shade 400 from the pink palette for primary intentions
|
|
'hue-1': '100', // use shade 100 for the <code>md-hue-1</code> class
|
|
'hue-2': '600', // use shade 600 for the <code>md-hue-2</code> class
|
|
'hue-3': 'A100' // use shade A100 for the <code>md-hue-3</code> class
|
|
})
|
|
// If you specify less than all of the keys, it will inherit from the
|
|
// default shades
|
|
.accentPalette('purple', {
|
|
'default': '200' // use shade 200 for default, and keep all other shades the same
|
|
});
|
|
});
|
|
|
|
|
|
/*
|
|
* Apllication Controller
|
|
*
|
|
*/
|
|
|
|
angularIO.controller('AppCtrl', ['$scope', '$mdDialog', function($scope, $mdDialog){
|
|
|
|
// TOGGLE MAIN NAV (TOP) ON MOBILE
|
|
$scope.toggleDocsMenu = function(event) {
|
|
$scope.showDocsNav = !$scope.showDocsNav;
|
|
};
|
|
|
|
// TOGGLE DOCS NAV
|
|
$scope.toggleMainMenu = function(event) {
|
|
$scope.showMainNav = !$scope.showMainNav;
|
|
};
|
|
|
|
// TOGGLE DOCS VERSION & LANGUAGE
|
|
$scope.toggleVersionMenu = function(event) {
|
|
$scope.showMenu = !$scope.showMenu;
|
|
};
|
|
|
|
// BIO MODAL
|
|
$scope.showBio = function($event) {
|
|
var parentEl = angular.element(document.body);
|
|
var person = angular.element($event.currentTarget);
|
|
var name = person.attr('data-name');
|
|
var bio = person.attr('data-bio');
|
|
var pic = person.attr('data-pic');
|
|
var twitter = person.attr('data-twitter');
|
|
var website = person.attr('data-website');
|
|
var $twitter = twitter !== 'undefined' ? '<a class="button button-subtle button-small" href="https://twitter.com/' + person.attr('data-twitter') + '" md-button>Twitter</a>' : '';
|
|
var $website = website !== 'undefined' ? '<a class="button button-subtle button-small" href="' + person.attr('data-website') + '" md-button>Website</a>' : '';
|
|
|
|
$mdDialog.show({
|
|
parent: parentEl,
|
|
targetEvent: $event,
|
|
template:
|
|
'<md-dialog class="modal" aria-label="List dialog">' +
|
|
' <md-content>' +
|
|
' <img class="left" src="' + pic + '" />' +
|
|
' <h3 class="text-headline">' + name + '</h3>' +
|
|
' <div class="modal-social">' + $twitter + $website + '</div>' +
|
|
' <p class="text-body">' + bio + '</p>' +
|
|
' </md-content>' +
|
|
' <div class="md-actions">' +
|
|
' <md-button ng-click="closeDialog()">' +
|
|
' Close Bio' +
|
|
' </md-button>' +
|
|
' </div>' +
|
|
'</md-dialog>',
|
|
locals: {
|
|
items: $scope.items
|
|
},
|
|
controller: DialogController
|
|
});
|
|
|
|
function DialogController(scope, $mdDialog, items) {
|
|
scope.items = items;
|
|
scope.closeDialog = function() {
|
|
$mdDialog.hide();
|
|
};
|
|
}
|
|
};
|
|
|
|
// INITIALIZE PRETTY PRINT
|
|
prettyPrint();
|
|
}]);
|
|
|
|
|
|
|
|
|