work in progress: personal info query/view - starting with link to 'change password'; define 'editTask' as a separately definable action
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3144 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
c185f72eea
commit
77376f1c04
7 changed files with 47 additions and 13 deletions
|
@ -206,7 +206,7 @@
|
|||
<!-- portlets -->
|
||||
|
||||
<metal:actions define-macro="parents">
|
||||
<div tal:repeat="concept macro/info/parents">
|
||||
<div tal:repeat="concept macro/info/view/parents">
|
||||
<a href="#"
|
||||
tal:attributes="href string:${view/url}/.target${concept/uniqueId}">
|
||||
<span i18n:translate="" tal:content="concept/title">Concept</span>
|
||||
|
|
|
@ -118,12 +118,18 @@ class NodeView(BaseView):
|
|||
mi = self.controller.memberInfo
|
||||
title = mi.title.value or _(u'Personal Informations')
|
||||
obj = mi.get('object')
|
||||
url = obj is not None and self.getUrlForTarget(obj.value) or None
|
||||
cm.register('portlet_right', 'personal', title=title,
|
||||
subMacro=node_macros.macros['personal'],
|
||||
icon='cybertools.icons/user.png',
|
||||
url=url,
|
||||
priority=10)
|
||||
if obj is not None:
|
||||
query = self.conceptManager.get('personal_info')
|
||||
if query is None:
|
||||
#url = self.url + '/personal_info.html'
|
||||
url = self.getUrlForTarget(obj.value)
|
||||
else:
|
||||
url = self.getUrlForTarget(query)
|
||||
cm.register('portlet_right', 'personal', title=title,
|
||||
subMacro=node_macros.macros['personal'],
|
||||
icon='cybertools.icons/user.png',
|
||||
url=url,
|
||||
priority=10)
|
||||
# force early portlet registrations by target by setting up target view
|
||||
self.virtualTarget
|
||||
|
||||
|
|
|
@ -335,7 +335,14 @@ Task view with edit action
|
|||
|
||||
>>> from loops.organize.browser.task import TaskView
|
||||
>>> view = TaskView(task01, TestRequest())
|
||||
>>> view.getActions('portlet')
|
||||
>>> list(view.getActions('portlet'))
|
||||
[]
|
||||
|
||||
OK, the action is not provided automatically any more by the TaskView
|
||||
but has to be entered as a type option.
|
||||
|
||||
>>> adapted(task).options = ['action.portlet:editTask']
|
||||
>>> list(view.getActions('portlet'))
|
||||
[<loops.browser.action.DialogAction ...>]
|
||||
|
||||
Events listing
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
i18n_domain="loops">
|
||||
|
||||
<zope:adapter
|
||||
name="mystuff"
|
||||
name="personal_info.html"
|
||||
for="loops.interfaces.IConcept
|
||||
zope.publisher.interfaces.browser.IBrowserRequest"
|
||||
provides="zope.interface.Interface"
|
||||
factory="loops.organize.browser.member.MyStuff"
|
||||
factory="loops.organize.browser.member.PersonalInfo"
|
||||
permission="zope.View"
|
||||
/>
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ from loops.util import _
|
|||
organize_macros = ViewPageTemplateFile('view_macros.pt')
|
||||
|
||||
|
||||
class MyStuff(ConceptView):
|
||||
class PersonalInfo(ConceptView):
|
||||
|
||||
def __init__(self, context, request):
|
||||
self.context = context
|
||||
|
|
|
@ -26,17 +26,29 @@ from zope import interface, component
|
|||
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||
from zope.cachedescriptors.property import Lazy
|
||||
|
||||
from cybertools.browser.action import actions
|
||||
from loops.browser.action import DialogAction
|
||||
from loops.browser.concept import ConceptView
|
||||
from loops.util import _
|
||||
|
||||
|
||||
actions.register('editTask', 'portlet', DialogAction,
|
||||
title=_(u'Edit Task...'),
|
||||
description=_(u'Modify task.'),
|
||||
viewName='edit_concept.html',
|
||||
dialogName='editTask',
|
||||
prerequisites=['registerDojoDateWidget'],
|
||||
)
|
||||
|
||||
|
||||
organize_macros = ViewPageTemplateFile('view_macros.pt')
|
||||
|
||||
|
||||
class TaskView(ConceptView):
|
||||
|
||||
def getActions(self, category='object', page=None, target=None):
|
||||
pass
|
||||
|
||||
def xx_getActions(self, category='object', page=None, target=None):
|
||||
actions = []
|
||||
if category == 'portlet':
|
||||
actions.append(DialogAction(self, title=_(u'Edit Task...'),
|
||||
|
|
|
@ -3,7 +3,16 @@
|
|||
|
||||
<metal:data define-macro="conceptdata">
|
||||
<tal:person condition="item/person">
|
||||
<metal:block use-macro="item/concept_macros/macros/conceptdata" />
|
||||
<metal:block use-macro="view/concept_macros/conceptdata">
|
||||
<metal:block fill-slot="fields">
|
||||
<metal:fields use-macro="view/concept_macros/conceptfields" />
|
||||
<h2 i18n:translate="">Actions</h2>
|
||||
<ul>
|
||||
<li><a href="change_password.html"
|
||||
i18n:translate="">Change Password</a></li>
|
||||
</ul>
|
||||
</metal:block>
|
||||
</metal:block>
|
||||
</tal:person>
|
||||
<tal:person condition="not:item/person">
|
||||
<metal:block use-macro="item/concept_macros/macros/concepttitle" /><br />
|
||||
|
|
Loading…
Add table
Reference in a new issue