Sfoglia il codice sorgente

Fix lack of autocompl; change input field names.

Add:
        static/js/index.advanced-search-form.js
                -Fix lack of drop-down autocompletion in new `language` fields.
                -Change the names displayed next to input fields to match those
                present in the sidebar.
tags/v1.0^2
Severyn Kozak 10 anni fa
parent
commit
9f007e8d65
2 ha cambiato i file con 30 aggiunte e 9 eliminazioni
  1. +23
    -9
      static/js/index.advanced-search-form.js
  2. +7
    -0
      static/sass/index.sass

+ 23
- 9
static/js/index.advanced-search-form.js Vedi File

@@ -7,10 +7,10 @@ var searchGroups = $("div#search-groups");
/*
* Load all advanced search form libraries.
*/
(function loadInputFieldWidgets(){
function loadInputFieldWidgets(){
$(".search-group input#date-last-modified").datepicker();
$(".search-group input#date-created").datepicker();
$("#autocomplete").autocomplete({
$(".search-group input#autocomplete").autocomplete({
source: function(request, response){
var matcher = new RegExp(
$.ui.autocomplete.escapeRegex(request.term), "i");
@@ -19,7 +19,8 @@ var searchGroups = $("div#search-groups");
}));
}
});
}());
};
loadInputFieldWidgets();

/*
* Set all advanced search form button callbacks.
@@ -35,7 +36,8 @@ var searchGroups = $("div#search-groups");
id : "selected"
});
searchGroups.append(
searchGroup.append(createSearchGroupInput("language")));
searchGroup.append(createSearchGroupInput("language", "languages")));
loadInputFieldWidgets();
$("div#sidebar input[type=checkbox]#language").prop("checked", true);

searchGroups[0].scrollTop = searchGroups[0].scrollHeight;
@@ -74,7 +76,10 @@ var searchGroups = $("div#search-groups");
var fieldId = $(this).prop("id");
if($(this).is(":checked")){
$("div.search-group#selected").append(
$.parseHTML(createSearchGroupInput(fieldId)));
$.parseHTML(createSearchGroupInput(
fieldId, $(this).next("label").children("div").
text())));
loadInputFieldWidgets();
if(fieldId.slice(0, 4) == "date")
$(".search-group#selected ." + fieldId).datepicker();
}
@@ -103,16 +108,25 @@ var searchGroups = $("div#search-groups");
* Return an HTML string representing a new input field div in a search group.
*
* @param fieldId The id of the input field div, and its child elements.
* @param name The name to display next to the input field.
*/
function createSearchGroupInput(fieldId){
return [
function createSearchGroupInput(fieldId, name){
var fieldHTML = [
"<div id='" + fieldId + "'>",
"<div class='name'>" + fieldId.replace(/-/g, " ") + "</div>",
"<div class='name'>" + name + "</div>",
"<input class='" + fieldId + "' name='" + fieldId + "'type='text'>",
"<input type='checkbox' name='regex'>",
"<span class='regex'>Regex</span>",
"</div>"
].join("");
]

if(fieldId == "language")
fieldHTML[2] = [
"<input id='autocomplete' class='language'",
"name='language' type='text'>"
].join(" ");

return fieldHTML.join("");
}

/*


+ 7
- 0
static/sass/index.sass Vedi File

@@ -155,6 +155,7 @@ div#search-field
padding-top: 3%
margin-left: auto
margin-right: auto
min-width: 800px
width: 60%

input
@@ -166,6 +167,9 @@ div#search-field
&:hover
border: 1px solid $baseColor1

button#advanced-search
margin-left: 30px

div#advanced-search
background-color: white
border: 1px solid $baseColor3
@@ -310,6 +314,9 @@ div#advanced-search
span.regex
font-size: 80%

&:hover
cursor: pointer

&#selected
background-color: #CACACA



Caricamento…
Annulla
Salva