Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
feat(docs): added support for the doc app to show its associated Git …
Browse files Browse the repository at this point in the history
…SHA id/link

Gulp mods still needed to to inject the SHA value into the JSON file.
  • Loading branch information
ThomasBurleson committed Sep 3, 2014
1 parent b4244bf commit 02d2e5d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/app/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,14 @@ ul li:first-child {
font-weight: bold;
text-transform: uppercase;
}


.version {
font-size:9pt;
color:#ffffff;
position: absolute;
top: 65px;
left: 104px;
text-decoration: underline;
opacity: 0.6;
}
1 change: 1 addition & 0 deletions docs/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<material-toolbar class="material-theme-light material-medium-tall">
<h1 class="material-toolbar-tools" style="padding-top:25px;">
<a href="#" ng-click="goHome()">Angular<br/>Material Design</a>
<span class="version"><a ng-href="{{versionURL}}" target="_blank">{{version}}</a></span>
</h1>
</material-toolbar>

Expand Down
23 changes: 22 additions & 1 deletion docs/app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ function(COMPONENTS, $location, $rootScope) {
'$materialDialog',
'menu',
'$location',
function($scope, COMPONENTS, $materialSidenav, $timeout, $materialDialog, menu, $location) {
'$http',
function($scope, COMPONENTS, $materialSidenav, $timeout, $materialDialog, menu, $location, $http ) {

$scope.version = "";
$scope.versionURL = "";

$scope.goToUrl = function(p) {
window.location = p;
};
Expand Down Expand Up @@ -171,6 +176,22 @@ function($scope, COMPONENTS, $materialSidenav, $timeout, $materialDialog, menu,
});
};

// Load build version information; to be
// used in the header bar area
var now = Math.round(new Date().getTime()/1000);
var versionFile = "version.json" + "?ts=" + now;

$http.get("version.json")
.then(function(response){
var sha = response.data.sha || "";
var url = response.data.url;

if ( sha != "" ) {
$scope.versionURL = url + sha;
$scope.version = sha.substr(0,6);
}
});


COMPONENTS.forEach(function(component) {
component.demos && component.demos.forEach(function(demo) {
Expand Down
6 changes: 6 additions & 0 deletions docs/app/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sha" : "",
"url" : "https://github.com/angular/material/commit/",

"_comment" : "Gulp tool should use command `git git rev-parse 'HEAD'` and inject SHA value above"
}

0 comments on commit 02d2e5d

Please sign in to comment.