add plone.resource dependency and change to plone:static

This commit is contained in:
Philip Bauer 2019-06-27 19:43:27 +02:00
parent 9b02d2b2fc
commit 4966d8388e
6 changed files with 8 additions and 38 deletions

View File

@ -135,36 +135,4 @@ comments.py file with our custom version of the comments viewlet::
return "%s/memberhome/%s" % (self.context.portal_url(), username)
To override the comments viewlet template, we create a comment.pt file in the
same directory and copy the contents from::
...
Override the comments viewlet Javascript
----------------------------------------
Overriding the comments viewlet javascript works just like overriding the
comments viewlet. We register the javascript file for our custom browser
layer and remove the existing javascript file in
profiles/default/jsregistry.xml::
<?xml version="1.0"?>
<object name="portal_javascripts">
<!-- Remove plone.app.discussion comments javascript -->
<javascript
id="++resource++plone.app.discussion.javascripts/comments.js"
remove="True"
/>
<!-- Register a custom version of the plone.app.discussion javascript -->
<javascript
id="++resource++example.myaddonproduct.javascripts/comments.js" />
</object>
browser/configure.zcml::
<!-- Resource directory for javascripts -->
<browser:resourceDirectory
name="example.myaddonproduct.javascripts"
directory="javascripts"
layer="example.myaddonprocuts.interfaces.IBrowserLayer"
/>
same directory and copy the contents from the original.

View File

@ -1,6 +1,7 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:plone="http://namespaces.plone.org/plone"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="plone">
@ -129,10 +130,10 @@
/>
<!-- Resource directory for javascripts -->
<browser:resourceDirectory
<plone:static
name="plone.app.discussion.javascripts"
type="plone"
directory="javascripts"
layer="..interfaces.IDiscussionLayer"
/>
<!-- Control panel -->

View File

@ -70,7 +70,7 @@
</div>
<script type="text/javascript"
tal:attributes="src string:${portal_url}/++resource++plone.app.discussion.javascripts/controlpanel.js">
tal:attributes="src string:${portal_url}/++plone++plone.app.discussion.javascripts/controlpanel.js">
</script>
</article>

View File

@ -18,7 +18,7 @@
b_start request/b_start | b_start;
moderation_enabled view/moderation_enabled;">
<script type="text/javascript"
tal:attributes="src string:${context/portal_url}/++resource++plone.app.discussion.javascripts/moderation.js">
tal:attributes="src string:${context/portal_url}/++plone++plone.app.discussion.javascripts/moderation.js">
</script>
<h1 class="documentFirstHeading" i18n:translate="heading_moderate_comments">

View File

@ -1,6 +1,7 @@
<metadata>
<version>1000</version>
<dependencies>
<dependency>profile-plone.resource:default</dependency>
<dependency>profile-plone.app.registry:default</dependency>
</dependencies>
</metadata>

View File

@ -7,7 +7,7 @@
<records prefix="plone.resources/plone-app-discussion"
interface='Products.CMFPlone.interfaces.IResourceRegistry'>
<value key="js">++resource++plone.app.discussion.javascripts/comments.js</value>
<value key="js">++plone++plone.app.discussion.javascripts/comments.js</value>
</records>
<records prefix="plone.bundles/plone-legacy"
interface='Products.CMFPlone.interfaces.IBundleRegistry'>