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
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,13 @@ public function store($updateNulls = true)
$table = Table::getInstance('ContactTable', __NAMESPACE__ . '\\', array('dbo' => $this->getDbo()));

if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) {
// Is the existing contact trashed?
$this->setError(Text::_('COM_CONTACT_ERROR_UNIQUE_ALIAS'));

if ($table->published === -2) {
$this->setError(Text::_('COM_CONTACT_ERROR_UNIQUE_ALIAS_TRASHED'));
}

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function store($updateNulls = true)
$table = new static($this->getDbo());

if ($table->load(array('alias' => $this->alias)) && ($table->filter_id != $this->filter_id || $this->filter_id == 0)) {
$this->setError(Text::_('JLIB_DATABASE_ERROR_ARTICLE_UNIQUE_ALIAS'));
$this->setError(Text::_('COM_FINDER_FILTER_ERROR_UNIQUE_ALIAS'));

return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,107 +17,129 @@
@on-focused="focused"
@keyup.up="openLastActions()"
@keyup.down="openActions()"
@keyup.end="openLastActions()"
@keyup.home="openActions()"
@keydown.up.prevent
@keydown.down.prevent
@keydown.home.prevent
@keydown.end.prevent
/>
<div
v-if="showActions"
ref="actionList"
class="media-browser-actions-list"
role="toolbar"
aria-orientation="vertical"
:aria-label="sprintf('COM_MEDIA_ACTIONS_TOOLBAR_LABEL',(this.$parent.$props.item.name))"
>
<ul>
<li>
<media-browser-action-item-preview
v-if="previewable"
ref="actionPreview"
:on-focused="focused"
:main-action="openPreview"
:closing-action="hideActions"
@keyup.up="$refs.actionDelete.$el.focus()"
@keyup.down="$refs.actionDelete.$el.previousElementSibling.focus()"
@keyup.esc="hideActions"
/>
</li>
<li>
<media-browser-action-item-download
v-if="downloadable"
ref="actionDownload"
:on-focused="focused"
:main-action="download"
:closing-action="hideActions"
@keyup.up="$refs.actionPreview.$el.focus()"
@keyup.down="$refs.actionPreview.$el.previousElementSibling.focus()"
@keyup.esc="hideActions"
/>
</li>
<li>
<media-browser-action-item-rename
v-if="canEdit"
ref="actionRename"
:on-focused="focused"
:main-action="openRenameModal"
:closing-action="hideActions"
@keyup.up="
downloadable
? $refs.actionDownload.$el.focus()
: $refs.actionDownload.$el.previousElementSibling.focus()
"
@keyup.down="
canEdit
? $refs.actionEdit.$el.focus()
: shareable
? $refs.actionShare.$el.focus()
: $refs.actionShare.$el.previousElementSibling.focus()
"
@keyup.esc="hideActions"
/>
</li>
<li>
<media-browser-action-item-edit
v-if="canEdit && canOpenEditView"
ref="actionEdit"
:on-focused="focused"
:main-action="editItem"
:closing-action="hideActions"
@keyup.up="$refs.actionRename.$el.focus()"
@keyup.down="$refs.actionRename.$el.previousElementSibling.focus()"
@keyup.esc="hideActions"
/>
</li>
<li>
<media-browser-action-item-share
v-if="shareable"
ref="actionShare"
:on-focused="focused"
:main-action="openShareUrlModal"
:closing-action="hideActions"
@keyup.up="
canEdit
? $refs.actionEdit.$el.focus()
: $refs.actionEdit.$el.previousElementSibling.focus()
"
@keyup.down="$refs.actionDelete.$el.focus()"
@keyup.esc="hideActions"
/>
</li>
<li>
<media-browser-action-item-delete
v-if="canDelete"
ref="actionDelete"
:on-focused="focused"
:main-action="openConfirmDeleteModal"
:hide-actions="hideActions"
@keyup.up="
shareable
? $refs.actionShare.$el.focus()
: $refs.actionShare.$el.previousElementSibling.focus()
"
@keyup.down="
previewable
? $refs.actionPreview.$el.focus()
: $refs.actionPreview.$el.previousElementSibling.focus()
"
@keyup.esc="hideActions"
/>
</li>
</ul>
<span
aria-hidden="true"
class="media-browser-actions-item-name"
>
<strong>{{ this.$parent.$props.item.name }}</strong>
</span>
<media-browser-action-item-preview
v-if="previewable"
ref="actionPreview"
:on-focused="focused"
:main-action="openPreview"
:closing-action="hideActions"
@keydown.up.prevent
@keydown.down.prevent
@keyup.up="focusPrev"
@keyup.down="focusNext"
@keyup.end="focusLast"
@keyup.home="focusFirst"
@keydown.home.prevent
@keydown.end.prevent
@keyup.esc="hideActions"
@keydown.tab="hideActions"
/>
<media-browser-action-item-download
v-if="downloadable"
ref="actionDownload"
:on-focused="focused"
:main-action="download"
:closing-action="hideActions"
@keydown.up.prevent
@keydown.down.prevent
@keyup.up="focusPrev"
@keyup.down="focusNext"
@keyup.esc="hideActions"
@keydown.tab="hideActions"
@keyup.end="focusLast"
@keyup.home="focusFirst"
@keydown.home.prevent
@keydown.end.prevent
/>
<media-browser-action-item-rename
v-if="canEdit"
ref="actionRename"
:on-focused="focused"
:main-action="openRenameModal"
:closing-action="hideActions"
@keydown.up.prevent
@keydown.down.prevent
@keyup.up="focusPrev"
@keyup.down="focusNext"
@keyup.esc="hideActions"
@keydown.tab="hideActions"
@keyup.end="focusLast"
@keyup.home="focusFirst"
@keydown.home.prevent
@keydown.end.prevent
/>
<media-browser-action-item-edit
v-if="canEdit && canOpenEditView"
ref="actionEdit"
:on-focused="focused"
:main-action="editItem"
:closing-action="hideActions"
@keydown.up.prevent
@keydown.down.prevent
@keyup.up="focusPrev"
@keyup.down="focusNext"
@keyup.esc="hideActions"
@keydown.tab="hideActions"
@keyup.end="focusLast"
@keyup.home="focusFirst"
@keydown.home.prevent
@keydown.end.prevent
/>
<media-browser-action-item-share
v-if="shareable"
ref="actionShare"
:on-focused="focused"
:main-action="openShareUrlModal"
:closing-action="hideActions"
@keydown.up.prevent
@keydown.down.prevent
@keyup.up="focusPrev"
@keyup.down="focusNext"
@keyup.esc="hideActions"
@keydown.tab="hideActions"
@keyup.end="focusLast"
@keyup.home="focusFirst"
@keydown.home.prevent
@keydown.end.prevent
/>
<media-browser-action-item-delete
v-if="canDelete"
ref="actionDelete"
:on-focused="focused"
:main-action="openConfirmDeleteModal"
:hide-actions="hideActions"
@keydown.up.prevent
@keydown.down.prevent
@keyup.up="focusPrev"
@keyup.down="focusNext"
@keyup.esc="hideActions"
@keydown.tab="hideActions"
@keyup.end="focusLast"
@keyup.home="focusFirst"
@keydown.home.prevent
@keydown.end.prevent
/>
</div>
</div>
</template>
Expand Down Expand Up @@ -170,6 +192,7 @@ export default {
/* Hide actions dropdown */
hideActions() {
this.showActions = false;
this.$parent.$parent.$data.actionsActive = false;
},
/* Preview an item */
openPreview() {
Expand Down Expand Up @@ -200,19 +223,89 @@ export default {
/* Open actions dropdown */
openActions() {
this.showActions = true;
this.$parent.$parent.$data.actionsActive = true;
const buttons = [...this.$el.parentElement.querySelectorAll('.media-browser-actions-list button')];
if (buttons.length) {
buttons.forEach((button, i) => {
if (i === (0)) {
button.tabIndex = 0;
} else {
button.tabIndex = -1;
}
});
buttons[0].focus();
}
},
/* Open actions dropdown and focus on last element */
openLastActions() {
this.showActions = true;
this.$parent.$parent.$data.actionsActive = true;
const buttons = [...this.$el.parentElement.querySelectorAll('.media-browser-actions-list button')];
if (buttons.length) {
buttons.forEach((button, i) => {
if (i === (buttons.length)) {
button.tabIndex = 0;
} else {
button.tabIndex = -1;
}
});
this.$nextTick(() => buttons[buttons.length - 1].focus());
}
},
/* Focus on the next item or go to the beginning again */
focusNext(event) {
const active = event.target;
const buttons = [...active.parentElement.querySelectorAll('button')];
const lastchild = buttons[buttons.length - 1];
active.tabIndex = -1;
if (active === lastchild) {
buttons[0].focus();
buttons[0].tabIndex = 0;
} else {
active.nextElementSibling.focus();
active.nextElementSibling.tabIndex = 0;
}
},
/* Focus on the previous item or go to the end again */
focusPrev(event) {
const active = event.target;
const buttons = [...active.parentElement.querySelectorAll('button')];
const firstchild = buttons[0];
active.tabIndex = -1;
if (active === firstchild) {
buttons[buttons.length - 1].focus();
buttons[buttons.length - 1].tabIndex = 0;
} else {
active.previousElementSibling.focus();
active.previousElementSibling.tabIndex = 0;
}
},
/* Focus on the first item */
focusFirst(event) {
const active = event.target;
const buttons = [...active.parentElement.querySelectorAll('button')];
buttons[0].focus();
buttons.forEach((button, i) => {
if (i === 0) {
button.tabIndex = 0;
} else {
button.tabIndex = -1;
}
});
},
/* Focus on the last item */
focusLast(event) {
const active = event.target;
const buttons = [...active.parentElement.querySelectorAll('button')];
buttons[buttons.length - 1].focus();
buttons.forEach((button, i) => {
if (i === (buttons.length)) {
button.tabIndex = 0;
} else {
button.tabIndex = -1;
}
});
},
editItem() {
this.edit();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
<button
type="button"
class="action-delete"
:aria-label="translate('COM_MEDIA_ACTION_DELETE')"
:title="translate('COM_MEDIA_ACTION_DELETE')"
@keyup.enter="openConfirmDeleteModal()"
@keyup.space="openConfirmDeleteModal()"
@focus="focused(true)"
@blur="focused(false)"
@keyup.esc="hideActions()"
@click.stop="openConfirmDeleteModal()"
>
<span
class="image-browser-action icon-trash"
aria-hidden="true"
@click.stop="openConfirmDeleteModal()"
/>
<span class="action-text">
{{ translate('COM_MEDIA_ACTION_DELETE') }}
</span>
</button>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
<button
type="button"
class="action-download"
:aria-label="translate('COM_MEDIA_ACTION_DOWNLOAD')"
:title="translate('COM_MEDIA_ACTION_DOWNLOAD')"
@keyup.enter="download()"
@keyup.space="download()"
@click.stop="download()"
@focus="focused(true)"
@blur="focused(false)"
@keyup.esc="hideActions()"
>
<span
class="image-browser-action icon-download"
aria-hidden="true"
@click.stop="download()"
/>
<span class="action-text">
{{ translate('COM_MEDIA_ACTION_DOWNLOAD') }}
</span>
</button>
</template>

Expand Down
Loading