Merge pull request #2754 from solgenomics/topic/fix_homepage_add_accessions_dialog
[sgn.git] / mason / breeders_toolbox / data_agreement.mas
blobc620cb5d3d180b8b7473af17ab099d9d822ab4ff
2 <%args>
3 $trial_id 
4 </%args>
6 <div id="data_agreement_div">
8 </div>
10 <script>
12 jQuery(document).ready(function () {
14     get_data_agreement(<% $trial_id %>, 'data_agreement_div');
16     function get_data_agreement(project_id, div) { 
17       jQuery.ajax( { 
18         async: true,
19         url: '/breeders/trial/data_agreement/get',
20         data: { 'project_id': project_id },
21         success: function(response) {
22            if (response.text) { 
23              jQuery('#'+div).html(response.text);
24            }
25            else { 
26              jQuery('#'+div).html('By default, trial data is provided under the Toronto agreement, as explained in the <a href="/usage_policy">data usage policy</a>.');
27            }
28            if (response.message) { alert(response.message); }
29         },
30         error: function(response) { 
31            alert('An error occurred fetching the data agreement data.');
32         }
33       });
34     }
36 });
39 </script>