Skip to content

Commit

Permalink
improve date selection
Browse files Browse the repository at this point in the history
  • Loading branch information
ishmael committed Jul 29, 2010
1 parent c0d753f commit b2e2259
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/models/search.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Search
attr_reader :options

def initialize(model, options,initial_conditions,initial_parameters)
@model = model
@options = options || {}
Expand Down
5 changes: 3 additions & 2 deletions app/views/movements/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@



<% form_for :search,:url => polymorphic_path([:search,@account,:movements]), :html=>{ :method => "get", :class => "search_form"} do |f| %>
<% form_for :search,:url => polymorphic_path([:search,@account,:movements]), :html=>{ :method => "get", :class => "search_form"} do |f| %>
<div id="search" class="basic clearfix">
<dl >
<dt><%= I18n.t('layout.movements.description') %></dt>
Expand All @@ -103,7 +103,7 @@
<dt><%= I18n.t('layout.movements.typetag') %></dt>
<dd>
<%= f.hidden_field :type_mov_hidden %>
<div id="buttongroup1" class="yui-buttongroup">
<div id="search_type_movements_group" class="yui-buttongroup">
<input type="radio" id="search_debit" name="mov_debit" value="<%= I18n.t('layout.movements.debit') %>" />
<input type="radio" id="search_credit" name="mov_credit" value="<%= I18n.t('layout.movements.credit') %>" />
<input type="radio" id="search_all" name="mov_all" value="<%= I18n.t('layout.movements.all_types') %>" />
Expand Down Expand Up @@ -271,4 +271,5 @@

<% content_for :javascript_includes do %>
<%= javascript_include_tag 'bankaccount_dashboard' %>
<%= javascript_include_tag 'date' %>
<% end %>
3 changes: 2 additions & 1 deletion app/views/movements/search.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<dt><%= I18n.t('layout.movements.typetag') %></dt>
<dd>
<%= f.hidden_field :type_mov_hidden %>
<div id="buttongroup1" class="yui-buttongroup">
<div id="search_type_movements_group" class="yui-buttongroup">
<input type="radio" id="search_debit" name="mov_debit" value="<%= I18n.t('layout.movements.debit') %>" />
<input type="radio" id="search_credit" name="mov_credit" value="<%= I18n.t('layout.movements.credit') %>" />
<input type="radio" id="search_all" name="mov_all" value="<%= I18n.t('layout.movements.all_types') %>" />
Expand Down Expand Up @@ -129,4 +129,5 @@

<% content_for :javascript_includes do %>
<%= javascript_include_tag 'bankaccount_dashboard' %>
<%= javascript_include_tag 'date' %>
<% end %>
8 changes: 5 additions & 3 deletions public/javascripts/bankaccount_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@

var cal = new YAHOO.example.calendar.IntervalCalendar("calSearchContainer", {pages:1,navigator:true,MDY_MONTH_POSITION:2,MDY_DAY_POSITION:1,MDY_YEAR_POSITION:3});
// cal.cfg.setProperty("DATE_FIELD_DELIMITER", ".");
var oButtonGroup1 = new YAHOO.widget.ButtonGroup("buttongroup1");
var oButtonGroup1 = new YAHOO.widget.ButtonGroup("search_type_movements_group");
oButtonGroup1.setStyle( 'visibility', 'visible');

if (mov_type.value == "-1")
oButtonGroup1.check(0);
Expand Down Expand Up @@ -340,8 +341,9 @@
outTxt.value = "";
}
}, cal, true);
//alert( new Date(Date.parse(outTxt.value)));
//cal.setInterval(inTxt.value,outTxt.value);
//alert( Date.parseExact(outTxt.value,"d/M/yyyy"));
if( inTxt.value != '' && outTxt.value != '')
cal.setInterval( Date.parseExact(inTxt.value,"d/M/yyyy"),Date.parseExact(outTxt.value,"d/M/yyyy"));
cal.render();

});
Expand Down

0 comments on commit b2e2259

Please sign in to comment.