link to appointment group from calendar event popup

fixes #6986

Test plan:
  - create an appointment group
  - reserve one of the slots as a student
  - go to the month view of the calendar and click on the appointment
  - clicking the name of the appt group should take you to the
    appointment group page

Change-Id: I58081f40b59da3b68597d645c3848d776b6c5f4c
Reviewed-on: https://gerrit.instructure.com/10459
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
This commit is contained in:
Cameron Matheson 2012-03-15 17:50:39 -06:00
parent 8a34204c51
commit 5c1a7ef113
5 changed files with 29 additions and 28 deletions

View File

@ -47,11 +47,10 @@ define [
if @calendarEvent.end_at then $.parseFromISO(@calendarEvent.end_at).time else null
fullDetailsURL: () ->
# We don't support full details links to placeholder events
if @isAppointmentGroupEvent()
return null
$.replaceTags(@contextInfo.calendar_event_url, 'id', @calendarEvent.parent_event_id ? @calendarEvent.id)
"/appointment_groups/#{@object.appointment_group_id}"
else
$.replaceTags(@contextInfo.calendar_event_url, 'id', @calendarEvent.parent_event_id ? @calendarEvent.id)
displayTimeString: () ->
semanticDateRange(@calendarEvent.start_at, @calendarEvent.end_at)

View File

@ -85,7 +85,7 @@ define [
# not the last _visible_ element
@rightSideAdminSection?.detach()
show: () =>
show: =>
$("#undated-events, #calendar-feed").hide()
@active = true
@div.show()
@ -93,7 +93,7 @@ define [
@toggleListMode(true)
$.publish "Calendar/saveVisibleContextListAndClear"
hide: () =>
hide: =>
$("#undated-events, #calendar-feed").show()
@active = false
@div.hide()
@ -101,13 +101,13 @@ define [
@calendar.displayAppointmentEvents = null
$.publish "Calendar/restoreVisibleContextList"
canManageAGroup: () =>
canManageAGroup: =>
for contextInfo in @contexts
if contextInfo.can_create_appointment_groups
return true
false
loadData: () =>
loadData: =>
if not @loadingDeferred || (@loadingDeferred && not @loadingDeferred.isResolved())
@loadingDeferred = new $.Deferred()
@ -120,7 +120,7 @@ define [
@redraw()
@loadingDeferred.resolve()
redraw: () =>
redraw: =>
@loadingDiv.hide()
if @groups
@ -210,12 +210,13 @@ define [
@calendar.displayAppointmentEvents = @viewingGroup
$.publish "Calendar/refetchEvents"
@redraw()
doneClick: (jsEvent) =>
jsEvent.preventDefault()
@toggleListMode(true)
showList: () =>
showList: =>
@div.removeClass('showing-single')
@listDiv.find('.appointment-group-item').removeClass('active')
@ -240,9 +241,9 @@ define [
message: $ deleteItemTemplate(message: I18n.t('confirm_appointment_group_deletion', "Are you sure you want to delete this appointment group?"), details: I18n.t('appointment_group_deletion_details', "Deleting it will also delete any appointments that have been signed up for by students."))
dialog: {title: I18n.t('confirm_deletion', "Confirm Deletion")}
prepareData: ($dialog) => {cancel_reason: $dialog.find('#cancel_reason').val() }
confirmed: () =>
confirmed: =>
$(jsEvent.target).closest(".appointment-group-item").addClass("event_pending")
success: () =>
success: =>
@calendar.dataSource.clearCache()
@loadData()

View File

@ -150,6 +150,8 @@ define [
else if @event.object?.available_slots > 0
params.availableSlotsText = @event.object.available_slots
params.showEventLink = params.can_edit and params.fullDetailsURL()
params.showEventLink or= params.isAppointmentGroupEvent()
@popover = new Popover(jsEvent, eventDetailsTemplate(params))
@popover.el.find(".edit_event_link").click preventDefault @showEditDialog

View File

@ -2,11 +2,11 @@
<div class='event-details-header'>
<a href="#" class="popover_close x-close-link">×</a>
<h3 class="details_title title">
{{#ifAll can_edit fullDetailsURL}}
{{#if showEventLink}}
<a href="{{fullDetailsURL}}" class="view_event_link">{{title}}</a>
{{else}}
{{title}}
{{/ifAll}}
{{/if}}
</h3>
</div>
<div class="event-details-content">

View File

@ -406,21 +406,20 @@ describe "calendar2" do
end
it "should validate appointment group popup link functionality" do
pending("bug 6986 - clicking on the name of an appointment group in a popup should take user to scheduler") do
ag = create_appointment_group
ag.appointments.first.reserve_for @student, @me
@user = @me
get "/calendar2"
wait_for_ajaximations
create_appointment_group
ag = AppointmentGroup.first
ag.appointments.first.reserve_for @student, @me
@user = @me
get "/calendar2"
wait_for_ajaximations
driver.find_element(:css, '.fc-event-title').click
popover = driver.find_element(:id, "popover-0")
popover.should be_displayed
expect_new_page_load { popover.find_element(:css, '.view_event_link').click }
wait_for_ajaximations
is_checked('#scheduler').should be_true
driver.find_element(:id, 'appointment-group-list').should include_text(ag.title)
end
driver.find_element(:css, '.fc-event-title').click
popover = driver.find_element(:id, "popover-0")
popover.should be_displayed
expect_new_page_load { popover.find_element(:css, '.view_event_link').click }
wait_for_ajaximations
is_checked('#scheduler').should be_true
driver.find_element(:id, 'appointment-group-list').should include_text(ag.title)
end
it "should show section-level events for the student's section" do