auto-fill course dates on course copy content page

The start/end dates of the source course are now filled in
for the user automatically for happiness

Test Plan:
 * Set the start/end dates for a course
 * Go to copy the course
 * In the "Adjust events and due dates" section, the dates for the original course should already be filled in

closes #8415

Change-Id: Ic00c9d8f438a8291421690ce814263dd102d4c26
Reviewed-on: https://gerrit.instructure.com/10562
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
This commit is contained in:
Bracken Mosbacker 2012-05-04 17:07:55 -06:00
parent ce12af199d
commit ba048b5b87
2 changed files with 12 additions and 7 deletions

View File

@ -5,9 +5,9 @@
<div style="margin-bottom: 5px;"><%= t 'labels.dates_range', "%{course} dates range", :course => %{<strong class="course_name">#{@source_course.name}</strong>}.html_safe %></div>
<% ot 'from_to', "*from* %{start_date} **to** %{end_date}",
:start_date => capture { %>
<div style="float: left;"><%= text_field :copy, :old_start_date, :value => "", :class => "date_field", :style => "width: 120px;" %></div>
<div style="float: left;"><%= text_field :copy, :old_start_date, :value => date_string(@source_course.real_start_date, :long), :class => "date_field", :style => "width: 120px;" %></div>
<% }, :end_date => capture { %>
<div style="float: left;"><%= text_field :copy, :old_end_date, :value => "", :class => "date_field", :style => "width: 120px;" %></div>
<div style="float: left;"><%= text_field :copy, :old_end_date, :value => date_string(@source_course.real_end_date, :long), :class => "date_field", :style => "width: 120px;" %></div>
<% }, :wrapper => { '*' => '<div style="float: left; margin-left: 10px;">\1&nbsp;</div>',
'**' => '<div style="float: left;">&nbsp;\1&nbsp;</div>' } %>
<div class="clear"></div>

View File

@ -62,7 +62,7 @@ describe "courses" do
context "course copy" do
def course_copy_helper
course_with_teacher_logged_in
course_with_teacher_logged_in unless @course
@second_course ||= Course.create!(:name => 'second course')
@second_course.offer!
5.times do |i|
@ -146,12 +146,17 @@ describe "courses" do
:delayed_post_at => old_start + 3.days)
@second_course.assignments.create!(:due_at => old_start)
# Set the start/end dates to test that they are auto-filled on the copy content page
@second_course.start_at = DateTime.parse("01 Jul 2012")
@second_course.conclude_at = DateTime.parse("11 Jul 2012")
@second_course.save!
course_with_teacher_logged_in
@course.start_at = DateTime.parse("05 Aug 2012")
@course.conclude_at = DateTime.parse("15 Aug 2012")
@course.save!
course_copy_helper do |driver|
f('#copy_shift_dates').click
f('#copy_old_start_date').send_keys('Jul 1, 2012')
f('#copy_old_end_date').send_keys('Jul 11, 2012')
replace_content(f('#copy_new_start_date'), 'Aug 5, 2012')
f('#copy_new_end_date').send_keys('Aug 15, 2012')
f('.add_substitution_link').click
wait_for_animations
select = driver.find_element(:name, "copy[day_substitutions][0]")