Skip to content
Snippets Groups Projects
Commit c75ae82b authored by Eike Cochu's avatar Eike Cochu
Browse files

moved topic/article link template to files

added dropdown to topic link, topic menu
added topic menu for common topic actions
removed sourcemaps, unused
added bootbox for modal prompts
parent 68e284ff
No related branches found
No related tags found
No related merge requests found
Showing
with 120 additions and 92 deletions
......@@ -15,6 +15,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.bson.types.ObjectId;
......@@ -104,7 +105,7 @@ public class TopicResource {
@Path("{id}/articles")
public Response getArticles(@PathParam("id") final String id, @QueryParam("skip") final Integer skip,
@QueryParam("limit") final Integer limit, @QueryParam("sort") @DefaultValue("title") final String sortBy,
@QueryParam("fields") final String fields) {
@QueryParam("fields") final String fields, @Context UriInfo uriInfo) {
final ResponseWrapper<List<ArticleFull>> res = new ResponseWrapper<>();
try {
final Topic topic = new Topic(MongoUtils.objectId(id));
......
<span>
<a class="article-link" ui-sref="articles.show({id:article.id})">
<span ng-bind="article.title"></span>
<ng-transclude/>
</a>
</span>
<span>
<a class="topic-link" ui-sref="topics.show({id:topic.id})">
<span ng-bind="topic.name"></span>
<ng-transclude/>
</a>
<topic-menu topic="topic" />
</span>
<div class="dropdown inline-block">
<a data-toggle="dropdown">
<i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a ui-sref="topics.show({id:topic.id})">Show</a></li>
<li><a ui-sref="network({type:'topics',id:topic.id})">Network</a></li>
<li><a ui-sref="topics.show.articles({id:topic.id})">Articles</a></li>
<li role="separator" class="divider"></li>
<li><a ng-click="renameTopic()">Rename...</a></li>
</ul>
</div>
......@@ -57,26 +57,6 @@
</div>
<div class="chart" highcharts="topicSeq"></div>
<div class="message text-muted" ng-show="!topicsSelected">No topic selected</div>
<div class="topics">
<div class="row">
<div class="col-md-6 col-sm-12" ng-repeat="topic in topics | filter:{selected:true}">
<div class="panel panel-default panel-condensed">
<div class="panel-heading">
<span ng-bind="topic.name"></span>
<a ui-sref="topics.show({id:topic.id})">
<i class="fa fa-link"></i>
</a>
<a ui-sref="network({type:'topics', id:topic.id})">
<i class="fa fa-sitemap"></i>
</a>
<span class="colorbox shown" style="background:{{::topic.color}}"></span>
</div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -2,10 +2,10 @@
<div class="row" ng-hide="search">
<div class="col-md-12 text-center">
<svg class="logo hover heading" viewBox="0 0 200 120">
<polyline style="animation-delay:0s" class="logo-shape" points="0,0 100,45 100,75 0,0" fill="#006591"/>
<polyline style="animation-delay:.5s" class="logo-shape" points="100,45 200,0 100,75 100,45" fill="#0079a2"/>
<polyline style="animation-delay:1s" class="logo-shape" points="100,75 200,0 100,120 100,75" fill="#006591"/>
<polyline style="animation-delay:1.5s" class="logo-shape" points="0,0 100,75 100,120 0,0" fill="#0079a2"/>
<polyline style="animation-delay:0s" class="logo-shape" points="0,0 100,45 100,75 0,0" fill="#006591" />
<polyline style="animation-delay:.5s" class="logo-shape" points="100,45 200,0 100,75 100,45" fill="#0079a2" />
<polyline style="animation-delay:1s" class="logo-shape" points="100,75 200,0 100,120 100,75" fill="#006591" />
<polyline style="animation-delay:1.5s" class="logo-shape" points="0,0 100,75 100,120 0,0" fill="#0079a2" />
</svg>
</div>
</div>
......@@ -54,4 +54,4 @@
</div>
</div>
</div>
<div ng-cloak ui-view></div>
\ No newline at end of file
<div ng-cloak ui-view></div>
......@@ -27,7 +27,7 @@
<tbody>
<tr ng-repeat="topic in topics">
<td>
<a ui-sref="topics.show({id: topic.id})" ng-bind="::topic.name"></a>
<topic-link topic="topic" />
</td>
</tr>
</tbody>
......
......@@ -22,7 +22,7 @@
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="actionsDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Actions
<span class="caret"></span>
<i class="fa fa-caret-down"></i>
</button>
<ul class="dropdown-menu" aria-labelledby="actionsDropdown">
<li><a ng-click="startRename()">Rename</a></li>
......@@ -56,8 +56,8 @@
<div class="row">
<div class="col-md-12">
<h3>Relevance</h3>
<div class="wrapper">
<div class="topbar">
<div class="panel panel-default">
<div class="panel-heading">
<small>Values:</small>
<div class="btn-group">
<a class="btn btn-sm btn-default" ng-model="opts.seqstyle" bs-radio="'absolute'">Absolute</a>
......@@ -70,31 +70,38 @@
<a class="btn btn-sm btn-default" ng-model="opts.chartstyle" bs-radio="'spline'">Line</a>
</div>
</div>
<div class="area-chart" id="topic-seq" highcharts="topicSeq"></div>
<div class="panel-body">
<div class="area-chart" id="topic-seq" highcharts="topicSeq"></div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h3>Words</h3>
<div class="topbar">
<small>Sequence:</small>
<sequence-dropdown ng-model="sequenceId" sequences="topic.sequences"></sequence-dropdown>
<div class="panel panel-default">
<div class="panel-heading">
<small>Sequence:</small>
<sequence-dropdown ng-model="sequenceId" sequences="topic.sequences"></sequence-dropdown>
</div>
<table class="table table-condensed table-bordered table-hover" ng-show="sequence">
<thead>
<tr>
<th ng-model="opts.sortwords" sort-by="id">Word</th>
<th ng-model="opts.sortwords" sort-by="likeliness">Likeliness</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="word in sequence.words | orderBy:opts.sortwords">
<td ng-bind="word.id"></td>
<td ng-bind="word.likeliness.toFixed(4)"></td>
</tr>
</tbody>
</table>
<div class="panel-footer" ng-show="sequence">
<ng-pluralize count="sequence.words.length||0" when="{0:'No words',1:'Top word',other:'Top {} words'}"></ng-pluralize>
</div>
</div>
<table class="table table-condensed table-bordered table-hover" ng-show="sequence">
<thead>
<tr>
<th ng-model="opts.sortwords" sort-by="id">Word</th>
<th ng-model="opts.sortwords" sort-by="likeliness">Likeliness</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="word in sequence.words | orderBy:opts.sortwords">
<td ng-bind="word.id"></td>
<td ng-bind="word.likeliness.toFixed(4)"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
......
......@@ -69,6 +69,9 @@
<li ui-sref-active="active">
<a ui-sref="topics">Topics</a>
</li>
<li ui-sref-active="active">
<a ui-sref="sequences">Sequences</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li ui-sref-active="active">
......
......@@ -82,6 +82,20 @@
controller: 'TopicsArticlesController'
});
// states: sequences
$stateProvider.state('sequences', {
url: '/sequences',
templateUrl: 'html/sequences/index.html',
controller: 'SequencesIndexController'
});
$stateProvider.state('sequences.show', {
url: '/:id',
templateUrl: 'html/sequences/show.html',
controller: 'SequencesShowController'
});
}]);
app.config(['$httpProvider', function($httpProvider) {
......
......@@ -2,7 +2,7 @@
* Vipra Application
* Directives
******************************************************************************/
/* globals angular, console, Vipra */
/* globals angular, console, Vipra, bootbox */
(function() {
"use strict";
......@@ -19,7 +19,7 @@
restrict: 'E',
replace: true,
transclude: true,
template: '<a class="topic-link" ui-sref="topics.show({id:topic.id})"><span ng-bind="topic.name"></span><ng-transclude/></a>'
templateUrl: 'html/directives/topic-link.html'
};
});
......@@ -31,7 +31,7 @@
restrict: 'E',
replace: true,
transclude: true,
template: '<a class="article-link" ui-sref="articles.show({id:article.id})"><span ng-bind="article.title"></span><ng-transclude/></a>'
templateUrl: 'html/directives/article-link.html'
};
});
......@@ -196,7 +196,31 @@
$scope.check();
},
transclude: true,
template: '<span ng-transclude></span> <span class="caret" ng-class="{\'caret-up\':reverse}" ng-show="showCaret()"></span>'
template: '<span ng-transclude></span> <i class="fa" ng-class="{\'fa-caret-down\':!reverse, \'fa-caret-up\':reverse}" ng-show="showCaret()"></i>'
};
});
app.directive('topicMenu', function() {
return {
scope: {
topic: '='
},
restrict: 'E',
replace: true,
templateUrl: 'html/directives/topic-menu.html',
link: function($scope) {
$scope.renameTopic = function() {
bootbox.prompt({
title: 'Rename topic',
value: $scope.topic.name,
callback: function(name) {
if (name && name.length && name !== $scope.topic.name) {
}
}
});
};
}
};
});
......
......@@ -8,6 +8,10 @@ body {
padding-bottom: 20px;
}
.pointer,
input[type=checkbox],
.checkbox label::before,
[sort-by],
a:hover {
cursor: pointer;
}
......@@ -250,13 +254,9 @@ a:hover {
right: 0;
bottom: 0;
}
.topics,
.chart {
padding: 15px;
}
.topics .panel-heading {
position: relative;
}
.sequence {
flex: 1 0 0;
}
......@@ -289,11 +289,6 @@ a:hover {
}
}
input[type=checkbox],
.checkbox label::before {
cursor: pointer;
}
.radio-inline {
vertical-align: bottom;
}
......@@ -310,6 +305,7 @@ input[type=checkbox],
}
.searchclear {
.pointer;
position: absolute;
right: 5px;
top: 0;
......@@ -317,7 +313,6 @@ input[type=checkbox],
height: 14px;
margin: auto;
font-size: 14px;
cursor: pointer;
color: #ccc;
}
......@@ -346,15 +341,6 @@ input[type=checkbox],
overflow-y: auto;
}
[sort-by] {
cursor: pointer;
}
.caret.caret-up {
border-top-width: 0;
border-bottom: 4px solid #000000;
}
.panel.panel-condensed {
.panel-heading {
padding: 5px 10px;
......@@ -364,6 +350,10 @@ input[type=checkbox],
}
}
.inline-block {
display: inline-block;
}
@-moz-keyframes spin {
100% {
-moz-transform: rotateY(360deg);
......
......@@ -29,6 +29,7 @@
"nya-bootstrap-select": "^2.x",
"font-awesome": "^4.x",
"awesome-bootstrap-checkbox": "^0.x",
"randomcolor": "randomColor#^0.x"
"randomcolor": "randomColor#^0.x",
"bootbox.js": "bootbox#^4.4.0"
}
}
......@@ -6,7 +6,6 @@ var gulp = require('gulp'),
uglify = require('gulp-uglify'),
cleancss = require('gulp-clean-css'),
webserver = require('gulp-webserver'),
sourcemaps = require('gulp-sourcemaps'),
ngannotate = require('gulp-ng-annotate'),
templatecache = require('gulp-angular-templatecache');
......@@ -22,7 +21,8 @@ var assets = {
'bower_components/vis/dist/vis.min.js',
'bower_components/moment/min/moment.min.js',
'bower_components/nya-bootstrap-select/dist/js/nya-bs-select.min.js',
'bower_components/randomcolor/randomColor.js'
'bower_components/randomcolor/randomColor.js',
'bower_components/bootbox.js/bootbox.js'
],
css: [
'bower_components/bootstrap/dist/css/bootstrap.min.css',
......@@ -40,21 +40,17 @@ var assets = {
gulp.task('less', function() {
gulp.src('app/less/**/*.less')
//.pipe(sourcemaps.init())
.pipe(concat('app.css'))
.pipe(less())
.pipe(cleancss())
//.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('public/css'));
});
gulp.task('js', function() {
gulp.src('app/js/**/*.js')
//.pipe(sourcemaps.init())
.pipe(concat('app.js'))
.pipe(ngannotate())
//.pipe(uglify())
//.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('public/js'));
});
......
......@@ -14,7 +14,6 @@
"gulp-include": "^2.1.0",
"gulp-less": "^3.0.5",
"gulp-ng-annotate": "^2.0.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^1.5.1",
"gulp-webserver": "^0.9.1"
}
......
......@@ -4,7 +4,6 @@ import java.io.Serializable;
import org.mongodb.morphia.annotations.Embedded;
import org.mongodb.morphia.annotations.Reference;
import org.mongodb.morphia.annotations.Transient;
@SuppressWarnings("serial")
@Embedded
......@@ -15,9 +14,6 @@ public class TopicRef implements Comparable<TopicRef>, Serializable {
private Double share;
@Transient
private Integer count;
public Topic getTopic() {
return topic;
}
......@@ -26,14 +22,6 @@ public class TopicRef implements Comparable<TopicRef>, Serializable {
this.topic = topic;
}
public Integer getCount() {
return count;
}
public void setCount(final Integer count) {
this.count = count;
}
public Double getShare() {
return share;
}
......@@ -49,7 +37,7 @@ public class TopicRef implements Comparable<TopicRef>, Serializable {
@Override
public String toString() {
return "TopicRef [topic=" + topic + ", share=" + share + ", count=" + count + "]";
return "TopicRef [topic=" + topic + ", share=" + share + "]";
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment