Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,17 @@
"neowiki-edit-summary-label",
"neowiki-edit-summary-placeholder",
"neowiki-edit-summary-help-text-schema",
"neowiki-delete-confirm-title",
"neowiki-delete-confirm-message",
"neowiki-delete-confirm-button",
"neowiki-schema-noun",
"neowiki-layout-noun",
"neowiki-mapping-noun",
"neowiki-delete-reason-label",
"neowiki-delete-reason-placeholder",
"neowiki-delete-summary-default",
"neowiki-delete-success",
"neowiki-delete-error",
"neowiki-subject-editor-title",
"neowiki-subject-editor-save",
"neowiki-schema-editor-new-property",
Expand Down Expand Up @@ -493,6 +504,7 @@
"neowiki-subject-creator-creating-schema",
"neowiki-subject-creator-back",
"neowiki-edit-schema",
"neowiki-schema-delete",
"neowiki-schema-editor-summary-default",
"neowiki-schema-editor-success",
"neowiki-schema-editor-error",
Expand Down Expand Up @@ -573,12 +585,6 @@
"neowiki-mapping-creator-summary-default",
"neowiki-edit-mapping",
"neowiki-mapping-delete",
"neowiki-mapping-delete-confirm-title",
"neowiki-mapping-delete-confirm-message",
"neowiki-mapping-delete-confirm-delete",
"neowiki-mapping-delete-summary-default",
"neowiki-mapping-delete-success",
"neowiki-mapping-delete-error",
"neowiki-layout-creator-title",
"neowiki-layout-creator-button",
"neowiki-layout-creator-name-field",
Expand All @@ -594,12 +600,6 @@
"neowiki-layout-creator-error",
"neowiki-layout-creator-summary-default",
"neowiki-layout-delete",
"neowiki-layout-delete-confirm-title",
"neowiki-layout-delete-confirm-message",
"neowiki-layout-delete-confirm-delete",
"neowiki-layout-delete-summary-default",
"neowiki-layout-delete-success",
"neowiki-layout-delete-error",
"neowiki-managesubjects-title",
"neowiki-managesubjects-not-applicable",
"neowiki-managesubjects-add-button",
Expand Down
30 changes: 12 additions & 18 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@
"neowiki-edit-summary-placeholder": "Describe what you changed",
"neowiki-edit-summary-help-text-schema": "Changes affect all Subjects using this Schema.",

"neowiki-delete-confirm-title": "Delete $1?",
"neowiki-delete-confirm-message": "The $1 will be deleted.",
"neowiki-delete-confirm-button": "Delete",
"neowiki-schema-noun": "schema",
"neowiki-layout-noun": "layout",
"neowiki-mapping-noun": "mapping",
"neowiki-delete-reason-label": "Reason",
"neowiki-delete-reason-placeholder": "Reason for deletion",
"neowiki-delete-summary-default": "Deleted via the NeoWiki UI",
"neowiki-delete-success": "Deleted $1",
"neowiki-delete-error": "Failed to delete $1",

"neowiki-subject-editor-title": "Editing $1",
"neowiki-subject-editor-save": "Save changes",

Expand Down Expand Up @@ -188,12 +200,6 @@
"neowiki-schema-sidebar-all-schemas": "All schemas",

"neowiki-schema-delete": "Delete schema",
"neowiki-schema-delete-confirm-title": "Delete schema?",
"neowiki-schema-delete-confirm-message": "The schema $1 will be permanently deleted.",
"neowiki-schema-delete-confirm-delete": "Delete",
"neowiki-schema-delete-summary-default": "Delete schema via NeoWiki UI",
"neowiki-schema-delete-success": "Deleted $1 schema",
"neowiki-schema-delete-error": "Failed to delete $1 schema.",

"neowiki-close-confirmation-title": "Discard unsaved changes?",
"neowiki-close-confirmation-message": "Your changes have not been saved and will be lost.",
Expand Down Expand Up @@ -269,12 +275,6 @@
"neowiki-mapping-creator-summary-default": "Create mapping via NeoWiki UI",
"neowiki-edit-mapping": "Edit mapping",
"neowiki-mapping-delete": "Delete mapping",
"neowiki-mapping-delete-confirm-title": "Delete mapping?",
"neowiki-mapping-delete-confirm-message": "The mapping $1 will be permanently deleted.",
"neowiki-mapping-delete-confirm-delete": "Delete",
"neowiki-mapping-delete-summary-default": "Delete mapping via NeoWiki UI",
"neowiki-mapping-delete-success": "Deleted $1 mapping",
"neowiki-mapping-delete-error": "Failed to delete $1 mapping.",

"neowiki-layout-creator-title": "Create layout",
"neowiki-layout-creator-button": "Create",
Expand All @@ -292,12 +292,6 @@
"neowiki-layout-creator-summary-default": "Create layout via NeoWiki UI",

"neowiki-layout-delete": "Delete layout",
"neowiki-layout-delete-confirm-title": "Delete layout?",
"neowiki-layout-delete-confirm-message": "The layout $1 will be permanently deleted.",
"neowiki-layout-delete-confirm-delete": "Delete",
"neowiki-layout-delete-summary-default": "Delete layout via NeoWiki UI",
"neowiki-layout-delete-success": "Deleted $1 layout",
"neowiki-layout-delete-error": "Failed to delete $1 layout.",

"neowiki-managesubjects-tab": "Data",
"neowiki-managesubjects-title": "Subjects on $1",
Expand Down
30 changes: 12 additions & 18 deletions i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@
"neowiki-schema-sidebar-all-schemas": "Label for the link in the NeoWiki section of the sidebar on Schema pages that navigates to [[Special:Schemas]].",

"neowiki-schema-delete": "Aria label for the delete button on a Schema row in the schemas list.",
"neowiki-schema-delete-confirm-title": "Title of the confirmation dialog shown when deleting a schema.",
"neowiki-schema-delete-confirm-message": "Message in the delete confirmation dialog. $1 is the schema name.",
"neowiki-schema-delete-confirm-delete": "Label for the delete button in the schema deletion dialog.",
"neowiki-schema-delete-summary-default": "Default deletion reason used when deleting a schema via the UI.",
"neowiki-schema-delete-success": "Success notification shown after deleting a schema. $1 is the schema name.",
"neowiki-schema-delete-error": "Error notification title shown when deleting a schema fails. $1 is the schema name.",

"neowiki-close-confirmation-title": "Title of the confirmation dialog shown when closing a dialog with unsaved changes.",
"neowiki-close-confirmation-message": "Message in the confirmation dialog asking the user to confirm discarding unsaved changes.",
Expand Down Expand Up @@ -127,6 +121,18 @@
"neowiki-editing-layout": "Title of the dialog for editing a layout. $1 is the layout name.",
"neowiki-save-layout": "Label for the save button in the layout editor dialog.",
"neowiki-edit-summary-help-text-layout": "Help text shown below the edit summary in the layout editor dialog.",

"neowiki-delete-confirm-title": "Title of the confirmation dialog shown before deleting a NeoWiki page (Schema, Layout, or Mapping). $1 is the entity name.",
"neowiki-delete-confirm-message": "Body of the delete confirmation dialog. $1 is the entity type noun (see neowiki-schema-noun etc.) followed by the entity name in bold, e.g. \"schema '''Foo'''\".",
"neowiki-delete-confirm-button": "Label for the button that confirms deletion in the delete confirmation dialog.",
"neowiki-schema-noun": "Lowercase common noun for a Schema, used inside sentences such as the delete confirmation message (\"The schema Foo will be deleted\").",
"neowiki-layout-noun": "Lowercase common noun for a Layout, used inside sentences such as the delete confirmation message (\"The layout Foo will be deleted\").",
"neowiki-mapping-noun": "Lowercase common noun for an ontology Mapping, used inside sentences such as the delete confirmation message (\"The mapping Foo will be deleted\").",
"neowiki-delete-reason-label": "Label for the optional deletion-reason field in the delete confirmation dialog.",
"neowiki-delete-reason-placeholder": "Placeholder for the optional deletion-reason field in the delete confirmation dialog.",
"neowiki-delete-summary-default": "Default deletion reason recorded in the deletion log when the user enters none.",
"neowiki-delete-success": "Success notification shown after a page is deleted. $1 is the page name.",
"neowiki-delete-error": "Error notification title shown when deleting a page fails. $1 is the page name.",
"neowiki-layout-editor-description": "Label for the description field in the layout editor.",
"neowiki-layout-editor-description-placeholder": "Placeholder text for the description field in the layout editor.",
"neowiki-layout-editor-schema": "Label for the read-only schema field in the layout editor.",
Expand Down Expand Up @@ -167,12 +173,6 @@
"neowiki-mapping-creator-summary-default": "Default edit summary used when creating a mapping via the UI.",
"neowiki-edit-mapping": "Aria label for the edit button on a Mapping row in the mappings list.",
"neowiki-mapping-delete": "Aria label for the delete button on a Mapping row in the mappings list.",
"neowiki-mapping-delete-confirm-title": "Title of the confirmation dialog shown when deleting a mapping.",
"neowiki-mapping-delete-confirm-message": "Message in the delete confirmation dialog. $1 is the mapping name.",
"neowiki-mapping-delete-confirm-delete": "Label for the delete button in the mapping deletion dialog.",
"neowiki-mapping-delete-summary-default": "Default deletion reason used when deleting a mapping via the UI.",
"neowiki-mapping-delete-success": "Success notification shown after deleting a mapping. $1 is the mapping name.",
"neowiki-mapping-delete-error": "Error notification title shown when deleting a mapping fails. $1 is the mapping name.",

"neowiki-layout-creator-title": "Title of the dialog for creating a new layout.",
"neowiki-layout-creator-button": "Label for the button that opens the layout creation dialog on [[Special:Layouts]].",
Expand All @@ -190,12 +190,6 @@
"neowiki-layout-creator-summary-default": "Default edit summary used when creating a layout via the UI.",

"neowiki-layout-delete": "Aria label for the delete button on a Layout row in the layouts list.",
"neowiki-layout-delete-confirm-title": "Title of the confirmation dialog shown when deleting a layout.",
"neowiki-layout-delete-confirm-message": "Message in the delete confirmation dialog. $1 is the layout name.",
"neowiki-layout-delete-confirm-delete": "Label for the delete button in the layout deletion dialog.",
"neowiki-layout-delete-summary-default": "Default deletion reason used when deleting a layout via the UI.",
"neowiki-layout-delete-success": "Success notification shown after deleting a layout. $1 is the layout name.",
"neowiki-layout-delete-error": "Error notification title shown when deleting a layout fails. $1 is the layout name.",
"neowiki-property-type-select": "Label for the select/dropdown property type shown in the property type selector.",
"neowiki-property-editor-min-exceeds-max": "Error shown in the schema editor when the minimum value exceeds the maximum value for a number property.",
"neowiki-property-editor-options": "Label for the options field in the select property type editor, where schema creators define the allowed values.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/>

<template #footer>
<EditSummary
<SummaryAction
:help-text="$i18n( 'neowiki-edit-summary-help-text-layout' ).text()"
:save-button-label="$i18n( 'neowiki-save-layout' ).text()"
:save-disabled="!hasChanged"
Expand All @@ -34,7 +34,7 @@
<script setup lang="ts">
import LayoutEditor from '@/components/LayoutEditor/LayoutEditor.vue';
import type { LayoutEditorExposes } from '@/components/LayoutEditor/LayoutEditor.vue';
import EditSummary from '@/components/common/EditSummary.vue';
import SummaryAction from '@/components/common/SummaryAction.vue';
import CloseConfirmationDialog from '@/components/common/CloseConfirmationDialog.vue';
import { CdxDialog } from '@wikimedia/codex';
import { Layout } from '@/domain/Layout.ts';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/>

<template #footer>
<EditSummary
<SummaryAction
help-text=""
:save-button-label="$i18n( 'neowiki-layout-creator-save' ).text()"
:save-disabled="!hasChanged"
Expand All @@ -35,7 +35,7 @@ import { ref, watch } from 'vue';
import { CdxDialog } from '@wikimedia/codex';
import LayoutCreator from './LayoutCreator.vue';
import type { LayoutCreatorExposes } from './LayoutCreator.vue';
import EditSummary from '@/components/common/EditSummary.vue';
import SummaryAction from '@/components/common/SummaryAction.vue';
import CloseConfirmationDialog from '@/components/common/CloseConfirmationDialog.vue';
import { Layout } from '@/domain/Layout.ts';
import type { LayoutSaveHandler } from '@/components/LayoutEditor/LayoutEditorDialog.vue';
Expand Down
55 changes: 8 additions & 47 deletions resources/ext.neowiki/src/components/LayoutsPage/LayoutsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,20 @@
@update:open="onEditorOpenChange"
/>

<CdxDialog
<DeletePageDialog
:open="isDeleteConfirmOpen"
:title="$i18n( 'neowiki-layout-delete-confirm-title' ).text()"
:use-close-button="true"
:page-title="`Layout:${ deletingLayoutName }`"
:display-name="deletingLayoutName"
:type-label="$i18n( 'neowiki-layout-noun' ).text()"
@update:open="isDeleteConfirmOpen = $event"
>
<I18nSlot message-key="neowiki-layout-delete-confirm-message">
<strong>{{ deletingLayoutName }}</strong>
</I18nSlot>

<template #footer>
<EditSummary
help-text=""
:save-button-label="$i18n( 'neowiki-layout-delete-confirm-delete' ).text()"
:save-disabled="false"
@save="executeDelete"
/>
</template>
</CdxDialog>
@deleted="fetchLayouts( lastOffset, pageSize )"
/>
</div>
</template>

<script setup lang="ts">
import { ref, shallowRef, onMounted, nextTick } from 'vue';
import { CdxButton, CdxDialog, CdxIcon, CdxTable } from '@wikimedia/codex';
import { CdxButton, CdxIcon, CdxTable } from '@wikimedia/codex';
import type { TableColumn } from '@wikimedia/codex';
import { cdxIconAdd, cdxIconEdit, cdxIconTrash } from '@wikimedia/codex-icons';
import { NeoWikiExtension } from '@/NeoWikiExtension.ts';
Expand All @@ -118,8 +107,7 @@ import { useLayoutStore } from '@/stores/LayoutStore.ts';
import { Layout } from '@/domain/Layout.ts';
import LayoutCreatorDialog from './LayoutCreatorDialog.vue';
import LayoutEditorDialog from '@/components/LayoutEditor/LayoutEditorDialog.vue';
import EditSummary from '@/components/common/EditSummary.vue';
import I18nSlot from '@/components/common/I18nSlot.vue';
import DeletePageDialog from '@/components/common/DeletePageDialog.vue';

const paginationSizeOptions: { value: number }[] = [
{ value: 10 },
Expand Down Expand Up @@ -266,33 +254,6 @@ function confirmDelete( layoutName: string ): void {
isDeleteConfirmOpen.value = true;
}

async function executeDelete( summary: string ): Promise<void> {
isDeleteConfirmOpen.value = false;
const name = deletingLayoutName.value;
const reason = summary || mw.msg( 'neowiki-layout-delete-summary-default' );

try {
const api = new mw.Api();
const token = await api.getEditToken();
await api.post( {
action: 'delete',
title: `Layout:${ name }`,
reason: reason,
token: token
} );
mw.notify( mw.msg( 'neowiki-layout-delete-success', name ), { type: 'success' } );
await fetchLayouts( lastOffset.value, pageSize.value );
} catch ( error ) {
mw.notify(
error instanceof Error ? error.message : String( error ),
{
title: mw.msg( 'neowiki-layout-delete-error', name ),
type: 'error'
}
);
}
}

onMounted( async () => {
await checkCreatePermission();
await checkEditPermission( '' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</CdxField>

<template #footer>
<EditSummary
ref="editSummaryRef"
<SummaryAction
ref="summaryActionRef"
help-text=""
:save-button-label="$i18n( 'neowiki-mapping-creator-save' ).text()"
:save-disabled="saving"
Expand All @@ -37,7 +37,7 @@
import { ref, watch } from 'vue';
import { CdxDialog, CdxField, CdxTextInput } from '@wikimedia/codex';
import type { ValidationStatusType } from '@wikimedia/codex';
import EditSummary from '@/components/common/EditSummary.vue';
import SummaryAction from '@/components/common/SummaryAction.vue';

// The reserved projection name (RdfPageProjector::PROJECTION). The backend rejects a Mapping:Native
// save (MappingName via MappingContentHandler::validateSave, case-insensitively); this client check
Expand All @@ -61,16 +61,16 @@ const mappingName = ref( '' );
const nameError = ref( '' );
const nameStatus = ref<ValidationStatusType>( 'default' );
const saving = ref( false );
const editSummaryRef = ref<InstanceType<typeof EditSummary> | null>( null );
const summaryActionRef = ref<InstanceType<typeof SummaryAction> | null>( null );

function close(): void {
emit( 'update:open', false );
}

// Enter in the name field saves through the EditSummary so the currently entered summary is used,
// Enter in the name field saves through the SummaryAction so the currently entered summary is used,
// exactly as clicking its save button does.
function onNameEnter(): void {
editSummaryRef.value?.submit();
summaryActionRef.value?.submit();
}

function onDialogUpdateOpen( value: boolean ): void {
Expand Down
Loading
Loading