Browse Source

Search-result style edits. Close #41.

Add:
    static/sass/index.sass
        -Add style rules to fix bugs, and improve the appearance of some minor
        details.

    static/js/index.advanced-search-form.js
        -Close #41. Add statements to scroll to the bottom of the search-groups
        div when any search-groups/input fields are added.

Fix:
    bitshift/languages.py
        -Python's `u"string"` unicode specifier results in a Javascript syntax
        error when pasted verbatim into `templates/index.html` by Flask; add
        `str()` to the languages array loader to fix it.
tags/v1.0^2
Severyn Kozak 10 years ago
parent
commit
69ca385939
5 changed files with 26 additions and 8 deletions
  1. +1
    -1
      bitshift/languages.py
  2. +5
    -1
      static/js/index.advanced-search-form.js
  3. +2
    -0
      static/js/index.js
  4. +17
    -5
      static/sass/index.sass
  5. +1
    -1
      templates/index.html

+ 1
- 1
bitshift/languages.py View File

@@ -2,4 +2,4 @@ import json
from os import path from os import path


with open(path.join(path.dirname(__file__), "languages.json")) as lang_json: with open(path.join(path.dirname(__file__), "languages.json")) as lang_json:
LANGS = [lang for lang in json.load(lang_json)["languages"]]
LANGS = [str(lang) for lang in json.load(lang_json)["languages"]]

+ 5
- 1
static/js/index.advanced-search-form.js View File

@@ -37,6 +37,8 @@ var searchGroups = $("div#search-groups");
searchGroups.append( searchGroups.append(
searchGroup.append(createSearchGroupInput("language"))); searchGroup.append(createSearchGroupInput("language")));
$("div#sidebar input[type=checkbox]#language").prop("checked", true); $("div#sidebar input[type=checkbox]#language").prop("checked", true);

searchGroups[0].scrollTop = searchGroups[0].scrollHeight;
}); });


// Remove the currently selected group if it's not the only one, and mark // Remove the currently selected group if it's not the only one, and mark
@@ -82,6 +84,7 @@ var searchGroups = $("div#search-groups");
else else
$(this).prop("checked", true); $(this).prop("checked", true);
} }
searchGroups[0].scrollTop = searchGroups[0].scrollHeight;
}); });


var previousAdvancedQuery = ""; var previousAdvancedQuery = "";
@@ -129,7 +132,8 @@ function assembleQuery(){
groupQuery.push(genFieldQueryString( groupQuery.push(genFieldQueryString(
inputFields[field], regexCheckbox[field].checked)); inputFields[field], regexCheckbox[field].checked));


groupQueries.push(groupQuery.join(" AND "));
if(groupQuery.length > 0)
groupQueries.push(groupQuery.join(" AND "));
} }


return groupQueries.join(" OR "); return groupQueries.join(" OR ");


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

@@ -302,3 +302,5 @@ function loadMoreResults(){
result * 20); result * 20);
} }
} }

loadMoreResults();

+ 17
- 5
static/sass/index.sass View File

@@ -236,7 +236,7 @@ div#advanced-search


#search-groups #search-groups
margin-top: 1% margin-top: 1%
max-height: 93%
max-height: 87%
overflow-y: auto overflow-y: auto
width: 75% width: 75%


@@ -325,16 +325,20 @@ div#display-info
#site #site
text-transform: capitalize text-transform: capitalize




td#code td#code
width: $codeWidth width: $codeWidth
height: inherit height: inherit
padding: 0px

@include vendor(transition, width 0.2s ease-in-out) @include vendor(transition, width 0.2s ease-in-out)


.display-all &
width: 500px
// .display-all &
// width: 500px


#tablecontainer #tablecontainer
overflow: scroll
overflow: hidden
width: 100% width: 100%
height: inherit height: inherit
background-color: #49483e background-color: #49483e
@@ -344,9 +348,17 @@ td#code
table table
table-layout:fixed table-layout:fixed
border-collapse: collapse border-collapse: collapse
border: none
font-family: monospace font-family: monospace


.linenos
padding-left: 1%

pre
margin-top: 5px

.code pre
margin-top: 5px

div#hidden-info div#hidden-info
width: $hiddenInfoWidth width: $hiddenInfoWidth
margin-left: -$hiddenInfoWidth - 10px margin-left: -$hiddenInfoWidth - 10px


+ 1
- 1
templates/index.html View File

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


= block body = block body
<div id="search-field">
<div id="search-field" class="partly-visible">
<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