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 = [];
$.getJSON(queryUrl, function(result){
if("error" in result)
errorMessage(result["error"]);
insertErrorMessage(result["error"]);
else
for(var codelet = 0; codelet < result["results"].length; codelet++)
resultDivs.push(result["results"][codelet]);
@@ -435,8 +435,10 @@ function loadMoreResults(){
*
* @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
color: orange

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

span
color: $baseColor1
font-size: 150%

&.disable-hover
pointer-events: none



+ 1
- 1
templates/index.html View File

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

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


Loading…
Cancel
Save