Skip to content

Commit

Permalink
Remove the override of grok views static method. This problem started…
Browse files Browse the repository at this point in the history
… with a merge at five.grok, http://svn.zope.org/five.grok/trunk/src/five/grok/meta.py?rev=123298&r1=112163&r2=123298

That merge removes the static resources grokker, maybe a not desired side effect of the merge. The static resource is documented by dexterity, and used by this package.
To fix this problem, if static resources grokker doesn't come back to five.grok, we can use a method also documented at dexterity, http://plone.org/products/dexterity/documentation/manual/developer-manual/advanced/static-resources
This way we use @@plone_portal_state/navigation_root_url as a base for our resources instead of the problematic static method.
  • Loading branch information
Juan Pablo Giménez committed Apr 4, 2013
1 parent 796dd58 commit 5cd3d9d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 24 deletions.
16 changes: 0 additions & 16 deletions src/collective/cover/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ class View(grok.View):
grok.require('zope2.View')
grok.name('view')

def update(self):
self.context = aq_inner(self.context)
portal_state = self.context.restrictedTraverse('@@plone_portal_state')
navroot_url = portal_state.navigation_root_url()
self.static = '%s/++resource++collective.cover' % navroot_url


class AddCTWidget(grok.View):
grok.context(ICover)
Expand Down Expand Up @@ -139,10 +133,6 @@ class RemoveTileWidget(grok.View):
grok.name("removetilewidget")

def __call__(self):
self.context = aq_inner(self.context)
portal_state = self.context.restrictedTraverse('@@plone_portal_state')
navroot_url = portal_state.navigation_root_url()
self.static = '%s/++resource++collective.cover' % navroot_url
template = self.template
if 'form.submitted' not in self.request:
return template.render(self)
Expand All @@ -169,9 +159,6 @@ class Compose(grok.View):

def update(self):
self.context = aq_inner(self.context)
portal_state = self.context.restrictedTraverse('@@plone_portal_state')
navroot_url = portal_state.navigation_root_url()
self.static = '%s/++resource++collective.cover' % navroot_url
# XXX: used to lock the object when someone is editing it
notify(EditBegunEvent(self.context))

Expand All @@ -184,9 +171,6 @@ class LayoutEdit(grok.View):

def update(self):
self.context = aq_inner(self.context)
portal_state = self.context.restrictedTraverse('@@plone_portal_state')
navroot_url = portal_state.navigation_root_url()
self.static = '%s/++resource++collective.cover' % navroot_url
# XXX: used to lock the object when someone is editing it
notify(EditBegunEvent(self.context))

Expand Down
7 changes: 5 additions & 2 deletions src/collective/cover/templates/compose.pt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

<metal:js fill-slot="javascript_head_slot">
<script type="text/javascript"
tal:attributes="src string:${view/static}/cover.js">
tal:define="navroot context/@@plone_portal_state/navigation_root_url"
tal:attributes="href string:${navroot}/++resource++collective.cover/cover.js">
</script>

<script type="text/javascript">
Expand All @@ -21,7 +22,9 @@

<metal:styles fill-slot="style_slot">
<link rel="stylesheet" type="text/css" media="screen" href=""
tal:attributes="href string:${view/static}/cover.css" />
tal:define="navroot context/@@plone_portal_state/navigation_root_url"
tal:attributes="href string:${navroot}/++resource++collective.cover/cover.css"
/>
</metal:styles>

<metal:main fill-slot="main">
Expand Down
13 changes: 9 additions & 4 deletions src/collective/cover/templates/layoutedit.pt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@

<metal:js fill-slot="javascript_head_slot">
<script type="text/javascript"
tal:attributes="src string:${view/static}/layout_edit.js">
tal:define="navroot context/@@plone_portal_state/navigation_root_url"
tal:attributes="href string:${navroot}/++resource++collective.cover/layout_edit.js">
</script>
<script type="text/javascript"
tal:attributes="src string:${view/static}/layout_base.js">
tal:define="navroot context/@@plone_portal_state/navigation_root_url"
tal:attributes="href string:${navroot}/++resource++collective.cover/layout_base.js">
</script>
<script type="text/javascript"
tal:attributes="src string:${view/static}/jss.js">
tal:define="navroot context/@@plone_portal_state/navigation_root_url"
tal:attributes="href string:${navroot}/++resource++collective.cover/jss.js">
</script>

<script type="text/javascript">
Expand All @@ -28,7 +31,9 @@

<metal:styles fill-slot="style_slot">
<link rel="stylesheet" type="text/css" media="screen" href=""
tal:attributes="href string:${view/static}/layout_edit.css" />
tal:define="navroot context/@@plone_portal_state/navigation_root_url"
tal:attributes="href string:${navroot}/++resource++collective.cover/layout_edit.css"
/>
</metal:styles>

<metal:main fill-slot="main">
Expand Down
4 changes: 3 additions & 1 deletion src/collective/cover/templates/removetilewidget.pt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

<metal:styles fill-slot="style_slot">
<link rel="stylesheet" type="text/css" media="screen" href=""
tal:attributes="href string:${view/static}/cover.css" />
tal:define="navroot context/@@plone_portal_state/navigation_root_url"
tal:attributes="href string:${navroot}/++resource++collective.cover/cover.css"
/>
</metal:styles>

<body>
Expand Down
4 changes: 3 additions & 1 deletion src/collective/cover/templates/view.pt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

<metal:styles fill-slot="style_slot">
<link rel="stylesheet" type="text/css" media="screen" href=""
tal:attributes="href string:${view/static}/cover.css" />
tal:define="navroot context/@@plone_portal_state/navigation_root_url"
tal:attributes="href string:${navroot}/++resource++collective.cover/cover.css"
/>
</metal:styles>
<body>

Expand Down

2 comments on commit 5cd3d9d

@hvelarde
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not working; tests are broken

@jpgimenez
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hvelarde: Fixed

Please sign in to comment.