Removal and editing of contacts of a SciProject

pull/1/head
Jens Pelzetter 2022-05-11 20:24:59 +02:00
parent cbfdf563f1
commit 06d7839b70
5 changed files with 22 additions and 17 deletions

View File

@ -29,7 +29,7 @@ import javax.ws.rs.core.Response;
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@RequestScoped @RequestScoped
@Path(MvcAuthoringSteps.PATH_PREFIX + "sciproject-description/contacts") @Path(MvcAuthoringSteps.PATH_PREFIX + "sciproject-description-contacts")
public class SciProjectDescriptionContacts { public class SciProjectDescriptionContacts {
@Inject @Inject

View File

@ -461,7 +461,7 @@ public class SciProjectDescriptionStep extends AbstractMvcAuthoringStep {
} }
@POST @POST
@Path("/contacts/remove") @Path("/contacts/{contactId}/remove")
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
@AuthorizationRequired @AuthorizationRequired
public String removeContact( public String removeContact(
@ -469,7 +469,7 @@ public class SciProjectDescriptionStep extends AbstractMvcAuthoringStep {
final String sectionIdentifier, final String sectionIdentifier,
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
final String documentPath, final String documentPath,
@FormParam("contactId") @PathParam("contactId")
final String contactId final String contactId
) { ) {
try { try {

View File

@ -66,6 +66,7 @@
assetPickerId="contacts-picker" assetPickerId="contacts-picker"
baseUrl="#{SciProjectDescriptionContacts.baseUrl}" baseUrl="#{SciProjectDescriptionContacts.baseUrl}"
contentSection="#{ContentSectionModel.sectionName}" contentSection="#{ContentSectionModel.sectionName}"
dialogTitle="#{SciProjectMessageBundle['contact.add.title']}"
formParamName="contactableUuid"> formParamName="contactableUuid">
<bootstrap:formGroupText <bootstrap:formGroupText
help="#{SciProjectMessageBundle['contacts.type.help']}" help="#{SciProjectMessageBundle['contacts.type.help']}"
@ -94,7 +95,7 @@
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<table id="sciproject-contacts-table" <table id="sciproject-contacts-table"
data-saveUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@sciproject-description/contacts/save-order"> data-saveUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@sciproject-description-contacts/save-order">
<thead> <thead>
<tr> <tr>
<th scope="col">#{SciProjectMessageBundle['contacts.cols.contactable']}</th> <th scope="col">#{SciProjectMessageBundle['contacts.cols.contactable']}</th>
@ -124,21 +125,23 @@
<td> <td>
<button class="btn btn-secondary" <button class="btn btn-secondary"
data-toggle="modal" data-toggle="modal"
data-target="#contact-edit-dialog" data-target="#contact-edit-dialog-#{contact.contactId}"
type="button"> type="button">
<bootstrap:svgIcon icon="pen" /> <bootstrap:svgIcon icon="pen" />
<span>#{SciProjectMessageBundle['contacts.edit.label']}</span> <span>#{SciProjectMessageBundle['contacts.edit.label']}</span>
</button> </button>
<div aria-hidden="true" <div aria-hidden="true"
aria-labelledby="contact-edit-dialog-title" aria-labelledby="contact-edit-dialog-#{contact.contactId}-title"
class="modal fade" class="modal fade"
id="contact-edit-dialog" id="contact-edit-dialog-#{contact.contactId}"
tabindex="-1"> tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<form class="modal-content"> <form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@sciproject-description/contacts/edit/#{contact.contactId}"
class="modal-content"
method="post">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" <h4 class="modal-title"
id="contact-edit-dialog-title"> id="contact-edit-dialog-#{contact.contactId}-title">
#{SciProjectMessageBundle['contacts.edit.title']} #{SciProjectMessageBundle['contacts.edit.title']}
</h4> </h4>
<button <button
@ -155,7 +158,7 @@
inputId="type-edit" inputId="type-edit"
label="#{SciProjectMessageBundle['contacts.edit.type.label']}" label="#{SciProjectMessageBundle['contacts.edit.type.label']}"
name="type" name="type"
value="#{contact.contactType}"
/> />
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -175,11 +178,11 @@
</td> </td>
<td> <td>
<libreccm:deleteDialog <libreccm:deleteDialog
actionTarget="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@sciproject-description/contacts/remove/#{contact.contactId}" actionTarget="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@sciproject-description/contacts/#{contact.contactId}/remove"
buttonText="#{SciProjectMessageBundle['contacts.delete.label']}" buttonText="#{SciProjectMessageBundle['contacts.delete.label']}"
cancelLabel="#{SciProjectMessageBundle['contacts.delete.cancel']}" cancelLabel="#{SciProjectMessageBundle['contacts.delete.cancel']}"
confirmLabel="#{SciProjectMessageBundle['contacts.delete.confirm']}" confirmLabel="#{SciProjectMessageBundle['contacts.delete.confirm']}"
dialogId="contact-delete-dialog" dialogId="contact-delete-dialog-#{contact.contactId}"
dialogTitle="#{SciProjectMessageBundle['contacts.delete.title']}" dialogTitle="#{SciProjectMessageBundle['contacts.delete.title']}"
message="#{SciProjectMessageBundle.getMessage('contacts.delete.message', [contact.contactable, contact.contactType])}" message="#{SciProjectMessageBundle.getMessage('contacts.delete.message', [contact.contactable, contact.contactType])}"

View File

@ -79,11 +79,11 @@ contacts.cols.contactable=Contact
contacts.cols.type=Type contacts.cols.type=Type
contacts.cols.actions=Actions contacts.cols.actions=Actions
contacts.edit.label=Edit contacts.edit.label=Edit
contacts.edit.title=Add a contact contacts.edit.title=Edit contact
contacts.edit.cancel=Cancel contacts.edit.cancel=Cancel
contacts.edit.type.help=The type of the contact. contacts.edit.type.help=The type of the contact.
contacts.edit.type.label=Type contacts.edit.type.label=Type
contacts.edit.submit=Add contacts.edit.submit=Save
contacts.delete.label=Remove contacts.delete.label=Remove
contacts.delete.cancel=Cancel contacts.delete.cancel=Cancel
contacts.delete.confirm=Remove contacts.delete.confirm=Remove
@ -177,3 +177,4 @@ contacts.order.save.inprogress=Saving...
contacts.order.save=Save order contacts.order.save=Save order
contacts.sort.errors.general=Error sorting contacts. contacts.sort.errors.general=Error sorting contacts.
contacts.sort.errors.save=Failed to save contacts order. contacts.sort.errors.save=Failed to save contacts order.
contact.add.title=Add contact

View File

@ -79,11 +79,11 @@ contacts.cols.contactable=Kontakt
contacts.cols.type=Typ contacts.cols.type=Typ
contacts.cols.actions=Aktionen contacts.cols.actions=Aktionen
contacts.edit.label=Bearbeiten contacts.edit.label=Bearbeiten
contacts.edit.title=Kontakt hinzuf\u00fcgen contacts.edit.title=Kontakt bearbeiten
contacts.edit.cancel=Abbrechen contacts.edit.cancel=Abbrechen
contacts.edit.type.help=Der Typ des Kontaktes. contacts.edit.type.help=Der Typ des Kontaktes.
contacts.edit.type.label=Typ contacts.edit.type.label=Typ
contacts.edit.submit=Hinzuf\u00fcgen contacts.edit.submit=Speichern
contacts.delete.label=Entfernen contacts.delete.label=Entfernen
contacts.delete.cancel=Abbrechen contacts.delete.cancel=Abbrechen
contacts.delete.confirm=Entfernen contacts.delete.confirm=Entfernen
@ -177,3 +177,4 @@ contacts.order.save.inprogress=Speichern...
contacts.order.save=Sortierung speichern contacts.order.save=Sortierung speichern
contacts.sort.errors.general=Fehler f\u00fcr Sortierung der Kontakte. contacts.sort.errors.general=Fehler f\u00fcr Sortierung der Kontakte.
contacts.sort.errors.save=Fehler beim Speichern der Sortierung der Kontakte. contacts.sort.errors.save=Fehler beim Speichern der Sortierung der Kontakte.
contact.add.title=Kontakt hinzuf\u00fcgen