4 To import CSS one should use the <code>/util/import_css.mas</code>
5 mason component instead of a <code><link></code> element. This will
6 ensure that a link is added to the <code><head></code>
7 instead of being part of the <code><body></code>. One provides this
8 mason componant with a list of strings which are one of the following:
10 <li>The relative path to the CSS file from the /static/css folder.</li>
11 <li>The absolute site path to the CSS file.</li>
12 <li>A URL starting with the scheme name (i.e. 'http://...').</li>
14 <pre><%text><& /util/import_css.mas, paths => [
17 'http://foo.bar/buzz.css'
23 <h3>Importing JavaScript</h3>
26 To import JavaScript one should use the <code>/util/import_javascript.mas</code>
27 mason component. This will ensure that the script is loaded in the
28 <code><head></code> instead of being part of the
29 <code><body></code>. One provides this mason componant with a list of
30 strings which are the path to the JavaScript file with slashes replaced by
31 periods (e.g. <code>s/\/\./g</code>) and the file extension removed.
32 <pre><%text><& /util/import_javascript.mas, classes => [qw[ CXGN.Effects CXGN.Phenome.Locus MochiKit.DOM ]] &></%text></pre>
37 <h3>Info Sections</h3>
40 <&| /page/info_section.mas, id=>'Example_Info_Section',
41 title => 'Example Info Section', subtitle => 'This is a subtitle',
42 collapsible=>1, collapsed=>0 &>
44 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
50 <&| /page/info_section.mas, id=>'Example_Info_Section',
51 title => 'Example Info Section', subtitle => 'This is a subtitle',
52 collapsible=>1, collapsed=>0 &>
54 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
60 <h3>List Select Menus</h3>
63 <& /util/import_javascript.mas, classes => ['CXGN.List'] &>
64 <div id="select_div_id"></div>
65 <script type="text/javascript">
66 var list_obj = new CXGN.List();
67 var listhtml = list_obj.listSelect('select_div_id', ['accessions'], "Select an Accession List", undefined, undefined);
68 jQuery('#select_div_id').html(listhtml);
73 <div id="select_div_id"></div>
74 <script type="text/javascript">
75 var lo = new CXGN.List();
76 var listhtml = lo.listSelect('select_div_id', ['accessions'], "Select an Accession List", undefined, undefined);
77 jQuery('#select_div_id').html(listhtml);
81 <h3>HTML Selects (get_select_box)</h3>
84 <& /util/import_javascript.mas, classes => ['CXGN.BreedersToolbox.HTMLSelect'] &>
85 <div id="htmlselectexample"></div>
86 <script type="text/javascript">
87 get_select_box("trials", "htmlselectexample")
92 <div id="htmlselectexample"></div>
93 <script type="text/javascript">
94 get_select_box("trials", "htmlselectexample")
99 <h3>HTML Muliple Selects (get_select_box has many options e.g. search for trials in breeding_program_name)</h3>
102 <& /util/import_javascript.mas, classes => ['CXGN.BreedersToolbox.HTMLSelect'] &>
103 <div id="htmlselectmultipleexample"></div>
104 <script type="text/javascript">
105 get_select_box("trials", "htmlselectmultipleexample", {'multiple':1, 'size':10, 'breeding_program_name':'test'})
110 <div id="htmlselectmultipleexample"></div>
111 <script type="text/javascript">
112 get_select_box("trials", "htmlselectmultipleexample", {'multiple':1, 'size':10, 'breeding_program_name':'test'})
117 <h3>Add to List Menu</h3>
120 <div id="styleguide_add_to_list_menu"></div>
121 <div id="styleguide_add_to_list_items" style="display:none">item1
125 <script type="text/javascript">
126 addToListMenu("styleguide_add_to_list_menu", "styleguide_add_to_list_items", {
127 listType:'accessions'
133 <div id="styleguide_add_to_list_menu"></div>
134 <div id="styleguide_add_to_list_items" style="display:none">item1
138 <script type="text/javascript">
139 addToListMenu("styleguide_add_to_list_menu", "styleguide_add_to_list_items", {
140 listType:'accessions'
146 <h3>jQueryUI autocomplete</h3>
149 <input type="text" class="form-control" id="popname" value="" placeholder="Populations autocomplete...">
150 <script type="text/javascript">
151 jQuery('#popname').autocomplete({
152 source: '/ajax/stock/population_autocomplete',
158 <input type="text" class="form-control" id="popname" value="" placeholder="Populations autocomplete...">
159 <script type="text/javascript">
160 jQuery('#popname').autocomplete({
161 source: '/ajax/stock/population_autocomplete',
167 <h3>2 Column Detail Page Section</h3>
168 <p>This section is used from trial detail page and stock detail page, but ideally it would be used on all detail pages. The info_section_id specifies what to show in the main section. Buttons can be passed into the buttons_html.</p>
171 <& /page/detail_page_2_col_section.mas,
172 info_section_title => "<h4 style='display:inline'>My Info Section</h4>",
173 info_section_subtitle => 'View my info.',
174 icon_class => "glyphicon glyphicon-equalizer",
175 info_section_id => "",
176 buttons_html => "<button class='btn btn-sm btn-primary' style='margin:3px' id='my_example_button'>Example Button</button>"
181 <& /page/detail_page_2_col_section.mas, info_section_title => "<h4 style='display:inline'>My Info Section</h4>", info_section_subtitle => 'View my info.', icon_class => "glyphicon glyphicon-equalizer", info_section_id => "", buttons_html => "<button class='btn btn-sm btn-primary' style='margin:3px' id='my_example_button'>Example Button</button>" &>
185 <h3>3 Column Detail Page Section</h3>
188 <& /page/detail_page_3_col_section.mas,
189 icon_class => "glyphicon glyphicon-qrcode",
190 title => "Example title.",
191 button_id => "example_button_link"
196 <& /page/detail_page_3_col_section.mas, icon_class => "glyphicon glyphicon-qrcode", title => "Example title.", button_id => "example_button_link" &>
200 <h3>An Example Workflow Explaining Workflows</h3>
202 <&| /util/workflow.mas , id=> "my_workflow"&>
204 <&| /util/workflow.mas:step, title=>"workflow.mas" &>
205 <p>Add a workflow using the <code>/util/workflow.mas</code> mason component</p>
206 <p><pre><%text><&| /util/workflow.mas, id=> "my_workflow" &>...</&></%text></pre></p>
207 <button type="button" class="btn btn-default" onclick="Workflow.complete(this);">Next</button>
210 <&| /util/workflow.mas:step, title=>"Adding Steps" &>
211 <p>Add steps to the workflow using the <code>/util/workflow.mas:step</code> mason method.</p>
213 <pre><%text><&| /util/workflow.mas, id=> "my_workflow" &>
214 <&| /util/workflow.mas:step, title=> "Step A" &>...</&>
215 <&| /util/workflow.mas:step, title=> "Another Step" &>...</&>
217 </&></%text></pre>
219 <button type="button" class="btn btn-default" onclick="Workflow.complete(this);">Next</button>
222 <&| /util/workflow.mas:step, title=>"Completing Steps" &>
224 Use the <code>Workflow.complete(Element)</code> JavaScript function to
225 complete a step. <code>Element</code> should be any DOM element within the
226 step you would like to complete.
229 <pre><%text><&| /util/workflow.mas, id=> "my_workflow"&>
230 <&| /util/workflow.mas:step, title=>"workflow.mas" &>
232 <button type="button" onclick="Workflow.complete(this);">Next</button>
235 </&></%text></pre>
237 <button type="button" class="btn btn-default" onclick="Workflow.complete(this);">Next</button>
240 <&| /util/workflow.mas:step, title=>"Skipping Steps" &>
242 Skipping works like completing but marks the step as incomplete. Use
243 <code>Workflow.skip(Element)</code> just like you would
244 <code>Workflow.complete(Element)</code>.
247 <pre><%text><&| /util/workflow.mas, id=> "my_workflow"&>
248 <&| /util/workflow.mas:step, title=>"workflow.mas" &>
250 <button type="button" onclick="Workflow.skip(this);">Skip</button>
253 </&></%text></pre>
255 <button type="button" class="btn btn-default" onclick="Workflow.skip(this);">Skip this Step</button>
258 <&| /util/workflow.mas:step, title=>"Pending Steps" &>
260 Sometimes a step needs time to complete, such as uploads. You can mark a
261 step as pending using <code>Workflow.pending(Element)</code>. You can later
262 fully complete the step using <code>Workflow.complete(Element)</code>.
265 <pre><%text><&| /util/workflow.mas, id=> "my_workflow"&>
266 <&| /util/workflow.mas:step, title=>"workflow.mas" &>
268 <button type="button" onclick="Workflow.pending(this);">Wait</button>
269 <button type="button" onclick="Workflow.complete(this,false);">Complete</button>
272 </&></%text></pre>
274 <button id="to_complete" type="button" class="btn btn-primary" onclick="Workflow.pending(this);">Wait and Continue</button>
277 <&| /util/workflow.mas:step, title=>"Endscreens" &>
279 After the final step is completed, an endscreen will be shown. To set the
280 content of the endscreen, use the <code>/util/workflow.mas:complete</code>
281 mason method. You can also optionally set a special endscreen which is shown
282 instead while there are pending steps using
283 <code>/util/workflow.mas:pending</code>.
286 <pre><%text><&| /util/workflow.mas, id=> "my_workflow"&>
288 <&| /util/workflow.mas:complete &> ... </&>
289 <&| /util/workflow.mas:pending &> ... </&>
290 </&></%text></pre>
292 <button type="button" class="btn btn-default" onclick="Workflow.complete(this);">Go to endscreen</button>
295 <&| /util/workflow.mas:pending &>
296 <h2>There is still a pending step. Complete it to see the final endscreen.</h2>
297 <button type="button" class="btn btn-default" onclick="Workflow.complete(document.querySelector('#to_complete'),false);">Complete Pending Step</button>
299 <&| /util/workflow.mas:complete &>
300 <h1>Congratulations, you've made it through the workflow!</h1>
301 <h4>Here are some other tips and tricks:</h4>
302 <p>To set the currently visible step of the workflow use</p>
303 <pre>var wf = document.querySelector("#my_workflow");
304 Workflow.focus(wf,step_index);</pre>
306 By default, <code>Workflow.complete(...)</code>,
307 <code>Workflow.skip(...)</code>, and <code>Workflow.pending(...)</code>
308 also change the focus to the next step. Sometimes, you need to set a step
309 to complete without changing the focus. To do this, pass
310 <code>false</code> as the second argument.
312 <pre>Workflow.complete(Element,false);
313 Workflow.skip(Element,false);
314 Workflow.pending(Element,false);</pre>
320 <h3>Vega(-lite) Graphs</h3>
323 Using <a href="https://vega.github.io/vega-lite/">vega-lite</a> is an easy and quick way to make graphs in the db. Simply include vega-lite:
324 <pre><%text><& /util/import_javascript.mas, classes => [qw[ vega.vega3 vega.vega-lite2 vega.vega-embed3 vega.vega-defaults ]] &></%text></pre>
326 <pre><%text><div id="vis"></div></%text></pre>
327 and then run vega-lite (you can also use a <a href="https://vega.github.io/vega/">vega</a> graph spec):
328 <pre><%text><script type="text/javascript">
330 "$schema": "https://vega.github.io/schema/vega-lite/v2.0.json",
331 "description": "A simple bar chart with embedded data.",
334 {"a": "A","b": 28}, {"a": "B","b": 55}, {"a": "C","b": 43},
335 {"a": "D","b": 91}, {"a": "E","b": 81}, {"a": "F","b": 53},
336 {"a": "G","b": 19}, {"a": "H","b": 87}, {"a": "I","b": 52}
341 "x": {"field": "a", "type": "ordinal"},
342 "y": {"field": "b", "type": "quantitative"}
345 vegaEmbed("#vis", yourVlSpec, window.VEGA_DEFAULTS);
346 </script></%text></pre>
349 <& /util/import_javascript.mas, classes => [qw[ vega.vega3 vega.vega-lite2 vega.vega-embed3 vega.vega-defaults ]] &>
353 <script type="text/javascript">
355 "$schema": "https://vega.github.io/schema/vega-lite/v2.0.json",
356 "description": "A simple bar chart with embedded data.",
359 {"a": "A","b": 28}, {"a": "B","b": 55}, {"a": "C","b": 43},
360 {"a": "D","b": 91}, {"a": "E","b": 81}, {"a": "F","b": 53},
361 {"a": "G","b": 19}, {"a": "H","b": 87}, {"a": "I","b": 52}
366 "x": {"field": "a", "type": "ordinal"},
367 "y": {"field": "b", "type": "quantitative"}
370 vegaEmbed("#vis", yourVlSpec, window.VEGA_DEFAULTS);
375 <h3>Field Trials Search Datatable</h3>
378 <div class="well">
379 <table id="trial_search_results" width="100%" class="table table-hover table-striped">
382 <th>Trial name</th>
383 <th>Description</th>
384 <th>Breeding program</th>
385 <th>Folder</th>
386 <th>Year</th>
387 <th>Location</th>
388 <th>Trial type</th>
389 <th>Design</th>
390 <th>Planting Date</th>
391 <th>Harvest Date</th>
392 <th>Download</th>
397 <script type="text/javascript">
398 var trial_table = jQuery('#trial_search_results').DataTable( {
400 'url':'/ajax/search/trials',
401 'data': function(d) {
402 d.select_checkbox_name = 'create_tissue_sample_select_trial';
411 <table id="styleguide_trial_search_results" width="100%" class="table table-hover table-striped">
417 <th>Breeding program</th>
423 <th>Planting Date</th>
424 <th>Harvest Date</th>
430 <script type="text/javascript">
431 var styleguide_trial_table = jQuery('#styleguide_trial_search_results').DataTable( {
433 'url':'/ajax/search/trials',
434 'data': function(d) {
435 d.select_checkbox_name = 'styleguide_select_trial';
443 <h3>Use of Symbols</h3>
446 Below is a table with current usages of symbols in the database.
447 Please add to this tale when you choose to use a new symbol.
449 <style media="screen">
450 .symbol-table>tbody>tr>td{
451 vertical-align: middle;
453 .symbol-table>tbody>tr>td:first-of-type>*{
457 <table class="table symbol-table">
460 <th>Usages and contexts</th>
463 <td><span class="glyphicon glyphicon-dashboard"></span></td>
466 <li>Trial Details Top Section[Trial Detail]</li>
471 <td><span class="glyphicon glyphicon-align-left"></span></td>
474 <li>JBrowse[Trial Detail]</li>
475 <li>JBrowse[Stock Detail]</li>
480 <td><span class="glyphicon glyphicon-book"></span></td>
483 <li>Literature Annotation[Stock Detail]</li>
484 <li>Upload Phenotype Data[Homepage Help]</li>
489 <td><span class="glyphicon glyphicon-briefcase"></span></td>
492 <li>Breeding Program Symbol[Manage Trials]</li>
493 <li>Breeding Program Symbol[Manage Crosses]</li>
494 <li>Breeding Program Symbol[Manage Genotyping Plates]</li>
495 <li>Breeding Program Symbol[Folder Detail]</li>
500 <td><span class="glyphicon glyphicon-folder-open"></span></td>
503 <li>Folder Symbol[Manage Trials]</li>
504 <li>Folder Symbol[Manage Crosses]</li>
505 <li>Folder Symbol[Manage Genotyping Plates]</li>
506 <li>Folder Symbol[Folder Detail]</li>
511 <td><span class="glyphicon glyphicon-camera"></span></td>
514 <li>Images[Stock Detail]</li>
519 <td><span class="glyphicon glyphicon-transfer"></span></td>
522 <li>Data Transfer[Manage ODK]</li>
527 <td><span class="glyphicon glyphicon-cloud"></span></td>
530 <li>Weather Data[Trial Detail]</li>
535 <td><span class="glyphicon glyphicon-equalizer"></span></td>
538 <li>Phenotypes Summary Statistics[Trial Detail]</li>
539 <li>Traits assayed[Stock Detail]</li>
544 <td><span class="glyphicon glyphicon-inbox"></span></td>
547 <li>Data Agreement[Trial Detail]</li>
552 <td><span class="glyphicon glyphicon-info-sign"></span></td>
555 <li>Additional Information[Stock Detail]</li>
560 <td><span class="glyphicon glyphicon-leaf"></span></td>
563 <li>Experiment Usage[Stock Detail]</li>
564 <li>Trial Symbol[Manage Trials]</li>
565 <li>Trial Symbol[Folder Detail]</li>
566 <li>Field Trial Section[Manage Tissue Samples]</li>
571 <td><span class="glyphicon glyphicon-link"></span></td>
574 <li>Experiment Linkage[Trial Detail]</li>
579 <td><span class="glyphicon glyphicon-list-alt"></span></td>
582 <li>Experiment Design[Trial Detail]</li>
583 <li>Catalog Seed Inventory[Homepage Help]</li>
588 <td><span class="glyphicon glyphicon-flash"></span></td>
591 <li>Design New Trial[Homepage Help]</li>
596 <td><span class="glyphicon glyphicon-cloud-upload"></span></td>
599 <li>Upload Data Files[Trial Detail]</li>
600 <li>Upload Trial[Homepage Help]</li>
605 <td><span class="glyphicon glyphicon-floppy-save"></span></td>
608 <li>Compute New Phenotypes[Trial Detail]</li>
613 <td><span class="glyphicon glyphicon-pencil"></span></td>
616 <li>Record Phenotypes[Trial Detail]</li>
617 <li>Comments[Stock Detail]</li>
622 <td><span class="glyphicon glyphicon-qrcode"></span></td>
625 <li>Barcode[Trial Detail]</li>
630 <td><span class="glyphicon glyphicon-random"></span></td>
633 <li>Pedigree[Stock Detail]</li>
634 <li>Upload Crosses[Homepage Help]</li>
639 <td><span class="glyphicon glyphicon-flag"></span></td>
642 <li>Plan Tissue Sampling[Homepage Help]</li>
647 <td><span class="glyphicon glyphicon-tags"></span></td>
650 <li>Print Barcode Labels[Homepage Help]</li>
655 <td><span class="glyphicon glyphicon-map-marker"></span></td>
658 <li>Genotype Marker Data[Stock Detail]</li>
659 <li>Upload VCF Genotype Data[Homepage Help]</li>
664 <td><span class="glyphicon glyphicon-retweet"></span></td>
667 <li>Related Stocks[Stock Detail]</li>
672 <td><span class="glyphicon glyphicon-grain"></span></td>
675 <li>Crosses Symbol[Manage Crosses]</li>
676 <li>Crosses Symbol[Folder Detail]</li>
681 <td><span class="glyphicon glyphicon-signal"></span></td>
684 <li>Analysis[Trial Detail]</li>
689 <td><span class="glyphicon glyphicon-th"></span></td>
692 <li>Field Layout and Heatmap[Trial Detail]</li>
693 <li>Add Genotyping Plate (96 or 384 well plate)[Homepage Help]</li>
694 <li>Genotyping Plate Symbol(96 or 384 well plate)[Manage Genotyping Plates]</li>
695 <li>Genotyping Plate Symbol(96 or 384 well plate)[Folder Detail]</li>
696 <li>Genotyping Plates Section[Manage Tissue Samples]</li>
701 <td><span class="glyphicon glyphicon-blackboard"></span></td>
704 <li>Analyze Phenotypes[Homepage Help]</li>
709 <td><span class="glyphicon glyphicon-trash"></span></td>
712 <li>Deletion[Trial Detail]</li>