Patch #19468 » 19468-for-r15361.diff
app/helpers/application_helper.rb (working copy) | ||
---|---|---|
1171 | 1171 | |
1172 | 1172 |
def calendar_for(field_id) |
1173 | 1173 |
include_calendar_headers_tags |
1174 |
javascript_tag("$(function() { $('##{field_id}').addClass('date').datepicker(datepickerOptions); });") |
|
1174 |
javascript_tag("$(function() { $('##{field_id}').addClass('date').datepickerFallback(datepickerOptions); });")
|
|
1175 | 1175 |
end |
1176 | 1176 | |
1177 | 1177 |
def include_calendar_headers_tags |
app/views/custom_fields/formats/_date.html.erb (working copy) | ||
---|---|---|
1 |
<p><%= f.text_field(:default_value, :size => 10) %></p>
|
|
1 |
<p><%= f.date_field(:default_value, :value => @custom_field.default_value, :size => 10) %></p>
|
|
2 | 2 |
<%= calendar_for('custom_field_default_value') %> |
3 | 3 |
<p><%= f.text_field :url_pattern, :size => 50, :label => :label_link_values_to %></p> |
app/views/issues/_attributes.html.erb (working copy) | ||
---|---|---|
52 | 52 | |
53 | 53 |
<% if @issue.safe_attribute? 'start_date' %> |
54 | 54 |
<p id="start_date_area"> |
55 |
<%= f.text_field(:start_date, :size => 10, :required => @issue.required_attribute?('start_date')) %>
|
|
55 |
<%= f.date_field(:start_date, :size => 10, :required => @issue.required_attribute?('start_date')) %>
|
|
56 | 56 |
<%= calendar_for('issue_start_date') %> |
57 | 57 |
</p> |
58 | 58 |
<% end %> |
59 | 59 | |
60 | 60 |
<% if @issue.safe_attribute? 'due_date' %> |
61 | 61 |
<p id="due_date_area"> |
62 |
<%= f.text_field(:due_date, :size => 10, :required => @issue.required_attribute?('due_date')) %>
|
|
62 |
<%= f.date_field(:due_date, :size => 10, :required => @issue.required_attribute?('due_date')) %>
|
|
63 | 63 |
<%= calendar_for('issue_due_date') %> |
64 | 64 |
</p> |
65 | 65 |
<% end %> |
app/views/issues/bulk_edit.html.erb (working copy) | ||
---|---|---|
147 | 147 |
<% if @safe_attributes.include?('start_date') %> |
148 | 148 |
<p> |
149 | 149 |
<label for='issue_start_date'><%= l(:field_start_date) %></label> |
150 |
<%= text_field_tag 'issue[start_date]', '', :value => @issue_params[:start_date], :size => 10 %><%= calendar_for('issue_start_date') %>
|
|
150 |
<%= date_field_tag 'issue[start_date]', '', :value => @issue_params[:start_date], :size => 10 %><%= calendar_for('issue_start_date') %>
|
|
151 | 151 |
<label class="inline"><%= check_box_tag 'issue[start_date]', 'none', (@issue_params[:start_date] == 'none'), :id => nil, :data => {:disables => '#issue_start_date'} %><%= l(:button_clear) %></label> |
152 | 152 |
</p> |
153 | 153 |
<% end %> |
... | ... | |
155 | 155 |
<% if @safe_attributes.include?('due_date') %> |
156 | 156 |
<p> |
157 | 157 |
<label for='issue_due_date'><%= l(:field_due_date) %></label> |
158 |
<%= text_field_tag 'issue[due_date]', '', :value => @issue_params[:due_date], :size => 10 %><%= calendar_for('issue_due_date') %>
|
|
158 |
<%= date_field_tag 'issue[due_date]', '', :value => @issue_params[:due_date], :size => 10 %><%= calendar_for('issue_due_date') %>
|
|
159 | 159 |
<label class="inline"><%= check_box_tag 'issue[due_date]', 'none', (@issue_params[:due_date] == 'none'), :id => nil, :data => {:disables => '#issue_due_date'} %><%= l(:button_clear) %></label> |
160 | 160 |
</p> |
161 | 161 |
<% end %> |
app/views/timelog/_form.html.erb (working copy) | ||
---|---|---|
17 | 17 |
<span id="time_entry_issue"><%= "#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}" %></span> |
18 | 18 |
<% end %> |
19 | 19 |
</p> |
20 |
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
|
|
20 |
<p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
|
|
21 | 21 |
<p><%= f.text_field :hours, :size => 6, :required => true %></p> |
22 | 22 |
<p><%= f.text_field :comments, :size => 100, :maxlength => 1024 %></p> |
23 | 23 |
<p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p> |
app/views/timelog/bulk_edit.html.erb (working copy) | ||
---|---|---|
18 | 18 | |
19 | 19 |
<p> |
20 | 20 |
<label><%= l(:field_spent_on) %></label> |
21 |
<%= text_field :time_entry, :spent_on, :size => 10 %><%= calendar_for('time_entry_spent_on') %>
|
|
21 |
<%= date_field :time_entry, :spent_on, :size => 10 %><%= calendar_for('time_entry_spent_on') %>
|
|
22 | 22 |
</p> |
23 | 23 | |
24 | 24 |
<p> |
app/views/versions/_form.html.erb (working copy) | ||
---|---|---|
6 | 6 |
<p><%= f.text_field :description, :size => 60 %></p> |
7 | 7 |
<p><%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %></p> |
8 | 8 |
<p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p> |
9 |
<p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
|
|
9 |
<p><%= f.date_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
|
|
10 | 10 |
<p><%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %></p> |
11 | 11 | |
12 | 12 |
<% @version.custom_field_values.each do |value| %> |
lib/redmine/field_format.rb (working copy) | ||
---|---|---|
461 | 461 |
end |
462 | 462 | |
463 | 463 |
def edit_tag(view, tag_id, tag_name, custom_value, options={}) |
464 |
view.text_field_tag(tag_name, custom_value.value, options.merge(:id => tag_id, :size => 10)) +
|
|
464 |
view.date_field_tag(tag_name, custom_value.value, options.merge(:id => tag_id, :size => 10)) +
|
|
465 | 465 |
view.calendar_for(tag_id) |
466 | 466 |
end |
467 | 467 | |
468 | 468 |
def bulk_edit_tag(view, tag_id, tag_name, custom_field, objects, value, options={}) |
469 |
view.text_field_tag(tag_name, value, options.merge(:id => tag_id, :size => 10)) +
|
|
469 |
view.date_field_tag(tag_name, value, options.merge(:id => tag_id, :size => 10)) +
|
|
470 | 470 |
view.calendar_for(tag_id) + |
471 | 471 |
bulk_clear_tag(view, tag_id, tag_name, custom_field, value) |
472 | 472 |
end |
public/javascripts/application.js (working copy) | ||
---|---|---|
185 | 185 |
case "date": |
186 | 186 |
case "date_past": |
187 | 187 |
tr.find('td.values').append( |
188 |
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_1" size="10" class="value date_value" /></span>' +
|
|
189 |
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_2" size="10" class="value date_value" /></span>' +
|
|
188 |
'<span style="display:none;"><input type="date" name="v['+field+'][]" id="values_'+fieldId+'_1" size="10" class="value date_value" /></span>' +
|
|
189 |
' <span style="display:none;"><input type="date" name="v['+field+'][]" id="values_'+fieldId+'_2" size="10" class="value date_value" /></span>' +
|
|
190 | 190 |
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="3" class="value" /> '+labelDayPlural+'</span>' |
191 | 191 |
); |
192 |
$('#values_'+fieldId+'_1').val(values[0]).datepicker(datepickerOptions); |
|
193 |
$('#values_'+fieldId+'_2').val(values[1]).datepicker(datepickerOptions); |
|
192 |
$('#values_'+fieldId+'_1').val(values[0]).datepickerFallback(datepickerOptions);
|
|
193 |
$('#values_'+fieldId+'_2').val(values[1]).datepickerFallback(datepickerOptions);
|
|
194 | 194 |
$('#values_'+fieldId).val(values[0]); |
195 | 195 |
break; |
196 | 196 |
case "string": |
... | ... | |
587 | 587 |
} |
588 | 588 |
break; |
589 | 589 |
} |
590 |
$(input).datepicker("option", "defaultDate", default_date); |
|
590 |
$(input).datepickerFallback("option", "defaultDate", default_date);
|
|
591 | 591 |
} |
592 | 592 | |
593 | 593 |
(function($){ |
... | ... | |
723 | 723 |
function toggleDisabledInit() { |
724 | 724 |
$('input[data-disables], input[data-enables]').each(toggleDisabledOnChange); |
725 | 725 |
} |
726 | ||
727 |
(function ( $ ) { |
|
728 | ||
729 |
// detect if native date input is supported |
|
730 |
var nativeDateInputSupported = true; |
|
731 | ||
732 |
var input = document.createElement('input'); |
|
733 |
input.setAttribute('type','date'); |
|
734 |
if (input.type === 'text') { |
|
735 |
nativeDateInputSupported = false; |
|
736 |
} |
|
737 | ||
738 |
var notADateValue = 'not-a-date'; |
|
739 |
input.setAttribute('value', notADateValue); |
|
740 |
if (input.value === notADateValue) { |
|
741 |
nativeDateInputSupported = false; |
|
742 |
} |
|
743 | ||
744 |
$.fn.datepickerFallback = function( options ) { |
|
745 |
if (nativeDateInputSupported) { |
|
746 |
return this; |
|
747 |
} else { |
|
748 |
return this.datepicker( options ); |
|
749 |
} |
|
750 |
}; |
|
751 |
}( jQuery )); |
|
752 | ||
726 | 753 |
$(document).ready(function(){ |
727 | 754 |
$('#content').on('change', 'input[data-disables], input[data-enables]', toggleDisabledOnChange); |
728 | 755 |
toggleDisabledInit(); |
- « Previous
- 1
- 2
- 3
- Next »