From fa8cb9196949f2ad56782c718a81fb89aef38d31 Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Sat, 26 Jan 2019 19:52:51 +1300 Subject: [PATCH 1/7] Use a unique HTML for the template, and load Vue via CDN --- annif/templates/base.html | 26 -------------------------- annif/templates/home.html | 27 ++++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 29 deletions(-) delete mode 100644 annif/templates/base.html diff --git a/annif/templates/base.html b/annif/templates/base.html deleted file mode 100644 index 2ecf4150a..000000000 --- a/annif/templates/base.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - {% if title %} - {{ title }} - {% else %} - Annif - {% endif %} - - - - - - {% block head %}{% endblock %} - - - -{% block content %}{% endblock %} - - - - - diff --git a/annif/templates/home.html b/annif/templates/home.html index a2effc171..7a21f566b 100644 --- a/annif/templates/home.html +++ b/annif/templates/home.html @@ -1,6 +1,21 @@ -{% extends "base.html" %} + + + + + + + {% if title %} + {{ title }} + {% else %} + Annif + {% endif %} + + + + {% block head %}{% endblock %} + + -{% block content %}

Annif

@@ -40,4 +55,10 @@

Results

-{% endblock %} + + + + + + + From c285f549ef5a0e07de0fe62ffc29411abe4b0012 Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Sat, 26 Jan 2019 20:35:52 +1300 Subject: [PATCH 2/7] Create initial components --- annif/static/js/annif.js | 2 ++ annif/templates/home.html | 65 +++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/annif/static/js/annif.js b/annif/static/js/annif.js index 3d0e1682b..1e7b6e483 100644 --- a/annif/static/js/annif.js +++ b/annif/static/js/annif.js @@ -43,4 +43,6 @@ $(document).ready(function() { clearResults(); analyze(); }); + + }); diff --git a/annif/templates/home.html b/annif/templates/home.html index 7a21f566b..7bb8eaa23 100644 --- a/annif/templates/home.html +++ b/annif/templates/home.html @@ -30,35 +30,60 @@

REST API

See the Swagger documentation for API specification.

-
-
-
-
- +
+
+
+
-
-
-
- - +
+ + +
- - -

Results

-
    -
-
- + - + From 3775f7361a99d4e236bb64b528238932f5072c57 Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Sat, 26 Jan 2019 21:57:22 +1300 Subject: [PATCH 3/7] Replace JQuery + HTML by simple VueJS app + components --- annif/static/js/annif.js | 48 ------------------ annif/templates/home.html | 100 +++++++++++++++++++++++++++++++++++--- 2 files changed, 94 insertions(+), 54 deletions(-) delete mode 100644 annif/static/js/annif.js diff --git a/annif/static/js/annif.js b/annif/static/js/annif.js deleted file mode 100644 index 1e7b6e483..000000000 --- a/annif/static/js/annif.js +++ /dev/null @@ -1,48 +0,0 @@ -function clearResults() { - $('#results').empty(); -} - -function fetch_projects() { - $.ajax({ - url: "/v1/projects", - method: 'GET', - success: function(data) { - $.each(data.projects, function(idx, value) { - $('#project').append( - $('