Commit 1b95879e0a67df7a3527a926ea251a58ce4499e5
Committed by
João M. M. da Silva
1 parent
e13f2060
Exists in
master
and in
23 other branches
[Mezuro] Fixed date picker.
Showing
2 changed files
with
7 additions
and
10 deletions
Show diff stats
plugins/mezuro/public/javascripts/project_content.js
| ... | ... | @@ -52,13 +52,7 @@ function reloadModule(){ |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | function reloadProjectWithDate(date){ |
| 55 | - var new_date = new Date(date + "T00:00:00+00:00"); | |
| 56 | - | |
| 57 | - if(isNaN(new_date)){ | |
| 58 | - alert("Invalid date! " + new_date); | |
| 59 | - return false; | |
| 60 | - } | |
| 61 | - reloadProject(new_date); | |
| 55 | + reloadProject(date + "T00:00:00+00:00"); | |
| 62 | 56 | return false; |
| 63 | 57 | } |
| 64 | 58 | ... | ... |
plugins/mezuro/views/content_viewer/_project_result.rhtml
| 1 | 1 | <% unless @content.errors[:base].nil? %> |
| 2 | 2 | <%= @content.errors[:base] %> |
| 3 | 3 | <% else %> |
| 4 | - <p> Choose a date to see specific project results: </p><input id="datepicker" style="display:none"/> | |
| 4 | + <p> Choose a date to see specific project results: </p> | |
| 5 | + <div id="datepicker"> | |
| 6 | + <input id="datepicker_field" style="display:none"/> | |
| 7 | + </div> | |
| 5 | 8 | |
| 6 | 9 | <h4><%= _('Last Result') %></h4> |
| 7 | 10 | |
| ... | ... | @@ -23,9 +26,9 @@ |
| 23 | 26 | |
| 24 | 27 | <script> |
| 25 | 28 | jQuery(document).ready(function($) { |
| 26 | - $("#datepicker").datepicker({ altField: '#datepicker', showOn: 'button', dateFormat: "yy-mm-dd", | |
| 29 | + $("#datepicker").datepicker({ altField: '#datepicker_field', showOn: 'button', dateFormat: "yy-mm-dd", | |
| 27 | 30 | buttonImageOnly: true, buttonImage: '/images/calendar_date_select/calendar.png', |
| 28 | - onSelect: function(dateText, inst) { | |
| 31 | + onSelect: function(dateText, inst) { | |
| 29 | 32 | reloadProjectWithDate(dateText) } }); |
| 30 | 33 | }); |
| 31 | 34 | </script> | ... | ... |