-
-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
React with lock exception and handle accordingly in the panel
- Loading branch information
1 parent
e15c4ab
commit b226a7f
Showing
5 changed files
with
158 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<template> | ||
<k-dialog | ||
ref="dialog" | ||
v-bind="$props" | ||
class="k-lock-dialog" | ||
@cancel="$emit('cancel')" | ||
@submit="$emit('submit')" | ||
> | ||
<k-dialog-text :text="$t('form.locked')" /> | ||
|
||
<dl> | ||
<div> | ||
<dt><k-icon type="user" /></dt> | ||
<dd>{{ lock.user.email }}</dd> | ||
</div> | ||
<div> | ||
<dt><k-icon type="clock" /></dt> | ||
<dd> | ||
{{ $library.dayjs(lock.modified).format("YYYY-MM-DD HH:mm:ss") }} | ||
</dd> | ||
</div> | ||
</dl> | ||
</k-dialog> | ||
</template> | ||
|
||
<script> | ||
import Dialog from "@/mixins/dialog.js"; | ||
export const props = { | ||
mixins: [Dialog], | ||
props: { | ||
cancelButton: { | ||
default: false | ||
}, | ||
lock: Object, | ||
preview: String | ||
} | ||
}; | ||
export default { | ||
mixins: [props] | ||
}; | ||
</script> | ||
|
||
<style> | ||
.k-lock-dialog dl { | ||
margin: var(--spacing-6) 0 var(--spacing-2) 0; | ||
} | ||
.k-lock-dialog dl div { | ||
padding: var(--spacing-1) 0; | ||
line-height: var(--leading-normal); | ||
display: flex; | ||
align-items: center; | ||
gap: 0.75rem; | ||
color: var(--color-gray-500); | ||
} | ||
.k-lock-dialog .k-dialog-buttons { | ||
grid-template-columns: 1fr; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Kirby\Content; | ||
|
||
use Kirby\Exception\LogicException; | ||
|
||
/** | ||
* @package Kirby Content | ||
* @author Bastian Allgeier <[email protected]> | ||
* @link https://getkirby.com | ||
* @copyright Bastian Allgeier | ||
* @license https://getkirby.com/license | ||
*/ | ||
class LockException extends LogicException | ||
{ | ||
protected static string $defaultKey = 'lock'; | ||
protected static string $defaultFallback = 'The version is locked'; | ||
protected static int $defaultHttpCode = 423; | ||
|
||
public function __construct( | ||
Lock $lock, | ||
string|null $key = null, | ||
string|null $message = null, | ||
) { | ||
parent::__construct( | ||
message: $message, | ||
key: $key, | ||
details: $lock->toArray() | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters