Browse Source

Add UI error messages. Close #50.

Add:
    templates/index.html, static/(js/index.js, sass/index.sass)
        -Add error messages for failed queries.
tags/v1.0^2
Severyn Kozak 10 years ago
parent
commit
9b4d5e4f5b
3 changed files with 16 additions and 5 deletions
  1. +6
    -4
      static/js/index.js
  2. +9
    -0
      static/sass/index.sass
  3. +1
    -1
      templates/index.html

+ 6
- 4
static/js/index.js View File

@@ -398,7 +398,7 @@ function queryServer(){
var resultDivs = []; var resultDivs = [];
$.getJSON(queryUrl, function(result){ $.getJSON(queryUrl, function(result){
if("error" in result) if("error" in result)
errorMessage(result["error"]);
insertErrorMessage(result["error"]);
else else
for(var codelet = 0; codelet < result["results"].length; codelet++) for(var codelet = 0; codelet < result["results"].length; codelet++)
resultDivs.push(result["results"][codelet]); resultDivs.push(result["results"][codelet]);
@@ -435,8 +435,10 @@ function loadMoreResults(){
* *
* @param msg (str) The message string. * @param msg (str) The message string.
*/ */
function errorMessage(msg){
alert(msg);
function insertErrorMessage(msg){
var error = $("<div id='error'><span>Error: </span></div>");
error.append(msg);
resultsDiv.appendChild(error[0]);
} }


loadMoreResults();
// loadMoreResults();

+ 9
- 0
static/sass/index.sass View File

@@ -296,6 +296,15 @@ div#results
&:hover &:hover
color: orange color: orange


div#error
font-size: 170%
margin-top: 22%
text-align: center

span
color: $baseColor1
font-size: 150%

&.disable-hover &.disable-hover
pointer-events: none pointer-events: none




+ 1
- 1
templates/index.html View File

@@ -18,7 +18,7 @@
= endblock = endblock


= block body = block body
<div id="search-field" class="partly-visible">
<div id="search-field">
<a id="title" href="/"> <a id="title" href="/">
<div id="title"> <div id="title">
<span id="title-bit">bit</span <span id="title-bit">bit</span


Loading…
Cancel
Save