Some more XHTML templates for editing publications
parent
01431f3f92
commit
655ee7f92c
|
|
@ -15,7 +15,7 @@ import javax.ws.rs.Path;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Path(MvcAuthoringSteps.PATH_PREFIX + "publication-extendedproperties")
|
||||
@Path(MvcAuthoringSteps.PATH_PREFIX + "monograph-extendedproperties")
|
||||
@Controller
|
||||
@MvcAuthoringStepDef(
|
||||
bundle = SciPublicationsConstants.BUNDLE,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html [<!ENTITY times '×'>]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
|
||||
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
|
||||
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
|
||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
|
||||
|
||||
<ui:define name="authoringStep">
|
||||
|
||||
<h2>#{authoringStepTitle}</h2>
|
||||
|
||||
<!-- peerReviewed: boolean -->
|
||||
|
||||
<!-- yearFirstPublished -->
|
||||
|
||||
<!-- languageOfPublication: int -->
|
||||
|
||||
<!-- series: asset -->
|
||||
|
||||
<ui:insert name="publicationExtendedProperties"/>
|
||||
|
||||
</ui:define>
|
||||
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html [<!ENTITY times '×'>]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
|
||||
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
|
||||
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
|
||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||
<ui:composition template="/WEB-INF/views/org/scientificcms/contenttypes/ui/edit-publication-extended-properties.xhtml">
|
||||
|
||||
<ui:define name="publicationExtendedProperties">
|
||||
|
||||
<!-- isbn10: String -->
|
||||
|
||||
<!-- isbn13: String -->
|
||||
|
||||
<!-- volume: int -->
|
||||
|
||||
<!-- numberOfVolumes: int -->
|
||||
|
||||
<!-- numberOfPages: int -->
|
||||
|
||||
<!-- edition: LocalizedString -->
|
||||
|
||||
<ui:insert name="publicationWithPublisherExtendedProperties"/>
|
||||
|
||||
</ui:define>
|
||||
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
|
@ -56,5 +56,9 @@
|
|||
|
||||
</ui:define>
|
||||
|
||||
<ui:define name="publicationScripts">
|
||||
<ui:insert name="publicationWithPublisherScripts" />
|
||||
</ui:define>
|
||||
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
|
@ -137,13 +137,70 @@
|
|||
values="#{SciCmsPublicationPropertiesStepModel.titleValues}"
|
||||
/>
|
||||
|
||||
<div class="text-right">
|
||||
<button class="btn btn-primary"
|
||||
data-toggle="modal"
|
||||
data-target="#properties-edit-dialog"
|
||||
type="button">
|
||||
<bootstrap:svgIcon icon="pen" />
|
||||
<span class="sr-only">#{SciPublicationsUiMessageBundle['publication.editstep.properties.edit']}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div aria-hidden="true"
|
||||
aria-labelledby="properties-edit-dialog-title"
|
||||
class="modal fade"
|
||||
id="properties-edit-dialog"
|
||||
tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@#{SciCmsPublicationsPropertiesStep.editStepUrlFragment}/properties"
|
||||
class="modal-content"
|
||||
method="post">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title"
|
||||
id="properties-edit-dialog-title">
|
||||
#{SciPublicationsUiMessageBundle['publication.editstep.properties.edit.title']}
|
||||
</h4>
|
||||
<button
|
||||
aria-label="#{SciPublicationsUiMessageBundle['publication.editstep.properties.edit.close']}"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
type="button">
|
||||
<bootstrap:svgIcon icon="x" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<bootstrap:formGroupNumber
|
||||
help="#{SciPublicationsUiMessageBundle['basicproperties.yearofpublication.help']}"
|
||||
inputId="yearOfPublication"
|
||||
label="#{SciPublicationsUiMessageBundle['basicproperties.yearofpublication.help']}"
|
||||
label="#{SciPublicationsUiMessageBundle['basicproperties.yearofpublication.label']}"
|
||||
name="yearOfPublication"
|
||||
value="#{SciCmsPublicationPropertiesStepModel.yearOfPublication}"
|
||||
/>
|
||||
|
||||
<ui:insert name="publicationBasicPropertiesForm" />
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-warning"
|
||||
data-dismiss="modal"
|
||||
type="button">
|
||||
#{SciPublicationsUiMessageBundle['publication.editstep.properties.edit.close']}
|
||||
</button>
|
||||
<button class="btn btn-success"
|
||||
type="submit">
|
||||
#{SciPublicationsUiMessageBundle['publication.editstep.properties.edit.submit']}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>#{SciPublicationsUiMessageBundle['basicproperties.yearofpublication.label']}</dt>
|
||||
<dd>#{SciCmsPublicationPropertiesStepModel.yearOfPublication}</dd>
|
||||
</div>
|
||||
<ui:insert name="publicationBasicPropertiesDl" />
|
||||
</dl>
|
||||
|
||||
<libreccm:localizedStringEditor
|
||||
addButtonLabel="#{SciPublicationsUiMessageBundle['basicproperties.shortdescription.add']}"
|
||||
addDialogCancelLabel="#{SciPublicationsUiMessageBundle['basicproperties.shortdescription.cancel']}"
|
||||
|
|
@ -174,6 +231,7 @@
|
|||
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@#{SciCmsPublicationsPropertiesStep.editStepUrlFragment}/shortdescription/@remove"
|
||||
title="#{SciPublicationsUiMessageBundle['basicproperties.shortdescription.header']}"
|
||||
unusedLocales="#{SciCmsPublicationPropertiesStepModel.unusedTitleLocales}"
|
||||
useTextarea="true"
|
||||
values="#{SciCmsPublicationPropertiesStepModel.shortdescriptionValues}"
|
||||
/>
|
||||
|
||||
|
|
@ -331,7 +389,7 @@
|
|||
|
||||
<ui:define name="scripts">
|
||||
<script src="#{request.contextPath}/assets/@scipublications/publication-authors.js" />
|
||||
<ui:insert name="publicationScript" />
|
||||
<ui:insert name="publicationScripts" />
|
||||
</ui:define>
|
||||
|
||||
</ui:composition>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html [<!ENTITY times '×'>]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
|
||||
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
|
||||
xmlns:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
|
||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||
<ui:composition template="/WEB-INF/views/org/scientificcms/contenttypes/ui/edit-publication-with-publisher-extended-properties.xhtml">
|
||||
|
||||
<ui:param name="authoringStep"
|
||||
value="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@monograph-extendedproperties" />
|
||||
|
||||
<ui:param name="authoringStepTitle"
|
||||
value="#{SciPublicationsUiMessageBundle.getMessage('monograph.extendedproperties.header', [SciCmsPublicationPropertiesStepModel.name])}" />
|
||||
|
||||
<ui:define name="publicationWithPublisherExtendedProperties">
|
||||
|
||||
</ui:define>
|
||||
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
|
|
@ -13,14 +13,31 @@
|
|||
<ui:param name="authoringStepTitle"
|
||||
value="#{SciPublicationsUiMessageBundle.getMessage('monograph.basicproperties.header', [SciCmsPublicationPropertiesStepModel.name])}" />
|
||||
|
||||
<ui:define name="publicationWithPublisherProperties">
|
||||
|
||||
<ui:define name="publicationBasicPropertiesForm">
|
||||
<bootstrap:formCheck
|
||||
checked="#{SciCmsMonographPropertiesStepModel.reviewed}"
|
||||
inputId="publication-reviewed"
|
||||
label="#{SciPublicationsUiMessageBundle['monograph.reviewed.label']}"
|
||||
name="reviewed"
|
||||
/>
|
||||
</ui:define>
|
||||
|
||||
<ui:define name="publicationBasicPropertiesDl">
|
||||
<div>
|
||||
<dt>#{SciPublicationsUiMessageBundle['monograph.reviewed.label']}</dt>
|
||||
<dd>
|
||||
<c:choose>
|
||||
<c:when test="#{SciCmsMonographPropertiesStepModel.reviewed}">
|
||||
#{SciPublicationsUiMessageBundle['monograph.reviewed.yes']}
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
#{SciPublicationsUiMessageBundle['monograph.reviewed.no']}
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
</dd>
|
||||
</div>
|
||||
</ui:define>
|
||||
|
||||
</ui:composition>
|
||||
|
|
|
|||
|
|
@ -282,3 +282,82 @@ basicproperties.name.help=The name (URL fragment) of the publication item. Can o
|
|||
basicproperties.name.label=Name
|
||||
basicproperties.name.edit.close=Cancel
|
||||
basicproperties.name.edit.submit=Save
|
||||
basicproperties.errors.author_not_found=No author identified by {0} found.
|
||||
basicproperties.errors.authorship_not_found=No authorship with ID {0} found.
|
||||
basicproperties.errors.publisher_not_found=No publisher with ID {0} found.
|
||||
basicproperties.errors.authors.sort.general=Failed to save authors order.
|
||||
basicproperties.errors.authors.sort.save=Failed to save authors order.
|
||||
basicproperties.title.add=Add localized title
|
||||
basicproperties.title.cancel=Cancel
|
||||
basicproperties.title.add.locale.help=The locale of the localized title.
|
||||
basicproperties.title.add.locale.label=Locale
|
||||
basicproperties.title.add.submit=Add
|
||||
basicproperties.title.header=Add localized title
|
||||
basicproperties.title.add.value.help=The localized title.
|
||||
basicproperties.title.add.value.label=Title
|
||||
basicproperties.title.edit=Edit
|
||||
basicproperties.title.edit.cancel=Cancel
|
||||
basicproperties.title.edit.submit=Save
|
||||
basicproperties.title.edit.header=Edit localized title
|
||||
basicproperties.title.edit.value.help=The localized title.
|
||||
basicproperties.title.edit.value.label=Title
|
||||
basicproperties.title.remove=Remove
|
||||
basicproperties.title.remove.cancel=Cancel
|
||||
basicproperties.title.remove.submit=Remove
|
||||
basicproperties.title.remove.text=Are you sure to remove the following localized title:
|
||||
basicproperties.title.remove.header=Confirm removal of localized title
|
||||
basicproperties.yearofpublication.label=Year of publication
|
||||
basicproperties.yearofpublication.help=The year in which the publication was published.
|
||||
basicproperties.shortdescription.add=Add localized short description
|
||||
basicproperties.shortdescription.cancel=Cancel
|
||||
basicproperties.shortdescription.add.locale.help=The language of the localized short description.
|
||||
basicproperties.shortdescription.add.locale.label=Locale
|
||||
basicproperties.shortdescription.add.submit=Add
|
||||
basicproperties.shortdescription.header=Add localized short description
|
||||
basicproperties.shortdescription.add.value.help=The localized short description.
|
||||
basicproperties.shortdescription.add.value.label=Short description
|
||||
basicproperties.shortdescription.edit=Edit
|
||||
basicproperties.shortdescription.edit.cancel=Cancel
|
||||
basicproperties.shortdescription.edit.submit=Save
|
||||
basicproperties.shortdescription.edit.header=Edit short description
|
||||
basicproperties.shortdescription.edit.value.help=The localized short description.
|
||||
basicproperties.shortdescription.edit.value.label=Short description
|
||||
basicproperties.shortdescription.remove=Remove
|
||||
basicproperties.shortdescription.remove.cancel=Cancel
|
||||
basicproperties.shortdescription.remove.submit=Remove
|
||||
basicproperties.shortdescription.remove.text=Are you sure to remove the following short description:
|
||||
basicproperties.shortdescription.remove.header=Confirm removal of short description
|
||||
basicproperties.authors.header=Authors
|
||||
basicproperties.authors.add.label=Add author
|
||||
basicproperties.authors.add.dialog.title=Select author to add
|
||||
basicproperties.authors.editor.label=Is editor?
|
||||
basicproperties.authors.table.name=Name
|
||||
basicproperties.authors.table.editor=Editor?
|
||||
basicproperties.authors.table.actions=Actions
|
||||
basicproperties.authors.move=Move
|
||||
basicproperties.authors.table.editor.yes=Yes
|
||||
basicproperties.authors.table.editor.no=No
|
||||
basicproperties.authors.edit.label=Edit authorship
|
||||
basicproperties.authors.editdialog.title=Edit authorship of {0}
|
||||
basicproperties.authors.editdialog.cancel=Cancel
|
||||
basicproperties.authors.editdialog.editor.label=Is editor?
|
||||
basicproperties.authors.editdialog.submit=Save
|
||||
basicproperties.authors.remove.label=Remove author
|
||||
basicproperties.authors.remove.cancel=Cancel
|
||||
basicproperties.authors.remove.title=Remove author {0}
|
||||
basicproperties.authors.remove.text=Are you sure to remove author {0} from this publication?
|
||||
publicationwithpublisher.publisher=Publisher
|
||||
publicationwithpublisher.publisher.set.label=Set publisher
|
||||
publicationwithpublisher.publisher.select.dialog.title=Select publisher
|
||||
publicationwithpublisher.publisher.remove.label=Remove publisher
|
||||
publicationwithpublisher.publisher.cancel=Cancel
|
||||
publicationwithpublisher.publisher.confirm=Remove
|
||||
publicationwithpublisher.publisher.title=Remove removal of publisher
|
||||
publicationwithpublisher.publisher.message=Are you sure to remove the publisher from this publication?
|
||||
monograph.reviewed.label=Reviewed?
|
||||
publication.editstep.properties.edit=Edit properties
|
||||
publication.editstep.properties.edit.title=Publication properties
|
||||
publication.editstep.properties.edit.close=Cancel
|
||||
publication.editstep.properties.edit.submit=Save
|
||||
monograph.reviewed.yes=Yes
|
||||
monograph.reviewed.no=No
|
||||
|
|
|
|||
|
|
@ -282,3 +282,82 @@ basicproperties.name.help=Der Name (URL-Fragment) des Publikations-Items. Darf n
|
|||
basicproperties.name.label=Name
|
||||
basicproperties.name.edit.close=Abbrechen
|
||||
basicproperties.name.edit.submit=Speichern
|
||||
basicproperties.errors.author_not_found=Kein Autor:in mit der ID {0} gefunden.
|
||||
basicproperties.errors.authorship_not_found=Es wurde keine Autorschaft mit der ID {0} gefunden.
|
||||
basicproperties.errors.publisher_not_found=Kein Verlag mit ID {0} gefunden.
|
||||
basicproperties.errors.authors.sort.general=Speichern der Sortierung der Autoren fehlgeschlagen.
|
||||
basicproperties.errors.authors.sort.save=Speichern der Sortierung der Autoren fehlgeschlagen.
|
||||
basicproperties.title.add=Lokalisierten Titel hinzuf\u00fcgen
|
||||
basicproperties.title.cancel=Abbrechen
|
||||
basicproperties.title.add.locale.help=Die Sprache des lokalisierten Titels.
|
||||
basicproperties.title.add.locale.label=Sprache
|
||||
basicproperties.title.add.submit=Hinzuf\u00fcgen
|
||||
basicproperties.title.header=Lokalisierten Titel hinzuf\u00fcgen
|
||||
basicproperties.title.add.value.help=Der lokalisierte Titel.
|
||||
basicproperties.title.add.value.label=Titel
|
||||
basicproperties.title.edit=Bearbeiten
|
||||
basicproperties.title.edit.cancel=Abbrechen
|
||||
basicproperties.title.edit.submit=Speichern
|
||||
basicproperties.title.edit.header=Lokalisierten Titel bearbeiten
|
||||
basicproperties.title.edit.value.help=Der lokalisierte Titel.
|
||||
basicproperties.title.edit.value.label=Titel
|
||||
basicproperties.title.remove=Entfernen
|
||||
basicproperties.title.remove.cancel=Abbrechen
|
||||
basicproperties.title.remove.submit=Entfernen
|
||||
basicproperties.title.remove.text=Are you sure to remove the following localized title:
|
||||
basicproperties.title.remove.header=Entfernen eines lokalisierten Titels best\u00e4tigen
|
||||
basicproperties.yearofpublication.label=Erscheinungsjahr
|
||||
basicproperties.yearofpublication.help=Das Jahr in dem die Publikation erschienen ist.
|
||||
basicproperties.shortdescription.add=Lokalisierte Kurzbeschreibung hinzuf\u00fcgen
|
||||
basicproperties.shortdescription.cancel=Abbrechen
|
||||
basicproperties.shortdescription.add.locale.help=Die Sprache der lokalisierten Kurzbeschreibung.
|
||||
basicproperties.shortdescription.add.locale.label=Sprache
|
||||
basicproperties.shortdescription.add.submit=Hinzuf\u00fcgen
|
||||
basicproperties.shortdescription.header=Lokalisierte Kurzbeschreibung hinzuf\u00fcgen
|
||||
basicproperties.shortdescription.add.value.help=Die lokaliserte Kurzbeschreibung.
|
||||
basicproperties.shortdescription.add.value.label=Kurzbeschreibung
|
||||
basicproperties.shortdescription.edit=Bearbeiten
|
||||
basicproperties.shortdescription.edit.cancel=Abbrechen
|
||||
basicproperties.shortdescription.edit.submit=Speichern
|
||||
basicproperties.shortdescription.edit.header=Kurzbeschreibung bearbeiten
|
||||
basicproperties.shortdescription.edit.value.help=Die lokaliserte Kurzbeschreibung.
|
||||
basicproperties.shortdescription.edit.value.label=Kurzbeschreibung
|
||||
basicproperties.shortdescription.remove=Entfernen
|
||||
basicproperties.shortdescription.remove.cancel=Abbrechen
|
||||
basicproperties.shortdescription.remove.submit=Entfernen
|
||||
basicproperties.shortdescription.remove.text=Sind Sie sicher das Sie die folgende Kurzbeschreibung entfernen wollen:
|
||||
basicproperties.shortdescription.remove.header=Entfernen einer Kurzbeschreibung best\u00e4tigen
|
||||
basicproperties.authors.header=Autoren
|
||||
basicproperties.authors.add.label=Author:in hinzuf\u00fcgen
|
||||
basicproperties.authors.add.dialog.title=Autor:in zum hinzuf\u00fcgen ausw\u00e4hlen
|
||||
basicproperties.authors.editor.label=Ist Herausgeber:in?
|
||||
basicproperties.authors.table.name=Name
|
||||
basicproperties.authors.table.editor=Herausgeber:in
|
||||
basicproperties.authors.table.actions=Aktionen
|
||||
basicproperties.authors.move=Verschieben
|
||||
basicproperties.authors.table.editor.yes=No
|
||||
basicproperties.authors.table.editor.no=Nein
|
||||
basicproperties.authors.edit.label=Autorenschaft bearbeiten
|
||||
basicproperties.authors.editdialog.title=Autorenschaft von {0} bearbeiten
|
||||
basicproperties.authors.editdialog.cancel=Abbrechen
|
||||
basicproperties.authors.editdialog.editor.label=Ist Herausgeber:in?
|
||||
basicproperties.authors.editdialog.submit=Speichern
|
||||
basicproperties.authors.remove.label=Autor:in entfernen
|
||||
basicproperties.authors.remove.cancel=Abbrechen
|
||||
basicproperties.authors.remove.title=Autor:in {0} entfernen
|
||||
basicproperties.authors.remove.text=Sind Sie sicher, dass Sie den/die Autor:in {0} von dieser Publikation entfernen wollen?
|
||||
publicationwithpublisher.publisher=Verlag
|
||||
publicationwithpublisher.publisher.set.label=Verlag setzen
|
||||
publicationwithpublisher.publisher.select.dialog.title=Verlag ausw\u00e4hlen
|
||||
publicationwithpublisher.publisher.remove.label=Verlag entfernen
|
||||
publicationwithpublisher.publisher.cancel=Abbrechen
|
||||
publicationwithpublisher.publisher.confirm=Entfernen
|
||||
publicationwithpublisher.publisher.title=Entfernen des Verlages best\u00e4tigen
|
||||
publicationwithpublisher.publisher.message=Sind Sie sicher, dass Sie den Verlag von dieser Publikation entfernen wollen?
|
||||
monograph.reviewed.label=Begutachtet?
|
||||
publication.editstep.properties.edit=Eigenschaften bearbeiten
|
||||
publication.editstep.properties.edit.title=Eigenschaften der Publikation
|
||||
publication.editstep.properties.edit.close=Abbrechen
|
||||
publication.editstep.properties.edit.submit=Speichern
|
||||
monograph.reviewed.yes=Ja
|
||||
monograph.reviewed.no=Nein
|
||||
|
|
|
|||
|
|
@ -0,0 +1,148 @@
|
|||
import Sortable, { SortableEvent } from "sortablejs";
|
||||
|
||||
let authorsSortable: Sortable;
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function (event) {
|
||||
const authorsTable = document.querySelector("#authors-table tbody");
|
||||
|
||||
if (authorsTable) {
|
||||
authorsSortable = initAuthorsTable(authorsTable as HTMLElement);
|
||||
}
|
||||
|
||||
const saveOrderButton = document.querySelectorAll(
|
||||
".authors-save-order-button"
|
||||
);
|
||||
for (let i = 0; i < saveOrderButton.length; i++) {
|
||||
saveOrderButton[i].addEventListener("click", saveOrder);
|
||||
}
|
||||
});
|
||||
|
||||
function initAuthorsTable(authorsTable: HTMLElement): Sortable {
|
||||
return new Sortable(authorsTable, {
|
||||
animation: 150,
|
||||
group: "collectedvolume-author",
|
||||
handle: ".cms-sort-handle",
|
||||
onEnd: enableSaveButton,
|
||||
});
|
||||
}
|
||||
|
||||
function enableSaveButton(event: SortableEvent) {
|
||||
const saveOrderButtons = document.querySelectorAll(
|
||||
".authors-save-order-button"
|
||||
);
|
||||
for (let i = 0; i < saveOrderButtons.length; i++) {
|
||||
const saveOrderButton: HTMLButtonElement = saveOrderButtons[
|
||||
i
|
||||
] as HTMLButtonElement;
|
||||
saveOrderButton.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function saveOrder() {
|
||||
const authorsTable = document.querySelector("#authors-table");
|
||||
|
||||
if (!authorsTable) {
|
||||
showGeneralError();
|
||||
throw Error("authors-table not found");
|
||||
}
|
||||
|
||||
const saveUrl = authorsTable.getAttribute("data-saveUrl");
|
||||
if (!saveUrl) {
|
||||
showGeneralError();
|
||||
throw Error("data-saveUrl on authors-table is missing or empty.");
|
||||
}
|
||||
|
||||
const saveOrderButtons = document.querySelectorAll(
|
||||
".authors-save-order-button"
|
||||
);
|
||||
for (let i = 0; i < saveOrderButtons.length; i++) {
|
||||
const saveOrderButton: HTMLButtonElement = saveOrderButtons[
|
||||
i
|
||||
] as HTMLButtonElement;
|
||||
saveOrderButton.disabled = true;
|
||||
const saveIcon = saveOrderButton.querySelector(".save-icon");
|
||||
const spinner = saveOrderButton.querySelector(".save-spinner");
|
||||
saveIcon?.classList.toggle("d-none");
|
||||
spinner?.classList.toggle("d-none");
|
||||
}
|
||||
|
||||
const headers = new Headers();
|
||||
headers.append("Content-Type", "application/json");
|
||||
fetch(saveUrl, {
|
||||
credentials: "include",
|
||||
body: JSON.stringify(authorsSortable.toArray()),
|
||||
headers,
|
||||
method: "POST",
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
for (let i = 0; i < saveOrderButtons.length; i++) {
|
||||
const saveOrderButton: HTMLButtonElement = saveOrderButtons[
|
||||
i
|
||||
] as HTMLButtonElement;
|
||||
saveOrderButton.disabled = true;
|
||||
const saveIcon =
|
||||
saveOrderButton.querySelector(".save-icon");
|
||||
const spinner =
|
||||
saveOrderButton.querySelector(".save-spinner");
|
||||
saveIcon?.classList.toggle("d-none");
|
||||
spinner?.classList.toggle("d-none");
|
||||
}
|
||||
} else {
|
||||
showSaveError();
|
||||
for (let i = 0; i < saveOrderButtons.length; i++) {
|
||||
const saveOrderButton: HTMLButtonElement = saveOrderButtons[
|
||||
i
|
||||
] as HTMLButtonElement;
|
||||
saveOrderButton.disabled = true;
|
||||
const saveIcon =
|
||||
saveOrderButton.querySelector(".save-icon");
|
||||
const spinner =
|
||||
saveOrderButton.querySelector(".save-spinner");
|
||||
saveIcon?.classList.toggle("d-none");
|
||||
spinner?.classList.toggle("d-none");
|
||||
}
|
||||
throw Error(
|
||||
`Failed to save authors order. Response status: ${response.status}, statusText: ${response.statusText}`
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
showSaveError();
|
||||
for (let i = 0; i < saveOrderButtons.length; i++) {
|
||||
const saveOrderButton: HTMLButtonElement = saveOrderButtons[
|
||||
i
|
||||
] as HTMLButtonElement;
|
||||
saveOrderButton.disabled = true;
|
||||
const saveIcon = saveOrderButton.querySelector(".save-icon");
|
||||
const spinner = saveOrderButton.querySelector(".save-spinner");
|
||||
saveIcon?.classList.toggle("d-none");
|
||||
spinner?.classList.toggle("d-none");
|
||||
}
|
||||
throw new Error(`Failed to save authors order: ${error}`);
|
||||
});
|
||||
}
|
||||
|
||||
function showGeneralError(): void {
|
||||
const alertTemplate = document.querySelector(
|
||||
"#authors-sort-error-general"
|
||||
) as HTMLTemplateElement;
|
||||
const alert = alertTemplate.content.cloneNode(true) as Element;
|
||||
|
||||
const container = document.querySelector("#messages");
|
||||
if (container) {
|
||||
container.appendChild(alert);
|
||||
}
|
||||
}
|
||||
|
||||
function showSaveError(): void {
|
||||
const alertTemplate = document.querySelector(
|
||||
"#authors-sort-error-save"
|
||||
) as HTMLTemplateElement;
|
||||
const alert = alertTemplate.content.cloneNode(true) as Element;
|
||||
|
||||
const container = document.querySelector("#messages");
|
||||
if (container) {
|
||||
container.appendChild(alert);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,8 @@ module.exports = {
|
|||
},
|
||||
entry: {
|
||||
"collectedvolume-asset-authors": "./src/main/typescript/collectedvolume-asset-authors.ts",
|
||||
"proceedings-asset-authors": "./src/main/typescript/proceedings-asset-authors.ts"
|
||||
"proceedings-asset-authors": "./src/main/typescript/proceedings-asset-authors",
|
||||
"publications-authors.ts": "./src/main/typescript/publication-authors.ts"
|
||||
},
|
||||
output: {
|
||||
filename: "[name].js",
|
||||
|
|
|
|||
Loading…
Reference in New Issue