Pārlūkot izejas kodu

Prevent removal of last input fields.

Add:
    static/js/index.advanced-search-form.js
        -Prevent the user from removing the last input field in an
        advanced-search group.

Rem:
    templates/index.html
        -Remove vestige code accidentally preserved during the c6e5b4f merge.
tags/v1.0^2
Severyn Kozak pirms 10 gadiem
vecāks
revīzija
dc84a6fd9c
2 mainītis faili ar 8 papildinājumiem un 32 dzēšanām
  1. +8
    -7
      static/js/index.advanced-search-form.js
  2. +0
    -25
      templates/index.html

+ 8
- 7
static/js/index.advanced-search-form.js Parādīt failu

@@ -67,7 +67,7 @@ var searchGroups = $("div#search-groups");
})
});

// Add an input field to the currently selected search group.
// Toggle the presence of an input field.
$("div#sidebar input[type=checkbox]").click(function(){
var fieldId = $(this).prop("id");
if($(this).is(":checked")){
@@ -76,8 +76,12 @@ var searchGroups = $("div#search-groups");
if(fieldId.slice(0, 4) == "date")
$(".search-group#selected ." + fieldId).datepicker();
}
else
$("div.search-group#selected #" + fieldId).remove()
else {
if($(".search-group#selected").children("div").length > 1)
$(".search-group#selected #" + fieldId).remove()
else
$(this).prop("checked", true);
}
});

var previousAdvancedQuery = "";
@@ -140,8 +144,5 @@ function assembleQuery(){
function genFieldQueryString(field, hasRegex){
var terms = field.value.replace(/\\/g, "\\\\").replace(/\"/g, "\\\"");
var query = field.getAttribute("name") + ":" + (hasRegex?"re:":"") + terms;
if(field.value.indexOf('"') >= 0){
return '"' + query + '"';
}
return query;
return '"' + query + '"';
}

+ 0
- 25
templates/index.html Parādīt failu

@@ -89,31 +89,6 @@
<span class="regex">Regex</span>
</div>
</div>

<div id="lower-half">
<ul>
<li>
<label for="symbols">Symbols</label>
<input type="text" name="symbols" id="symbols"><br>
</li>

<li>
<label for="functions">Functions</label>
<input type="text" name="functions" id="functions"><br>
</li>

<li>
<label for="classes">Classes</label>
<input type="text" name="classes" id="classes"><br>
</li>

<li>
<label for="variables">Variables</label>
<input type="text" name="variables" id="variables"><br>
</li>

</ul>
</div>
</div>
</div>
</form>


Notiek ielāde…
Atcelt
Saglabāt