Disable unused fields when switching the period type.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5299 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-04-03 12:02:56 +00:00
parent 70ec78d013
commit 4ab4c21890
1 changed files with 6 additions and 5 deletions

View File

@ -2,16 +2,17 @@
<legend onclick="toggleFieldset(this);"><%= l(:label_date_range) %></legend>
<div>
<p>
<%= radio_button_tag 'period_type', '1', !@free_period %>
<%= radio_button_tag 'period_type', '1', !@free_period, :onclick => 'Form.Element.disable("from");Form.Element.disable("to");Form.Element.enable("period");' %>
<%= select_tag 'period', options_for_period_select(params[:period]),
:onchange => 'this.form.submit();',
:onfocus => '$("period_type_1").checked = true;' %>
:onfocus => '$("period_type_1").checked = true;',
:disabled => @free_period %>
</p>
<p>
<%= radio_button_tag 'period_type', '2', @free_period %>
<%= radio_button_tag 'period_type', '2', @free_period, :onclick => 'Form.Element.enable("from");Form.Element.enable("to");Form.Element.disable("period");' %>
<span onclick="$('period_type_2').checked = true;">
<%= l(:label_date_from_to, :start => (text_field_tag('from', @from, :size => 10) + calendar_for('from')),
:end => (text_field_tag('to', @to, :size => 10) + calendar_for('to'))) %>
<%= l(:label_date_from_to, :start => (text_field_tag('from', @from, :size => 10, :disabled => !@free_period) + calendar_for('from')),
:end => (text_field_tag('to', @to, :size => 10, :disabled => !@free_period) + calendar_for('to'))) %>
</span>
</p>
</div>