Browse Source

order status not changable for normal users

php2python
Holger Frey 7 years ago
parent
commit
ed9d9c22e1
  1. 4
      ordr2/schemas/account.py
  2. 8
      ordr2/schemas/orders.py
  3. 11
      ordr2/static/css/style.css
  4. 2
      ordr2/templates/orders/list.jinja2

4
ordr2/schemas/account.py

@ -131,10 +131,6 @@ class SettingsSchema(CSRFSchema):
settings.update(override) settings.update(override)
form = super().as_form(request, **settings) form = super().as_form(request, **settings)
# disable the role field for user settings # disable the role field for user settings
form['general']['role'].widget = deform.widget.SelectWidget(
values=ROLES,
template='select_disabled.pt'
)
form['general']['role'].widget = deform.widget.TextInputWidget( form['general']['role'].widget = deform.widget.TextInputWidget(
template='textinput_disabled.pt' template='textinput_disabled.pt'
) )

8
ordr2/schemas/orders.py

@ -177,4 +177,10 @@ class EditOrderSchema(CSRFSchema):
'css_class': 'form-horizontal' 'css_class': 'form-horizontal'
} }
settings.update(override) settings.update(override)
return super().as_form(request, **settings) form = super().as_form(request, **settings)
if not 'role:purchaser' in request.user.role_principals:
form['order_information']['status'].widget = \
deform.widget.TextInputWidget(
template='textinput_disabled.pt'
)
return form

11
ordr2/static/css/style.css

@ -463,6 +463,17 @@ table .action.edit:hover {
background-position: -16px -52px; background-position: -16px -52px;
} }
table .action.eye {
background-position: -145px 0px;
}
table .action.eye:hover {
background-position: -145px -18px;
}
/*================================ MODALS ================================*/ /*================================ MODALS ================================*/
.modal form { .modal form {

2
ordr2/templates/orders/list.jinja2

@ -96,7 +96,7 @@
{% if request.has_permission('edit', order) %} {% if request.has_permission('edit', order) %}
<a href="{{ request.resource_url(order, 'edit') }}" class="action edit" title="Edit Order">edit</a> <a href="{{ request.resource_url(order, 'edit') }}" class="action edit" title="Edit Order">edit</a>
{% else %} {% else %}
<a href="{{ request.resource_url(order) }}" class="action edit" title="Edit Order">edit</a> <a href="{{ request.resource_url(order) }}" class="action eye" title="View Order">edit</a>
{% endif %} {% endif %}
{% if request.has_permission('delete', order) %} {% if request.has_permission('delete', order) %}
<a href="{{ request.resource_url(order, 'delete') }}" class="action delete" title="Delete Order">delete</a> <a href="{{ request.resource_url(order, 'delete') }}" class="action delete" title="Delete Order">delete</a>