Browse Source

Add cooccurrence button

Alessia 2 years ago
parent
commit
db59978f9d
8 changed files with 72 additions and 115 deletions
  1. 0 27
      site/index.html
  2. 0 54
      site/index.js
  3. 0 1
      site/vendor/jquery/jquery.min.js
  4. 5 0
      site2/css/mystyle.css
  5. BIN
      site2/img/TIgrO icon.png
  6. BIN
      site2/img/tigro.jpeg
  7. 43 33
      site2/index.html
  8. 24 0
      site2/js/ricerca.js

+ 0 - 27
site/index.html

@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<html>
-
-<head>
-  <meta charset="UTF-8">
-</head>
-
-
-<body>
-
-  <form id="simple_query">
-    <div>
-      Enter a word to search<br/>
-      <input type="text" id="query_text">
-    </div>
-  </form>
-
-  <span id="result"></span>
-
-
-  <!-- Javascript includes -->
-  <script src="vendor/jquery/jquery.min.js"></script>
-  <script src="index.js"></script>
-
-</body>
-
-</html>

+ 0 - 54
site/index.js

@@ -1,54 +0,0 @@
-
-// Config data -- could be whatever
-// should be moved to a different file if/when there's a lot of it
-const flask_be_address = 'http://127.0.0.1:5000'
-
-
-// PAGE INITIALIZER -- function that gets auto-executed when the page's DOM is loaded
-$(function(){
-
-    // Handle 'simple_query' form submit
-    $('#simple_query').submit(
-        
-        function (e) {
-            
-            // Prevent default handling of form
-            e.preventDefault();
-
-            // Get form data, define custom object to be sent to the BE
-            let f = $(this);
-            let word = f.find('[id=query_text]').val();
-            console.log(word)
-            //
-            // DTO: 'Data Transfer Object'
-            let queryDTO = {
-                word: word
-            }
-
-            // Do async post request to BE service
-            getData(queryDTO)
-                // After request finishes, process response data
-                .done(response => processData(response));
-           
-        }
-    )
-});
-
-
-// Separate function to handle HTTP request -- could be moved to different file (a service)
-function getData(queryDTO){
-
-    let url = flask_be_address.concat('/simple_get_query');
-
-    return $.post(url, queryDTO);
-}
-
-
-// Separate function to handle response data -- could be moved to different file (a service)
-function processData(response){
-    console.log(response)
-    if(response.length==0){
-        alert('No results!')
-    }
-    $("#result").html(response.join('<br/>'));
-}

File diff suppressed because it is too large
+ 0 - 1
site/vendor/jquery/jquery.min.js


+ 5 - 0
site2/css/mystyle.css

@@ -11,6 +11,11 @@
 
 }
 
+#logo {
+  width:100px;
+  height:auto;
+}
+
 /* The container must be positioned relative: */
 .custom-select {
     position: relative;

BIN
site2/img/TIgrO icon.png


BIN
site2/img/tigro.jpeg


+ 43 - 33
site2/index.html

@@ -47,52 +47,62 @@
    <div class="container">
 
       <div id="title" class="row justify-content-center align-items-center">
+         <img id="logo" src="img/TIgrO icon.png" />
          <h1>Progetto 2023</h1>
       </div>
 
-      <div class="row height d-flex justify-content-center align-items-center">
-
-         <div class="col">
-            
-            <div class="row">
-               <div class="col-6">
-                  <div class="input-group form-check">
-                     <input id="barraDiRicerca" type="text" class="form-control" aria-label="Text input with dropdown button">
-                        <select id="flViewBy">
-                        <option value="forma" selected="selected">Forma</option>
-                        <option value="lemma">Lemma</option>
-                        </select>
+      <div id="search_form">
+         <div id="occ_0" class="row height d-flex justify-content-center align-items-center">
+
+            <div class="col search_params">
+               
+               <div class="row">
+                  <div class="col-6">
+                     <div class="input-group form-check">
+                        <input id="barraDiRicerca" type="text" class="form-control" aria-label="Text input with dropdown button">
+                           <select id="flViewBy">
+                           <option value="forma" selected="selected">Forma</option>
+                           <option value="lemma">Lemma</option>
+                           </select>
+                     </div>
                   </div>
-               </div>
-               <div class="col">
-                  <div class="form-check">
-                     <input id="ricercaEx" value="ricerca_espansa" class="form-check-input" type="checkbox" name="espansa" >
-                     <label class="form-check-label" for="checkbox1">
-                     Ricerca espansa
-                     </label>
+                  <div class="col">
+                     <div class="form-check">
+                        <input id="ricercaEx" value="ricerca_espansa" class="form-check-input" type="checkbox" name="espansa" >
+                        <label class="form-check-label" for="checkbox1">
+                        Ricerca espansa
+                        </label>
+                     </div>
                   </div>
-               </div>
-               <div class="col">
-                  <div class="form-check">
-                     <input id="raddoppiata" value="raddoppiata" class="form-check-input" type="checkbox" name="raddoppiata">
-                     <label class="form-check-label" for="checkbox2">
-                     Raddoppiata
-                     </label>
+                  <div class="col">
+                     <div class="form-check">
+                        <input id="raddoppiata" value="raddoppiata" class="form-check-input" type="checkbox" name="raddoppiata">
+                        <label class="form-check-label" for="checkbox2">
+                        Raddoppiata
+                        </label>
+                     </div>
                   </div>
-               </div>
-               <div class="col">
-                  <div class="form-check">
-                     <input id="showOther" value="mostra" class="form-check-input" type="checkbox" name="altro">
-                     <label class="form-check-label" for="showOther">
-                     Mostra <span id="mostraFormaLemma">lemmi</span>
-                     </label>
+                  <div class="col">
+                     <div class="form-check">
+                        <input id="showOther" value="mostra" class="form-check-input" type="checkbox" name="altro">
+                        <label class="form-check-label" for="showOther">
+                        Mostra <span id="mostraFormaLemma">lemmi</span>
+                        </label>
+                     </div>
                   </div>
+
                </div>
 
             </div>
 
          </div>
+      </div>
 
+      <div class="input-group">
+         <div class="input-group-prepend">
+           <div class="btn btn-outline-secondary" id="btnGroupAddon">&#43</div>
+         </div>
+         <button id="add_cc" class="btn" onclick="add_cooccurrence()">Aggiungi cooccorrenza</button>
       </div>
 
       <div id="searchBar" class="row">

+ 24 - 0
site2/js/ricerca.js

@@ -86,3 +86,27 @@ $( document ).ready(function() {
 function changeFL(word) {
   $("#mostraFormaLemma").html(word);
 }
+
+var occ = 0;
+
+function add_cooccurrence() {
+
+  if (occ > 8) {
+    alert("Hai esaurito i parametri a disposizione");
+  }
+  else {
+    occ = occ + 1;
+    
+    var new_id = "occ_" + occ;
+    var new_par = document.createElement('div');
+    new_par.className = "row height d-flex justify-content-center align-items-center";
+    new_par.id = new_id;
+    const node = document.getElementsByClassName("search_params")[0];
+    const clone = node.cloneNode(true);
+    new_par.append(clone);
+    console.log(clone);
+    $("#search_form").append(new_par);
+  }
+ 
+  
+}

Some files were not shown because too many files changed in this diff