Skip to content

Commit

Permalink
Plone6 styles (#114)
Browse files Browse the repository at this point in the history
* Adapt viewlet styles to Plone 6

* add button css vclasses

* add plone.app.layout as dependency

* wrap messages in container

* zpretty

---------

Co-authored-by: Philip Bauer <bauer@starzel.de>
  • Loading branch information
spereverde and pbauer authored Feb 19, 2024
1 parent 975b5d4 commit f37417f
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 70 deletions.
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 @@ -36,14 +36,14 @@

<div class="formControls">

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

<input class="standalone"
<input class="btn btn-secondary"
name="form.button.Keep"
type="submit"
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 @@ -57,14 +57,14 @@
</div>

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

<input class="standalone"
<input class="btn btn-secondary"
name="form.button.Cancel"
type="submit"
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 @@ -91,14 +91,14 @@

<div class="formControls">

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

<input class="standalone"
<input class="btn btn-secondary"
name="form.button.Cancel"
type="submit"
value="Cancel"
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 @@ -4,6 +4,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 @@ -96,6 +97,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):
index = ViewPageTemplateFile("info_baseline.pt")
Expand Down
73 changes: 40 additions & 33 deletions plone/app/iterate/browser/info_baseline.pt
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
<div class="portalMessage warning"
tal:define="
working_copy view/working_copy;
isAnon context/@@plone_portal_state/anonymous;
"
tal:condition="python: not isAnon"
i18n:domain="plone"
>
<div class="container">
<div class="portalMessage ${python:display_info['cssclass']}"
role="alert"
tal:define="
working_copy view/working_copy;
isAnon context/@@plone_portal_state/anonymous;
display_info python:view.display_info_for_mtype('warning');
icons nocall: context/@@iconresolver;
"
tal:condition="python: not isAnon"
i18n:domain="plone"
>

<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 i18n:translate="">Warning</strong>
<tal:block i18n:translate="working_copy_info">
<strong>${python:display_info['msg']}</strong>
<tal:block i18n:translate="working_copy_info">
This item is being edited by
<a tal:content="view/creator_name"
tal:omit-tag="not: view/creator_url"
tal:attributes="
href view/creator_url;
"
i18n:name="creator"
>john smith</a>
<a tal:content="view/creator_name"
tal:omit-tag="not: view/creator_url"
tal:attributes="
href view/creator_url;
"
i18n:name="creator"
>john smith</a>
in
<a tal:attributes="
href working_copy/@@plone_context_state/view_url;
title working_copy/Description;
"
i18n:name="working_copy"
i18n:translate="label_working_copy"
>a working copy</a>
<a tal:attributes="
href working_copy/@@plone_context_state/view_url;
title working_copy/Description;
"
i18n:name="working_copy"
i18n:translate="label_working_copy"
>a working copy</a>
created on
<span tal:content="view/created"
i18n:name="created"
></span>.
<span tal:content="view/created"
i18n:name="created"
></span>.

</tal:block>
</tal:block>

(<a tal:attributes="
href string:${context/absolute_url}/@@iterate_diff;
"
i18n:translate="label_view_changes"
>View changes</a>)
(<a tal:attributes="
href string:${context/absolute_url}/@@iterate_diff;
"
i18n:translate="label_view_changes"
>View changes</a>)
</div>
</div>
68 changes: 37 additions & 31 deletions plone/app/iterate/browser/info_checkout.pt
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
<div class="portalMessage info"
tal:define="
baseline view/baseline;
"
i18n:domain="plone"
>
<div class="container">
<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"
>

<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 i18n:translate="">Warning</strong>
<tal:block i18n:translate="checkout_info">
<strong>${python:display_info['msg']}</strong>
<tal:block i18n:translate="checkout_info">

This is a working copy of
<a tal:content="baseline/Title"
tal:attributes="
href baseline/@@plone_context_state/view_url;
title baseline/Description;
"
i18n:name="baseline_title"
></a>, made by
<a tal:content="baseline/Title"
tal:attributes="
href baseline/@@plone_context_state/view_url;
title baseline/Description;
"
i18n:name="baseline_title"
></a>, made by

<a tal:content="view/creator_name"
tal:omit-tag="not: view/creator_url"
tal:attributes="
href view/creator_url;
"
i18n:name="creator"
>john smith</a>
<a tal:content="view/creator_name"
tal:omit-tag="not: view/creator_url"
tal:attributes="
href view/creator_url;
"
i18n:name="creator"
>john smith</a>

on

<span tal:content="view/created"
i18n:name="created"
></span>.
</tal:block>
<span tal:content="view/created"
i18n:name="created"
></span>.
</tal:block>

(<a tal:attributes="
href string:${context/absolute_url}/@@iterate_diff;
"
i18n:translate="view_changes"
>View changes</a>)
(<a tal:attributes="
href string:${context/absolute_url}/@@iterate_diff;
"
i18n:translate="view_changes"
>View changes</a>)
</div>
</div>
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"zope.schema",
"zope.viewlet",
"persistent",
"plone.app.layout",
"plone.base",
"plone.dexterity",
"plone.registry",
Expand Down

0 comments on commit f37417f

Please sign in to comment.