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

templates: add semantic ui #207

Merged
merged 1 commit into from
Jun 22, 2020
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2015-2020 CERN.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}

{% macro render_field(field, icon="", placeholder='', autofocus=False) %}
<div class="field {% if field.errors %} error{% endif %}">
{%- set extras = dict(autofocus="") if autofocus else dict() %}
{{field(class_="form-control", placeholder=placeholder or _(field.label.text | string), **extras)}}
{%- if icon %}
<i class="{{icon}}" aria-hidden="true" ></i>
{%- endif%}
</div>
{% endmacro %}


{% macro form_errors(form) %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for @kprzerwa were you able how the errors are rendered?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't render form_errors because it is used only in the signup.html and to view that file I need to setup the Github authorization.

Copy link
Contributor

@kpsherva kpsherva May 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not super fast to do, clue how to solve in:
inveniosoftware/invenio-accounts#325

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created dedicate issue: #209

{%- if form.errors %}
<div class="ui negative message" role="alert">
{%- for field, errors in form.errors.items() %}
{%- for error in errors %}
<p>{{error}}</p>
{%- endfor %}
{%- endfor %}
</div>
{%- endif %}
{% endmacro %}


{% macro oauth_button(name, next=None) %}
<div class="field">
<a class="fluid ui basic button large"
href="{{url_for('invenio_oauthclient.login', remote_app=name, next=next or request.referrer)}}">
<i class="{{ name|lower() }} icon"></i> {{
_('Sign in with %(title)s', title=config.OAUTHCLIENT_REMOTE_APPS[name]['title'])
}}
</a>
</div>
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2015-2020 CERN.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
{%- block page_body %}{%- endblock page_body %}
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2015-2020 CERN.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}
{%- extends config.OAUTHCLIENT_BASE_TEMPLATE %}

{%- block page_body %}
{%- block panel %}{%- endblock panel %}
{%- endblock page_body %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2015-2020 CERN.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}
{%- extends config.OAUTHCLIENT_LOGIN_USER_TEMPLATE_PARENT %}

{%- from "invenio_oauthclient/_macros.html" import oauth_button %}


{%- block form_outer %}
{% if config.OAUTHCLIENT_REMOTE_APPS %}
<div class="ui form">
{% for name in config.OAUTHCLIENT_REMOTE_APPS.keys() %}
{{ oauth_button(name, next=request.args.get('next')) }}
{% endfor %}
</div>

<div class="ui horizontal divider">
Or
</div>
{% endif %}
{{ super () }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2015-2020 CERN.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}

{%- extends config.OAUTHCLIENT_COVER_TEMPLATE %}

{% block page_body %}
{{ _('Rejected'} }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2015-2018 CERN.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}
{%- extends "invenio_oauthclient/base.html" %}

{%- block page_body %}
{%- block settings_body %}{%- endblock settings_body %}
{%- endblock page_body %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2015-2018 CERN.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}

{%- extends config.OAUTHCLIENT_SETTINGS_TEMPLATE %}

{% from "invenio_oauthclient/_macros.html" import render_field, form_errors %}

{% set panel_title = _("Linked accounts") %}
{% set panel_icon = "linkify icon" %}

{% block settings_body %}
<div class="ui segment">
{% block oauth_body_text %}
<p>{{ _('Tired of entering password for %(sitename)s every time you sign in? Set up single sign-on with one or more of the services below:',
sitename=config.THEME_SITENAME) }}</p>
{% endblock oauth_body_text %}
</div>
<div class="ui celled list">
{%- for s in services %}
<div class="item">
<div class="ui basic segment">
{% block oauth_controls scoped %}
<div class="right floated content">
{%- if s.account -%}
<a href="{{url_for('invenio_oauthclient.disconnect', remote_app=s.appid)}}" class="ui compact basic button mini"><i class="times circle outline icon"></i> {{ _('Disconnect') }}</a>
{%- else -%}
<a href="{{url_for('invenio_oauthclient.login', remote_app=s.appid)}}" class="ui compact basic button mini"><i class="linkify icon"></i> {{ _('Connect') }}</a>
{%- endif -%}
</div>
{% endblock oauth_controls %}
<div>{% if s.icon %}<i class="{{s.icon}}"></i>{% endif %} {{s.title}} {% if s.account %}<i class="check icon green"></i>{% endif %}</div>
<small>{{s.description}}</small>

</div>
</div>
{%- endfor %}
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2015-2020 CERN.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}

{%- extends config.OAUTHCLIENT_SETTINGS_TEMPLATE %}

{% from "invenio_oauthclient/_macros.html" import render_field, form_errors %}

{% block page_body %}
<div class="ui centered grid">
<div class="row">
{%- block signup_panel %}
<div>
{%- block signup_header %}
<div class="ui center aligned header">
<div class="content">
{%- block signup_app_icon %}
{% if app_icon -%}
<i class="{{app_icon}}"></i>
{% endif %}
{%- endblock %}
{{ _('Sign-up with %(title)s!', title=app_title) }}
<div class="sub header">
{{ _('Fill in your details to complete your registration. You only have to do this once.') }}
</div>
</div>
<hr />
</div>
{% endblock %}
{%- block signup_form %}
<form name="edit" method="post" role="form">
{%- for field in form %}
{{ render_field(field) }}
{%- endfor %}
</form>
{%- endblock %}
</div>
{%- endblock %}
</div>
</div>
{% endblock %}