aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src
diff options
context:
space:
mode:
authorMatias Niemelä2013-04-02 19:41:16 -0400
committerIgor Minar2013-04-03 17:40:15 -0700
commit19f1801379104bc1f74fbb9d288f71034ba829c9 (patch)
treeeaf2d28c5056b80669b33478c808df88431d6a4e /docs/src
parent303df9dafee4314e5cfbc805f3321f4f4297a41a (diff)
downloadangular.js-19f1801379104bc1f74fbb9d288f71034ba829c9.tar.bz2
docs: add animations into docs and directive examples
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/example.js30
-rw-r--r--docs/src/ngdoc.js9
-rw-r--r--docs/src/templates/css/animations.css73
-rw-r--r--docs/src/templates/css/docs.css9
-rw-r--r--docs/src/templates/index.html11
5 files changed, 120 insertions, 12 deletions
diff --git a/docs/src/example.js b/docs/src/example.js
index 7477b0a5..eadc218f 100644
--- a/docs/src/example.js
+++ b/docs/src/example.js
@@ -57,12 +57,27 @@ exports.Example.prototype.addSource = function(name, content) {
}
};
+exports.Example.prototype.enableAnimations = function() {
+ this.animations = true;
+};
+
+exports.Example.prototype.disableAnimations = function() {
+ this.animations = false;
+};
+
exports.Example.prototype.toHtml = function() {
- return '<h2>Source</h2>\n' +
- this.toHtmlEdit() +
- this.toHtmlTabs() +
- '<h2>Demo</h2>\n' +
- this.toHtmlEmbed();
+ var html = "<h2>Source</h2>\n";
+ html += this.toHtmlEdit();
+ html += this.toHtmlTabs();
+ if(this.animations) {
+ html += '<div class="pull-right">';
+ html += ' <button class="btn btn-primary" ng-click="animationsOff=true" ng-hide="animationsOff">Animations on</button>';
+ html += ' <button class="btn btn-primary disabled" ng-click="animationsOff=false" ng-show="animationsOff">Animations off</button>';
+ html += '</div>';
+ }
+ html += "<h2>Demo</h2>\n";
+ html += this.toHtmlEmbed();
+ return html;
};
@@ -116,7 +131,10 @@ exports.Example.prototype.toHtmlTabs = function() {
exports.Example.prototype.toHtmlEmbed = function() {
var out = [];
- out.push('<div class="well doc-example-live"');
+ out.push('<div class="well doc-example-live animator-container"');
+ if(this.animations) {
+ out.push(" ng-class=\"{'animations-off':animationsOff == true}\"");
+ }
out.push(' ng-embed-app="' + this.module + '"');
out.push(' ng-set-html="' + this.html[0].id + '"');
out.push(' ng-eval-javascript="' + ids(this.js) + '">');
diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js
index 3e1bbe9d..4f94a1cd 100644
--- a/docs/src/ngdoc.js
+++ b/docs/src/ngdoc.js
@@ -130,8 +130,13 @@ Doc.prototype = {
parts.forEach(function(text, i) {
parts[i] = (text || '').
- replace(/<example(?:\s+module="([^"]*)")?(?:\s+deps="([^"]*)")?>([\s\S]*?)<\/example>/gmi, function(_, module, deps, content) {
+ replace(/<example(?:\s+module="([^"]*)")?(?:\s+deps="([^"]*)")?(\s+animations="true")?>([\s\S]*?)<\/example>/gmi,
+ function(_, module, deps, animations, content) {
+
var example = new Example(self.scenarios);
+ if(animations) {
+ example.enableAnimations();
+ }
example.setModule(module);
example.addDeps(deps);
@@ -437,9 +442,11 @@ Doc.prototype = {
var restrict = self.restrict || 'AC';
if (restrict.match(/E/)) {
+ dom.html('<p>');
dom.text('This directive can be used as custom element, but we aware of ');
dom.tag('a', {href:'guide/ie'}, 'IE restrictions');
dom.text('.');
+ dom.html('</p>');
}
if (self.usage) {
diff --git a/docs/src/templates/css/animations.css b/docs/src/templates/css/animations.css
new file mode 100644
index 00000000..3defa5ad
--- /dev/null
+++ b/docs/src/templates/css/animations.css
@@ -0,0 +1,73 @@
+.reveal-setup {
+ -webkit-transition:1s linear all;
+ -moz-transition:1s linear all;
+ -ms-transition:1s linear all;
+ -o-transition:1s linear all;
+ transition:1s linear all;
+
+ opacity:0;
+}
+.reveal-setup.reveal-start {
+ opacity:1;
+}
+
+.slide-reveal-setup {
+ -webkit-transition:0.5s linear all;
+ -moz-transition:0.5s linear all;
+ -ms-transition:0.5s linear all;
+ -o-transition:0.5s linear all;
+ transition:0.5s linear all;
+ opacity:0.5;
+}
+.slide-reveal-setup.slide-reveal-start {
+ opacity:1;
+}
+
+.slide-enter-setup {
+ -webkit-transition:0.5s linear all;
+ -moz-transition:0.5s linear all;
+ -ms-transition:0.5s linear all;
+ -o-transition:0.5s linear all;
+ transition:0.5s linear all;
+
+ position:relative;
+ left:10px;
+ opacity:0;
+}
+.slide-enter-setup.slide-enter-start {
+ left:0;
+ opacity:1;
+}
+
+.slide-leave-setup {
+ -webkit-transition:0.5s linear all;
+ -moz-transition:0.5s linear all;
+ -ms-transition:0.5s linear all;
+ -o-transition:0.5s linear all;
+ transition:0.5s linear all;
+
+ opacity:1;
+}
+.slide-leave-setup.slide-leave-start {
+ opacity:0;
+}
+
+.example-animate-container {
+ position:relative;
+ background:white;
+ border:1px solid black;
+ height:40px;
+ overflow:hidden;
+}
+
+.example-animate-container > div {
+ padding:1em;
+}
+
+.animator-container.animations-off * {
+ -webkit-transition: none;
+ -moz-transition: none;
+ -ms-transition: none;
+ -o-transition: color 0 ease-in; /* opera is special :) */
+ transition: none;
+}
diff --git a/docs/src/templates/css/docs.css b/docs/src/templates/css/docs.css
index 70d98a3c..bed88f80 100644
--- a/docs/src/templates/css/docs.css
+++ b/docs/src/templates/css/docs.css
@@ -3,6 +3,15 @@ img.AngularJS-small {
height: 25px;
}
+/* this is here to avoid the display=block shuffling of ngShow */
+.breadcrumb li > * {
+ float:left;
+ margin:0 2px 0 0;
+}
+
+.breadcrumb {
+ padding-bottom:2px;
+}
.clear-navbar {
margin-top: 60px;
diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html
index bd460838..6e3be195 100644
--- a/docs/src/templates/index.html
+++ b/docs/src/templates/index.html
@@ -34,6 +34,7 @@
addTag('link', {rel: 'stylesheet', href: 'css/bootstrap.min.css', type: 'text/css'});
addTag('link', {rel: 'stylesheet', href: 'css/font-awesome.css', type: 'text/css'});
addTag('link', {rel: 'stylesheet', href: 'css/docs.css', type: 'text/css'});
+ addTag('link', {rel: 'stylesheet', href: 'css/animations.css', type: 'text/css'});
if (jQuery) addTag('script', {src: debug ? 'js/jquery.js' : 'js/jquery.min.js'});
addTag('script', {src: path('angular.js')}, sync);
addTag('script', {src: path('angular-resource.js') }, sync);
@@ -231,21 +232,21 @@
<li class="nav-header section" ng-show="module.directives">
<a href="{{URL.directive}}" class="guide">directive</a>
</li>
- <li ng-repeat="page in module.directives" ng-class="navClass(page)">
+ <li ng-repeat="page in module.directives" ng-class="navClass(page)" ng-animate="'slide'">
<a href="{{page.url}}" tabindex="2">{{page.shortName}}</a>
</li>
<li class="nav-header section" ng-show="module.filters">
<a href="{{URL.filter}}" class="guide">filter</a>
</li>
- <li ng-repeat="page in module.filters" ng-class="navClass(page)">
+ <li ng-repeat="page in module.filters" ng-class="navClass(page)" ng-animate="'slide'">
<a href="{{page.url}}" tabindex="2">{{page.shortName}}</a>
</li>
<li class="nav-header section" ng-show="module.services">
<a href="{{URL.service}}" class="guide">service</a>
</li>
- <li ng-repeat="service in module.services" ng-class="navClass(service.instance, service.provider)">
+ <li ng-repeat="service in module.services" ng-animate="'slide'" ng-class="navClass(service.instance, service.provider)">
<a ng-show="service.provider" class="pull-right" href="{{service.provider.url}}" tabindex="2"><i class="icon-cog"></i></a>
<a href="{{service.instance.url}}" tabindex="2">{{service.name}}</a>
</li>
@@ -253,7 +254,7 @@
<li class="nav-header section" ng-show="module.types">
<a href="{{URL.type}}" class="guide">Types</a>
</li>
- <li ng-repeat="page in module.types" ng-class="navClass(page)">
+ <li ng-repeat="page in module.types" ng-class="navClass(page)" ng-animate="'slide'">
<a href="{{page.url}}" tabindex="2">{{page.shortName}}</a>
</li>
@@ -281,7 +282,7 @@
<div id="loading" ng-show="loading">Loading...</div>
- <div ng-hide="loading" ng-include src="currentPage.partialUrl" onload="afterPartialLoaded()" autoscroll class="content"></div>
+ <div ng-hide="loading" ng-include src="currentPage.partialUrl" onload="afterPartialLoaded()" autoscroll class="content" ng-animate="{enter: 'slide-reveal'}" ></div>
<div id="disqus" class="disqus">
<h2>Discussion</h2>