Skip to content

Commit

Permalink
interface: keep the viewcode in the urls
Browse files Browse the repository at this point in the history
The change of the user's data as well as the change of
the password has been transferred to the Angular user profile.

* Adds functionality for editing user data in angular.
* Adds functionality to change user password in angular.
* Closes rero#2000.
* Closes rero#2195.

Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Feb 14, 2022
1 parent a9e3be9 commit 507aefc
Show file tree
Hide file tree
Showing 15 changed files with 268 additions and 39 deletions.
51 changes: 48 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ redisbeat = "*"
jsonpickle = ">=1.4.1"
ciso8601 = "*"
# TODO: to be removed when the thumbnail will be refactored
invenio-userprofiles = {git = "https://github.com/rero/invenio-userprofiles.git", rev = "v1.2.1-rero1.0"}
invenio-userprofiles = {git = "https://github.com/rero/invenio-userprofiles.git", rev = "41d2b471cde1a93f660ba7bf0037ee3fb80b65fc"}

## Additionnal constraints on python modules
flask-wiki = {git = "https://github.com/rero/flask-wiki.git", tag = "v0.0.1"}
Expand Down
12 changes: 12 additions & 0 deletions rero_ils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,18 @@ def _(x):
#: proxies) removes these headers again before sending the response to the
#: client. Set to False, in case of doubt.
ACCOUNTS_USERINFO_HEADERS = False

#: User profile
RERO_PUBLIC_USERPROFILES_READONLY = False
RERO_PUBLIC_USERPROFILES_READONLY_FIELDS = [
'first_name',
'last_name',
'birth_date'
]

#: USER PROFILES
USERPROFILES_READ_ONLY = False;

# Disable User Profiles
USERPROFILES = True
USERPROFILES_COUNTRIES = get_profile_countries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h4 class="alert-heading">{{ _('Caution!') }}</h4>
<p class="mb-0">{{ _('A well detailed request is more likely to be satisfied') }}</p>
</div>

<form id="ill-public-form" action="{{ url_for('ill_requests.ill_request_form') }}" method="POST" class="form" role="form" novalidate>
<form id="ill-public-form" action="{{ url_for('ill_requests.ill_request_form', viewcode=viewcode) }}" method="POST" class="form" role="form" novalidate>
{{ form.hidden_tag() }}
{%- if form.csrf_token and form.csrf_token.errors %}
<div class="alert alert-danger" role="alert">
Expand Down
14 changes: 8 additions & 6 deletions rero_ils/modules/ill_requests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@
blueprint = Blueprint(
'ill_requests',
__name__,
url_prefix='/ill_requests',
url_prefix='/<string:viewcode>',
template_folder='templates',
static_folder='static',
)


@blueprint.route('/create/', methods=['GET', 'POST'])
@blueprint.route('/ill_requests/new', methods=['GET', 'POST'])
@check_user_is_authenticated(redirect_to='security.login')
@check_logged_as_patron
def ill_request_form():
def ill_request_form(viewcode):
"""Return professional view."""
form = ILLRequestForm(request.form)
# pickup locations selection are based on app context then the choices
Expand All @@ -58,7 +58,7 @@ def ill_request_form():
ill_request_data['pickup_location'])

# get the patron account of the same org of the location pid
def get_patron(location_pid):
def get_patron(loc_pid):
loc = Location.get_record_by_pid(loc_pid)
for ptrn in current_patrons:
if ptrn.organisation_pid == loc.organisation_pid:
Expand All @@ -73,6 +73,8 @@ def get_patron(location_pid):
_('The request has been transmitted to your library.'),
'success'
)
return redirect(url_for('patrons.profile', tab='ill_request'))
return redirect(url_for(
'patrons.profile', viewcode=viewcode, tab='ill_request'))

return render_template('rero_ils/ill_request_form.html', form=form)
return render_template('rero_ils/ill_request_form.html',
form=form, viewcode=viewcode)
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
{%- endblock css %}

{%- block body %}
<public-patron-profile language="{{ current_i18n.locale.language[:2] }}"></public-patron-profile>
<public-patron-profile language="{{ current_i18n.locale.language[:2] }}" viewcode="{{ viewcode }}"></public-patron-profile>
{%- endblock body %}

{%- block javascript %}
{{ super() }}
{{ node_assets('@rero/rero-ils-ui/dist/public-patron-profile', tags='defer') }}
{{ webpack['reroils_public.js']}}
{{ node_assets('@rero/rero-ils-ui/dist/public-patron-profile', patterns=['polyfills-es5*.js','main-es5*.js'], tags='nomodule defer') }}
{{ node_assets('@rero/rero-ils-ui/dist/public-patron-profile', patterns=['polyfills-es2015*.js','main-es2015*.js'], tags='type="module"') }}
{%- endblock javascript %}
Loading

0 comments on commit 507aefc

Please sign in to comment.