display a create own option before a search is performed
This commit is contained in:
parent
ccd359dc2a
commit
2fb20f1efe
3 changed files with 26 additions and 16 deletions
|
@ -26,3 +26,8 @@
|
|||
form#addConceptForm {
|
||||
display:none;
|
||||
}
|
||||
|
||||
form#addConceptForm span#createOwnOne{
|
||||
float:left;
|
||||
margin-top:24px
|
||||
}
|
|
@ -55,7 +55,8 @@ var addConceptForm = {
|
|||
//remove links
|
||||
this.removeConceptLinks = $('a.remove');
|
||||
this.errors = $('#errors');
|
||||
this.createOwn = $('#createOwn');
|
||||
this.createOwn1 = $('#createOwnOne');
|
||||
this.createOwn2 = $('#createOwnTwo');
|
||||
this.orSpan = $('span.or')
|
||||
},
|
||||
|
||||
|
@ -90,7 +91,7 @@ var addConceptForm = {
|
|||
this.clearSearchResults();
|
||||
// Hide the create own link, add selected button and "or"" span
|
||||
this.orSpan.hide();
|
||||
this.createOwn.hide();
|
||||
this.createOwn2.hide();
|
||||
this.submit.hide();
|
||||
//Also clear the search input
|
||||
this.searchTerm.val("");
|
||||
|
@ -114,14 +115,17 @@ var addConceptForm = {
|
|||
clearErrors:function() {
|
||||
addConceptForm.errors.empty();
|
||||
},
|
||||
showHiddenElements:function() {
|
||||
showHiddenElements:function(results) {
|
||||
this.createOwn1.hide();
|
||||
if ( results ) {
|
||||
this.orSpan.show();
|
||||
this.createOwn.show();
|
||||
this.createOwn2.show();
|
||||
this.submit.show();
|
||||
},
|
||||
showSpanAndCreateOption:function() {
|
||||
}
|
||||
else {
|
||||
this.orSpan.show();
|
||||
this.createOwn.show();
|
||||
this.createOwn2.show();
|
||||
}
|
||||
},
|
||||
showConceptListOnlyView: function() {
|
||||
this.hideForm();
|
||||
|
@ -131,7 +135,7 @@ var addConceptForm = {
|
|||
//Get value of search term
|
||||
var searchValue = this.searchTerm.val();
|
||||
var checkedVocabSource = $('input:radio[name="source"]:checked');
|
||||
var createLink = this.createOwn;
|
||||
var hasResults = false;
|
||||
if(!checkedVocabSource.length) {
|
||||
addConceptForm.showUncheckedSourceError();
|
||||
return;
|
||||
|
@ -173,10 +177,11 @@ var addConceptForm = {
|
|||
if(htmlAdd.length) {
|
||||
$('#selectedConcept').html(htmlAdd);
|
||||
if (htmlAdd.indexOf("No search results") >= 0) {
|
||||
addConceptForm.showSpanAndCreateOption();
|
||||
addConceptForm.showHiddenElements(hasResults);
|
||||
}
|
||||
else {
|
||||
addConceptForm.showHiddenElements();
|
||||
hasResults = true;
|
||||
addConceptForm.showHiddenElements(hasResults);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -90,8 +90,8 @@
|
|||
</#list>
|
||||
<p class="inline-search">
|
||||
<input type="text" id="searchTerm" label="Search" class="acSelector" size="35" />
|
||||
<input type="button" class="submit concept-search" id="searchButton" name="searchButton" value="Search"/>
|
||||
</p>
|
||||
<input type="button" class="submit concept-search" id="searchButton" name="searchButton" value="Search"/>
|
||||
</p><span id="createOwnOne"> or <a href="${userDefinedConceptUrl}" >Create your own concept </a></span>
|
||||
<input type="hidden" id="conceptNode" name="conceptNode" value=""/> <!-- Field value populated by JavaScript -->
|
||||
<input type="hidden" id="conceptLabel" name="conceptLabel" value="" /> <!-- Field value populated by JavaScript -->
|
||||
<input type="hidden" id="conceptSource" name="conceptSource" value="" /> <!-- Field value populated by JavaScript -->
|
||||
|
@ -107,7 +107,7 @@
|
|||
<input type="submit" id="submit" name="submit" value="Add Selected Concept" />
|
||||
|
||||
</p>
|
||||
<div id="createOwn"><br />
|
||||
<div id="createOwnTwo"><br />
|
||||
<a href="${userDefinedConceptUrl}" > Can't find the concept you want? Create your own.</a>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue