TextBody Step basiclly works now
parent
62d98af857
commit
4a6478c78b
|
|
@ -152,7 +152,7 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CmsEditorLocaleVariantRow> getVariants() {
|
public List<CmsEditorLocaleVariantRow> getVariants() {
|
||||||
return variants;
|
return Collections.unmodifiableList(variants);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -178,7 +178,6 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
||||||
* @return A redirect to this authoring step.
|
* @return A redirect to this authoring step.
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
// @Path("/@add")
|
|
||||||
@Path("/add")
|
@Path("/add")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String addTextValue(
|
public String addTextValue(
|
||||||
|
|
@ -212,11 +211,7 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
||||||
getArticle().getText().addValue(locale, value);
|
getArticle().getText().addValue(locale, value);
|
||||||
itemRepo.save(getArticle());
|
itemRepo.save(getArticle());
|
||||||
|
|
||||||
return String.format(
|
return buildRedirectPathForStep();
|
||||||
"%s/%s/@edit",
|
|
||||||
buildRedirectPathForStep(),
|
|
||||||
locale.toString()
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return documentUi.showAccessDenied(
|
return documentUi.showAccessDenied(
|
||||||
getContentSection(),
|
getContentSection(),
|
||||||
|
|
@ -261,7 +256,6 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
||||||
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
// @Path("/{locale}/@edit")
|
|
||||||
@Path("/edit/{locale}")
|
@Path("/edit/{locale}")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String editTextValue(
|
public String editTextValue(
|
||||||
|
|
@ -303,7 +297,6 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
||||||
* @return A redirect to this authoring step.
|
* @return A redirect to this authoring step.
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
// @Path("/{locale}/@edit")
|
|
||||||
@Path("/edit/{locale}")
|
@Path("/edit/{locale}")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String editTextValue(
|
public String editTextValue(
|
||||||
|
|
@ -428,7 +421,6 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
||||||
final CmsEditorLocaleVariantRow variant = new CmsEditorLocaleVariantRow();
|
final CmsEditorLocaleVariantRow variant = new CmsEditorLocaleVariantRow();
|
||||||
variant.setLocale(entry.getKey().toString());
|
variant.setLocale(entry.getKey().toString());
|
||||||
final Document document = Jsoup.parseBodyFragment(entry.getValue());
|
final Document document = Jsoup.parseBodyFragment(entry.getValue());
|
||||||
document.body().text();
|
|
||||||
variant.setWordCount(
|
variant.setWordCount(
|
||||||
new StringTokenizer(document.body().text()).countTokens()
|
new StringTokenizer(document.body().text()).countTokens()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.ui.contenttypes;
|
package org.librecms.ui.contenttypes;
|
||||||
|
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
import org.librecms.contentsection.ContentItem;
|
import org.librecms.contentsection.ContentItem;
|
||||||
import org.librecms.contentsection.ContentItemRepository;
|
import org.librecms.contentsection.ContentItemRepository;
|
||||||
import org.librecms.contentsection.ContentSection;
|
import org.librecms.contentsection.ContentSection;
|
||||||
|
|
@ -27,6 +29,7 @@ import org.librecms.ui.contentsections.ItemPermissionChecker;
|
||||||
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
|
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
@ -36,6 +39,8 @@ import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.NotFoundException;
|
import javax.ws.rs.NotFoundException;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -58,8 +63,47 @@ public class MvcArticleTextBodyStepResources {
|
||||||
private ItemPermissionChecker itemPermissionChecker;
|
private ItemPermissionChecker itemPermissionChecker;
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
// @Path("/{locale}/@view")
|
@Path("/variants/{locale}/wordcount")
|
||||||
|
@Produces(MediaType.TEXT_HTML)
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public long getWordCount(
|
||||||
|
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||||
|
final String sectionIdentifier,
|
||||||
|
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||||
|
final String documentPathParam,
|
||||||
|
@PathParam("locale") final String localeParam
|
||||||
|
) {
|
||||||
|
final ContentSection contentSection = sectionsUi
|
||||||
|
.findContentSection(sectionIdentifier)
|
||||||
|
.orElseThrow(
|
||||||
|
() -> new NotFoundException()
|
||||||
|
);
|
||||||
|
|
||||||
|
final ContentItem document = itemRepo
|
||||||
|
.findByPath(contentSection, documentPathParam)
|
||||||
|
.orElseThrow(
|
||||||
|
() -> new NotFoundException()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!(document instanceof Article)) {
|
||||||
|
throw new NotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
final Article article = (Article) document;
|
||||||
|
if (itemPermissionChecker.canEditItem(article)) {
|
||||||
|
final String text = article
|
||||||
|
.getText()
|
||||||
|
.getValue(new Locale(localeParam));
|
||||||
|
final Document jsoupDoc = Jsoup.parseBodyFragment(text);
|
||||||
|
return new StringTokenizer(jsoupDoc.body().text()).countTokens();
|
||||||
|
} else {
|
||||||
|
throw new ForbiddenException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
@Path("/variants/{locale}")
|
@Path("/variants/{locale}")
|
||||||
|
@Produces(MediaType.TEXT_HTML)
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String viewTextValue(
|
public String viewTextValue(
|
||||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||||
|
|
@ -68,14 +112,6 @@ public class MvcArticleTextBodyStepResources {
|
||||||
final String documentPathParam,
|
final String documentPathParam,
|
||||||
@PathParam("locale") final String localeParam
|
@PathParam("locale") final String localeParam
|
||||||
) {
|
) {
|
||||||
// try {
|
|
||||||
// init();
|
|
||||||
// } catch (ContentSectionNotFoundException ex) {
|
|
||||||
// return ex.showErrorMessage();
|
|
||||||
// } catch (DocumentNotFoundException ex) {
|
|
||||||
// return ex.showErrorMessage();
|
|
||||||
// }
|
|
||||||
|
|
||||||
final ContentSection contentSection = sectionsUi
|
final ContentSection contentSection = sectionsUi
|
||||||
.findContentSection(sectionIdentifier)
|
.findContentSection(sectionIdentifier)
|
||||||
.orElseThrow(
|
.orElseThrow(
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
shortDescription="Label for the add button"
|
shortDescription="Label for the add button"
|
||||||
type="String" />
|
type="String" />
|
||||||
<cc:attribute name="addDialogCancelLabel"
|
<cc:attribute name="addDialogCancelLabel"
|
||||||
default="Cancel"
|
default="#{CmsAdminMessages['cancel_button.label']}"
|
||||||
required="false"
|
required="false"
|
||||||
shortDescription="Label for the cancel and close buttons."
|
shortDescription="Label for the cancel and close buttons."
|
||||||
type="String" />
|
type="String" />
|
||||||
|
|
@ -24,17 +24,17 @@
|
||||||
shortDescription="Help text for the locale select field"
|
shortDescription="Help text for the locale select field"
|
||||||
type="String" />
|
type="String" />
|
||||||
<cc:attribute name="addDialogLocaleSelectLabel"
|
<cc:attribute name="addDialogLocaleSelectLabel"
|
||||||
default="Locale"
|
default="#{CmsAdminMessages['locale_select.label']}"
|
||||||
required="false"
|
required="false"
|
||||||
shortDescription="Label for the locale select field"
|
shortDescription="Label for the locale select field"
|
||||||
type="String" />
|
type="String" />
|
||||||
<cc:attribute name="addDialogSubmitLabel"
|
<cc:attribute name="addDialogSubmitLabel"
|
||||||
default="Add"
|
default="#{CmsAdminMessages['locale_add.label']}"
|
||||||
required="false"
|
required="false"
|
||||||
shortDescription="Label for the submit button"
|
shortDescription="Label for the submit button"
|
||||||
type="String" />
|
type="String" />
|
||||||
<cc:attribute name="addDialogTitle"
|
<cc:attribute name="addDialogTitle"
|
||||||
default="Add localization"
|
default="#{CmsAdminMessages['locale_add.dialog.title']}"
|
||||||
required="false"
|
required="false"
|
||||||
shortDescription="Title for the dialog."
|
shortDescription="Title for the dialog."
|
||||||
type="String" />
|
type="String" />
|
||||||
|
|
@ -44,17 +44,17 @@
|
||||||
shortDescription="Can the current user edit the text?"
|
shortDescription="Can the current user edit the text?"
|
||||||
type="boolean" />
|
type="boolean" />
|
||||||
<cc:attribute name="editButtonLabel"
|
<cc:attribute name="editButtonLabel"
|
||||||
default="Edit"
|
default="#{CmsAdminMessages['edit_button.label']}"
|
||||||
required="false"
|
required="false"
|
||||||
shortDescription="Label for the edit button"
|
shortDescription="Label for the edit button"
|
||||||
type="String" />
|
type="String" />
|
||||||
<cc:attribute name="editDialogCancelLabel"
|
<cc:attribute name="editDialogCancelLabel"
|
||||||
default="Cancel"
|
default="#{CmsAdminMessages['cancel_button.label']}"
|
||||||
required="false"
|
required="false"
|
||||||
shortDescription="Label for the cancel and close button of the edit dialog"
|
shortDescription="Label for the cancel and close button of the edit dialog"
|
||||||
type="String" />
|
type="String" />
|
||||||
<cc:attribute name="editDialogSubmitLabel"
|
<cc:attribute name="editDialogSubmitLabel"
|
||||||
default="save"
|
default="#{CmsAdminMessages['save_button.label']}"
|
||||||
required="false"
|
required="false"
|
||||||
shortDescription="Label for the submit button of the edit dialog"
|
shortDescription="Label for the submit button of the edit dialog"
|
||||||
type="String" />
|
type="String" />
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
shortDescription="Label for the value field"
|
shortDescription="Label for the value field"
|
||||||
type="String" />
|
type="String" />
|
||||||
<cc:attribute name="editDialogTitle"
|
<cc:attribute name="editDialogTitle"
|
||||||
default="Edit localized value"
|
default="#{CmsAdminMessages['text.edit.dialog.title']}"
|
||||||
required="false"
|
required="false"
|
||||||
shortDescription="Title for the edit dialog"
|
shortDescription="Title for the edit dialog"
|
||||||
type="String" />
|
type="String" />
|
||||||
|
|
@ -91,7 +91,7 @@
|
||||||
shortDescription="ID for the editor. Also used as prefix to generate IDs for some subcomponents"
|
shortDescription="ID for the editor. Also used as prefix to generate IDs for some subcomponents"
|
||||||
type="String" />
|
type="String" />
|
||||||
<cc:attribute name="emptyText"
|
<cc:attribute name="emptyText"
|
||||||
default="No localized values"
|
default="#{text.editor.no_localized_values}"
|
||||||
required="false"
|
required="false"
|
||||||
shortDescription="Text shown if the localized has no values yet."
|
shortDescription="Text shown if the localized has no values yet."
|
||||||
type="String" />
|
type="String" />
|
||||||
|
|
@ -337,9 +337,11 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<c:forEach items="#{cc.attrs.variants}"
|
<c:forEach items="#{cc.attrs.variants}"
|
||||||
var="variant">
|
var="variant">
|
||||||
<tr>
|
<tr id="variant-#{variant.locale}">
|
||||||
<td>#{variant.locale}</td>
|
<td>#{variant.locale}</td>
|
||||||
<td>#{CmsAdminMessages.getMessage('cms_editor.variants.wordcount', [variant.wordCount])}</td>
|
<td>
|
||||||
|
<span class="wordcount">#{variant.wordCount}</span> #{CmsAdminMessages['cms_editor.variants.wordcount']}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-primary cms-editor-view-button"
|
<button class="btn btn-primary cms-editor-view-button"
|
||||||
data-view-dialog="#{cc.attrs.editorId}-view-dialog"
|
data-view-dialog="#{cc.attrs.editorId}-view-dialog"
|
||||||
|
|
@ -353,6 +355,7 @@
|
||||||
<c:if test="#{cc.attrs.canEdit}">
|
<c:if test="#{cc.attrs.canEdit}">
|
||||||
<button class="btn btn-primary cms-editor-edit-button"
|
<button class="btn btn-primary cms-editor-edit-button"
|
||||||
data-edit-dialog="#{cc.attrs.editorId}-edit-dialog"
|
data-edit-dialog="#{cc.attrs.editorId}-edit-dialog"
|
||||||
|
data-locale="#{variant.locale}"
|
||||||
data-variant-url="#{cc.attrs.variantUrl}/#{variant.locale}"
|
data-variant-url="#{cc.attrs.variantUrl}/#{variant.locale}"
|
||||||
data-save-url="#{cc.attrs.editMethod}/#{variant.locale}"
|
data-save-url="#{cc.attrs.editMethod}/#{variant.locale}"
|
||||||
type="button">
|
type="button">
|
||||||
|
|
@ -445,7 +448,7 @@
|
||||||
data-backdrop="static"
|
data-backdrop="static"
|
||||||
id="#{cc.attrs.editorId}-view-dialog"
|
id="#{cc.attrs.editorId}-view-dialog"
|
||||||
tabindex="-1">
|
tabindex="-1">
|
||||||
<div class="modal-dialog modal-xl">
|
<div class="modal-dialog modal-xl modal-dialog-scrollable">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<c:choose>
|
<c:choose>
|
||||||
|
|
@ -493,7 +496,7 @@
|
||||||
data-backdrop="static"
|
data-backdrop="static"
|
||||||
id="#{cc.attrs.editorId}-edit-dialog"
|
id="#{cc.attrs.editorId}-edit-dialog"
|
||||||
tabindex="-1">
|
tabindex="-1">
|
||||||
<div class="modal-dialog modal-xl">
|
<div class="modal-dialog modal-xl modal-dialog-scrollable">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<c:choose>
|
<c:choose>
|
||||||
|
|
|
||||||
|
|
@ -10,23 +10,11 @@
|
||||||
<ui:define name="authoringStep">
|
<ui:define name="authoringStep">
|
||||||
<h2>#{CmsArticleMessageBundle['textstep.header']}</h2>
|
<h2>#{CmsArticleMessageBundle['textstep.header']}</h2>
|
||||||
|
|
||||||
<!-- <libreccm:localizedStringEditor
|
<librecms:cmsEditor addButtonLabel="#{CmsArticleMessageBundle['text.editor.add_variant']}"
|
||||||
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text/add"
|
addDialogLocaleSelectHelp="#{CmsAdminMessages['text.editor.add.locale.help']}"
|
||||||
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text/edit"
|
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text/add"
|
||||||
editorId="article-text-editor"
|
editDialogValueHelp="#{CmsAdminMessages['text.editor.edit.value.help']}"
|
||||||
hasUnusedLocales="#{!CmsArticleTextBodyStep.unusedLocales.isEmpty()}"
|
editDialogValueLabel="#{CmsAdminMessages['text.editor.edit.value.label']}"
|
||||||
headingLevel="3"
|
|
||||||
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
|
|
||||||
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text/remove"
|
|
||||||
title="#{CmsArticleMessageBundle['text.editor.header']}"
|
|
||||||
unusedLocales="#{CmsArticleTextBodyStep.unusedLocales}"
|
|
||||||
useTextarea="true"
|
|
||||||
values="#{CmsArticleTextBodyStep.textValues}"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div id="cms-editor"></div>-->
|
|
||||||
|
|
||||||
<librecms:cmsEditor addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text/add"
|
|
||||||
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text/edit"
|
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text/edit"
|
||||||
editorId="article-text-editor"
|
editorId="article-text-editor"
|
||||||
hasUnusedLocales="#{!CmsArticleTextBodyStep.unusedLocales.isEmpty()}"
|
hasUnusedLocales="#{!CmsArticleTextBodyStep.unusedLocales.isEmpty()}"
|
||||||
|
|
|
||||||
|
|
@ -768,4 +768,12 @@ contentsection.configuration.workflow.task_details.assignments.dialog.roles.help
|
||||||
contentsection.configuration.workflows.task_details.assigned_to.dialog.title=Edit assigned roles
|
contentsection.configuration.workflows.task_details.assigned_to.dialog.title=Edit assigned roles
|
||||||
cms_editor.buttons.emph=Emphasized
|
cms_editor.buttons.emph=Emphasized
|
||||||
cms_editor.buttons.strong_emph=Strong emphasized
|
cms_editor.buttons.strong_emph=Strong emphasized
|
||||||
cms_editor.variants.wordcount={0} words
|
cms_editor.variants.wordcount=words
|
||||||
|
cancel_button.label=Cancel
|
||||||
|
locale_select.label=Language
|
||||||
|
locale_add.label=Add language
|
||||||
|
locale_add.dialog.title=Add language variant
|
||||||
|
edit_button.label=Edit
|
||||||
|
save_button.label=Save
|
||||||
|
text.edit.dialog.title=Edit localized variant
|
||||||
|
text.editor.no_localized_values=No localized variants available yet.
|
||||||
|
|
|
||||||
|
|
@ -769,4 +769,12 @@ contentsection.configuration.workflow.task_details.assignments.dialog.roles.help
|
||||||
contentsection.configuration.workflows.task_details.assigned_to.dialog.title=Zugewiesene Rollen bearbeiten
|
contentsection.configuration.workflows.task_details.assigned_to.dialog.title=Zugewiesene Rollen bearbeiten
|
||||||
cms_editor.buttons.emph=Betont
|
cms_editor.buttons.emph=Betont
|
||||||
cms_editor.buttons.strong_emph=Stark betont
|
cms_editor.buttons.strong_emph=Stark betont
|
||||||
cms_editor.variants.wordcount={0} W\u00f6rter
|
cms_editor.variants.wordcount=W\u00f6rter
|
||||||
|
cancel_button.label=Abbrechen
|
||||||
|
locale_select.label=Sprache
|
||||||
|
locale_add.label=Sprache hinzuf\u00fcgen
|
||||||
|
locale_add.dialog.title=Sprachvariante hinzuf\u00fcgen
|
||||||
|
edit_button.label=Bearbeiten
|
||||||
|
save_button.label=Speichern
|
||||||
|
text.edit.dialog.title=Lokalisierte Variante bearbeiten
|
||||||
|
text.editor.no_localized_values=Es wurden noch keine lokalisierten Varianten angelegt
|
||||||
|
|
|
||||||
|
|
@ -92,3 +92,7 @@ textstep.languages.none=No texts available
|
||||||
textstep.header.edit=Edit text for locale {0}
|
textstep.header.edit=Edit text for locale {0}
|
||||||
textstep.header.view=Text for locale {0}
|
textstep.header.view=Text for locale {0}
|
||||||
textstep.back=Back to available languages
|
textstep.back=Back to available languages
|
||||||
|
text.editor.add_variant=Add language
|
||||||
|
text.editor.add.locale.help=The language of the new variant.
|
||||||
|
text.editor.edit.value.help=The text of the article.
|
||||||
|
text.editor.edit.value.label=Text
|
||||||
|
|
|
||||||
|
|
@ -92,3 +92,7 @@ textstep.languages.none=Keine Texte vorhandenen
|
||||||
textstep.header.edit=Text f\u00fcr Sprache {0} bearbeiten
|
textstep.header.edit=Text f\u00fcr Sprache {0} bearbeiten
|
||||||
textstep.header.view=Text f\u00fcr Sprache {0}
|
textstep.header.view=Text f\u00fcr Sprache {0}
|
||||||
textstep.back=Zur\u00fcck zur Liste der verf\u00fcgbaren Sprachen
|
textstep.back=Zur\u00fcck zur Liste der verf\u00fcgbaren Sprachen
|
||||||
|
text.editor.add_variant=Sprache hinzuf\u00fcgen
|
||||||
|
text.editor.add.locale.help=Die Sprache der neuen Variante.
|
||||||
|
text.editor.edit.value.help=Der Text des Artikels.
|
||||||
|
text.editor.edit.value.label=Text
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
const target = event.currentTarget as Element;
|
const target = event.currentTarget as Element;
|
||||||
|
const locale = target.getAttribute("data-locale");
|
||||||
const variantUrl = target.getAttribute("data-variant-url");
|
const variantUrl = target.getAttribute("data-variant-url");
|
||||||
const editDialogId = target.getAttribute("data-edit-dialog");
|
const editDialogId = target.getAttribute("data-edit-dialog");
|
||||||
const saveUrl = target.getAttribute("data-save-url");
|
const saveUrl = target.getAttribute("data-save-url");
|
||||||
|
|
@ -154,21 +155,22 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
||||||
|
|
||||||
saveButton.addEventListener("click", event => {
|
saveButton.addEventListener("click", event => {
|
||||||
const html = editor.getHTML();
|
const html = editor.getHTML();
|
||||||
const formData = new FormData();
|
const params = new URLSearchParams();
|
||||||
formData.append("value", html);
|
params.append("value", html);
|
||||||
fetch(saveUrl, {
|
fetch(saveUrl, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/x-www-form-urlencoded"
|
"Content-Type": "application/x-www-form-urlencoded"
|
||||||
},
|
},
|
||||||
body: formData
|
body: params
|
||||||
})
|
})
|
||||||
.then(saveResponse => {
|
.then(saveResponse => {
|
||||||
if (saveResponse.ok) {
|
if (saveResponse.ok) {
|
||||||
showMessage(
|
showMessage(
|
||||||
"#cms-editor-msg-save-successful"
|
"#cms-editor-msg-save-successful"
|
||||||
);
|
);
|
||||||
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
showMessage(
|
showMessage(
|
||||||
"#cms-editor-msg-save-failed"
|
"#cms-editor-msg-save-failed"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue