Skip to content
Snippets Groups Projects
Commit eac07336 authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Aligned user edit form with ckan 2.10 templates (removed api token generation...

Aligned user edit form with ckan 2.10 templates (removed api token generation and email notifications)
parent 044cd616
No related branches found
No related tags found
1 merge request!50Upgraded to CKAN 2.10
{% import 'macros/form.html' as form %} {% import 'macros/form.html' as form %}
{% block form %}
<form id="user-edit-form" class="dataset-form form-horizontal" method="post" action="{{ action }}"> <form id="user-edit-form" class="dataset-form form-horizontal" method="post" action="{{ action }}">
{{ h.csrf_input() }} {{ h.csrf_input() }}
{{ form.errors(error_summary) }} {{ form.errors(error_summary) }}
{% block core_fields %}
<fieldset> <fieldset>
<legend>{{ _('Change details') }}</legend> <legend>{{ _('Change details') }}</legend>
{{ form.input('name', label=_('Username'), id='field-username', value=data.name, error=errors.name, classes=['control-medium'], is_required=true) }} {{ form.input('name', label=_('Username'), id='field-username', value=data.name, error=errors.name, classes=['control-medium'], is_required=true) }}
...@@ -14,15 +16,44 @@ ...@@ -14,15 +16,44 @@
{{ form.markdown('about', label=_('About'), id='field-about', value=data.about, error=errors.about, placeholder=_('A little information about yourself')) }} {{ form.markdown('about', label=_('About'), id='field-about', value=data.about, error=errors.about, placeholder=_('A little information about yourself')) }}
{% if c.show_email_notifications %} </fieldset>
{% call form.checkbox('activity_streams_email_notifications', label=_('Subscribe to notification emails'), id='field-activity-streams-email-notifications', value=True, checked=c.userobj.activity_streams_email_notifications) %} {% endblock %}
{% set helper_text = _("You will receive notification emails from {site_title}, e.g. when you have new activities on your dashboard."|string) %}
{{ form.info(helper_text.format(site_title=g.site_title), classes=['info-help-tight']) }} {% block extra_fields %}
{% if g.userobj.sysadmin and data.state == 'deleted' %}
{% call form.checkbox('activate_user', label=_('Reactivate User'), id='activate_user', value=True, checked=false) %}
{% set helper_text = _('This account is deactivated, if you want to reactivate it, please click on checkbox.') %}
{{ form.info(helper_text, classes='info-help-tight') }}
{% endcall %} {% endcall %}
{% endif %} {% endif %}
{% endblock %}
{% if is_sysadmin and current_user.name != data.name %}
{% block sysadmin_password %}
<fieldset>
<legend>{{ _('Change ' + data.name|capitalize + "'s" + ' password') }}</legend>
{{ form.input('password1', type='password', label=_('Password'), id='field-password', value=data.password1, error=errors.password1, classes=['control-medium'], attrs={'autocomplete': 'off', 'class': 'form-control'} ) }}
{{ form.input('password2', type='password', label=_('Confirm Password'), id='field-password-confirm', value=data.password2, error=errors.password2, classes=['control-medium'], attrs={'autocomplete': 'off', 'class': 'form-control'}) }}
</fieldset> </fieldset>
{% endblock %}
{% block sysadmin_old_password %}
<fieldset>
<legend>{{ _('Sysadmin password') }}</legend>
{{ form.input('old_password',
type='password',
label=_('Sysadmin Password'),
id='field-password-old',
value=data.oldpassword,
error=errors.oldpassword,
classes=['control-medium'],
attrs={'autocomplete': 'off', 'class': 'form-control'}
) }}
</fieldset>
{% endblock %}
{% else %}
{% block change_password %}
<fieldset> <fieldset>
<legend>{{ _('Change password') }}</legend> <legend>{{ _('Change password') }}</legend>
{{ form.input('old_password', {{ form.input('old_password',
...@@ -40,22 +71,26 @@ ...@@ -40,22 +71,26 @@
{{ form.input('password2', type='password', label=_('Confirm Password'), id='field-password-confirm', value=data.password2, error=errors.password2, classes=['control-medium'], attrs={'autocomplete': 'off'}) }} {{ form.input('password2', type='password', label=_('Confirm Password'), id='field-password-confirm', value=data.password2, error=errors.password2, classes=['control-medium'], attrs={'autocomplete': 'off'}) }}
</fieldset> </fieldset>
{% endblock %}
{% endif %}
{{ form.required_message() }}
<div class="form-actions"> <div class="form-actions">
{% block form_actions %}
{% set is_deleted = data.state == 'deleted' %}
{% if not is_deleted %}
{% block delete_button %} {% block delete_button %}
{% if h.check_access('user_delete', {'id': data.id}) %} {% if h.check_access('user_delete', {'id': data.id}) %}
<a class="btn btn-danger pull-left" href="{% url_for 'user_delete', id=data.id %}" data-module="confirm-action" data-module-content="{{ _('Are you sure you want to delete this User?') }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a> <a class="btn btn-danger pull-left" href="{% url_for 'user_delete', id=data.id %}" data-module="confirm-action" data-module-content="{{ _('Are you sure you want to delete this User?') }}">{% block delete_button_text %}{{ _('Delete') }}{% endblock %}</a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block generate_button %}
{% if h.check_access('user_generate_apikey', {'id': data.id}) %}
<a class="btn btn-warning" href="{% url_for 'user_generate_apikey', id=data.id %}" data-module="confirm-action" data-module-content="{{ _('Are you sure you want to regenerate the API key?') }}">{% block generate_button_text %}{{ _('Regenerate API Key') }}{% endblock %}</a>
{% endif %} {% endif %}
<button class="btn btn-primary" type="submit" name="save">{{ _('Reactivate Profile') if is_deleted else _('Update Profile') }}</button>
{% endblock %} {% endblock %}
{{ form.required_message() }}
<button class="btn btn-primary" type="submit" name="save">{{ _('Update Profile') }}</button>
</div> </div>
</form> </form>
{% endblock %}
{% block scripts %} {% block scripts %}
{% asset 'ckanext-odsh/odsh_validate_password' %} {% asset 'ckanext-odsh/odsh_validate_password' %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment