Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt styles to Plone 6 #96

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/95.news
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adapt viewlet styles to Plone 6 [pbauer]
4 changes: 2 additions & 2 deletions plone/app/iterate/browser/cancel.pt
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
<div class="formControls">

<input
class="destructive"
class="btn btn-danger"
type="submit"
name="form.button.Cancel"
value="Cancel checkout"
i18n:attributes="value"
/>

<input
class="standalone"
class="btn btn-secondary"
type="submit"
name="form.button.Keep"
value="Keep checkout"
Expand Down
4 changes: 2 additions & 2 deletions plone/app/iterate/browser/checkin.pt
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@

<div class="formControls">
<input
class="context"
class="btn btn-primary"
type="submit"
name="form.button.Checkin"
value="Check in"
i18n:attributes="value"
/>

<input
class="standalone"
class="btn btn-secondary"
type="submit"
name="form.button.Cancel"
value="Cancel"
Expand Down
4 changes: 2 additions & 2 deletions plone/app/iterate/browser/checkout.pt
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@
<div class="formControls">

<input
class="context"
class="btn btn-primary"
type="submit"
name="form.button.Checkout"
value="Check out"
i18n:attributes="value"
/>

<input
class="standalone"
class="btn btn-secondary"
type="submit"
name="form.button.Cancel"
value="Cancel"
Expand Down
6 changes: 3 additions & 3 deletions plone/app/iterate/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
name="content-checkout"
class=".checkout.Checkout"
template="checkout.pt"
permission="zope2.View"
permission="plone.app.iterate.CheckOutContent"
/>

<browser:page
for="..interfaces.IIterateAware"
name="content-checkin"
class=".checkin.Checkin"
template="checkin.pt"
permission="cmf.ModifyPortalContent"
permission="plone.app.iterate.CheckInContent"
/>

<browser:page
Expand All @@ -45,7 +45,7 @@
class=".diff.DiffView"
name="iterate_diff"
template="diff.pt"
permission="zope2.View"
permission="cmf.ModifyPortalContent"
/>
Copy link
Member

Choose a reason for hiding this comment

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

@pbauer I found this old PR while testing plone/Products.CMFPlone#1452. The style updates look good to me. The permission updates also look desirable but I think they will need a bit more work to ensure the rolemap is set up correctly; could you separate out that change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done with #120
The rolemap is setup the old-school way in permissiosn.py


<browser:viewlet
Expand Down
5 changes: 5 additions & 0 deletions plone/app/iterate/browser/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from plone.app.iterate.interfaces import ICheckinCheckoutPolicy
from plone.app.iterate.interfaces import keys
from plone.app.iterate.permissions import CheckoutPermission
from plone.app.layout.viewlets.globalstatusmessage import MTYPES_DISPLAY
from plone.memoize.instance import memoize
from Products.CMFCore.permissions import ModifyPortalContent
from Products.CMFCore.utils import getToolByName
Expand Down Expand Up @@ -97,6 +98,10 @@ def properties(self):
def _getReference(self):
raise NotImplementedError

def display_info_for_mtype(self, mtype):
"""get info for display of an mtype"""
return MTYPES_DISPLAY.get(mtype, MTYPES_DISPLAY["info"])


class BaselineInfoViewlet(BaseInfoViewlet):

Expand Down
14 changes: 10 additions & 4 deletions plone/app/iterate/browser/info_baseline.pt
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<div class="portalMessage warning"
<div class="portalMessage ${python:display_info['cssclass']}"
tal:define="working_copy view/working_copy;
isAnon context/@@plone_portal_state/anonymous;"
isAnon context/@@plone_portal_state/anonymous;
display_info python:view.display_info_for_mtype('warning');
icons nocall: context/@@iconresolver;
"
i18n:domain="plone"
tal:condition="python: not isAnon">
tal:condition="python: not isAnon"
role="alert">

<strong i18n:translate="">Warning</strong>
<tal:icon tal:replace="structure python:icons.tag(display_info['icon'], tag_alt=display_info['msg'], tag_class='statusmessage-icon mb-1 me-2')" />

<strong>${python:display_info['msg']}</strong>
<tal:block i18n:translate="working_copy_info">
This item is being edited by
<a i18n:name="creator"
Expand Down
11 changes: 8 additions & 3 deletions plone/app/iterate/browser/info_checkout.pt
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<div class="portalMessage info"
tal:define="baseline view/baseline;"
<div class="portalMessage ${python:display_info['cssclass']}"
tal:define="baseline view/baseline;
display_info python:view.display_info_for_mtype('warning');
icons nocall: context/@@iconresolver;
"
i18n:domain="plone">

<strong i18n:translate="">Warning</strong>
<tal:icon tal:replace="structure python:icons.tag(display_info['icon'], tag_alt=display_info['msg'], tag_class='statusmessage-icon mb-1 me-2')" />

<strong>${python:display_info['msg']}</strong>
<tal:block i18n:translate="checkout_info">

This is a working copy of
Expand Down
20 changes: 10 additions & 10 deletions plone/app/iterate/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
<include package="zope.component" file="meta.zcml"/>
<include package="zope.viewlet" file="meta.zcml"/>

<permission
id="plone.app.iterate.CheckInContent"
title="iterate : Check in content"
/>

<permission
id="plone.app.iterate.CheckOutContent"
title="iterate : Check out content"
/>

<include package="plone.locking" />
<include package="plone.memoize" />
<include package="Products.CMFCore" />
Expand Down Expand Up @@ -106,16 +116,6 @@
handler=".event.handleDeletion"
/>

<permission
id="plone.app.iterate.CheckInContent"
title="iterate : Check in content"
/>

<permission
id="plone.app.iterate.CheckOutContent"
title="iterate : Check out content"
/>

<include package=".dexterity" zcml:condition="installed plone.app.relationfield" />
<include file="at.zcml" zcml:condition="installed Products.Archetypes.BaseObject" />

Expand Down