Commit a50f0267 authored by J. Fernando Sánchez's avatar J. Fernando Sánchez
Browse files

Fixed Playground

parent b8339e39
......@@ -107,7 +107,7 @@ class Senpy(object):
candidates = self.filter_plugins(is_activated=True)
if len(candidates) > 0:
candidate = list(candidates.values())[0]
logger.debug("Default: {}".format(candidate))
logger.debug("Default: {}".format(candidate.name))
return candidate
else:
return None
......
var ONYX = "http://www.gsi.dit.upm.es/ontologies/onyx/ns#";
var RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
var plugins_params={};
function replaceURLWithHTMLLinks(text) {
console.log('Text: ' + text);
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
......@@ -15,6 +16,15 @@ function encodeHTML(text) {
.replace(/'/g, ''');
};
function hashchanged(){
var hash = location.hash
, hashPieces = hash.split('?');
if( hashPieces[0].length > 0 ){
activeTab = $('[href=' + hashPieces[0] + ']');
activeTab && activeTab.tab('show');
}
}
$(document).ready(function() {
var response = JSON.parse($.ajax({type: "GET", url: "/api/plugins/" , async: false}).responseText);
var defaultPlugin= JSON.parse($.ajax({type: "GET", url: "/api/plugins/default" , async: false}).responseText);
......@@ -55,15 +65,18 @@ $(document).ready(function() {
}
document.getElementById('plugins').innerHTML = html;
change_params();
$(window).on('hashchange', hashchanged);
hashchanged();
$('.tooltip-form').tooltip();
});
function change_params(){
var plugin = document.getElementById("plugins").options[document.getElementById("plugins").selectedIndex].value;
html=""
for (param in plugins_params[plugin]){
if (param || plugins_params[plugin][param].length > 1){
html=""
html+= "<label> Parameter "+param+"</label>"
html+= "<select id=\""+param+"\" name=\""+param+"\">"
for (option in plugins_params[plugin][param]){
......@@ -93,3 +106,5 @@ function load_JSON(){
document.getElementById("input_request").innerHTML = "<label>"+url+"</label>"
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Playground</title>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Playground</title>
</head>
<script src="static/js/jquery-2.1.1.min.js" ></script>
<!--<script src="jquery.autosize.min.js"></script>-->
<link rel="stylesheet" href="static/css/bootstrap.min.css">
<link rel="stylesheet" href="static/css/main.css">
<link rel="stylesheet" href="static/font-awesome-4.1.0/css/font-awesome.min.css">
</head>
<script src="static/js/jquery-2.1.1.min.js" ></script>
<!--<script src="jquery.autosize.min.js"></script>-->
<link rel="stylesheet" href="static/css/bootstrap.min.css">
<link rel="stylesheet" href="static/css/main.css">
<link rel="stylesheet" href="static/font-awesome-4.1.0/css/font-awesome.min.css">
<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/main.js"></script>
<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/main.js"></script>
<body>
<div class="container">
<div id="header">
<h3 id="header-title">
<a href="https://github.com/gsi-upm/senpy" target="_blank">
<img id="header-logo" class="imsg-responsive" src="static/img/header.png"/></a> Playground
<body>
<div class="container">
<div id="header">
<h3 id="header-title">
<a href="https://github.com/gsi-upm/senpy" target="_blank">
<img id="header-logo" class="imsg-responsive" src="static/img/header.png"/></a> Playground
</h3>
</div>
</h3>
</div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a class="active" href="#about" role="tab" data-toggle="tab">About</a></li>
<li role="presentation"><a class="active" href="#test" role="tab" data-toggle="tab">Test it</a></li>
</ul>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a class="active" href="#about">About</a></li>
<li role="presentation"><a class="active" href="#test">Test it</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="about">
<div class="row">
<div class="col-lg-6 ">
<div class="well">
<h2>Test our services</h2>
<div>
<p>EUROSENTIMENT provides services and resources for Sentiment Analysis in several languages. There are several utilities, code snippets and instructions on how to make use of the platform publicly available. However, all of them require the installation of a third party tool or the use of a programming language to consume the API.</p>
<p>The EUROSENTIMENT Playground solves this problem by providing an easy-to-use web interface to make API calls.</p>
<p>Read our simple instructions and start using EUROSENTIMENT today! Once you're ready, head to the right section:</p>
<p class="text-center">
<a class="btn btn-lg btn-primary" href="#test" role="button">Test it »</a>
</p>
</div>
</div>
</div>
<div class="col-lg-6 ">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-sign-in"></i> Sign up in the <a href="http://portal.eurosentiment.eu">EUROSENTIMENT portal</a></div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-pencil-square-o"></i> Get your access token.</div>
<div class="panel-body">
<p>Your credentials will allow you to access any service available to you.</p>
<p>For convenience, some services might be publicly available, under heavy restrictions.</p>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"> <i class="fa fa-sliders"></i> Add the parameters you need for the service.</div>
<div class="panel-body">
<ol>
<li>Set the endpoint</li>
<li>Choose the HTTP action (GET/POST)</li>
<li>Set the headers (for authentication)</li>
<li>Set the necessary parameters (e.g. input text, language, format...)</li>
<li>Submit your request!</li>
<li>The results will be shown in the lower part of the screen, propertly formatted.</li>
</ol>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-child"></i> Enjoy.</div>
</div>
</div>
</div>
<div class="tab-content">
<div class="tab-pane active" id="about">
<div class="row">
<div class="col-lg-6 ">
<div class="well">
<h2>Test Senpy</h2>
<div>
<p class="text-center">
<a class="btn btn-lg btn-primary" href="#test" role="button">Test it »</a>
</p>
</div>
</div>
</div>
<div class="col-lg-6 ">
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-sign-in"></i> Follow us on <a href="http://www.github.com/gsi-upm/senpy">GitHub</a></div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><i class="fa fa-child"></i> Enjoy.</div>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="test">
<div class="well">
<form id="form" onsubmit="return getPlugins();" accept-charset="utf-8">
<div id="inputswrapper">
<div><textarea id="input" class="boxsizingBorder" rows="5" name="i">This text makes me sad.
<div class="tab-pane" id="test">
<div class="well">
<form id="form" onsubmit="return getPlugins();" accept-charset="utf-8">
<div id="inputswrapper">
<div><textarea id="input" class="boxsizingBorder" rows="5" name="i">This text makes me sad.
whilst this text makes me happy and surprised at the same time.
I cannot believe it!</textarea></div>
<label>Select the plugin:</label>
<select id="plugins" name="plugins" onchange="change_params()">
</select>
</br>
<div id ="params">
</div>
</br>
<div id ="params">
</div>
</br>
<button id="preview" type="button" onclick="load_JSON()" name="type">Preview!</button>
<a id="preview" class="btn btn-lg btn-primary" href="#" onclick="load_JSON()">Analyse!</a>
<!--<button id="visualise" name="type" type="button">Visualise!</button>-->
<button type="submit" >Download!</button>
</form>
</header>
<div id="content">
<span id="input_request"></span>
<pre id="results"></pre>
</div>
<span id="input_request"></span>
<pre id="results"></pre>
</div>
</div>
</div>
</div>
</div>
<a href="http://www.gsi.dit.upm.es" target="_blank"><img class="center-block" src="static/img/gsi.png"/> </a>
<a href="http://www.gsi.dit.upm.es" target="_blank"><img class="center-block" src="static/img/gsi.png"/> </a>
</div>
</div>
<div id="footer">
<div class="container">
<div id="site-info">
<p>
This development has been partially funded by the European Union through the<a href="http://mixedemotions-project.eu/"><span style="text-transform:uppercase;">MixedEmotions project</span></a>(project number H2020 655632), as part of the RIA ICT 15 Big data and Open Data Innovation and take-up programme.
</p>
</div>
<div id="footer">
<div class="container">
<div id="site-info">
<p>
This development has been partially funded by the European Union through the<a href="http://mixedemotions-project.eu/"><span style="text-transform:uppercase;">MixedEmotions project</span></a>(project number H2020 655632), as part of the RIA ICT 15 Big data and Open Data Innovation and take-up programme.
</p>
</div>
<div id="site-logos">
<a href="http://www.gsi.dit.upm.es" target="_blank"><img id="mixedemotions-logo"src="static/img/me.png"/></a>
</div>
</div>
<div id="site-logos">
<a href="http://www.gsi.dit.upm.es" target="_blank"><img id="mixedemotions-logo"src="static/img/me.png"/></a>
</div>
</body>
<link href='http://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
</div>
</body>
<link href='http://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment