clickable labels

This commit is contained in:
Benjamin Gamard 2018-03-12 11:43:11 +01:00
parent 647ad841df
commit 9d8034e010
6 changed files with 7 additions and 46 deletions

View File

@ -27,7 +27,6 @@ public class DocumentUpdatedAsyncListener {
* Document updated.
*
* @param event Document updated event
* @throws Exception
*/
@Subscribe
public void on(final DocumentUpdatedAsyncEvent event) {

View File

@ -1,13 +1,12 @@
package com.sismics.docs.core.listener.async;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.eventbus.Subscribe;
import com.sismics.docs.core.dao.lucene.LuceneDao;
import com.sismics.docs.core.event.FileDeletedAsyncEvent;
import com.sismics.docs.core.model.jpa.File;
import com.sismics.docs.core.util.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Listener on file deleted.
@ -24,7 +23,7 @@ public class FileDeletedAsyncListener {
* File deleted.
*
* @param fileDeletedAsyncEvent File deleted event
* @throws Exception
* @throws Exception e
*/
@Subscribe
public void on(final FileDeletedAsyncEvent fileDeletedAsyncEvent) throws Exception {

View File

@ -39,7 +39,7 @@ public class RouteStepValidateAsyncListener {
public void run() {
final UserDto user = routeStepValidateEvent.getUser();
// Send the password recovery email
// Send route step validated email
Map<String, Object> paramRootMap = new HashMap<>();
paramRootMap.put("user_name", user.getUsername());
paramRootMap.put("document_id", routeStepValidateEvent.getDocument().getId());

View File

@ -1,58 +1,20 @@
package com.sismics.util;
import org.jsoup.Jsoup;
import org.jsoup.helper.StringUtil;
import org.jsoup.helper.Validate;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
import org.jsoup.select.Elements;
import org.jsoup.select.NodeTraversor;
import org.jsoup.select.NodeVisitor;
import java.io.IOException;
/**
* HTML to plain-text. This example program demonstrates the use of jsoup to convert HTML input to lightly-formatted
* plain-text. That is divergent from the general goal of jsoup's .text() methods, which is to get clean data from a
* scrape.
* <p>
* Note that this is a fairly simplistic formatter -- for real world use you'll want to embrace and extend.
* </p>
* <p>
* To invoke from the command line, assuming you've downloaded the jsoup jar to your current directory:</p>
* <p><code>java -cp jsoup.jar org.jsoup.examples.HtmlToPlainText url [selector]</code></p>
* where <i>url</i> is the URL to fetch, and <i>selector</i> is an optional CSS selector.
*
* @author Jonathan Hedley, jonathan@hedley.net
*/
public class HtmlToPlainText {
private static final String userAgent = "Mozilla/5.0 (jsoup)";
private static final int timeout = 5 * 1000;
public static void main(String... args) throws IOException {
Validate.isTrue(args.length == 1 || args.length == 2, "usage: java -cp jsoup.jar org.jsoup.examples.HtmlToPlainText url [selector]");
final String url = args[0];
final String selector = args.length == 2 ? args[1] : null;
// fetch the specified URL and parse to a HTML DOM
Document doc = Jsoup.connect(url).userAgent(userAgent).timeout(timeout).get();
HtmlToPlainText formatter = new HtmlToPlainText();
if (selector != null) {
Elements elements = doc.select(selector); // get each element that matches the CSS selector
for (Element element : elements) {
String plainText = formatter.getPlainText(element); // format that element to plain text
System.out.println(plainText);
}
} else { // format the whole doc
String plainText = formatter.getPlainText(doc);
System.out.println(plainText);
}
}
/**
* Format an Element to plain-text
* @param element the root element to format

View File

@ -13,6 +13,7 @@ angular.module('docs').controller('Document', function ($scope, $rootScope, $tim
$scope.currentPage = 1;
$scope.limit = _.isUndefined(localStorage.documentsPageSize) ? '10' : localStorage.documentsPageSize;
$scope.search = $state.params.search ? $state.params.search : '';
$scope.setSearch = function (search) { $scope.search = search };
$scope.searchOpened = false;
$scope.searchDropdownAnchor = angular.element(document.querySelector('.search-dropdown-anchor'));
$scope.paginationShown = true;

View File

@ -63,7 +63,7 @@
<ul class="list-inline">
<li ng-repeat="tag in document.tags">
<span class="label label-info" ng-style="{ 'background': tag.color }">{{ tag.name }}</span>
<span class="label label-info pointer" ng-click="setSearch('tag:' + tag.name)" ng-style="{ 'background': tag.color }">{{ tag.name }}</span>
</li>
</ul>
</div>