Feature #14024 » dafault-issue-date.diff
| app/views/issues/_attributes.html.erb | ||
|---|---|---|
|
<% end %>
|
||
|
<% if @issue.safe_attribute? 'start_date' %>
|
||
|
<p>
|
||
|
<p id="start_date_area">
|
||
|
<%= f.text_field(:start_date, :size => 10, :disabled => !@issue.leaf?,
|
||
|
:required => @issue.required_attribute?('start_date')) %>
|
||
|
<%= calendar_for('issue_start_date') if @issue.leaf? %>
|
||
| ... | ... | |
|
<% end %>
|
||
|
<% if @issue.safe_attribute? 'due_date' %>
|
||
|
<p>
|
||
|
<p id="due_date_area">
|
||
|
<%= f.text_field(:due_date, :size => 10, :disabled => !@issue.leaf?,
|
||
|
:required => @issue.required_attribute?('due_date')) %>
|
||
|
<%= calendar_for('issue_due_date') if @issue.leaf? %>
|
||
| test/ui/issues_test.rb | ||
|---|---|---|
|
assert_equal ['Dave Lopper', 'Some Watcher'], issue.watcher_users.map(&:name).sort
|
||
|
end
|
||
|
def test_create_issue_start_due_date
|
||
|
with_settings :default_issue_start_date_to_creation_date => 0 do
|
||
|
log_user('jsmith', 'jsmith')
|
||
|
visit '/projects/ecookbook/issues/new'
|
||
|
assert_equal "", page.find('input#issue_start_date').value
|
||
|
assert_equal "", page.find('input#issue_due_date').value
|
||
|
page.first('p#start_date_area').first('img').click
|
||
|
page.first("td.ui-datepicker-days-cell-over a").click
|
||
|
assert_equal Date.today.to_s, page.find('input#issue_start_date').value
|
||
|
page.first('p#due_date_area').first('img').click
|
||
|
page.first("td.ui-datepicker-days-cell-over a").click
|
||
|
assert_equal Date.today.to_s, page.find('input#issue_due_date').value
|
||
|
end
|
||
|
end
|
||
|
def test_preview_issue_description
|
||
|
log_user('jsmith', 'jsmith')
|
||
|
visit '/projects/ecookbook/issues/new'
|
||
| app/helpers/application_helper.rb | ||
|---|---|---|
|
def include_calendar_headers_tags
|
||
|
unless @calendar_headers_tags_included
|
||
|
tags = javascript_include_tag("datepicker")
|
||
|
@calendar_headers_tags_included = true
|
||
|
content_for :header_tags do
|
||
|
start_of_week = Setting.start_of_week
|
||
| ... | ... | |
|
# Redmine uses 1..7 (monday..sunday) in settings and locales
|
||
|
# JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0
|
||
|
start_of_week = start_of_week.to_i % 7
|
||
|
tags = javascript_tag(
|
||
|
tags << javascript_tag(
|
||
|
"var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: #{start_of_week}, " +
|
||
|
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
|
||
|
path_to_image('/images/calendar.png') +
|
||
|
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true, changeMonth: true, changeYear: true};")
|
||
|
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, " +
|
||
|
"selectOtherMonths: true, changeMonth: true, changeYear: true, " +
|
||
|
"beforeShow: beforeShowDatePicker};")
|
||
|
jquery_locale = l('jquery.locale', :default => current_language.to_s)
|
||
|
unless jquery_locale == 'en'
|
||
|
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
|
||
| public/javascripts/datepicker.js | ||
|---|---|---|
|
function beforeShowDatePicker(input, inst) {
|
||
|
var default_date = null;
|
||
|
switch ($(input).attr("id")) {
|
||
|
case "issue_start_date" :
|
||
|
if ($("#issue_due_date").size() > 0) {
|
||
|
default_date = $("#issue_due_date").val();
|
||
|
}
|
||
|
break;
|
||
|
case "issue_due_date" :
|
||
|
if ($("#issue_start_date").size() > 0) {
|
||
|
default_date = $("#issue_start_date").val();
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
$(input).datepicker("option", "defaultDate", default_date);
|
||
|
}
|
||
| test/ui/issues_test.rb | ||
|---|---|---|
|
page.first('p#due_date_area').first('img').click
|
||
|
page.first("td.ui-datepicker-days-cell-over a").click
|
||
|
assert_equal Date.today.to_s, page.find('input#issue_due_date').value
|
||
|
fill_in 'Start date', :with => '2012-05-01'
|
||
|
fill_in 'Due date', :with => ''
|
||
|
page.first('p#due_date_area').first('img').click
|
||
|
assert page.has_css?('td.ui-datepicker-days-cell-over')
|
||
|
page.first("td.ui-datepicker-days-cell-over a").click
|
||
|
assert_equal '2012-05-01', page.find('input#issue_due_date').value
|
||
|
fill_in 'Start date', :with => ''
|
||
|
fill_in 'Due date', :with => '2012-05-01'
|
||
|
page.first('p#start_date_area').first('img').click
|
||
|
page.first("td.ui-datepicker-days-cell-over a").click
|
||
|
assert_equal '2012-05-01', page.find('input#issue_start_date').value
|
||
|
end
|
||
|
end
|
||