Commit 4848a472a53fcbb3e42cdfcd562d5c45da7eed64
Committed by
Paulo Meireles
1 parent
6cb5005b
Exists in
master
and in
28 other branches
[Mezuro] Toggle datepicker
Showing
1 changed file
with
11 additions
and
7 deletions
Show diff stats
plugins/mezuro/views/mezuro_plugin_project/_project_result.rhtml
| 1 | <% unless @content.errors[:base].nil? %> | 1 | <% unless @content.errors[:base].nil? %> |
| 2 | <%= @content.errors[:base] %> | 2 | <%= @content.errors[:base] %> |
| 3 | <% else %> | 3 | <% else %> |
| 4 | - <p> Choose a date to see specific project results: <input type="image" id="datepicker" /> </p> | ||
| 5 | <div id="current_project_date" data-date="<%= @project_result.date %>"/> | 4 | <div id="current_project_date" data-date="<%= @project_result.date %>"/> |
| 6 | 5 | ||
| 7 | <h4><%= _('Last Result') %></h4> | 6 | <h4><%= _('Last Result') %></h4> |
| @@ -19,19 +18,24 @@ | @@ -19,19 +18,24 @@ | ||
| 19 | <td><%= _('Analysis time') %></td> | 18 | <td><%= _('Analysis time') %></td> |
| 20 | <td><%= @project_result.formatted_analysis_time %></td> | 19 | <td><%= @project_result.formatted_analysis_time %></td> |
| 21 | </tr> | 20 | </tr> |
| 21 | + <tr> | ||
| 22 | + <td>Click to choose specific date:</td> | ||
| 23 | + <td><%= link_to(image_tag('/images/calendar_date_select/calendar.png', :width => 20, :height => 20, :onClick => "$( 'datepicker' ).toggle();"), "javascript:void(0)") %></p></td> | ||
| 24 | + </tr> | ||
| 22 | </table> | 25 | </table> |
| 23 | - | ||
| 24 | - | 26 | + |
| 27 | + <div id="datepicker"></div> | ||
| 28 | + | ||
| 25 | <script> | 29 | <script> |
| 26 | jQuery(document).ready(function($) { | 30 | jQuery(document).ready(function($) { |
| 27 | - $("#datepicker").datepicker({ showOn: 'button', dateFormat: "yy-mm-dd", | ||
| 28 | - buttonImageOnly: true, buttonImage: '/images/calendar_date_select/calendar.png', | 31 | + $("#datepicker").datepicker({ |
| 29 | onSelect: function(dateText, inst) { | 32 | onSelect: function(dateText, inst) { |
| 30 | reloadProjectWithDate(dateText) } }); | 33 | reloadProjectWithDate(dateText) } }); |
| 34 | + $("#datepicker").toggle(); | ||
| 31 | var date = jQuery("#current_project_date").attr('data-date').substr(0,10); | 35 | var date = jQuery("#current_project_date").attr('data-date').substr(0,10); |
| 32 | $("#datepicker").datepicker( "setDate" , date ); | 36 | $("#datepicker").datepicker( "setDate" , date ); |
| 33 | - | 37 | + |
| 34 | }); | 38 | }); |
| 35 | </script> | 39 | </script> |
| 36 | - | 40 | + |
| 37 | <% end %> | 41 | <% end %> |