allow editing of resources via pop-up dialog directly from list; use in section view of book
This commit is contained in:
parent
99ade04957
commit
9c9a504fea
4 changed files with 29 additions and 4 deletions
|
@ -500,6 +500,9 @@ class EditObject(FormController, I18NView):
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def target(self):
|
def target(self):
|
||||||
|
targetUid = self.request.form.get('targetUid')
|
||||||
|
if targetUid:
|
||||||
|
return self.view.getObjectForUid(targetUid)
|
||||||
return self.view.virtualTargetObject or self.context
|
return self.view.virtualTargetObject or self.context
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
|
@ -694,7 +697,7 @@ class CreateObject(EditObject):
|
||||||
obj.setType(self.loopsRoot.loopsTraverse(tc))
|
obj.setType(self.loopsRoot.loopsTraverse(tc))
|
||||||
notify(ObjectCreatedEvent(obj))
|
notify(ObjectCreatedEvent(obj))
|
||||||
#notify(ObjectAddedEvent(obj))
|
#notify(ObjectAddedEvent(obj))
|
||||||
self.object = obj
|
self.object = self.view.object = obj
|
||||||
formState = self.updateFields() # TODO: suppress validation
|
formState = self.updateFields() # TODO: suppress validation
|
||||||
self.view.formState = formState
|
self.view.formState = formState
|
||||||
# TODO: error handling
|
# TODO: error handling
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
tal:attributes="value view/form_action" />
|
tal:attributes="value view/form_action" />
|
||||||
<input type="hidden" name="version"
|
<input type="hidden" name="version"
|
||||||
tal:attributes="value request/version|nothing" />
|
tal:attributes="value request/version|nothing" />
|
||||||
|
<input type="hidden" name="targetUid"
|
||||||
|
tal:attributes="value request/targetUid|nothing" />
|
||||||
<tal:title condition="not:view/isInnerHtml">
|
<tal:title condition="not:view/isInnerHtml">
|
||||||
<h1 tal:content="request/view_title|view/title"
|
<h1 tal:content="request/view_title|view/title"
|
||||||
i18n:translate="">Edit Information Object</h1>
|
i18n:translate="">Edit Information Object</h1>
|
||||||
|
|
|
@ -83,8 +83,8 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="button"
|
<span class="button"
|
||||||
tal:condition="item/xeditable">
|
tal:condition="item/xeditable">
|
||||||
<a title="Edit with External Editor"
|
<a title="Edit with external editor"
|
||||||
i18n:translate=""
|
i18n:translate="" i18n:attributes="title"
|
||||||
tal:define="url view/virtualTargetUrl"
|
tal:define="url view/virtualTargetUrl"
|
||||||
tal:attributes="href string:$url/external_edit?version=this">
|
tal:attributes="href string:$url/external_edit?version=this">
|
||||||
Open for editing
|
Open for editing
|
||||||
|
|
|
@ -4,6 +4,26 @@
|
||||||
<metal:section define-macro="section">
|
<metal:section define-macro="section">
|
||||||
<metal:info use-macro="view/concept_macros/concepttitle" />
|
<metal:info use-macro="view/concept_macros/concepttitle" />
|
||||||
<div tal:repeat="related item/resources">
|
<div tal:repeat="related item/resources">
|
||||||
|
<div class="object-actions" style="padding-top: 0"
|
||||||
|
tal:define="url python:view.getUrlForTarget(related.context)"
|
||||||
|
tal:condition="related/editable">
|
||||||
|
<a i18n:translate="" i18n:attributes="title"
|
||||||
|
title="Edit"
|
||||||
|
tal:define="targetUid python:view.getUidForObject(related.context);
|
||||||
|
url
|
||||||
|
string:$url/edit_object.html?version=this&targetUid=$targetUid"
|
||||||
|
tal:attributes="href url;
|
||||||
|
onclick string:objectDialog('edit', '$url');;
|
||||||
|
return false">
|
||||||
|
<img tal:attributes="src
|
||||||
|
string:$resourceBase/cybertools.icons/vcard_edit.png" /></a>
|
||||||
|
<a i18n:translate="" i18n:attributes="title"
|
||||||
|
title="Edit with external editor."
|
||||||
|
tal:condition="related/xeditable"
|
||||||
|
tal:attributes="href string:$url/external_edit?version=this">
|
||||||
|
<img tal:attributes="src
|
||||||
|
string:$resourceBase/cybertools.icons/application_edit.png" /></a>
|
||||||
|
</div>
|
||||||
<div tal:attributes="class python:
|
<div tal:attributes="class python:
|
||||||
item.getCssClassForResource(related)"
|
item.getCssClassForResource(related)"
|
||||||
tal:content="structure related/render" />
|
tal:content="structure related/render" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue