Browse Source

Add submit button to adv-search form.

Add:
        templates/index.html, static/(js/index.advanced-search-form.js,
        sass/index.sass)
                -Add a "submit" button to the advanced search form, with styling
                and appropriate callbacks.
tags/v1.0^2
Severyn Kozak 10 years ago
parent
commit
7debb99461
4 changed files with 22 additions and 1 deletions
  1. +9
    -0
      static/js/index.advanced-search-form.js
  2. +2
    -0
      static/js/index.js
  3. +8
    -1
      static/sass/index.sass
  4. +3
    -0
      templates/index.html

+ 9
- 0
static/js/index.advanced-search-form.js View File

@@ -92,6 +92,13 @@ loadInputFieldWidgets();
searchGroups[0].scrollTop = searchGroups[0].scrollHeight; searchGroups[0].scrollTop = searchGroups[0].scrollHeight;
}); });


$("div#advanced-search button#submit").click(function(){
$("div#advanced-search").hide();
advancedSearchButton.removeClass("clicked");
assembleQuery();
queryServer();
})

var previousAdvancedQuery = ""; var previousAdvancedQuery = "";
var searchBar = $("form#search-bar input[name=query]"); var searchBar = $("form#search-bar input[name=query]");


@@ -158,6 +165,8 @@ function assembleQuery(){
* *
* @param field (DOM element) An `input[type=text]` element. * @param field (DOM element) An `input[type=text]` element.
* @param hasRegex (boolean) Whether or not the field's value has regex. * @param hasRegex (boolean) Whether or not the field's value has regex.
*
* @return The processed query.
*/ */
function genFieldQueryString(field, hasRegex){ function genFieldQueryString(field, hasRegex){
var terms = field.value.replace(/\\/g, "\\\\").replace(/\"/g, "\\\""); var terms = field.value.replace(/\\/g, "\\\\").replace(/\"/g, "\\\"");


+ 2
- 0
static/js/index.js View File

@@ -47,6 +47,7 @@ var searchResultsPage = 1;
advancedSearchButton.removeClass("clicked"); advancedSearchButton.removeClass("clicked");
if($("div#results .result").length == 0) if($("div#results .result").length == 0)
searchField.removeClass("partly-visible"); searchField.removeClass("partly-visible");
clearResults();
} }
}); });


@@ -197,6 +198,7 @@ function finishedTyping(){
searchField.removeClass("partly-visible"); searchField.removeClass("partly-visible");
$("div#advanced-search").fadeOut(50); $("div#advanced-search").fadeOut(50);
advancedSearchButton.removeClass("clicked"); advancedSearchButton.removeClass("clicked");
clearResults();
} }
} }




+ 8
- 1
static/sass/index.sass View File

@@ -205,6 +205,7 @@ div#advanced-search
float: right float: right
font-size: 80% font-size: 80%
font-weight: bold font-weight: bold
margin-right: 1%
padding-left: 4% padding-left: 4%
padding-right: 4% padding-right: 4%


@@ -213,7 +214,6 @@ div#advanced-search


&#add-group &#add-group
background-color: #7FAFFC background-color: #7FAFFC
margin-right: 1%


&:hover &:hover
background-color: #609AF8 background-color: #609AF8
@@ -224,6 +224,12 @@ div#advanced-search
&:hover &:hover
background-color: #D63636 background-color: #D63636


&#submit
background-color: #4ee76c

&:hover
background-color: #0FDD38

>div >div
@include vendor(box-sizing, border-box) @include vendor(box-sizing, border-box)


@@ -316,6 +322,7 @@ div#advanced-search


&:hover &:hover
cursor: pointer cursor: pointer
background-color: #d6d6d6


&#selected &#selected
background-color: #CACACA background-color: #CACACA


+ 3
- 0
templates/index.html View File

@@ -39,6 +39,9 @@
<div id="col1">Fields</div <div id="col1">Fields</div
><div id="col2"> ><div id="col2">
Search groups Search groups
<button id="submit">
<div>Search</div>
</button>
<button id="add-group"> <button id="add-group">
<div><span>+</span> Add</div> <div><span>+</span> Add</div>
</button> </button>


Loading…
Cancel
Save