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

Add actions toolbar #75

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
16 changes: 16 additions & 0 deletions src/plonemeeting/portal/core/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
permission="zope2.View"
/>

<browser:page
name="content_status_modify"
for="plonemeeting.portal.core.content.meeting.IMeeting"
class=".meeting.MeetingContentStatusModifyView"
permission="zope2.View"
/>

<browser:page
name="view"
for="plonemeeting.portal.core.content.item.IItem"
Expand Down Expand Up @@ -211,4 +218,13 @@
permission="zope.Public" />
</configure>


<adapter
factory=".providers.change_state.ChangeStateButtonProvider"
provides="zope.contentprovider.interfaces.IContentProvider"
for="*
zope.publisher.interfaces.browser.IDefaultBrowserLayer
*"
name="plonemeeting.portal.core.change_state_button"
/>
</configure>
13 changes: 12 additions & 1 deletion src/plonemeeting/portal/core/browser/meeting.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-

from plone.app.content.browser.content_status_modify import ContentStatusModifyView
from plone.dexterity.browser.view import DefaultView
from plonemeeting.portal.core.browser.utils import path_to_dx_default_template
from Products.CMFCore.permissions import ModifyPortalContent
from Products.CMFCore.utils import _checkPermission
from plonemeeting.portal.core.utils import redirect
from zope.browserpage import ViewPageTemplateFile


Expand All @@ -20,3 +21,13 @@ def __call__(self):
utils_view = self.context.restrictedTraverse("@@utils_view")
self.request.response.redirect(utils_view.get_meeting_url(meeting=self.context))
return ""


class MeetingContentStatusModifyView(ContentStatusModifyView):
"""Override to redirect back."""

def __call__(self, workflow_action=None, comment="", effective_date=None, expiration_date=None, **kwargs):
super().__call__(workflow_action, comment, effective_date, expiration_date, **kwargs)
utils_view = self.context.restrictedTraverse("@@utils_view")
return self.request.response.redirect(utils_view.get_meeting_url(meeting=self.context))

Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
<tal:comment replace="nothing">
<!-- Ellipsis after first item -->
</tal:comment>
<li class="page-item disabled"
<li class="page-item"
tal:condition="batch/second_page_not_in_navlist"
>
<span>...</span>
<span class="page-link">...</span>
</li>

<tal:comment replace="nothing">
Expand Down Expand Up @@ -106,7 +106,7 @@
<tal:comment replace="nothing">
<!-- Ellipsis before last item -->
</tal:comment>
<li class="page-item disabled"
<li class="page-item"
tal:condition="batch/before_last_page_not_in_navlist"
>
<span class="page-link">...</span>
Expand Down
Empty file.
20 changes: 20 additions & 0 deletions src/plonemeeting/portal/core/browser/providers/change_state.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<tal:change-state-menu>
<button class="btn-delib btn-delib-icon-text dropdown-toggle" type="button" data-bs-toggle="dropdown"
aria-expanded="false">
<i class="bi bi-bezier2"></i>
<span i18n:translate="">Change state</span>
<i class="bi bi-caret-right-fill"></i>
</button>
<ul class="dropdown-menu" i18n:domain="plone">
<li tal:repeat="transition view/transitions">
<a class="dropdown-item" href="#"
tal:attributes="href transition/url">
<tal:title content="structure transition/title"
i18n:translate=""
>
Title
</tal:title>
</a>
</li>
</ul>
</tal:change-state-menu>
44 changes: 44 additions & 0 deletions src/plonemeeting/portal/core/browser/providers/change_state.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from IPython.testing.ipunittest import ipdoctest
from Products.CMFCore.utils import getToolByName
from plone.base.interfaces.controlpanel import ISiteSchema
from plone.protect.utils import addTokenToUrl
from plone.registry.interfaces import IRegistry
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope.browsermenu.interfaces import IBrowserMenu
from zope.component import getUtility
from zope.contentprovider.interfaces import ITALNamespaceData
from zope.contentprovider.provider import ContentProviderBase
from zope.interface import implementer, Interface, provider
from zope.schema import Field
from plone.memoize.instance import memoize


@provider(ITALNamespaceData)
class IChangeStateButton(Interface):
actual_context = Field("Provider context.", required=False)


@implementer(IChangeStateButton)
class ChangeStateButtonProvider(ContentProviderBase):
"""Content menu provider for the "view" tab: displays the menu"""

index = ViewPageTemplateFile("change_state.pt")

def update(self):
if not hasattr(self, "actual_context") or self.actual_context is None:
self.actual_context = self.context
self.transitions = self._transitions()
super().update()

def render(self):
return self.index()

def _transitions(self):
wf_tool = getToolByName(self.actual_context, "portal_workflow")
transitions = wf_tool.listActionInfos(object=self.actual_context)
res = []
for t in transitions:
if t["allowed"] and t["available"]:
t["url"] = addTokenToUrl(t["url"], self.request)
res.append(t)
return res
3 changes: 1 addition & 2 deletions src/plonemeeting/portal/core/browser/resources/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import DarkModeToggle from "./components/DarkModeToggle";
import LayoutSelect from "./components/LayoutSelect";
import PdfViewer from "./components/PdfViewer";
import MeetingAgenda from "./components/MeetingAgenda";
import Tooltip from "./components/Tooltip";

import "../theme/main.scss";
import Tooltip from "./components/Tooltip";

register(CheckboxSelector, "x-checkbox-selector", ["scope", "checked"]);
register(AnnexesStatus, "x-annexes-status", ["data-annexes"]);
Expand All @@ -23,7 +23,6 @@ register(DarkModeToggle, "x-dark-mode-toggle", []);
register(MeetingAgenda, "x-meeting-agenda", ["count", "meeting-url"]);
register(PdfViewer, "x-pdf-viewer", ["file"]);


function setUpEnvironmentLabel() {
let hostname = document.location.hostname;
if (hostname === "localhost" || hostname === "0.0.0.0") {
Expand Down
13 changes: 0 additions & 13 deletions src/plonemeeting/portal/core/browser/templates/macros/annexes.pt

This file was deleted.

48 changes: 42 additions & 6 deletions src/plonemeeting/portal/core/browser/templates/publication.pt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,46 @@
i18n:domain="plonemeeting.portal.core"
>
<body>

<metal:item-description fill-slot="content-description">
<div class="actions-toolbar" tal:condition="python: checkPermission('Modify portal content', context)">
<div class="actions-title">
<i class="bi bi-lightning"></i>
Actions
</div>
<div class="btn-group dropend btn-group-delib" tal:condition="not: is_anon">
<a class="btn-delib btn-delib-icon-text"
tal:define="url string:${context/absolute_url}/@@import_meeting"
tal:condition="python: checkPermission('Modify portal content', context)"
tal:attributes="href python: utils_view.protect_url(url)"
title="Import a new meeting"
i18n:attributes="title">
<i class="bi bi-plus-lg"></i>
<span i18n:translate=''>Add a annex</span>
</a>
<a class="btn-delib btn-delib-icon-text"
tal:define="url string:${context/absolute_url}/edit"
tal:condition="python: checkPermission('Modify portal content', context)"
tal:attributes="href python: utils_view.protect_url(url)"
title="Edit meeting"
i18n:attributes="title">
<i class="bi bi-pencil"></i><span i18n:translate=''>Edit</span>
</a>
<tal:block replace="structure provider:plonemeeting.portal.core.change_state_button"/>
</div>
</div>
</metal:item-description>


<metal:content-core fill-slot="content-core">
<metal:content-core define-macro="content-core"
tal:define="
file python: context.file;
toLocalizedTime nocall:context/@@plone/toLocalizedTime;
toc python: getattr(context, 'table_of_contents', False);
toc python: getattr(context, 'table_of_contents', False);
is_editor python: checkPermission('Modify portal content', context);
"
>

<section class="row metadatas-section mb-3">
<div id="publication-dates" class="col-lg-6 content-metadatas order-last order-lg-first">
<div class="content-metadata-row">
Expand Down Expand Up @@ -292,7 +323,9 @@
<h4>Horodatage qualifié</h4>
</div>
<div class="tooltip-content">
<p>Un horodatage qualifié garantit la date et l'heure exactes de publication d'un document numérique, conformément à la législation européenne (eIDAS). Il assure l'intégrité et la validité juridique du document.</p>
<p>Un horodatage qualifié garantit la date et l'heure exactes de publication d'un document numérique,
conformément à la législation européenne (eIDAS). Il assure l'intégrité et la validité juridique du
document.</p>
</div>

</div>
Expand All @@ -315,7 +348,8 @@
</div>
<div class="row">
<div class="">
<a class="btn btn-outline-secondary" data-bs-toggle="collapse" href="#collapse-timestamping-more-info" role="button"
<a class="btn btn-outline-secondary" data-bs-toggle="collapse" href="#collapse-timestamping-more-info"
role="button"
aria-expanded="false" aria-controls="collapseExample">
En savoir plus <i class="bi bi-info-circle" style="font-size: 1em"></i>
</a>
Expand All @@ -326,10 +360,12 @@
<div class="collapse alert-collapse" id="collapse-timestamping-more-info">
<ul class="text-muted dashed">
<li>
<a href="/faq/quest-ce-que-l-horodatage" target="_blank" class="help-link">Qu'est-ce que l'horodatage qualifié ?</a>
<a href="/faq/quest-ce-que-l-horodatage" target="_blank" class="help-link">Qu'est-ce que l'horodatage
qualifié ?</a>
</li>
<li>
<a href="/faq/verifier-un-horodatage" target="_blank" class="help-link">Comment vérifier un horodatage ?</a>
<a href="/faq/verifier-un-horodatage" target="_blank" class="help-link">Comment vérifier un horodatage
?</a>
</li>
</ul>
</div>
Expand Down
92 changes: 46 additions & 46 deletions src/plonemeeting/portal/core/faceted/preview_meeting.pt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
metal:use-macro="context/main_template/macros/master"
i18n:domain="plonemeeting.portal.core">

Expand All @@ -10,59 +9,59 @@
<metal:block define-macro="content-core">
<div i18n:domain="plonemeeting.portal.core"
tal:define="
portal_url context/@@plone_portal_state/portal_url;
folderContents folderContents | python:context.getFolderContents();
Batch python:modules['Products.CMFPlone'].Batch;
b_start python:request.get('b_start', 0);
batch python:isinstance(folderContents, Batch) and folderContents or Batch(folderContents, 100, int(b_start), orphan=2);
isAnon context/@@plone_portal_state/anonymous;
checkPermission nocall: context/portal_membership/checkPermission;
utils_view nocall:context/@@utils_view;
meeting python: utils_view.get_linked_meeting();
portal_url context/@@plone_portal_state/portal_url;
folderContents folderContents | python:context.getFolderContents();
Batch python:modules['Products.CMFPlone'].Batch;
b_start python:request.get('b_start', 0);
batch python:isinstance(folderContents, Batch) and folderContents or Batch(folderContents, 100, int(b_start), orphan=2);
isAnon context/@@plone_portal_state/anonymous;
checkPermission nocall: context/portal_membership/checkPermission;
utils_view nocall:context/@@utils_view;
meeting python: utils_view.get_linked_meeting();
">
<div class="pm-preview-meeting">
<tal:meeting define="utils_view nocall:context/@@utils_view;
meeting python: utils_view.get_linked_meeting();"
condition="nocall:meeting">
<div tal:define="
meeting_utils_view nocall:meeting/@@utils_view;
review_state python: utils_view.get_state(meeting)"
meeting_utils_view nocall:meeting/@@utils_view;
review_state python: utils_view.get_state(meeting)"
tal:attributes="class string:meeting-infos ${review_state}">
<div class="row mb-5">
<div class="col-lg-3">
<div class="btn-group btn-group-delib btn-group-delib-vertical" tal:condition="not: isAnon">
<a class="btn-delib btn-delib-icon-text"
tal:define="url string:${context/absolute_url}/@@import_meeting"
tal:condition="python: checkPermission('Modify portal content', meeting)"
tal:attributes="href python: utils_view.protect_url(url)"
title="Import a new meeting"
i18n:attributes="title">
<i class="bi bi-plus-lg"></i>
<div class="actions-toolbar vertical">
<div class="actions-title">
<i class="bi bi-lightning"></i>
Actions
</div>
<div class="btn-group dropend btn-group-delib btn-group-delib-vertical" tal:condition="not: isAnon">
<a class="btn-delib btn-delib-icon-text"
tal:define="url string:${context/absolute_url}/@@import_meeting"
tal:condition="python: checkPermission('Modify portal content', meeting)"
tal:attributes="href python: utils_view.protect_url(url)"
title="Import a new meeting"
i18n:attributes="title">
<i class="bi bi-plus-lg"></i>
<span i18n:translate=''>Import a new meeting</span>
</a>
<a class="btn-delib btn-delib-icon-text"
tal:define="url string:${meeting/absolute_url}/view"
tal:condition="python: checkPermission('Modify portal content', meeting)"
tal:attributes="href python: utils_view.protect_url(url)"
title="View meeting"
i18n:attributes="title">
<i class="bi bi-eye"></i><span i18n:translate=''>View meeting</span>
</a>
<a class="btn-delib btn-delib-icon-text"
tal:define="url string:${meeting/absolute_url}/edit"
tal:condition="python: checkPermission('Modify portal content', meeting)"
tal:attributes="href python: utils_view.protect_url(url)"
title="Edit meeting"
i18n:attributes="title">
<i class="bi bi-pencil"></i><span i18n:translate=''>Edit meeting</span>
</a>
<a class="btn-delib btn-delib-icon-text"
tal:define="url string:${meeting/absolute_url}/@@pre_sync_report_form"
tal:condition="python: checkPermission('Modify portal content', meeting)"
tal:attributes="href python: utils_view.protect_url(url)"
title="Update meeting"
i18n:attributes="title">
<i class="bi bi-arrow-repeat"></i><span i18n:translate=''>Update meeting</span></a>
</a>
<a class="btn-delib btn-delib-icon-text"
tal:define="url string:${meeting/absolute_url}/edit"
tal:condition="python: checkPermission('Modify portal content', meeting)"
tal:attributes="href python: utils_view.protect_url(url)"
title="Edit meeting"
i18n:attributes="title">
<i class="bi bi-pencil"></i><span i18n:translate=''>Edit meeting</span>
</a>
<a class="btn-delib btn-delib-icon-text"
tal:define="url string:${meeting/absolute_url}/@@pre_sync_report_form"
tal:condition="python: checkPermission('Modify portal content', meeting)"
tal:attributes="href python: utils_view.protect_url(url)"
title="Update meeting"
i18n:attributes="title">
<i class="bi bi-arrow-repeat"></i><span i18n:translate=''>Update meeting</span></a>
<tal:block define="actual_context nocall:meeting"
replace="structure provider:plonemeeting.portal.core.change_state_button"/>
</div>
</div>
</div>
<div class="col-lg-6">
Expand All @@ -79,9 +78,10 @@
<div class="col-lg-3 order-first order-lg-last">
<div class="meeting-state meeting-state--top"
i18n:domain="plone">

<span i18n:translate=""
tal:content="python: review_state.capitalize().replace('_', ' ')"
tal:attributes="class string:state-${review_state} badge state-badge"></span>
tal:content="python: review_state.capitalize().replace('_', ' ')"
tal:attributes="class string:state-${review_state} badge state-badge"></span>
</div>
</div>
</div>
Expand Down
Loading