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

Fix worksheet transposed view #429

Merged
merged 3 commits into from
Nov 29, 2017
Merged
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 CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Changelog

**Fixed**

- #429 Fix worksheet switch to transposed layout raises an Error
- #420 Searches by term with custom indexes do not work in clients folder view
- #410 Unable to select or deselect columns to be displayed in lists
- #409 In Add Analyses view, analyses id are displayed instead of Analysis Request IDs
Expand Down
160 changes: 79 additions & 81 deletions bika/lims/browser/worksheet/templates/analyses_transposed.pt
Original file line number Diff line number Diff line change
@@ -1,95 +1,93 @@
<form name="bika_listing_form" method="post" action="workflow_action"
i18n:domain="bika"
tal:attributes="id view/bika_listing/form_id"
tal:define="
form_id view/bika_listing/form_id;
review_state_id python:request.get(form_id+'_review_state', 'default');
review_state python:[t for t in view.bika_listing.review_states
if t['id'] == review_state_id];
review_state python:review_state and review_state[0]
or view.bika_listing.review_states[0];
toggle_cols python:dict([(col, view.bika_listing.columns[col])
for col in view.bika_listing.columns.keys()
if col in review_state['columns']]);
sm python:modules['AccessControl'].getSecurityManager();
EditAnalyses python:sm.checkPermission('BIKA: Edit analyses', context);
ViewResults python:sm.checkPermission('BIKA: View Results', context);
tabindex view/tabindex;
user python:sm.getUser();
roles python:user.getRoles();
nr_cols python:len(review_state['columns']);
nr_cols python:view.bika_listing.show_select_column and nr_cols + 1 or nr_cols;
nr_cols python:view.bika_listing.show_sort_column and nr_cols + 1 or nr_cols;
nr_cols python:str(nr_cols);">
i18n:domain="bika"
tal:attributes="id view/bika_listing/form_id"
tal:define="form_id view/bika_listing/form_id;
review_state_id python:request.get(form_id+'_review_state', 'default');
review_state python:[t for t in view.bika_listing.review_states
if t['id'] == review_state_id];
review_state python:review_state and review_state[0]
or view.bika_listing.review_states[0];
toggle_cols python:dict([(col, view.bika_listing.columns[col])
for col in view.bika_listing.columns.keys()
if col in review_state['columns']]);
sm python:modules['AccessControl'].getSecurityManager();
EditAnalyses python:sm.checkPermission('BIKA: Edit analyses', context);
ViewResults python:sm.checkPermission('BIKA: View Results', context);
tabindex view/tabindex;
user python:sm.getUser();
roles python:user.getRoles();
nr_cols python:len(review_state['columns']);
nr_cols python:view.bika_listing.show_select_column and nr_cols + 1 or nr_cols;
nr_cols python:view.bika_listing.show_sort_column and nr_cols + 1 or nr_cols;
nr_cols python:str(nr_cols);">

<input tal:replace="structure context/@@authenticator/authenticator"/>
<input type="hidden" name="submitted" value="1"/>
<input type="hidden" name="form_id" tal:attributes="value form_id"/>
<input type="hidden" name="view_url" tal:attributes="value view/bika_listing/view_url"/>
<input type="hidden" name="portal_type" tal:attributes="value view/context/portal_type"/>
<input type="hidden" name="item_data" id="item_data"
tal:attributes="value python:hasattr(view.bika_listing, 'json_interim_fields') and
view.bika_listing.json_interim_fields or []"/>
<input tal:replace="structure context/@@authenticator/authenticator"/>
<input type="hidden" name="submitted" value="1"/>
<input type="hidden" name="form_id" tal:attributes="value form_id"/>
<input type="hidden" name="view_url" tal:attributes="value view/bika_listing/view_url"/>
<input type="hidden" name="portal_type" tal:attributes="value view/context/portal_type"/>
<input type="hidden" name="item_data" id="item_data"
tal:attributes="value python:hasattr(view.bika_listing, 'json_interim_fields') and
view.bika_listing.json_interim_fields or []"/>

<table
<table
tal:attributes="class python:'bika-listing-table bika-listing-table-transposed';
form_id form_id"
i18n:attributes="summary summary_content_listing;"
tal:define="rows python:[r for r in view.rows_headers if r.get('hidden', False) == False];"
summary="Content listing">

<tbody class="item-listing-tbody" tal:condition="view/items">
<tr tal:repeat="row rows">
<th><span tal:content="structure row/title"></span></th>
<tal:analysis repeat="position view/positions">
<tal:cell define="cellhtml python:view.render_row_cell(row, position)">
<td tal:condition="python:cellhtml"
tal:attributes="class python:'%s %s' % (view.current_item.get('table_row_class',''), view.current_item.get('state_class'));"
tal:content="structure cellhtml"></td>
<td tal:condition="python:not cellhtml" class="filled-cell"></td>
</tal:cell>
</tal:analysis>
</tr>
<tr tal:repeat="row rows">
<th><span tal:content="structure row/title"></span></th>
<tal:analysis repeat="position view/positions">
<tal:cell define="cellhtml python:view.render_row_cell(row, position)">
<td tal:condition="python:cellhtml"
tal:attributes="class python:'%s %s' % (view.current_item.get('table_row_class',''), view.current_item.get('state_class'));"
tal:content="structure cellhtml"></td>
<td tal:condition="python:not cellhtml" class="filled-cell"></td>
</tal:cell>
</tal:analysis>
</tr>
</tbody>
<tfoot>
<!-- Workflow actions -->
<tr>
<td class="noborder"
tal:attributes="colspan python:len(view.positions)"
tal:condition="python:view.bika_listing.show_workflow_action_buttons">
<tal:selected_uids repeat="item view/items">
<input type="hidden" name="uids:list"
tal:attributes="value item/uid">
</tal:selected_uids>
<table>
<tr class="noborder" tal:condition="python:len(rows) > 0">
<td class="workflow_actions">
<span class="workflow_action_buttons"
tal:define="actions view/get_workflow_actions;
exclude_actions python:['unassign',];
actions python:[a for a in actions if a.get('id','') not in exclude_actions];">
<span tal:omit-tag="python:True" tal:repeat="action actions"
tal:condition="view/bika_listing/show_workflow_action_buttons">
<input
type="hidden"
tal:attributes="name action/title;
value action/id;"/>
<input
class="context workflow_action_button action_button allowMultiSubmit"
type="submit"
name="workflow_action_button"
tal:attributes="
id python:action['id']+'_transition';
transition action/id;
value action/title;
url python:action.get('url', '');"/>
</span>
</span>
</td>
</tr>
</table>
</td>
</tr>
<!-- Workflow actions -->
<tr>
<td class="noborder"
tal:attributes="colspan nr_cols"
tal:condition="python:view.bika_listing.show_workflow_action_buttons">
<tal:selected_uids repeat="item view/items">
<input type="hidden" name="uids:list"
tal:attributes="value item/uid">
</tal:selected_uids>
<table>
<tr class="noborder" tal:condition="python:len(rows) > 0">
<td class="workflow_actions">
<span class="workflow_action_buttons"
tal:define="actions view/get_workflow_actions;
exclude_actions python:['unassign',];
actions python:[a for a in actions if a.get('id','') not in exclude_actions];">
<span tal:omit-tag="python:True" tal:repeat="action actions"
tal:condition="view/bika_listing/show_workflow_action_buttons">
<input
type="hidden"
tal:attributes="name action/title;
value action/id;"/>
<input
class="context workflow_action_button action_button allowMultiSubmit"
type="submit"
name="workflow_action_button"
tal:attributes="id python:action['id']+'_transition';
transition action/id;
value action/title;
url python:action.get('url', '');"/>
</span>
</span>
</td>
</tr>
</table>
</td>
</tr>
</tfoot>
</table>
</table>
</form>
2 changes: 1 addition & 1 deletion bika/lims/browser/worksheet/views/analyses_transposed.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ def get_workflow_actions(self):
actions = new_actions

# and these are removed
hidden_transitions = self.bika_listing.review_state['hide_transitions']
if 'hide_transitions' in self.bika_listing.review_state:
hidden_transitions = self.bika_listing.review_state['hide_transitions']
actions = [a for a in actions if a['id'] not in hidden_transitions]

# cheat: until workflow_action is abolished, all URLs defined in
Expand Down