source: trunk/grails-app/views/studyWizard/pages/_subjects.gsp @ 1865

Last change on this file since 1865 was 1865, checked in by work@…, 9 years ago
  • resolves gscf #447
  • gdt up to 0.0.49
  • Property svn:keywords set to Rev Author Date
File size: 3.4 KB
Line 
1<%
2/**
3 * Subjects page
4 *
5 * @author  Jeroen Wesbeek
6 * @since   20100113
7 * @package wizard
8 * @see     dbnp.studycapturing.WizardTagLib::previousNext
9 * @see     dbnp.studycapturing.WizardController
10 *
11 * Revision information:
12 * $Rev: 1865 $
13 * $Author: work@osx.eu $
14 * $Date: 2011-05-23 15:28:51 +0000 (ma, 23 mei 2011) $
15 */
16
17def speciesOntologies = dbnp.studycapturing.Subject.giveDomainFields().find { it.name == 'species' }.ontologies.collect { it.ncboId }
18%>
19<af:page>
20        <span class="info">
21                <span class="title">Add subjects to your study</span>
22                Describe the subjects studied with all details available. Use the template that contains the necessary fields. New templates can be defined (based on existing templates).
23                To add subjects to the study, select the correct species and template, input the number of subjects you want to add, and click 'Add'. They will appear below the 'Add' button.
24                As multiple species may be studied within one study, there is no hard link between the template and the species.
25                <br/><i>Note that you can edit multiple subjects at once by selecting multiple rows by either ctrl-clicking them or dragging a selection over them in the space between the fields.</i>
26                <br/><i>Note that depending on the size of your browser window and the template, additional fields can be reached by the slider at the bottom of the page.</i>         
27        </span>
28
29        <af:textFieldElement name="addNumber" description="Number of subjects to add" error="addNumber" value="${values?.addNumber}" size="4" maxlength="4">
30                The number of subjects to add to your study
31        </af:textFieldElement>
32        <af:termElement name="species" description="of species" value="${values?.species}" ontologies="${speciesOntologies.join(',')}" addDummy="true">
33                The species of the subjects you would like to add to your study
34        </af:termElement>
35        <af:templateElement name="template" description="with template" value="${values?.template}" error="template" entity="${dbnp.studycapturing.Subject}" ontologies="${speciesOntologies.join( ',' )}" addDummy="true">
36                The template to use for these subjects
37        </af:templateElement>
38        <af:ajaxButtonElement name="add" value="Add" afterSuccess="onPage()">
39        </af:ajaxButtonElement>
40
41        <g:if test="${study.subjects}">
42                <g:each var="template" in="${study.giveSubjectTemplates()}">
43                        <g:set var="showHeader" value="${true}" />
44                        <h1>${template} template</h1>
45                        <div class="tableEditor">
46                        <g:each var="subject" status="s" in="${study.giveSubjectsForTemplate(template)}">
47                                <g:if test="${showHeader}">
48                                <g:set var="showHeader" value="${false}" />
49                                <div class="header">
50                                  <div class="firstColumn"></div>
51                                  <af:templateColumnHeaders class="column" entity="${subject}" columnWidths="[Name:200, Species: 150]" />
52                                </div>
53                                </g:if>
54                                <div class="row" identifier="${subject.getIdentifier()}">
55                                        <div class="firstColumn">
56                                                <input type="button" value="" action="delete" class="delete" identifier="${subject.getIdentifier()}" />
57                                        </div>
58                                        <af:templateColumns class="column" entity="${subject}" name="subject_${subject.getIdentifier()}" />
59                                </div>
60                        </g:each>
61                        </div>
62                </g:each>
63        </g:if>
64
65        <script type="text/javascript">
66        $(document).ready(function() {
67                if (tableEditor) {
68                        tableEditor.registerActionCallback('delete', function() {
69                                if (confirm('are you sure you want to delete ' + ((this.length>1) ? 'these '+this.length+' subjects?' : 'this subject?'))) {
70                                        $('input[name="do"]').val(this);
71                                        <af:ajaxSubmitJs name="delete" afterSuccess="onPage()" />
72                                }
73                        });
74                }
75        });
76        </script>
77</af:page>
Note: See TracBrowser for help on using the repository browser.