Skip to content

Commit 4753dfa

Browse files
rtibblesbotclaude
andcommitted
Style mark-all-present modal confirm button with error color
Use the #actions slot in KModal to provide a custom confirm button styled with $themeTokens.error background, matching the established destructive-action pattern used by MoveToTrashModal and PermanentDeleteModal. Update test mock to support #actions slot. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9bba8be commit 4753dfa

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

kolibri/plugins/coach/frontend/views/attendance/AttendanceNewPage.vue

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,21 @@
123123
<KModal
124124
v-if="showMarkAllModal"
125125
:title="markAllModalTitle$({ count: sortedLearners.length })"
126-
:submitText="markAllPresentAction$()"
127-
:cancelText="coreString('goBackAction')"
128-
@submit="confirmMarkAll"
129126
@cancel="cancelMarkAll"
130127
>
131128
<p>{{ markAllModalDescription$({ count: absentCount }) }}</p>
129+
<template #actions>
130+
<KButton
131+
:text="coreString('goBackAction')"
132+
@click="cancelMarkAll"
133+
/>
134+
<KButton
135+
data-test="mark-all-confirm"
136+
:text="markAllPresentAction$()"
137+
:appearanceOverrides="confirmButtonStyles"
138+
@click="confirmMarkAll"
139+
/>
140+
</template>
132141
</KModal>
133142

134143
<KModal
@@ -150,6 +159,8 @@
150159
151160
import { computed, ref } from 'vue';
152161
import { useRouter } from 'vue-router/composables';
162+
import { darken1 } from 'kolibri-design-system/lib/styles/darkenColors';
163+
import { themeTokens } from 'kolibri-design-system/lib/styles/theme';
153164
import { localeCompare } from 'kolibri/utils/i18n';
154165
import { coreString } from 'kolibri/uiText/commonCoreStrings';
155166
import store from 'kolibri/store';
@@ -240,6 +251,12 @@
240251
);
241252
const absentCount = computed(() => sortedLearners.value.length - presentCount.value);
242253
254+
const confirmButtonStyles = {
255+
color: themeTokens().textInverted,
256+
backgroundColor: themeTokens().error,
257+
':hover': { backgroundColor: darken1(themeTokens().error) },
258+
};
259+
243260
// Mark all
244261
const allPresent = computed(
245262
() => sortedLearners.value.length > 0 && presentCount.value === sortedLearners.value.length,
@@ -328,6 +345,7 @@
328345
handleMarkAllChange,
329346
confirmMarkAll,
330347
cancelMarkAll,
348+
confirmButtonStyles,
331349
handleSubmit,
332350
handleCancel,
333351
confirmLeave,

kolibri/plugins/coach/frontend/views/attendance/__tests__/AttendancePages.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const TEST_STUBS = {
6161
name: 'KModal',
6262
props: ['title', 'submitText', 'cancelText'],
6363
template:
64-
'<div data-test="modal"><h2>{{ title }}</h2><slot /><button data-test="modal-submit" @click="$emit(\'submit\')">{{ submitText }}</button><button data-test="modal-cancel" @click="$emit(\'cancel\')">{{ cancelText }}</button></div>',
64+
'<div data-test="modal"><h2>{{ title }}</h2><slot /><slot name="actions"><button data-test="modal-submit" @click="$emit(\'submit\')">{{ submitText }}</button><button data-test="modal-cancel" @click="$emit(\'cancel\')">{{ cancelText }}</button></slot></div>',
6565
},
6666
BottomAppBar: {
6767
name: 'BottomAppBar',
@@ -199,7 +199,7 @@ describe('AttendanceNewPage', () => {
199199
await markAllSwitch.trigger('click');
200200
await global.flushPromises();
201201

202-
await wrapper.find('[data-test="modal-submit"]').trigger('click');
202+
await wrapper.find('[data-test="mark-all-confirm"]').trigger('click');
203203
await global.flushPromises();
204204

205205
expect(wrapper.text()).toContain('3 present');

0 commit comments

Comments
 (0)