Skip to content

Commit 2618b7f

Browse files
committed
docs(app): merges master into materialize branch
1 parent 291d7c4 commit 2618b7f

34 files changed

+3853
-1048
lines changed

docs/app/assets/css/angular_io.css

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/app/assets/css/docs.css

Lines changed: 126 additions & 631 deletions
Large diffs are not rendered by default.

docs/app/assets/css/docs_old.css

Lines changed: 696 additions & 0 deletions
Large diffs are not rendered by default.

docs/app/assets/font-awesome/css/font-awesome.css

Lines changed: 1672 additions & 0 deletions
Large diffs are not rendered by default.

docs/app/assets/font-awesome/css/font-awesome.min.css

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.

docs/app/assets/font-awesome/fonts/fontawesome-webfont.svg

Lines changed: 520 additions & 0 deletions
Loading
Binary file not shown.
Binary file not shown.

docs/app/src/app.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
'use strict';
2+
13
angular.module('docsApp', [
2-
'ngRoute',
3-
'ngCookies',
4-
'ngSanitize',
5-
'ngAnimate',
4+
'ngMaterial',
5+
'HeaderController',
6+
'FooterController',
67
'DocsController',
8+
'ViewUtils',
79
'versionsData',
810
'pagesData',
911
'navData',
@@ -13,8 +15,7 @@ angular.module('docsApp', [
1315
'search',
1416
'tutorials',
1517
'versions',
16-
'bootstrap',
17-
'ui.bootstrap.dropdown'
18+
'responsiveMenu'
1819
])
1920

2021
.config(['$locationProvider', function($locationProvider) {

docs/app/src/directives.js

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
angular.module('directives', [])
22

33
/**
4-
* backToTop Directive
5-
* @param {Function} $anchorScroll
4+
* scrollTo Directive
65
*
7-
* @description Ensure that the browser scrolls when the anchor is clicked
6+
* @description
7+
* Upon click, scroll to the target element (identified by the selector provided via the `scroll-to`
8+
* attribute).
89
*/
9-
.directive('backToTop', ['$anchorScroll', '$location', function($anchorScroll, $location) {
10-
return function link(scope, element) {
11-
element.on('click', function(event) {
12-
$location.hash('');
13-
scope.$apply($anchorScroll);
14-
});
10+
.directive('scrollTo', ['$document', '$location', function($document, $location) {
11+
var doc = $document[0];
12+
13+
return {
14+
restrict: 'A',
15+
link: function scrollToPostLink(scope, elem, attrs) {
16+
elem.on('click', onClick);
17+
18+
function onClick() {
19+
var targetSelector = attrs.scrollTo;
20+
var targetElem = doc.querySelector(targetSelector);
21+
22+
if (targetElem) {
23+
targetElem.scrollIntoView();
24+
}
25+
}
26+
}
1527
};
1628
}])
1729

1830

19-
.directive('code', function() {
31+
.directive('code', ['$window', function($window) {
2032
return {
2133
restrict: 'E',
2234
terminal: true,
@@ -25,13 +37,17 @@ angular.module('directives', [])
2537
var match = /lang-(\S+)/.exec(element[0].className);
2638
var lang = match && match[1];
2739
var html = element.html();
28-
element.html(window.prettyPrintOne(html, lang, linenums));
40+
element.html($window.prettyPrintOne(html, lang, linenums));
2941
}
3042
};
31-
})
43+
}])
44+
3245

46+
// TODO: Probably not needed any more
3347
.directive('scrollYOffsetElement', ['$anchorScroll', function($anchorScroll) {
34-
return function(scope, element) {
35-
$anchorScroll.yOffset = element;
48+
return {
49+
link: function(scope, element) {
50+
$anchorScroll.yOffset = element;
51+
}
3652
};
3753
}]);

docs/app/src/docs.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
angular.module('DocsController', [])
1+
angular.module('DocsController', ['ViewUtils'])
22

33
.controller('DocsController', [
4-
'$scope', '$rootScope', '$location', '$window', '$cookies', 'openPlunkr',
4+
'$scope', '$rootScope', '$location', '$window', 'openPlunkr', 'ViewUtils',
55
'NG_PAGES', 'NG_NAVIGATION', 'NG_VERSION',
6-
function($scope, $rootScope, $location, $window, $cookies, openPlunkr,
6+
function($scope, $rootScope, $location, $window, openPlunkr, ViewUtils,
77
NG_PAGES, NG_NAVIGATION, NG_VERSION) {
88

9+
$scope.vu = ViewUtils;
10+
911
$scope.openPlunkr = openPlunkr;
1012

1113
$scope.docsVersion = NG_VERSION.isSnapshot ? 'snapshot' : NG_VERSION.version;
1214

15+
$scope.isCurrentPath = function(path) {
16+
return this.currentPage && path && (this.currentPage.path === path);
17+
};
18+
1319
$scope.navClass = function(navItem) {
1420
return {
1521
active: navItem.href && this.currentPage && this.currentPage.path,
@@ -25,13 +31,13 @@ angular.module('DocsController', [])
2531
$window._gaq.push(['_trackPageview', pagePath]);
2632
});
2733

28-
$scope.$watch(function docsPathWatch() {return $location.path(); }, function docsPathWatchAction(path) {
34+
$scope.$watch(function docsPathWatch() { return $location.path(); }, function docsPathWatchAction(path) {
2935

3036
path = path.replace(/^\/?(.+?)(\/index)?\/?$/, '$1');
3137

32-
currentPage = $scope.currentPage = NG_PAGES[path];
38+
var currentPage = $scope.currentPage = NG_PAGES[path];
3339

34-
if ( currentPage ) {
40+
if (currentPage) {
3541
$scope.partialPath = 'partials/' + path + '.html';
3642
$scope.currentArea = NG_NAVIGATION[currentPage.area];
3743
var pathParts = currentPage.path.split('/');
@@ -53,8 +59,6 @@ angular.module('DocsController', [])
5359
Initialize
5460
***********************************/
5561

56-
$scope.versionNumber = angular.version.full;
57-
$scope.version = angular.version.full + " " + angular.version.codeName;
5862
$scope.loading = 0;
5963

6064

docs/app/src/errors.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
angular.module('errors', ['ngSanitize'])
22

3-
.filter('errorLink', ['$sanitize', function ($sanitize) {
3+
.filter('errorLink', ['$sanitize', function($sanitize) {
44
var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}<>]/g,
55
MAILTO_REGEXP = /^mailto:/,
66
STACK_TRACE_REGEXP = /:\d+:\d+$/;
77

8-
var truncate = function (text, nchars) {
8+
var truncate = function(text, nchars) {
99
if (text.length > nchars) {
1010
return text.substr(0, nchars - 3) + '...';
1111
}
1212
return text;
1313
};
1414

15-
return function (text, target) {
15+
return function(text, target) {
1616
var targetHtml = target ? ' target="' + target + '"' : '';
1717

1818
if (!text) return text;
1919

20-
return $sanitize(text.replace(LINKY_URL_REGEXP, function (url) {
20+
return $sanitize(text.replace(LINKY_URL_REGEXP, function(url) {
2121
if (STACK_TRACE_REGEXP.test(url)) {
2222
return url;
2323
}
@@ -48,10 +48,10 @@ angular.module('errors', ['ngSanitize'])
4848
};
4949

5050
return {
51-
link: function (scope, element, attrs) {
51+
link: function(scope, element, attrs) {
5252
var search = $location.search(),
53-
formatArgs = [attrs.errorDisplay],
54-
i;
53+
formatArgs = [attrs.errorDisplay],
54+
i;
5555

5656
for (i = 0; angular.isDefined(search['p'+i]); i++) {
5757
formatArgs.push(search['p'+i]);

docs/app/src/examples.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ angular.module('examples', [])
22

33
.factory('formPostData', ['$document', function($document) {
44
return function(url, newWindow, fields) {
5-
/**
6-
* If the form posts to target="_blank", pop-up blockers can cause it not to work.
7-
* If a user choses to bypass pop-up blocker one time and click the link, they will arrive at
8-
* a new default plnkr, not a plnkr with the desired template. Given this undesired behavior,
9-
* some may still want to open the plnk in a new window by opting-in via ctrl+click. The
10-
* newWindow param allows for this possibility.
5+
/*
6+
* Form previously posted to target="_blank", but pop-up blockers were causing this to not work.
7+
* If a user chose to bypass pop-up blocker one time and click the link, they would arrive at
8+
* a new default plnkr, not a plnkr with the desired template.
119
*/
1210
var target = newWindow ? '_blank' : '_self';
1311
var form = angular.element('<form style="display: none;" method="post" action="' + url + '" target="' + target + '"></form>');
@@ -52,7 +50,7 @@ angular.module('examples', [])
5250
// The manifests provide the production index file but Plunkr wants
5351
// a straight index.html
5452
if (filename === "index-production.html") {
55-
filename = "index.html"
53+
filename = "index.html";
5654
}
5755

5856
return {

docs/app/src/footer-controller.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
angular.
2+
module('FooterController', []).
3+
controller('FooterController', FooterController);
4+
5+
function FooterController() {
6+
var vm = this;
7+
var v = angular.version;
8+
9+
vm.versionNumber = v.full;
10+
vm.version = v.full + ' ' + v.codeName;
11+
}

docs/app/src/header-controller.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
angular.
2+
module('HeaderController', []).
3+
controller('HeaderController', HeaderController);
4+
5+
function HeaderController() {
6+
var vm = this;
7+
8+
vm.learnItems = [
9+
{label: 'Why AngularJS?', url: '//angularjs.org/'},
10+
{label: 'Watch', url: '//www.youtube.com/user/angularjs'},
11+
{label: 'Tutorial', url: 'tutorial'},
12+
{label: 'Case Studies', url: '//builtwith.angularjs.org/'},
13+
{label: 'Seed App project template', url: '//github.com/angular/angular-seed'},
14+
{label: 'FAQ', url: 'misc/faq'}
15+
];
16+
17+
vm.developItems = [
18+
{label: 'Why AngularJS?', url: '//angularjs.org/'},
19+
{label: 'Tutorial', url: 'tutorial'},
20+
{label: 'Developer Guide', url: 'guide'},
21+
{label: 'API Reference', url: 'api'},
22+
{label: 'Error Reference', url: 'error'},
23+
{label: 'Contribute', url: 'misc/contribute'},
24+
{label: 'Download', url: '//code.angularjs.org/'}
25+
];
26+
27+
vm.discussItems = [
28+
{label: 'Blog', url: '//blog.angularjs.org'},
29+
{label: 'Mailing List', url: '//groups.google.com/group/angular'},
30+
{label: 'Chat Room', url: '//webchat.freenode.net/?channels=angularjs&uio=d4'},
31+
{label: 'Twitter', url: '//twitter.com/#!/angularjs'},
32+
{label: 'Google+', url: '//plus.google.com/110323587230527980117'},
33+
{label: 'GitHub', url: '//github.com/angular/angular.js'},
34+
{label: 'Issue Tracker', url: '//github.com/angular/angular.js/issues'},
35+
];
36+
}

docs/app/src/responsive-menu.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
angular.
2+
module('responsiveMenu', ['ngMaterial', 'ViewUtils']).
3+
directive('responsiveMenu', responsiveMenuDirective);
4+
5+
responsiveMenuDirective.$inject = ['$mdBottomSheet', 'ViewUtils'];
6+
function responsiveMenuDirective($mdBottomSheet, ViewUtils) {
7+
// TODO: Create showFns for various sizes (not necessarily all)
8+
var showFns = {
9+
// 'gt-lg': '',
10+
// 'lg': '',
11+
// 'md': '',
12+
'sm': function showSmFn(items) {
13+
$mdBottomSheet.show({
14+
template: _getResponsiveMenuSmTemplate(),
15+
controller: ['$mdBottomSheet', '$scope',
16+
function ResponsiveMenuSmController($mdBottomSheet, $scope) {
17+
$scope.items = items;
18+
$scope.onItemClick = $mdBottomSheet.hide.bind($mdBottomSheet);
19+
}
20+
]
21+
});
22+
}
23+
};
24+
25+
var defaultShowFn = showFns.sm;
26+
27+
return {
28+
restrict: 'A',
29+
scope: {
30+
items: '=rmItems'
31+
},
32+
controller: ['$element', '$scope', function ResponsiveMenuController($element, $scope) {
33+
$element.on('click', onClick.bind(this));
34+
35+
function onClick(evt) {
36+
var showFn = ViewUtils.getValueForSize(showFns, defaultShowFn);
37+
showFn($scope.items);
38+
}
39+
}]
40+
};
41+
}
42+
43+
function _getResponsiveMenuSmTemplate() {
44+
return [
45+
'<md-bottom-sheet>',
46+
' <md-list>',
47+
' <md-item ng-repeat="item in items">',
48+
' <md-button aria-label="{{item.label}}" ng-click="onItemClick(item)">',
49+
' <a ng-href="{{item.url}}">{{item.label}}</a>',
50+
' </md-button>',
51+
' </md-item>',
52+
' </md-list>',
53+
'</md-bottom-sheet>',
54+
''].join('\n');
55+
}

0 commit comments

Comments
 (0)