Browse files

Replace jQuery-tools dateinput with jQuery-UI datepicker per #158.

  • Loading branch information...
1 parent f70679b commit 3b04ae40f94d244d920d8f3addab657898534aba @bamnet bamnet committed Oct 25, 2012
Showing with 12 additions and 19 deletions.
  1. +1 −1 app/assets/javascripts/application.js
  2. +11 −18 app/views/contents/form_elements/_dates.html.erb
View
2 app/assets/javascripts/application.js
@@ -12,9 +12,9 @@
//
//= require jquery
//= require jquery_ujs
+//= require jquery-ui
//= require html5_shiv/html5
//= require jquery.qtip.min
-//= require jquery-tools/dateinput/dateinput
//= require jquery-tools/rangeinput/rangeinput
//= require timepicker/jquery.timepicker
//= require_tree .
View
29 app/views/contents/form_elements/_dates.html.erb
@@ -1,24 +1,19 @@
<% content_for :js_ready do %>
-var date_settings = {
- format: 'mm/dd/yyyy',
-};
-$("#start_time_date").dateinput(date_settings);
-$("#end_time_date").dateinput(date_settings);
-
-var end_date_api = $("#end_time_date").data("dateinput");
-var start_date_api = $("#start_time_date").data("dateinput");
+// Setup the date pickers
+$("#start_time_date").datepicker();
+$("#end_time_date").datepicker();
$('#date_start').click(function(event) {
- window.setTimeout(function() {
- start_date_api.show();
- }, 1);
- });
+ event.stopPropagation();
+ var visible = $('#ui-datepicker-div').is(':hidden');
+ $("#start_time_date").datepicker(visible ? 'show' : 'hide');
+});
$('#date_end').click(function(event) {
- window.setTimeout(function() {
- end_date_api.show();
- }, 1);
- });
+ event.stopPropagation();
+ var visible = $('#ui-datepicker-div').is(':hidden');
+ $("#start_time_date").datepicker(visible ? 'show' : 'hide');
+});
// Setup the time pickers
@@ -30,12 +25,10 @@ $('#time_start').click(function(e) {
$('#start_time_time').timepicker('show');
});
-
$('#time_end').click(function(e) {
e.stopPropagation();
$('#end_time_time').timepicker('show');
});
-
<% end %>
<div class="clearfix datetime">

0 comments on commit 3b04ae4

Please sign in to comment.