Brak opisu

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. {% extends "bootstrapheader.html" %}
  2. {% block body %}
  3. <body>
  4. <div class="container">
  5. <h2>Home</h2>
  6. Loged in as {{email}}
  7. <div class=container>
  8. {% for m in msg %}
  9. <div class="alert alert-{{m["type"]}}">
  10. <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
  11. {{m["msg"]}}
  12. </div>
  13. {% endfor %}
  14. <h3>My Experiments:</h3>
  15. <div class="panel-group" id="accordion">
  16. {% if experiments %}
  17. {% for dict_item in experiments %}
  18. <div class="panel panel-default">
  19. <div class="panel-heading">
  20. <h4 class="panel-title">
  21. <a data-toggle="collapse" data-parent="#accordion" href="#collapse{{dict_item['eid']}}">{{dict_item['name']}}</a>
  22. </h4>
  23. </div>
  24. <div id="collapse{{dict_item['eid']}}" class="panel-collapse collapse">
  25. <div class="panel-body">
  26. <div class="container">
  27. <h4>Description:</h4>
  28. <p>
  29. {{dict_item['description']}}
  30. </p>
  31. <p>
  32. Experiment date: {{dict_item['date']}}
  33. </p>
  34. <form class="form-inline" name="options" role="form" action="#" method="post">
  35. <input type="hidden" name="deid" value="{{dict_item['eid']}}">
  36. <button type="submit" class="btn btn-primary" name="eid" value="{{dict_item['eid']}}" OnClick="SetDestView(this)">View</button>
  37. <button type="submit" class="btn btn-danger" name="deid" value="{{dict_item['eid']}}">Delete</button>
  38. </form>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. {% endfor %}
  44. {% endif %}
  45. </div>
  46. <form class="form-inline" role="form" action="/experiment" method="post">
  47. <div class="form-group">
  48. <label for="expname">Name: </label>
  49. <input type="text" class="form-control" id="expname" name="expname" placeholder="New experiment name" required>
  50. </div>
  51. <div class="form-group">
  52. <label for="inpeaks">Peaks: </label>
  53. <input type="text" class="form-control" id="inpeaks" name="inpeaks" placeholder="Experiment Peaks" value = "1257.4,1419.5,1581.5,1743.6,1809.7,1905.6" required>
  54. </div>
  55. <button type="submit" class="btn btn-primary">New Experiment</button>
  56. </form>
  57. </div> <!-- /container -->
  58. <div id="confirm" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  59. <div class="modal-dialog">
  60. <div class="modal-content">
  61. <div class="modal-header">
  62. Confirm Submit
  63. </div>
  64. <div class="modal-body">
  65. Are you sure you want to delete the experiment?
  66. </div>
  67. <div class="modal-footer">
  68. <button type="button" data-dismiss="modal" class="btn btn-primary" id="delete">Delete</button>
  69. <button type="button" data-dismiss="modal" class="btn">Cancel</button>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <div class=container>
  75. {% if col_experiments %}
  76. <h3>Collaborations:</h3>
  77. <div class="panel-group" id="accordion">
  78. {% for dict_item in col_experiments %}
  79. <div class="panel panel-default">
  80. <div class="panel-heading">
  81. <h4 class="panel-title">
  82. <a data-toggle="collapse" data-parent="#accordion" href="#collapse{{dict_item['eid']}}">{{dict_item['name']}}</a>
  83. </h4>
  84. </div>
  85. <div id="collapse{{dict_item['eid']}}" class="panel-collapse collapse">
  86. <div class="panel-body">
  87. <div class="container">
  88. <h4>Description:</h4>
  89. <p>
  90. {{dict_item['description']}}
  91. </p>
  92. <p>
  93. Experiment date: {{dict_item['date']}}
  94. </p>
  95. <form class="form-inline" name="options" role="form" action="" method="post">
  96. <button type="submit" class="btn btn-primary" name="eid" value="{{dict_item['eid']}}" OnClick="SetDestView(this)">View</button>
  97. </form>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. {% endfor %}
  103. {% endif %}
  104. </div>
  105. </div> <!-- /container -->
  106. <SCRIPT LANGUAGE="JavaScript">
  107. function SetDestView(element) {
  108. element.form.action = "/experiment";
  109. }
  110. function SetDestDelete(element) {
  111. element.form.action = "/";
  112. }
  113. $('button[name="deid"]').on('click', function(e){
  114. e.preventDefault();
  115. var $form=$(this).closest('form');
  116. $('#confirm').modal({ backdrop: 'static', keyboard: false })
  117. .one('click', '#delete', function (e) {
  118. $form.action = "/"
  119. $form.submit();
  120. });
  121. });
  122. </script>
  123. </body>
  124. {% endblock %}