Skip to content

Commit

Permalink
Replace jQuery-tools dateinput with jQuery-UI datepicker per #158.
Browse files Browse the repository at this point in the history
  • Loading branch information
bamnet committed Oct 26, 2012
1 parent f70679b commit 3b04ae4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/application.js
Expand Up @@ -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 .
Expand Down
29 changes: 11 additions & 18 deletions 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
Expand All @@ -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">
Expand Down

0 comments on commit 3b04ae4

Please sign in to comment.