Skip to content
This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Commit 3b42f26

Browse files
committed
added select2 js library for enhanced select boxes
1 parent eeb26f1 commit 3b42f26

File tree

72 files changed

+6219
-246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+6219
-246
lines changed

GeneTracker/grails-app/views/cellLineData/create.gsp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<label for="cellLine"><g:message code="cellLineData.cellLine.label" default="Cell Line" /></label>
3131
</td>
3232
<td valign="top" class="value ${hasErrors(bean: cellLineDataInstance, field: 'cellLine', 'errors')}">
33-
<g:select name="cellLine.id" from="${org.openlab.genetracker.CellLine.list(sort:'label')}" optionKey="id" value="${cellLineDataInstance?.cellLine?.id}" />
33+
<g:select class="select2" name="cellLine.id" from="${org.openlab.genetracker.CellLine.list(sort:'label')}" optionKey="id" value="${cellLineDataInstance?.cellLine?.id}" />
3434
</td>
3535
</tr>
3636

@@ -39,7 +39,7 @@
3939
<label for="acceptor"><g:message code="cellLineData.acceptor.label" default="Acceptor" /></label>
4040
</td>
4141
<td valign="top" class="value ${hasErrors(bean: cellLineDataInstance, field: 'acceptor', 'errors')}">
42-
<g:select name="acceptor.id" from="${org.openlab.genetracker.vector.Acceptor.list(sort:'label')}" optionKey="id" noSelection="['':'']" value="${cellLineDataInstance?.acceptor?.id}" />
42+
<g:select class="select2" name="acceptor.id" from="${org.openlab.genetracker.vector.Acceptor.list(sort:'label')}" optionKey="id" noSelection="['':'']" value="${cellLineDataInstance?.acceptor?.id}" />
4343
</td>
4444
</tr>
4545

@@ -53,7 +53,7 @@
5353
${cellLineDataInstance.firstRecombinant}
5454
</g:if>
5555
<g:else>
56-
<g:select noSelection="['':'']" onChange="${remoteFunction(action: 'updateFirstVector', update: 'firstVectorSpan', params:'\'firstGene=\'+this.value')}" name="firstRecombinantGene.id" from="${org.openlab.genetracker.Gene.list(sort:'name')}" optionKey="id" />
56+
<g:select class="select2" noSelection="['':'']" onChange="${remoteFunction(action: 'updateFirstVector', update: 'firstVectorSpan', params:'\'firstGene=\'+this.value')}" name="firstRecombinantGene.id" from="${org.openlab.genetracker.Gene.list(sort:'name')}" optionKey="id" />
5757
<span id="firstVectorSpan">${cellLineDataInstance?.firstRecombinant?.vector?:"Select a gene"}</span>
5858
</g:else>
5959
</td>
@@ -69,7 +69,7 @@
6969
${cellLineDataInstance.secondRecombinant}
7070
</g:if>
7171
<g:else>
72-
<g:select noSelection="['':'']" onChange="${remoteFunction(action: 'updateSecondVector', update: 'secondVectorSpan', params:'\'secondGene=\'+this.value')}" name="firstRecombinantGene.id" from="${org.openlab.genetracker.Gene.list(sort:'name')}" optionKey="id" value="${cellLineDataInstance?.secondRecombinant?.gene?.id}" />
72+
<g:select class="select2" noSelection="['':'']" onChange="${remoteFunction(action: 'updateSecondVector', update: 'secondVectorSpan', params:'\'secondGene=\'+this.value')}" name="firstRecombinantGene.id" from="${org.openlab.genetracker.Gene.list(sort:'name')}" optionKey="id" value="${cellLineDataInstance?.secondRecombinant?.gene?.id}" />
7373
<span id="secondVectorSpan">${cellLineDataInstance?.secondRecombinant?.vector?:"Select a gene"}</span>
7474
</g:else>
7575
</td>
@@ -80,7 +80,7 @@
8080
<label for="cultureMedia"><g:message code="cellLineData.cultureMedia.label" default="Culture Media" /></label>
8181
</td>
8282
<td valign="top" class="value ${hasErrors(bean: cellLineDataInstance, field: 'cultureMedia', 'errors')}">
83-
<g:select name="cultureMedia.id" from="${org.openlab.genetracker.CultureMedia.list(sort:'label')}" optionKey="id" value="${cellLineDataInstance?.cultureMedia?.id}" noSelection="['null': '']" />
83+
<g:select class="select2" name="cultureMedia.id" from="${org.openlab.genetracker.CultureMedia.list(sort:'label')}" optionKey="id" value="${cellLineDataInstance?.cultureMedia?.id}" noSelection="['null': '']" />
8484
</td>
8585
</tr>
8686

OpenLabFrontend/OpenLabFrontend-grailsPlugins.iml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@
128128
<sourceFolder url="file://$USER_HOME$/.grails/2.2.2/projects/OpenLabFramework/plugins/spring-security-core-1.2.7.3/grails-app/services" isTestSource="false" />
129129
<sourceFolder url="file://$USER_HOME$/.grails/2.2.2/projects/OpenLabFramework/plugins/spring-security-core-1.2.7.3/grails-app/taglib" isTestSource="false" />
130130
</content>
131+
<content url="file://$USER_HOME$/.grails/2.2.2/projects/OpenLabFramework/plugins/tomcat-2.2.2" />
132+
<content url="file://$USER_HOME$/.grails/2.2.2/projects/OpenLabFramework/plugins/webflow-2.0.0" />
131133
<content url="file://$USER_HOME$/.grails/2.2.2/projects/OpenLabFramework/plugins/webxml-1.4.1">
132134
<sourceFolder url="file://$USER_HOME$/.grails/2.2.2/projects/OpenLabFramework/plugins/webxml-1.4.1/src/groovy" isTestSource="false" />
133135
</content>

OpenLabFrontend/grails-app/conf/Config.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ grails.resources.modules = {
212212
dependsOn 'jquery'
213213
resource url: 'js/jquery.jstree.js'
214214
}
215+
select2{
216+
dependsOn 'jquery'
217+
resource url: 'js/select2/select2.min.js'
218+
}
215219
jquerymobileaddons {
216220
dependsOn 'jquery-mobile'
217221
resource url: 'js/jquery.mobile.pagination.js'
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
<g:select name="${propertyName}Select" from="${domainClassList}" optionKey="id" value="${currentValue?.id}" noSelection="['':'-None-']"
2-
onchange="${remoteFunction(controller: targetController, action:'saveEditable',update: targetUpdate, id: id, params:'\'propertyName='+propertyName+'&referencedClassName='+referencedClassName+'&selected=\' + this.value' )}"/>
1+
<g:select class="select2" name="${propertyName}Select" from="${domainClassList}" optionKey="id" value="${currentValue?.id}" noSelection="['':'-None-']"
2+
onchange="${remoteFunction(controller: targetController, action:'saveEditable',update: targetUpdate, id: id, params:'\'propertyName='+propertyName+'&referencedClassName='+referencedClassName+'&selected=\' + this.value' )}"/>
3+

OpenLabFrontend/grails-app/views/layouts/body.gsp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<head>
22
<!-- Main CSS at the end to make sure it is effective -->
33
<r:require module="prototypeManual"/>
4+
<link rel="stylesheet" href="${resource(dir: 'css', file: 'select2.css')}"/>
5+
46
<r:layoutResources/>
57
<g:set var="historyURL" value="${request.forwardURI+params.toQueryString()}" />
68

@@ -21,5 +23,11 @@
2123
</head>
2224
<body>
2325
<g:layoutBody/>
26+
27+
<!-- init select boxes -->
28+
<script type="text/javascript">
29+
YAHOO.util.Event.onDOMReady(function () { jQuery(".select2").select2({width:165}); });
30+
</script>
31+
2432
<r:layoutResources/>
2533
</body>

OpenLabFrontend/grails-app/views/layouts/main.gsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<!-- customized CSS files for yui -->
2626
<r:require modules="myyui"/>
2727
<r:require module="fileuploader" />
28+
<r:require module="select2"/>
2829
<!-- custom event handling -->
2930
<r:script disposition="head">
3031

OpenLabFrontend/grails-app/views/project/_form.gsp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@
1919
<g:textField name="description" value="${projectInstance?.description}"/>
2020
</div>
2121

22-
<div class="fieldcontain ${hasErrors(bean: projectInstance, field: 'object', 'error')} ">
23-
<label for="object">
24-
<g:message code="project.object.label" default="Object"/>
25-
26-
</label>
27-
<g:select name="object" from="${org.openlab.main.DataObject.list()}" multiple="multiple" optionKey="id" size="5"
28-
value="${projectInstance?.object*.id}" class="many-to-many"/>
29-
</div>
30-
3122
<div class="fieldcontain ${hasErrors(bean: projectInstance, field: 'laboratory', 'error')} required">
3223
<label for="laboratory">
3324
<g:message code="project.laboratory.label" default="Laboratory"/>

0 commit comments

Comments
 (0)