Skip to content

Commit

Permalink
Merge pull request #87 from plone/thet-control-panel-url
Browse files Browse the repository at this point in the history
Use ``getSite()`` instead of portal url
  • Loading branch information
jensens committed Mar 14, 2016
2 parents aca1e3a + ec7fe25 commit 12d5347
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Changelog

New:

- *add item here*
- For the discussion controlpanel, change base URLs from portal URL to what getSite returns, but don't change the controlpanels context binding.
This allows for more flexibility when configuring it to be allowed on a sub site with a local registry.
[thet]

Fixes:

Expand Down
14 changes: 7 additions & 7 deletions plone/app/discussion/browser/controlpanel.pt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tal:link i18n:name="label_mail_control_panel_link">
<a href=""
i18n:translate="text_no_mailhost_configured_control_panel_link"
tal:attributes="href string:${portal_url}/@@mail-controlpanel"
tal:attributes="href string:${view/site_url}/@@mail-controlpanel"
>Mail control panel</a>
</tal:link>
to fix this.
Expand All @@ -42,7 +42,7 @@
<tal:link i18n:name="label_discussion_control_panel_link">
<a href=""
i18n:translate="text_discussion_type_control_panel_link"
tal:attributes="href string:${portal_url}/@@content-controlpanel?type_id=Discussion Item"
tal:attributes="href string:${view/site_url}/@@content-controlpanel?type_id=Discussion Item"
>Types control panel</a>
</tal:link>
to choose a workflow for the 'Discussion Item' type.
Expand All @@ -61,7 +61,7 @@
<tal:link i18n:name="label_comments_migration_link">
<a href=""
i18n:translate="text_comments_migration_link"
tal:attributes="href string:${portal_url}/@@comment-migration"
tal:attributes="href string:${view/site_url}/@@comment-migration"
>migrate your comments</a>
</tal:link>
to fix this.
Expand All @@ -73,9 +73,9 @@
</div>

<a id="setup-link" class="link-parent"
tal:attributes="href string:$portal_url/@@overview-controlpanel"
i18n:translate="">
Site Setup
tal:attributes="href string:${view/site_url}/@@overview-controlpanel"
i18n:translate="">
Site Setup
</a>

<h1 class="documentFirstHeading" tal:content="view/label">View Title</h1>
Expand All @@ -87,7 +87,7 @@
</div>

<script type="text/javascript"
tal:attributes="src string:${context/portal_url}/++resource++plone.app.discussion.javascripts/controlpanel.js">
tal:attributes="src string:${portal_url}/++resource++plone.app.discussion.javascripts/controlpanel.js">
</script>

</article>
Expand Down
7 changes: 7 additions & 0 deletions plone/app/discussion/browser/controlpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper):
form = DiscussionSettingsEditForm
index = ViewPageTemplateFile('controlpanel.pt')

@property
def site_url(self):
"""Return the absolute URL to the current site, which is likely not
necessarily the portal root.
"""
return getSite().absolute_url()

def settings(self):
"""Compose a string that contains all registry settings that are
needed for the discussion control panel.
Expand Down

1 comment on commit 12d5347

@jenkins-plone-org
Copy link

Choose a reason for hiding this comment

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

@jensens Jenkins CI reporting about code analysis
See the full report here: http://jenkins.plone.org/job/package-plone.app.discussion/37/violations

plone/app/discussion/contentrules.py:20:5: E731 do not assign a lambda expression, use a def
plone/app/discussion/browser/comments.py:132:1: C901 'CommentForm.handleComment' is too complex (17)
plone/app/discussion/browser/conversation.py:29:1: C901 'ConversationView._enabled_for_archetypes' is too complex (14)
plone/app/discussion/browser/conversation.py:135:12: P002 found "hasattr", consider replacing it
plone/app/discussion/browser/migration.py:34:1: C901 'View.__call__' is too complex (32)

Follow these instructions to reproduce it locally.

Please sign in to comment.