allow editing of resources via pop-up dialog directly from list; use in section view of book

This commit is contained in:
Helmut Merz 2012-06-25 09:37:59 +02:00
parent 99ade04957
commit 9c9a504fea
4 changed files with 29 additions and 4 deletions

View file

@ -500,6 +500,9 @@ class EditObject(FormController, I18NView):
@Lazy
def target(self):
targetUid = self.request.form.get('targetUid')
if targetUid:
return self.view.getObjectForUid(targetUid)
return self.view.virtualTargetObject or self.context
@Lazy
@ -694,7 +697,7 @@ class CreateObject(EditObject):
obj.setType(self.loopsRoot.loopsTraverse(tc))
notify(ObjectCreatedEvent(obj))
#notify(ObjectAddedEvent(obj))
self.object = obj
self.object = self.view.object = obj
formState = self.updateFields() # TODO: suppress validation
self.view.formState = formState
# TODO: error handling

View file

@ -20,6 +20,8 @@
tal:attributes="value view/form_action" />
<input type="hidden" name="version"
tal:attributes="value request/version|nothing" />
<input type="hidden" name="targetUid"
tal:attributes="value request/targetUid|nothing" />
<tal:title condition="not:view/isInnerHtml">
<h1 tal:content="request/view_title|view/title"
i18n:translate="">Edit Information Object</h1>

View file

@ -83,8 +83,8 @@
</span>
<span class="button"
tal:condition="item/xeditable">
<a title="Edit with External Editor"
i18n:translate=""
<a title="Edit with external editor"
i18n:translate="" i18n:attributes="title"
tal:define="url view/virtualTargetUrl"
tal:attributes="href string:$url/external_edit?version=this">
Open for editing

View file

@ -4,6 +4,26 @@
<metal:section define-macro="section">
<metal:info use-macro="view/concept_macros/concepttitle" />
<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:
item.getCssClassForResource(related)"
tal:content="structure related/render" />