Skip to content

Commit ddcfb09

Browse files
authored
fix(agenda): replace download cal dropdown with actual links (ietf-tools#5287)
1 parent 996e6c2 commit ddcfb09

2 files changed

Lines changed: 47 additions & 24 deletions

File tree

client/agenda/AgendaQuickAccess.vue

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
size='large'
7575
:show-arrow='true'
7676
trigger='click'
77-
@select='downloadIcs'
7877
)
7978
n-button.mt-2(
8079
id='agenda-quickaccess-addtocal-btn'
@@ -141,14 +140,26 @@ const route = useRoute()
141140
142141
const downloadIcsOptions = [
143142
{
144-
label: 'Subscribe... (webcal)',
145143
key: 'subscribe',
146-
icon: () => h('i', { class: 'bi bi-calendar-week text-blue' })
144+
type: 'render',
145+
render: () => h('a', {
146+
class: 'agenda-quickaccess-callinks',
147+
href: `webcal://${window.location.host}${icsLink.value}`
148+
}, [
149+
h('i', { class: 'bi bi-calendar-week text-blue' }),
150+
h('span', 'Subscribe... (webcal)')
151+
])
147152
},
148153
{
149-
label: 'Download... (.ics)',
150154
key: 'download',
151-
icon: () => h('i', { class: 'bi bi-arrow-down-square' })
155+
type: 'render',
156+
render: () => h('a', {
157+
class: 'agenda-quickaccess-callinks',
158+
href: icsLink.value
159+
}, [
160+
h('i', { class: 'bi bi-arrow-down-square' }),
161+
h('span', 'Download... (.ics)')
162+
])
152163
}
153164
]
154165
@@ -158,6 +169,17 @@ const shortMode = computed(() => {
158169
return siteStore.viewport <= 1350
159170
})
160171
172+
const icsLink = computed(() => {
173+
if (agendaStore.pickerMode) {
174+
const sessionKeywords = agendaStore.scheduleAdjusted.map(s => s.sessionKeyword)
175+
return `${getUrl('meetingCalIcs', { meetingNumber: agendaStore.meeting.number })}?show=${sessionKeywords.join(',')}`
176+
} else if (agendaStore.selectedCatSubs.length > 0) {
177+
return `${getUrl('meetingCalIcs', { meetingNumber: agendaStore.meeting.number })}?show=${agendaStore.selectedCatSubs.join(',')}`
178+
} else {
179+
return `${getUrl('meetingCalIcs', { meetingNumber: agendaStore.meeting.number })}`
180+
}
181+
})
182+
161183
// METHODS
162184
163185
function pickerStart () {
@@ -177,24 +199,6 @@ function pickerDiscard () {
177199
}
178200
}
179201
180-
function downloadIcs (key) {
181-
message.loading('Generating calendar file... Download will begin shortly.')
182-
let icsUrl = ''
183-
if (agendaStore.pickerMode) {
184-
const sessionKeywords = agendaStore.scheduleAdjusted.map(s => s.sessionKeyword)
185-
icsUrl = `${getUrl('meetingCalIcs', { meetingNumber: agendaStore.meeting.number })}?show=${sessionKeywords.join(',')}`
186-
} else if (agendaStore.selectedCatSubs.length > 0) {
187-
icsUrl = `${getUrl('meetingCalIcs', { meetingNumber: agendaStore.meeting.number })}?show=${agendaStore.selectedCatSubs.join(',')}`
188-
} else {
189-
icsUrl = `${getUrl('meetingCalIcs', { meetingNumber: agendaStore.meeting.number })}`
190-
}
191-
if (key === 'subscribe') {
192-
window.location.assign(`webcal://${window.location.host}${icsUrl}`)
193-
} else {
194-
window.location.assign(icsUrl)
195-
}
196-
}
197-
198202
function scrollToDay (dayId, ev) {
199203
ev.preventDefault()
200204
document.getElementById(`agenda-day-${dayId}`)?.scrollIntoView(true)
@@ -284,5 +288,24 @@ function scrollToNow (ev) {
284288
margin-top: 15px;
285289
margin-bottom: 15px;
286290
}
291+
292+
&-callinks {
293+
padding: 8px 16px;
294+
display: flex;
295+
text-decoration: none;
296+
align-items: center;
297+
298+
&:hover, &:focus {
299+
text-decoration: underline;
300+
}
301+
302+
> i {
303+
font-size: var(--n-font-size);
304+
}
305+
306+
> span {
307+
margin-left: 12px;
308+
}
309+
}
287310
}
288311
</style>

playwright/tests/meeting/agenda.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ test.describe('past - desktop', () => {
928928
test('agenda add to calendar', async ({ page }) => {
929929
await expect(page.locator('#agenda-quickaccess-addtocal-btn')).toContainText('Add to your calendar')
930930
await page.locator('#agenda-quickaccess-addtocal-btn').click()
931-
const ddnLocator = page.locator('.n-dropdown-menu > .n-dropdown-option')
931+
const ddnLocator = page.locator('.n-dropdown-menu > div > a.agenda-quickaccess-callinks')
932932
await expect(ddnLocator).toHaveCount(2)
933933
await expect(ddnLocator.first()).toContainText('Subscribe')
934934
await expect(ddnLocator.last()).toContainText('Download')

0 commit comments

Comments
 (0)