Skip to content

Commit

Permalink
add documentation support via github
Browse files Browse the repository at this point in the history
  • Loading branch information
nconrad committed Jul 23, 2015
1 parent cfac992 commit cae2d4e
Show file tree
Hide file tree
Showing 18 changed files with 280 additions and 161 deletions.
9 changes: 8 additions & 1 deletion app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ angular.module('ModelSEED',
'Biochem',
'Browser',
'Regulons',
'Dialogs'
'Dialogs',
'docs-directives'
])
.config(['$locationProvider', '$stateProvider', '$httpProvider',
'$urlRouterProvider', '$urlMatcherFactoryProvider', '$sceProvider',
Expand Down Expand Up @@ -165,6 +166,12 @@ function($locationProvider, $stateProvider, $httpProvider,
controller: 'Proto',
})

.state('app.faq', {
url: "/faq",
templateUrl: 'app/views/docs/faq.html',
})


/* only used for testing analysis forms */
.state('app.run', {
url: "/run",
Expand Down
7 changes: 7 additions & 0 deletions app/ctrls/ctrls.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ angular.module('ctrls', [])
$scope.MV = MV;
}])

.controller('Documentation',
['$scope', '$state',
function($scope, $state) {

console.log('state', $state)

}])

.controller('MyModels',
['$scope', 'WS', 'MS', '$compile', 'uiTools', '$mdDialog', 'Dialogs',
Expand Down
25 changes: 25 additions & 0 deletions app/directives/docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

angular.module('docs-directives', []);
angular.module('docs-directives')

.directive('msFaq', ['$http', function($http) {
return {
template: '<div id="docs" ng-bind-html="data"></div>'+
'<a class="edit-docs-btn no-href" href="{{githubURL}}" target="_blank">'+
'<i class="icon-pencil2"></i> Edit on Github'+
'</a>',
link: function(scope, elem, attr) {
var url = attr.msFaq;
$http.get(url)
.then(function(res) {
var text = window.atob(res.data.content);
scope.githubURL = res.data.html_url;

var converter = new showdown.Converter(),
html = converter.makeHtml(text);

scope.data = html;
})
}
};
}])
154 changes: 4 additions & 150 deletions app/views/app.html
Original file line number Diff line number Diff line change
@@ -1,158 +1,12 @@

<div layout="row" style="height: 100%;">
<md-sidenav class="md-sidenav-left md-whiteframe-z2"
md-component-id="left"
md-is-locked-open="$mdMedia('min-width: 870px')"
style="height: 100%;">

<md-toolbar ng-controller="LeftCtrl" style="background-color: #444;">
<div class="md-toolbar-tools">
<md-button class="md-icon-button" aria-label="Settings">
<md-icon class="material-icons">menu</md-icon>
</md-button>
<div class="logo">
<a ui-sref="home">Model<span>SEED<span></a>
</div>
</div>

</md-toolbar>

<md-content layout-padding>
<div id="selected-models" ng-controller="SelectedData">
<div class="header">
<i class="icon-lab"></i>
Model Analysis
<span class="model-count" ng-controller="ModelCount">({{MV.models.length}})</span>

</div>

<hr class="no-margin">

<ul ng-show="MV.models.length" class="list-unstyled">
<li ng-repeat="item in MV.models track by $index" class="selected-model">

<div class="ellipsis selected-data-item" ng-click="makeActive($event)">
<a ui-sref=".modelPage({path: item.model})"
class="model">
{{item.org}}
</a>
<i class="icon-close hover pointer"
ng-click="MV.rm($index)">
</i>
</div>

<div class="ellipsis selected-data-item">
<a ui-sref=".fbaPage({path: item.fba})"
class="fba" ng-click="makeActive($event)">
<span class="label label-fba">FBA</span> {{item.media}}
</a>

<i class="glyphicon glyphicon-cog hover pointer"
ng-click="openFBAView($event, $index, item)">
</i>
</div>
</li>
</ul>
<div class="pull-right" ng-if="MV.models.length">
(<a ng-click="MV.rmAll()">
<small>Clear All</small>
</a>)
</div>

<div ng-if="!MV.models.length" class="warning-msg">

</div>
</div>
</md-content>

</md-sidenav>

<div layout="column" tabindex="-1" role="main" flex>
<md-toolbar class="md-toolbar-tools md-whiteframe-z1">

<ul class="toolbar" >
<li ng-class="{ active: $state.includes('app.biochem') }">
<a ui-sref="app.biochem">
<i class="icon-benzene"></i> <span hide-sm>Biochemistry</span>
</a>
</li>
<li ng-class="{ active: $state.includes('app.reconstruct') }">
<a ui-sref="app.reconstruct">
<i class="icon-tools"></i> <span hide-sm>Reconstruct</span>
</a>
</li>
<!--<li ng-class="{ active: $state.includes('app.myData') }">
<a ui-sref="app.myData({dir: '/'+$root.user})">
<i class="icon-archive2"></i> All Files
</a>
</li>-->
<li ng-class="{ active: $state.includes('app.myModels') }">
<a ui-sref="app.myModels">
<i class="icon-folder-open-o"></i> <span hide-sm>My Models</span>
</a>
</li>

<!--
<li ng-class="{ active: $state.includes('app.reconstruct') }">
<a ui-sref="app.reconstruct">
<i class="icon-tools"></i> Reconstruct
</a>
</li>-->
<!--<li ng-class="{ active: $state.includes('app.publicModels') }">
<a ui-sref="app.publicModels">
<i class="icon-earth"></i> Public
</a>
</li>-->
<!--<li ng-class="{ active: $state.includes('app.modelEditor')}" >
<a ui-sref="app.modelEditor">Model Editor</a>
</li>-->
<!--<li ng-class="{ active: $state.includes('app.compare')}" >
<a ui-sref="app.compare">
<i class="icon-lab"></i>
Analysis
<span class="model-count" ng-controller="ModelCount">({{MV.models.length}})</span>
</a>
</li>-->
</ul>
<span flex></span>
<ng-include src="'app/views/sidebar.html'" style="height: 100%;"></ng-include>

<div layout="column" role="main" flex>

<ul class="nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle cursor" data-toggle="dropdown">More
<i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<a ui-sref="app.myData({dir: '/'+$root.user})">
<i class="icon-archive2"></i> All My Files
</a>
</li>
<li role="separator" class="divider"></li>
<li>
<a ui-sref="home">About</a>
</li>
<!--<li>
<a ui-sref="app.api"><i class="fa fa-sign-out fa-fw"></i> API Documentation</a>
</li>-->
</ul>
</li>
<li ng-if="$root.user" class="dropdown" ng-controller="Login">
<a class="dropdown-toggle cursor" data-toggle="dropdown" style="padding-top: 5px; padding-bottom: 5px;">
{{$root.user.split('@')[0]}}
<br>
<small>@{{$root.user.split('@')[1] ? $root.user.split('@')[1] : ' RAST'}}</small>
<i class="fa fa-caret-down vertical-center"></i>
</a>
<ul class="dropdown-menu">
<li>
<a ng-click="logout()">
<i class="fa fa-sign-out fa-fw"></i> Logout
</a>
</li>
</ul>
</li>
</ul>
<md-toolbar class="md-toolbar-tools md-whiteframe-z1"
ng-include="'app/views/toolbar.html'">
</md-toolbar>

<md-content ui-view id="content" layout-padding></md-content>
Expand Down
2 changes: 2 additions & 0 deletions app/views/docs/faq.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

<div ms-faq="https://api.github.com/repos/ModelSEED/Documentation/contents/faq.md" layout-margin></div>
65 changes: 65 additions & 0 deletions app/views/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<md-sidenav class="md-sidenav-left md-whiteframe-z2"
md-component-id="left"
md-is-locked-open="$mdMedia('min-width: 870px')"
style="height: 100%;">

<md-toolbar ng-controller="LeftCtrl" style="background-color: #444;">
<div class="md-toolbar-tools">
<md-button class="md-icon-button" aria-label="Settings">
<md-icon class="material-icons">menu</md-icon>
</md-button>
<div class="logo">
<a ui-sref="home">Model<span>SEED<span></a>
</div>
</div>

</md-toolbar>

<md-content layout-padding>
<div id="selected-models" ng-controller="SelectedData">
<div class="header">
<i class="icon-lab"></i>
Model Analysis
<span class="model-count" ng-controller="ModelCount">({{MV.models.length}})</span>

</div>

<hr class="no-margin">

<ul ng-show="MV.models.length" class="list-unstyled">
<li ng-repeat="item in MV.models track by $index" class="selected-model">

<div class="ellipsis selected-data-item" ng-click="makeActive($event)">
<a ui-sref=".modelPage({path: item.model})"
class="model">
{{item.org}}
</a>
<i class="icon-close hover pointer"
ng-click="MV.rm($index)">
</i>
</div>

<div class="ellipsis selected-data-item">
<a ui-sref=".fbaPage({path: item.fba})"
class="fba" ng-click="makeActive($event)">
<span class="label label-fba">FBA</span> {{item.media}}
</a>

<i class="glyphicon glyphicon-cog hover pointer"
ng-click="openFBAView($event, $index, item)">
</i>
</div>
</li>
</ul>
<div class="pull-right" ng-if="MV.models.length">
(<a ng-click="MV.rmAll()">
<small>Clear All</small>
</a>)
</div>

<div ng-if="!MV.models.length" class="warning-msg">

</div>
</div>
</md-content>
</md-sidenav>
87 changes: 87 additions & 0 deletions app/views/toolbar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

<ul class="toolbar" >
<li ng-class="{ active: $state.includes('app.biochem') }">
<a ui-sref="app.biochem">
<i class="icon-benzene"></i> <span hide-sm>Biochemistry</span>
</a>
</li>
<li ng-class="{ active: $state.includes('app.reconstruct') }">
<a ui-sref="app.reconstruct">
<i class="icon-tools"></i> <span hide-sm>Reconstruct</span>
</a>
</li>
<!--<li ng-class="{ active: $state.includes('app.myData') }">
<a ui-sref="app.myData({dir: '/'+$root.user})">
<i class="icon-archive2"></i> All Files
</a>
</li>-->
<li ng-class="{ active: $state.includes('app.myModels') }">
<a ui-sref="app.myModels">
<i class="icon-folder-open-o"></i> <span hide-sm>My Models</span>
</a>
</li>

<!--
<li ng-class="{ active: $state.includes('app.reconstruct') }">
<a ui-sref="app.reconstruct">
<i class="icon-tools"></i> Reconstruct
</a>
</li>-->
<!--<li ng-class="{ active: $state.includes('app.publicModels') }">
<a ui-sref="app.publicModels">
<i class="icon-earth"></i> Public
</a>
</li>-->
<!--<li ng-class="{ active: $state.includes('app.modelEditor')}" >
<a ui-sref="app.modelEditor">Model Editor</a>
</li>-->
<!--<li ng-class="{ active: $state.includes('app.compare')}" >
<a ui-sref="app.compare">
<i class="icon-lab"></i>
Analysis
<span class="model-count" ng-controller="ModelCount">({{MV.models.length}})</span>
</a>
</li>-->
</ul>
<span flex></span>


<ul class="nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle cursor" data-toggle="dropdown">More
<i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<a ui-sref="app.myData({dir: '/'+$root.user})">
<i class="icon-archive2"></i> All My Files
</a>
</li>
<li role="separator" class="divider"></li>
<li>
<a ui-sref="app.faq">FAQ</a>
</li>
<li>
<a ui-sref="home">About</a>
</li>
<!--<li>
<a ui-sref="app.api"><i class="fa fa-sign-out fa-fw"></i> API Documentation</a>
</li>-->
</ul>
</li>
<li ng-if="$root.user" class="dropdown" ng-controller="Login">
<a class="dropdown-toggle cursor" data-toggle="dropdown" style="padding-top: 5px; padding-bottom: 5px;">
{{$root.user.split('@')[0]}}
<br>
<small>@{{$root.user.split('@')[1] ? $root.user.split('@')[1] : ' RAST'}}</small>
<i class="fa fa-caret-down vertical-center"></i>
</a>
<ul class="dropdown-menu">
<li>
<a ng-click="logout()">
<i class="fa fa-sign-out fa-fw"></i> Logout
</a>
</li>
</ul>
</li>
</ul>
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"angular-material": "0.10.0",
"angular-scroll": "0.6.5",
"angular": "1.4.0",
"angular-animate": "1.3.15"
"angular-animate": "1.3.15",
"showdown": "1.2.1"
},
"resolutions": {
"angular": "1.4.0"
Expand Down
3 changes: 3 additions & 0 deletions css/core.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

@import url("docs.css");

body {
font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
-webkit-font-smoothing: subpixel-antialiased;
Expand Down
Loading

0 comments on commit cae2d4e

Please sign in to comment.