Skip to content

Commit

Permalink
Date selection in configure now done using jQuery Datepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
reddragon committed Jul 6, 2010
1 parent a3c0393 commit 43c7473
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
6 changes: 4 additions & 2 deletions app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ def set_timeframes

app_setting = AppSetting.new
date_params.each do |dp|
APP_CONFIG[dp] = DateTime::civil(params[dp.intern][:year].to_i,\
params[dp.intern][:month].to_i, params[dp.intern][:day].to_i, 0, 0, 0)
date_array = params[dp.intern][0].split("-")
APP_CONFIG[dp] = DateTime::civil(date_array[0].to_i,\
date_array[1].to_i, date_array[2].to_i, 0, 0, 0)
puts APP_CONFIG[dp]
end

app_setting.pct_from = APP_CONFIG['pct_from']
Expand Down
25 changes: 13 additions & 12 deletions app/views/dashboard/configure.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
mode
%br
%br

%br
- if APP_CONFIG['fsoc_mode'] == "Summer Coding"
- form_tag :action => "set_timeframes" do
Expand All @@ -42,9 +43,9 @@
To
%tr
%td
= select_date APP_CONFIG["pct_from"], :prefix => "pct_from"
= text_field "pct_from", "", :value => APP_CONFIG["pct_from"].to_date
%td
= select_date APP_CONFIG["pct_to"], :prefix => "pct_to"
= text_field "pct_to", "", :value => APP_CONFIG["pct_to"].to_date
%br
%h3
Proposal Submission Timeframe
Expand All @@ -56,9 +57,9 @@
To
%tr
%td
= select_date APP_CONFIG["pst_from"], :prefix => "pst_from"
= text_field "pst_from", "", :value => APP_CONFIG["pst_from"].to_date
%td
= select_date APP_CONFIG["pst_to"], :prefix => "pst_to"
= text_field "pst_to", "", :value => APP_CONFIG["pst_to"].to_date

%br
%h3
Expand All @@ -71,9 +72,9 @@
To
%tr
%td
= select_date APP_CONFIG["pat_from"], :prefix => "pat_from"
= text_field "pat_from", "", :value => APP_CONFIG["pat_from"].to_date
%td
= select_date APP_CONFIG["pat_to"], :prefix => "pat_to"
= text_field "pat_to", "", :value => APP_CONFIG["pat_to"].to_date
%br

%h3
Expand All @@ -84,7 +85,7 @@
On
%tr
%td
= select_date APP_CONFIG["csd_on"], :prefix => "csd_on"
= text_field "csd_on", "", :value => APP_CONFIG["csd_on"].to_date

%br
%h3
Expand All @@ -97,9 +98,9 @@
To
%tr
%td
= select_date APP_CONFIG["met_from"], :prefix => "met_from"
= text_field "met_from", "", :value => APP_CONFIG["met_from"].to_date
%td
= select_date APP_CONFIG["met_to"], :prefix => "met_to"
= text_field "met_to", "", :value => APP_CONFIG["met_to"].to_date

%br
%h3
Expand All @@ -110,7 +111,7 @@
On
%tr
%td
= select_date APP_CONFIG["ced_on"], :prefix => "ced_on"
= text_field "ced_on", "", :value => APP_CONFIG["ced_on"].to_date
%br
%h3
Final Evaluation Timeframe
Expand All @@ -122,9 +123,9 @@
To
%tr
%td
= select_date APP_CONFIG["fet_from"], :prefix => "fet_from"
= text_field "fet_from", "", :value => APP_CONFIG["fet_from"].to_date
%td
= select_date APP_CONFIG["fet_to"], :prefix => "fet_to"
= text_field "fet_to", "", :value => APP_CONFIG["fet_to"].to_date
%br
= submit_tag 'Set Timeframes'

Expand Down
3 changes: 3 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Released : 20090910
<title>FSoC <%= controller_name.titlecase %></title>
<%= stylesheet_link_tag 'scaffold' %>
<%= stylesheet_link_tag 'style' %>
<%= stylesheet_link_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/redmond/jquery-ui.css", "application" %>
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js", "application" %>

</head><body>
<div id="wrapper">
<div id="header">
Expand Down
15 changes: 15 additions & 0 deletions public/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

$(function() {
$("#pct_from_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#pct_to_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#pst_from_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#pst_to_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#pat_from_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#pat_to_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#csd_on_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#met_from_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#met_to_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#ced_on_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#fet_from_").datepicker({ dateFormat: 'yy-mm-dd' });
$("#fet_to_").datepicker({ dateFormat: 'yy-mm-dd' });
});

0 comments on commit 43c7473

Please sign in to comment.