Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
fnikitin committed Apr 9, 2015
2 parents cfcfca2 + ecd4b7f commit cf1e4d6
Show file tree
Hide file tree
Showing 13 changed files with 384 additions and 38 deletions.
Binary file added app/assets/img/np.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 25 additions & 7 deletions app/assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@

<!-- application script -->
<script src="js/app.js?release={!distRelease!}"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</head>

<body ng-controller="SnorqlCtrl">


<div class="navbar navbar-fixed-top navbar-snorql" role="navigation">
<div class="">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
Expand All @@ -56,10 +57,27 @@
<li ng-class=""><a href="{{'api' | getNeXtProtUrl}}">API</a></li>
</ul>
</li>
<li><a href="/page">Help</a></li>
<li><a ng-href="/page/title/about">About</a></li>
<li><a href="/help/doc/introduction">Help</a></li>
<li><a ng-href="/about">About</a></li>
<li><a href="mailto:[email protected]?subject=[neXtProt%20SnorQL]">Contact us</a></li>
</ul>
</ul>
<ul class="nav navbar-nav navbar-right">

<!-- login button -->
<li ng-if="!user.profile.email">
<a href='' type="button" class="link" ng-click="login()">Login</a>
</li>

<!-- once logged in user resources -->
<li class="dropdown" ng-if="user.profile.email" ng-cloak>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
{{user.profile.name || user.profile.email}}<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#" ng-click="logout()">Logout</a></li>
</ul>
</li>
</ul>
</div><!-- /.nav-collapse -->
</div><!-- /.container -->
</div><!-- /.navbar -->
Expand Down Expand Up @@ -89,8 +107,8 @@ <h4 class="list-group-item-heading">List group item heading</h4>
<hr>
<footer>
<p><a target="_blank" href="https://github.com/calipho-sib/nextprot-snorql">GitHub fork</a></p>
<p><a href="/pages/legal-disclaimer">Terms of Service</a></p>
<p><a href="/pages/copyright">&copy; SIB 2015</a></p>
<p><a href="/legal-disclaimer">Terms of Service</a></p>
<p><a href="/copyright">&copy; SIB 2015</a></p>
</footer>
-->
Expand All @@ -100,12 +118,12 @@ <h4 class="list-group-item-heading">List group item heading</h4>
<div class="row">
<div class="col-md-4">
<ul class="nav nav-pills nav-stacked">
<li><a href="/pages/legal-disclaimer">Legal disclaimer</a></li>
<li><a href="/legal-disclaimer">Legal disclaimer</a></li>
</ul>
</div>
<div class="col-md-4">
<ul class="nav nav-pills nav-stacked">
<li><a href="/pages/copyright">&copy; 2015 SIB</a></li>
<li><a href="/copyright">&copy; 2015 SIB</a></li>
</ul>
</div>
<div class="col-md-4">
Expand Down
2 changes: 1 addition & 1 deletion app/assets/partials/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>

<!-- CENTER PANE -->
<div class="col-sm-8 col-sm-offset-4 col-lg-9 col-lg-offset-3 main" rdf-help></div>
<div class="col-sm-8 col-sm-offset-4 col-lg-9 col-lg-offset-3 main help" rdf-help></div>
</div>
</div>
</div><!--/.container-->
18 changes: 10 additions & 8 deletions app/assets/partials/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h5 ng-if="snorql.selectedQueryId != 0">Found a bug? <a target="_blank" href="{{

<!-- DISPLAY SPARQL RESULT -->
<div class=" snorql " style="min-height:60px">
<div class="snorql-info" ng-show="waiting">Excuting query ...</div>
<div class="snorql-info" ng-show="waiting">Executing query ...</div>
<div class="snorql-info" ng-show="error">{{error}}</div>
<div class="snorql-info" ng-show="executionTime">Query time is {{executionTime}}[s] for {{snorql.result.results.bindings.length||0}} rows</div>
<div class=" " sparql-formatter="snorql.result"></div>
Expand Down Expand Up @@ -69,13 +69,15 @@ <h5 ng-if="snorql.selectedQueryId != 0">Found a bug? <a target="_blank" href="{{
<input type="text" class="form-control" placeholder="Filter sparql examples" ng-model="filter">
</div>

<a href="#" ng-click="selectExample(example.index)" ng-class="{'active':qSelected===example.index}"
class="list-group-item query-{{example.index}}" ng-repeat="example in snorql.examples | containsTag:filterTag | filter:filter">
<h5 class="list-group-item-heading">{{example.userQueryId | addQueryPrefix}} - {{example.title}}</h5>
<p class="list-group-item-text"><span class="label" >
<span ng-repeat="tag in example.tags | orderBy" class="label label-default label-as-badge">{{tag}}</span>
</p>
</a>
<div class="example-list">
<a href="#" ng-click="selectExample(example.index)" ng-class="{'active':qSelected===example.index}"
class="list-group-item query-{{example.index}}" ng-repeat="example in snorql.examples | containsTag:filterTag | filter:filter">
<h5 class="list-group-item-heading">{{example.userQueryId | addQueryPrefix}} - {{example.title}}</h5>
<p class="list-group-item-text"><span class="label" >
<span ng-repeat="tag in example.tags | orderBy" class="label label-default label-as-badge">{{tag}}</span>
</p>
</a>
</div>

</div>
</div><!--/span-->
Expand Down
7 changes: 0 additions & 7 deletions app/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ body {
body {
padding-top: 70px;
}
footer {
padding: 30px 0;
}

.content{
margin:0 5px;
}
.prefixes {
font-family: monospace;
font-size: 80%;
Expand Down
8 changes: 6 additions & 2 deletions app/css/snorql.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* Put your css in here */

img{ width:16px;position:absolute;top:10px;left:50%;}

.link { background: url(link.png) center right no-repeat; padding-right: 13px; }
.queryresults { border-collapse: collapse; margin-top: 0.3em;width:100%;font-size:90%; }
.queryresults td, .queryresults th { padding: 0.2em 0.4em; vertical-align: top; }
Expand Down Expand Up @@ -54,3 +52,9 @@ img{ width:16px;position:absolute;top:10px;left:50%;}
color: #428bca;
font-size: 10px;
}

.example-list {
height: 90vh;
min-height: 580px;
overflow-y: scroll;
}
67 changes: 55 additions & 12 deletions app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
* create application snorql and load deps
*/
var app = angular.module('snorql', [
'ngRoute','ngResource', 'npHelp','ui.codemirror', 'snorql.config', 'snorql.service','snorql.ui'
'ngRoute',
'ngResource',
'npHelp',
'ui.codemirror',
'snorql.config',
'snorql.service',
'snorql.ui',
'snorql.user', // user
'auth0', // authorization (auth0)
'angular-jwt', // token
'ipCookie' // cookie
]).controller('SnorqlCtrl',SnorqlCtrl)
.factory('errorInterceptor',errorInterceptor)
.config(appConfig)
Expand All @@ -17,17 +27,21 @@ function appRun(gitHubContent, config) {
// baseUrl:"http://uat-web2:8080",
helpPath:'rdfhelp.json',
helpTitle:'Generalities',
root:'page', // specify the root of RDF entity routes
root:'help', // specify the root of RDF entity routes
githubRepo: '/',
githubApi:config.apiUrl,
githubEditPage : "https://github.com/calipho-sib/nextprot-docs/edit/master/"
githubEditPage : "https://github.com/calipho-sib/nextprot-docs/edit/master/",
githubToken : null
});
};

//
// implement controller SnorqlCtrl
SnorqlCtrl.$inject=['$scope','$timeout','$location','snorql','config','gitHubContent']
function SnorqlCtrl( $scope, $timeout, $location, snorql, config, gitHubContent) {
SnorqlCtrl.$inject=['$scope','$timeout','$window','$location','snorql','config','gitHubContent','user']
function SnorqlCtrl( $scope, $timeout, $window, $location, snorql, config, gitHubContent, user) {
// user
$scope.user=user;

//
// go home link
$scope.home=config.home;
Expand Down Expand Up @@ -115,6 +129,13 @@ function SnorqlCtrl( $scope, $timeout, $location, snorql, config, gitHubCont
snorql.reset();
};

$scope.login=function(){
user.login();
};

$scope.logout=function(){
user.logout();
};

//
// load sparql examples
Expand All @@ -127,27 +148,49 @@ function SnorqlCtrl( $scope, $timeout, $location, snorql, config, gitHubCont
// $scope.executeQuery(snorql.updateQuery($location.search()));
$scope.$on('$locationChangeSuccess',function(url){
snorql.updateQuery($location.search())

if($location.path()==='/') {
$window.document.title = "neXtProt SnorQL";
}

})
};


/**
* ANGULAR BOOTSTRAP
*/
appConfig.$inject=['$routeProvider','$locationProvider','$httpProvider']
function appConfig($routeProvider, $locationProvider, $httpProvider) {
appConfig.$inject=['$routeProvider','$locationProvider','$httpProvider','authProvider','jwtInterceptorProvider']
function appConfig($routeProvider, $locationProvider, $httpProvider, authProvider, jwtInterceptorProvider) {

authProvider.init({
clientID: '7vS32LzPoIR1Y0JKahOvUCgGbn94AcFW',
callbackURL: window.location.origin,
domain: 'nextprot.auth0.com',
icon: '/img/np.png'
});

jwtInterceptorProvider.tokenGetter = ['ipCookie', function (ipCookie) {
// Return the saved token
return ipCookie('nxtoken');
}];
$httpProvider.interceptors.push('jwtInterceptor');

// intercept errors
$httpProvider.interceptors.push('errorInterceptor')


// List of routes of the application
$routeProvider
.when('/', {title: 'welcome to snorql', templateUrl: 'partials/home.html'})
.when('/page/entity/:entity',{title: 'help for snorql', templateUrl: 'partials/help.html'})
.when('/page/title/:article?',{title: 'help for snorql', templateUrl: 'partials/page.html'})
.when('/page/:docs?/:article?',{title: 'help for snorql', templateUrl: 'partials/doc.html'})

// Home page
.when('/', {title: 'welcome to snorql', templateUrl: '/partials/home.html'})
// Pages (in nextprot-docs/pages): about, copyright...
.when('/:article', {title: 'page', templateUrl: '/partials/page.html'})
//// Help pages
// GENERALITIES
.when('/help/doc/:article',{title: 'help for snorql', templateUrl: '/partials/doc.html'})
// RDF ENTITIES
.when('/help/entity/:entity',{title: 'help for snorql', templateUrl: '/partials/help.html'})

// Without serve side support html5 must be disabled.
$locationProvider.html5Mode(true);
Expand Down
Loading

0 comments on commit cf1e4d6

Please sign in to comment.