Skip to content

Commit

Permalink
templates: add semantic ui
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantinaStoikou authored and zzacharo committed Jun 22, 2020
1 parent 42d2437 commit 252dc86
Show file tree
Hide file tree
Showing 8 changed files with 217 additions and 0 deletions.
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) %}
{%- 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 %}

0 comments on commit 252dc86

Please sign in to comment.