Skip to content

Commit

Permalink
Add pattern option hideCheckboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanteoh committed Jul 25, 2017
1 parent 564d41d commit 9695d57
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
6 changes: 6 additions & 0 deletions ide/app/editors/settings/views-settings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
</label>
<p class="help-block">Reverse the sort ordering</p>
</div>
<div class="checkbox">
<label>
<input #hideCheckboxes formControlName="form.controls.hideCheckboxes" type="checkbox" [checked]="data?.hide_checkboxes"> Hide checkboxes
</label>
<p class="help-block">The first column with checkboxes will not be displayed</p>
</div>
<div class="checkbox">
<label>
<input #staticRendering formControlName="form.controls.staticRendering" type="checkbox" [checked]="data?.static_rendering"> Static rendering
Expand Down
12 changes: 7 additions & 5 deletions src/Products/CMFPlomino/browser/static/js/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ require([
for(var i=0; i<data.rows.length; i++) {
var row = data.rows[i];
html += '<tr>';
html += '<td>' +
'<input type="checkbox" name="sdoc" value="' +
row[0] +
'" />' +
'</td>';
html += '<td>';
if (self.options.hideCheckboxes !== 'True') {
html += '<input type="checkbox" name="sdoc" value="' +
row[0] +
'" />';
}
html += '<td>';
html += '<td><a href="' +
self.options.source +
'/../document/' + row[0] +
Expand Down
9 changes: 5 additions & 4 deletions src/Products/CMFPlomino/browser/templates/openview.pt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@

<!-- TODO(ivanteoh): do we need 'hasReadPermission' in 2.x -->
<tal:view_parameters
define="plomino_view python:here;
hideCheckboxes python:False;">
define="hideCheckboxes context/hide_checkboxes|nothing;">

<form id="plomino-view" tal:attributes="name python:plomino_view.id"
<form id="plomino-view" tal:attributes="name python:context.id"
class="plominoviewform">

<h1 class="documentFirstHeading" tal:content="context/Title">Title</h1>
Expand All @@ -29,7 +28,9 @@
<table
tal:define="columns python:context.getColumns();"
tal:attributes="class python:(context.static_rendering and 'listing') or 'listing plomino-table';
data-pat-plominotable string:source:${context/absolute_url}/tojson;">
data-pat-plominotable
string:source:${context/absolute_url}/tojson;;
hideCheckboxes:${context/hide_checkboxes};">
<tr class="header-row">
<th></th>
<tal:headers tal:repeat="column columns">
Expand Down
8 changes: 8 additions & 0 deletions src/Products/CMFPlomino/contents/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ class IPlominoView(model.Schema):
default=False,
)

hide_checkboxes = schema.Bool(
title=_('CMFPlomino_label_hide_checkboxes',
default="Hide checkboxes"),
description=_('CMFPlomino_help_hide_checkboxes',
default='The first column with checkboxes will not be displayed'),
default=False,
)

static_rendering = schema.Bool(
title=_('CMFPlomino_label_static_rendering',
default="Static rendering"),
Expand Down

0 comments on commit 9695d57

Please sign in to comment.