Skip to content

Commit e2f37d8

Browse files
committed
Add page for editing appointment groups
closes CNVS-32301 Test Plan: - Enable Better Scheduler - Create some appointment groups - Click on an appointment group in any calendar view - There should be a button for "Group Details" - That should take you to a new page that shows "Edit ABC" where ABC is the title of the appointment group. Change-Id: Id5b9cb93adc071bdb3d2e930e99eb27c69077f1f Reviewed-on: https://gerrit.instructure.com/91477 Reviewed-by: Steven Burnett <sburnett@instructure.com> Tested-by: Jenkins QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com> Product-Review: Clay Diffrient <cdiffrient@instructure.com>
1 parent 3a2d565 commit e2f37d8

9 files changed

Lines changed: 88 additions & 3 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require [
2+
'react-dom'
3+
'jsx/calendar/scheduler/components/appointment_groups/EditPage'
4+
], (ReactDOM, EditPage) ->
5+
6+
ReactDOM.render(
7+
React.createElement(EditPage, {appointment_group: ENV.APPOINTMENT_GROUP.appointment_group}),
8+
document.getElementById('content')
9+
)

app/coffeescripts/calendar/CommonEvent.CalendarEvent.coffee

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ define [
6161
else
6262
$.replaceTags(@contextInfo.calendar_event_url, 'id', @calendarEvent.parent_event_id ? @calendarEvent.id)
6363

64+
editGroupURL: () ->
65+
if @isAppointmentGroupEvent()
66+
"/appointment_groups/#{@object.appointment_group_id}/edit"
67+
else
68+
"#"
69+
6470
displayTimeString: () ->
6571
if @calendarEvent.all_day
6672
@formatTime(@startDate(), true)

app/coffeescripts/calendar/ShowEventDetailsDialog.coffee

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ define [
173173
else if @event.object?.available_slots > 0
174174
params.availableSlotsText = @event.object.available_slots
175175

176+
params.use_new_scheduler = ENV.CALENDAR.BETTER_SCHEDULER
177+
params.is_appointment_group = !!@event.isAppointmentGroupEvent() # this returns the actual url so make it boolean for clarity
176178
params.reserve_comments = @event.object.reserve_comments ?= @event.object.comments
177179
params.showEventLink = params.fullDetailsURL()
178180
params.showEventLink or= params.isAppointmentGroupEvent()

app/controllers/appointment_groups_controller.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class AppointmentGroupsController < ApplicationController
207207
include Api::V1::CalendarEvent
208208

209209
before_filter :require_user
210-
before_filter :get_appointment_group, :only => [:show, :update, :destroy, :users, :groups]
210+
before_filter :get_appointment_group, :only => [:show, :update, :destroy, :users, :groups, :edit]
211211

212212
def calendar_fragment(opts)
213213
opts.to_json.unpack('H*')
@@ -386,6 +386,20 @@ def show
386386
end
387387
end
388388

389+
# Shows the edit page for an assignment group
390+
def edit
391+
if request.format == :html
392+
if authorized_action(@group, @current_user, :update)
393+
@page_title = t('Edit %{title}', {title: @group.title})
394+
js_env({
395+
:APPOINTMENT_GROUP => @group
396+
})
397+
js_bundle :calendar_appointment_group_edit
398+
render :text => "".html_safe, :layout => true
399+
end
400+
end
401+
end
402+
389403
# @API Update an appointment group
390404
#
391405
# Update and return an appointment group. If new_appointments are specified,
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
define([
2+
'react',
3+
'i18n!appointment_groups',
4+
], (React, I18n) => {
5+
6+
class FindAppointment extends React.Component {
7+
8+
static propTypes = {
9+
appointment_group: React.PropTypes.shape({
10+
title: React.PropTypes.string
11+
})
12+
};
13+
14+
render () {
15+
return (
16+
<h1>
17+
{I18n.t('Edit %{pageTitle}', {
18+
pageTitle: this.props.appointment_group.title
19+
})}
20+
</h1>
21+
);
22+
}
23+
}
24+
25+
return FindAppointment;
26+
});

app/stylesheets/jst/calendar/calendarApp.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
border: 1px solid #b0afaf;
6363
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.6);
6464
background-color: white;
65-
min-width: 250px;
65+
min-width: 320px;
6666
max-width: 500px;
6767
ul {
6868
@include reset-list;

app/views/jst/calendar/eventDetails.handlebars

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
</div>
103103
<div class="popover-links-holder event-details-footer">
104104
<div class="pull-right">
105+
{{#ifAll can_edit is_appointment_group use_new_scheduler}}
106+
<a href={{editGroupURL}} class="group_details Button Button--small">{{#t}}Group Details{{/t}}</a>
107+
{{/ifAll}}
105108
{{#if can_delete }}
106109
<button class="event_button Button Button--small delete_event_link">{{#t "links.delete"}}Delete{{/t}}</button>
107110
{{/if}}

config/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@
816816
end
817817
end
818818

819-
resources :appointment_groups, only: [:index, :show]
819+
resources :appointment_groups, only: [:index, :show, :edit]
820820

821821
resources :errors, only: [:show, :index, :create], path: :error_reports
822822

spec/selenium/calendar/calendar2_general_spec.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,31 @@
1717
course_with_teacher_logged_in
1818
end
1919

20+
context "with Better Scheduler enabled" do
21+
before(:each) do
22+
account = Account.default
23+
account.enable_feature! :better_scheduler
24+
end
25+
26+
it "should let me go to the Edit Appointment group page from the appointment group slot dialog" do
27+
date = Date.today.to_s
28+
create_appointment_group :new_appointments => [
29+
["#{date} 12:00:00", "#{date} 13:00:00"],
30+
["#{date} 13:00:00", "#{date} 14:00:00"],
31+
]
32+
33+
get '/calendar2'
34+
35+
f('.fc-event').click
36+
wait_for_ajaximations
37+
expect_new_page_load { f('.group_details').click }
38+
wait_for_ajaximations
39+
40+
expect(f('h1')).to include_text "Edit new appointment group"
41+
end
42+
43+
end
44+
2045
it "should let me message students who have signed up for an appointment" do
2146
date = Date.today.to_s
2247
create_appointment_group :new_appointments => [

0 commit comments

Comments
 (0)