Skip to content

Commit

Permalink
new style for assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
agitator committed Jan 12, 2022
1 parent 3cf13de commit b6339bc
Show file tree
Hide file tree
Showing 2 changed files with 391 additions and 484 deletions.
339 changes: 172 additions & 167 deletions plone/app/contentrules/browser/templates/controlpanel.pt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,47 @@
<h1 class="documentFirstHeading"
i18n:translate="title_manage_contentrules">Content Rules</h1>

<p i18n:translate="description-contentrules-controlpanel" class="documentDescription">
<p i18n:translate="description-contentrules-controlpanel" class="lead">
Use the form below to define, change or remove content rules. Rules
will automatically perform actions on content when certain triggers
take place. After defining rules, you may want to go to a folder
to assign them, using the "rules" item in the actions menu.
</p>

<div id="fieldset-global">
<form name="ruleSettings" method="POST"
tal:attributes="action string:${context/absolute_url}/@@rules-controlpanel">
<span tal:replace="structure context/@@authenticator/authenticator"/>
<div class="form-check">
<input type="hidden" name="global_disable:boolean:default" value="" />
<input type="checkbox"
class="form-check-input"
id="rules_disable_globally"
name="global_disable:boolean"
value="True"
tal:attributes="checked python:view.globally_disabled() and 'checked' or None" />
<label class="form-check-label" for="rules_disable_globally" i18n:translate="">Disable globally</label>
<div class="form-text" i18n:translate="">
Whether or not content rules should be disabled globally. If this is selected,
no rules will be executed anywhere in the portal.
</div>
</div>

<noscript>
<!-- we'll use js to submit this normally -->
<div class="formControls">
<input type="submit"
name="form.button.SaveSettings"
class="btn btn-primary"
value="Save"
i18n:attributes="value label_save;" />
</div>
</noscript>
</form>

</div>


</header>

<div id="content-core">
Expand All @@ -42,177 +77,147 @@
</span>
</div>

<div id="fieldset-global" class="mb-5">
<form name="ruleSettings" method="POST"
tal:attributes="action string:${context/absolute_url}/@@rules-controlpanel">
<span tal:replace="structure context/@@authenticator/authenticator"/>
<div class="form-check">
<input type="hidden" name="global_disable:boolean:default" value="" />
<input type="checkbox"
class="form-check-input"
id="rules_disable_globally"
name="global_disable:boolean"
value="True"
tal:attributes="checked python:view.globally_disabled() and 'checked' or None" />
<label class="form-check-label" for="rules_disable_globally" i18n:translate="">Disable globally</label>
<div class="form-text" i18n:translate="">
Whether or not content rules should be disabled globally. If this is selected,
no rules will be executed anywhere in the portal.
</div>
</div>

<noscript>
<!-- we'll use js to submit this normally -->
<div class="formControls">
<input type="submit"
name="form.button.SaveSettings"
class="btn btn-primary"
value="Save"
i18n:attributes="value label_save;" />
</div>
</noscript>
</form>

</div>

<div class="card">
<fieldset id="fieldset-rules" class="card-body"
tal:define="rules rules|view/registeredRules;">
<legend id="fieldsetlegend-rules" i18n:translate="legend-contentrules">Content rules</legend>

<div class="filters mt-2 mb-3" tal:condition="rules">
<span class="type-filters">
<span i18n:translate="">Filter:</span>
<span class="filter-option"
tal:repeat="rule view/ruleTypesToShow">
<div class="form-check form-check-inline">
<input id="all" class="form-check-input" type="checkbox"
tal:attributes="id rule/id"
/>
<label class="form-check-label"
for="all"
tal:attributes="for rule/id"
tal:content="rule/title">
All</label>
</div>
</span>
<div class="card">
<fieldset id="fieldset-rules" class="card-body"
tal:define="rules rules|view/registeredRules;">

<div class="filters row row-cols-lg-auto g-3 align-items-center" tal:condition="rules">
<span class="type-filters">
<label class="col-form-label pe-3" i18n:translate="">Filter rules:</label>
<span class="filter-option"
tal:repeat="rule view/ruleTypesToShow">
<div class="form-check form-check-inline">
<input id="all" class="form-check-input" type="checkbox"
tal:attributes="id rule/id"
/>
<label class="form-check-label"
for="all"
tal:attributes="for rule/id"
tal:content="rule/title">
All</label>
</div>
</span>
<span class="state-filters" tal:condition="rules">
<span class="filter-option"
tal:repeat="state view/statesToShow">
<div class="form-check form-check-inline">
<input id="all" class="form-check-input" type="checkbox"
tal:attributes="id state/id"
/>
<label class="form-check-label"
for="all"
tal:attributes="for state/id"
tal:content="state/title">
All</label>
</div>
</span>
</span>
<span class="state-filters">
<span class="filter-option"
tal:repeat="state view/statesToShow">
<div class="form-check form-check-inline">
<input id="all" class="form-check-input" type="checkbox"
tal:attributes="id state/id"
/>
<label class="form-check-label"
for="all"
tal:attributes="for state/id"
tal:content="state/title">
All</label>
</div>
</span>
</div>
<div class="visualClear"><!-- --></div>
<div id="rules_table_form"
metal:define-macro="rules_table_form">
<table class="listing nosort controlpanel-listing table"
tal:condition="rules">
<thead class="">
<tr>
<th scope="col" i18n:translate="label_contentrules_rule_listing">Content rule</th>
<th scope="col" i18n:translate="label_contentrules_rule_event">Event</th>
<th scope="col" i18n:translate="label_contentrules_rule_status"><span class="ps-2">Status</span></th>
<th scope="col" i18n:translate="label_contentrules_rule_actions">Actions</th>
</tr>
</thead>
<tbody>
<tal:rules repeat="rule view/registeredRules">
<tr tal:define="oddrow repeat/rule/odd"
tal:attributes="class python:(oddrow and 'even ' or 'odd ') + rule['row_class'];">
<td>
<h5 class="rule-title">
<span
tal:replace="rule/title">Rule Title</span>
</h5>
<div tal:content="rule/description">
Rule Description.
</div>
</td>
<td>
<span class="trigger"
tal:content="rule/trigger"
i18n:translate="">trigger</span>
</td>
<td class="status">

<form style="display: inline" method="POST"
tal:attributes="action string:${context/absolute_url}/@@rules-controlpanel">
<span tal:replace="structure context/@@authenticator/authenticator"/>
<input type="hidden"
name="rule-id"
tal:attributes="value rule/id">
<button class="context btn-rule-action btn-rule-enable btn btn-sm btn-link ${python: rule['enabled'] and 'd-none'}" type="submit" value="Enable"
name="form.button.EnableRule"
tal:attributes="data-value rule/id;
data-url string:$portal_url/@@contentrule-enable"
i18n:translate=""
i18n:attributes="value label_enable;">
<tal:icon tal:replace="structure python:icons.tag('square', tag_alt='Toggle to show')" /><span class="ms-2" i18n:translate="">enabled</span>
</button>
<button class="standalone btn-rule-action btn-rule-disable btn btn-sm btn-link ${python: not rule['enabled'] and 'd-none'}" type="submit" value="Disable"
name="form.button.DisableRule"
tal:attributes="data-value rule/id;
data-url string:$portal_url/@@contentrule-disable"
i18n:translate=""
i18n:attributes="value label_disable;">
<tal:icon tal:replace="structure python:icons.tag('check-square', tag_alt='Toggle to show')" /><span class="ms-2" i18n:translate="">enabled</span>
</button>
</form>

</span>
</div>

<div class="visualClear"><!-- --></div>
<div id="rules_table_form"
metal:define-macro="rules_table_form">
<table class="listing nosort controlpanel-listing table mb-0"
tal:condition="rules">
<thead class="">
<tr>
<th scope="col" i18n:translate="label_contentrules_rule_listing">Content rule</th>
<th scope="col" i18n:translate="label_contentrules_rule_event">Event</th>
<th scope="col" i18n:translate="label_contentrules_rule_status"><span class="ps-2">Status</span></th>
<th scope="col" i18n:translate="label_contentrules_rule_actions">Actions</th>
</tr>
</thead>
<tbody>
<tal:rules repeat="rule view/registeredRules">
<tr tal:define="oddrow repeat/rule/odd"
tal:attributes="class python:(oddrow and 'even ' or 'odd ') + rule['row_class'];">
<td>
<h5 class="rule-title">
<span
class="badge bg-warning text-dark icon-contentrule-enabled-unassigned"
alt="unassigned"
title="this rule has not been assigned"
tal:condition="python:not rule['assigned']"
i18n:attributes="alt label_contentrules_rule_unassigned;
title title_contentrule_rule_unassigned;">
<tal:icon tal:replace="structure python:icons.tag('exclamation-triangle-fill', tag_alt='not assigned')" /><span class="ms-2" i18n:translate="">not assigned</span>
</span>



</td>
<td>
<form style="display: inline" method="POST"
tal:attributes="action string:${context/absolute_url}/@@rules-controlpanel">
<span tal:replace="structure context/@@authenticator/authenticator"/>
<input type="hidden"
name="rule-id"
tal:attributes="value rule/id">
<a href="" class="btn btn-sm btn-primary"
tal:attributes="href string:${context/absolute_url}/++rule++${rule/id}/@@manage-elements">Configure</a>
<a href="" class="btn btn-sm btn-secondary"
tal:attributes="href string:${context/absolute_url}/++rule++${rule/id}/@@edit">Edit</a>

<button class="destructive btn-rule-action btn-rule-delete btn btn-sm btn-danger" type="submit" value="Delete"
tal:attributes="data-value rule/id;
data-url string:$portal_url/@@contentrule-delete"
name="form.button.DeleteRule"
i18n:translate=""
i18n:attributes="value label_delete;">Delete</button>
</form>
</td>
</tr>
</tal:rules>
</tbody>
</table>
</div>
</fieldset>
</div>
tal:replace="rule/title">Rule Title</span>
</h5>
<div tal:content="rule/description">
Rule Description.
</div>
</td>
<td>
<span class="trigger"
tal:content="rule/trigger"
i18n:translate="">trigger</span>
</td>
<td class="status">

<form style="display: inline" method="POST"
tal:attributes="action string:${context/absolute_url}/@@rules-controlpanel">
<span tal:replace="structure context/@@authenticator/authenticator"/>
<input type="hidden"
name="rule-id"
tal:attributes="value rule/id">
<button class="context btn-rule-action btn-rule-enable btn btn-sm btn-link ${python: rule['enabled'] and 'd-none'}" type="submit" value="Enable"
name="form.button.EnableRule"
tal:attributes="data-value rule/id;
data-url string:$portal_url/@@contentrule-enable"
i18n:translate=""
i18n:attributes="value label_enable;">
<tal:icon tal:replace="structure python:icons.tag('square', tag_alt='Toggle to show')" /><span class="ms-2" i18n:translate="">enabled</span>
</button>
<button class="standalone btn-rule-action btn-rule-disable btn btn-sm btn-link ${python: not rule['enabled'] and 'd-none'}" type="submit" value="Disable"
name="form.button.DisableRule"
tal:attributes="data-value rule/id;
data-url string:$portal_url/@@contentrule-disable"
i18n:translate=""
i18n:attributes="value label_disable;">
<tal:icon tal:replace="structure python:icons.tag('check-square', tag_alt='Toggle to show')" /><span class="ms-2" i18n:translate="">enabled</span>
</button>
</form>

<span
class="badge bg-warning text-dark icon-contentrule-enabled-unassigned"
alt="unassigned"
title="this rule has not been assigned"
tal:condition="python:not rule['assigned']"
i18n:attributes="alt label_contentrules_rule_unassigned;
title title_contentrule_rule_unassigned;">
<tal:icon tal:replace="structure python:icons.tag('exclamation-triangle-fill', tag_alt='not assigned')" /><span class="ms-2" i18n:translate="">not assigned</span>
</span>



</td>
<td>
<form style="display: inline" method="POST"
tal:attributes="action string:${context/absolute_url}/@@rules-controlpanel">
<span tal:replace="structure context/@@authenticator/authenticator"/>
<input type="hidden"
name="rule-id"
tal:attributes="value rule/id">
<a href="" class="btn btn-sm btn-primary"
tal:attributes="href string:${context/absolute_url}/++rule++${rule/id}/@@manage-elements">Configure</a>
<a href="" class="btn btn-sm btn-secondary"
tal:attributes="href string:${context/absolute_url}/++rule++${rule/id}/@@edit">Edit</a>

<button class="destructive btn-rule-action btn-rule-delete btn btn-sm btn-danger" type="submit" value="Delete"
tal:attributes="data-value rule/id;
data-url string:$portal_url/@@contentrule-delete"
name="form.button.DeleteRule"
i18n:translate=""
i18n:attributes="value label_delete;">Delete</button>
</form>
</td>
</tr>
</tal:rules>
</tbody>
</table>
</div>
</fieldset>
</div>
<div class="mt-3">
<a id="#addcontentrule" tal:attributes="href string:${context/absolute_url}/+rule/plone.ContentRule;"
class="plone-btn plone-btn-primary btn btn-success"
i18n:translate="label_contentrule_add">Add content rule</a>
class="plone-btn plone-btn-primary btn btn-success"
i18n:translate="label_contentrule_add">Add content rule</a>
</div>
</div>
</metal:main>
</body>
Expand Down
Loading

0 comments on commit b6339bc

Please sign in to comment.