Feature #14024 » dafault-issue-date.diff
| app/views/issues/_attributes.html.erb | ||
|---|---|---|
| 47 | 47 |
<% end %> |
| 48 | 48 | |
| 49 | 49 |
<% if @issue.safe_attribute? 'start_date' %> |
| 50 |
<p> |
|
| 50 |
<p id="start_date_area">
|
|
| 51 | 51 |
<%= f.text_field(:start_date, :size => 10, :disabled => !@issue.leaf?, |
| 52 | 52 |
:required => @issue.required_attribute?('start_date')) %>
|
| 53 | 53 |
<%= calendar_for('issue_start_date') if @issue.leaf? %>
|
| ... | ... | |
| 55 | 55 |
<% end %> |
| 56 | 56 | |
| 57 | 57 |
<% if @issue.safe_attribute? 'due_date' %> |
| 58 |
<p> |
|
| 58 |
<p id="due_date_area">
|
|
| 59 | 59 |
<%= f.text_field(:due_date, :size => 10, :disabled => !@issue.leaf?, |
| 60 | 60 |
:required => @issue.required_attribute?('due_date')) %>
|
| 61 | 61 |
<%= calendar_for('issue_due_date') if @issue.leaf? %>
|
| test/ui/issues_test.rb | ||
|---|---|---|
| 132 | 132 |
assert_equal ['Dave Lopper', 'Some Watcher'], issue.watcher_users.map(&:name).sort |
| 133 | 133 |
end |
| 134 | 134 | |
| 135 |
def test_create_issue_start_due_date |
|
| 136 |
with_settings :default_issue_start_date_to_creation_date => 0 do |
|
| 137 |
log_user('jsmith', 'jsmith')
|
|
| 138 |
visit '/projects/ecookbook/issues/new' |
|
| 139 |
assert_equal "", page.find('input#issue_start_date').value
|
|
| 140 |
assert_equal "", page.find('input#issue_due_date').value
|
|
| 141 |
page.first('p#start_date_area').first('img').click
|
|
| 142 |
page.first("td.ui-datepicker-days-cell-over a").click
|
|
| 143 |
assert_equal Date.today.to_s, page.find('input#issue_start_date').value
|
|
| 144 |
page.first('p#due_date_area').first('img').click
|
|
| 145 |
page.first("td.ui-datepicker-days-cell-over a").click
|
|
| 146 |
assert_equal Date.today.to_s, page.find('input#issue_due_date').value
|
|
| 147 |
end |
|
| 148 |
end |
|
| 149 | ||
| 135 | 150 |
def test_preview_issue_description |
| 136 | 151 |
log_user('jsmith', 'jsmith')
|
| 137 | 152 |
visit '/projects/ecookbook/issues/new' |
| app/helpers/application_helper.rb | ||
|---|---|---|
| 1075 | 1075 | |
| 1076 | 1076 |
def include_calendar_headers_tags |
| 1077 | 1077 |
unless @calendar_headers_tags_included |
| 1078 |
tags = javascript_include_tag("datepicker")
|
|
| 1078 | 1079 |
@calendar_headers_tags_included = true |
| 1079 | 1080 |
content_for :header_tags do |
| 1080 | 1081 |
start_of_week = Setting.start_of_week |
| ... | ... | |
| 1082 | 1083 |
# Redmine uses 1..7 (monday..sunday) in settings and locales |
| 1083 | 1084 |
# JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0 |
| 1084 | 1085 |
start_of_week = start_of_week.to_i % 7 |
| 1085 | ||
| 1086 |
tags = javascript_tag( |
|
| 1086 |
tags << javascript_tag( |
|
| 1087 | 1087 |
"var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: #{start_of_week}, " +
|
| 1088 | 1088 |
"showOn: 'button', buttonImageOnly: true, buttonImage: '" + |
| 1089 | 1089 |
path_to_image('/images/calendar.png') +
|
| 1090 |
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true, changeMonth: true, changeYear: true};") |
|
| 1090 |
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, " + |
|
| 1091 |
"selectOtherMonths: true, changeMonth: true, changeYear: true, " + |
|
| 1092 |
"beforeShow: beforeShowDatePicker};") |
|
| 1091 | 1093 |
jquery_locale = l('jquery.locale', :default => current_language.to_s)
|
| 1092 | 1094 |
unless jquery_locale == 'en' |
| 1093 | 1095 |
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
|
| public/javascripts/datepicker.js | ||
|---|---|---|
| 1 |
function beforeShowDatePicker(input, inst) {
|
|
| 2 |
var default_date = null; |
|
| 3 |
switch ($(input).attr("id")) {
|
|
| 4 |
case "issue_start_date" : |
|
| 5 |
if ($("#issue_due_date").size() > 0) {
|
|
| 6 |
default_date = $("#issue_due_date").val();
|
|
| 7 |
} |
|
| 8 |
break; |
|
| 9 |
case "issue_due_date" : |
|
| 10 |
if ($("#issue_start_date").size() > 0) {
|
|
| 11 |
default_date = $("#issue_start_date").val();
|
|
| 12 |
} |
|
| 13 |
break; |
|
| 14 |
} |
|
| 15 |
$(input).datepicker("option", "defaultDate", default_date);
|
|
| 16 |
} |
|
| test/ui/issues_test.rb | ||
|---|---|---|
| 144 | 144 |
page.first('p#due_date_area').first('img').click
|
| 145 | 145 |
page.first("td.ui-datepicker-days-cell-over a").click
|
| 146 | 146 |
assert_equal Date.today.to_s, page.find('input#issue_due_date').value
|
| 147 | ||
| 148 |
fill_in 'Start date', :with => '2012-05-01' |
|
| 149 |
fill_in 'Due date', :with => '' |
|
| 150 |
page.first('p#due_date_area').first('img').click
|
|
| 151 |
assert page.has_css?('td.ui-datepicker-days-cell-over')
|
|
| 152 |
page.first("td.ui-datepicker-days-cell-over a").click
|
|
| 153 |
assert_equal '2012-05-01', page.find('input#issue_due_date').value
|
|
| 154 | ||
| 155 |
fill_in 'Start date', :with => '' |
|
| 156 |
fill_in 'Due date', :with => '2012-05-01' |
|
| 157 |
page.first('p#start_date_area').first('img').click
|
|
| 158 |
page.first("td.ui-datepicker-days-cell-over a").click
|
|
| 159 |
assert_equal '2012-05-01', page.find('input#issue_start_date').value
|
|
| 147 | 160 |
end |
| 148 | 161 |
end |
| 149 | 162 | |