8
0
Fork 0
mirror of https://gitlab.federez.net/re2o/re2o synced 2024-06-30 11:04:38 +00:00

Merge branch 'fix_frontend' into 'dev'

Fix frontend

See merge request federez/re2o!244
This commit is contained in:
chirac 2018-08-12 18:40:18 +02:00
commit a55a6b3052
12 changed files with 91 additions and 62 deletions

View file

@ -35,7 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>{% trans "Cotisation type" %}</th>
<th>{% trans "Duration (month)" %}</th>
<th>{% trans "Concerned users" %}</th>
<th>{% trans "Available for everyone" | tick %}</th>
<th>{% trans "Available for everyone" %}</th>
<th></th>
</tr>
</thead>
@ -46,7 +46,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ article.type_cotisation }}</td>
<td>{{ article.duration }}</td>
<td>{{ article.type_user }}</td>
<td>{{ article.available_for_everyone }}</td>
<td>{{ article.available_for_everyone|tick }}</td>
<td class="text-right">
{% can_edit article %}
<a class="btn btn-primary btn-sm" role="button" title="{% trans "Edit" %}" href="{% url 'cotisations:edit-article' article.id %}">

View file

@ -26,7 +26,7 @@ from __future__ import unicode_literals
import datetime
from django.contrib import messages
from django.http import HttpRequest
from preferences.models import GeneralOption, OptionalMachine
from django.utils.translation import get_language
@ -40,7 +40,10 @@ def context_user(request):
else:
global_message = GeneralOption.get_cached_value('general_message_en')
if global_message:
messages.warning(request, global_message)
if isinstance(request, HttpRequest):
messages.warning(request, global_message)
else:
messages.warning(request._request, global_message)
if user.is_authenticated():
interfaces = user.user_interfaces()
else:

View file

@ -27,5 +27,7 @@ CONTRIBUTORS = [
'Hugo "Shaka" Hervieux',
'"Mikachu"',
'Thomas "Nymous" Gaudin',
'"Esum"'
'Benjamin "Esum" Graillot',
'Gabriel "Boudy" Le Bouder',
'Charlie "Le membre" Jacomme',
]

View file

@ -41,7 +41,7 @@ class Command(BaseCommand):
self.stdout.write(self.style.SUCCESS("Exportation Sucessfull"))
with open("re2o/contributors.py", "w") as contrib_file:
contrib_file.write("\"\"\"re2o.contributors\n")
contrib_file.write("A list of the proud contributors to Re2o\n")
contrib_file.write("A list of the contributors to Re2o\n")
contrib_file.write("\"\"\"\n")
contrib_file.write("\n")
contrib_file.write("CONTRIBUTORS = " + str(contributeurs))

View file

@ -179,7 +179,7 @@ STATIC_URL = '/static/'
# Directory where the media files served by the server are stored
MEDIA_ROOT = os.path.join(BASE_DIR, 'media').replace('\\', '/')
# The URL to access the static files
MEDIA_URL = '/media/'
MEDIA_URL = os.path.join(BASE_DIR,'/media/')
# Models to use for graphs
GRAPH_MODELS = {

View file

@ -42,9 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
so it can be setup in "a few steps". This tool is entirely free and
available under a GNU Public License v2 (GPLv2) license on
<a href="https://gitlab.federez.net/federez/re2o/">FedeRez gitlab</a>.<br />
Re2o's mainteners are proud volunteers mainly from French engineering
schools (but not limited to) who have given a lot of their time to make
this project possible. So please be kind with them.<br />
Re2o's mainteners are volunteers mainly from French schools. <br />
If you want to get involved in the development process, we will be glad to
welcome you so do not hesitate to contact us and come help us build the
future of Re2o.

View file

@ -146,7 +146,7 @@ def get_callback(tag_name, obj=None):
if tag_name == 'can_view_app':
return acl_fct(
lambda x: (
not any(not sys.modules[o].can_view(x) for o in obj),
not any(not sys.modules[o].can_view(x)[0] for o in obj),
None
),
False
@ -154,7 +154,7 @@ def get_callback(tag_name, obj=None):
if tag_name == 'cannot_view_app':
return acl_fct(
lambda x: (
not any(not sys.modules[o].can_view(x) for o in obj),
not any(not sys.modules[o].can_view(x)[0] for o in obj),
None
),
True
@ -171,12 +171,12 @@ def get_callback(tag_name, obj=None):
)
if tag_name == 'can_view_any_app':
return acl_fct(
lambda x: (any(sys.modules[o].can_view(x) for o in obj), None),
lambda x: (any(sys.modules[o].can_view(x)[0] for o in obj), None),
False
)
if tag_name == 'cannot_view_any_app':
return acl_fct(
lambda x: (any(sys.modules[o].can_view(x) for o in obj), None),
lambda x: (any(sys.modules[o].can_view(x)[0] for o in obj), None),
True
)

View file

@ -70,7 +70,6 @@ def index(request):
}, 're2o/index.html', request)
@cache_page(7 * 24 * 60 * 60)
def about_page(request):
""" The view for the about page.
Fetch some info about the configuration of the project. If it can't
@ -108,7 +107,6 @@ def about_page(request):
}
)
def contact_page(request):
"""The view for the contact page
Send all the objects MailContact

View file

@ -33,6 +33,7 @@ from django.contrib.auth.decorators import login_required
from django.db.models import Q
from users.models import User, Adherent, Club, Ban, Whitelist
from machines.models import Machine
from cotisations.models import Cotisation
from topologie.models import Port, Switch, Room
from cotisations.models import Facture
from preferences.models import GeneralOption
@ -44,6 +45,7 @@ from search.forms import (
initial_choices
)
from re2o.utils import SortTable
from re2o.acl import can_view_all
def is_int(variable):
@ -405,6 +407,7 @@ def get_results(query, request, params):
@login_required
@can_view_all(User, Machine, Cotisation)
def search(request):
""" La page de recherche standard """
search_form = SearchForm(request.GET or None)
@ -422,6 +425,7 @@ def search(request):
@login_required
@can_view_all(User, Machine, Cotisation)
def searchp(request):
""" La page de recherche avancée """
search_form = SearchFormPlus(request.GET or None)

View file

@ -129,3 +129,21 @@ td.long_text{
th.long_text{
width: 60%;
}
/* change color of panel heading on hover */
.panel > .profil:hover {
background-image: none;
background-color: #e6e6e6;
color: black;
}
/* add padding under title in profile */
.title-dashboard{
padding-bottom: 30px;
}
/* center the profil boxes */
.dashboard{
text-align: center;
}

View file

@ -76,15 +76,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
{% if request.user.is_authenticated %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user-circle"></i> {{request.user.pseudo|slice:":15"}} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{% url "users:mon-profil" %}"><i class="fa fa-user"></i> {% trans "My profile" %}</a></li>
<li><a id="toggle_login" href="{% url 'logout' %}"><i class="fa fa-sign-out-alt"></i> {% trans "Log out" %}</a></li>
</ul>
</li>
{% endif %}
{% can_view_any_app users machines cotisations %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-users"></i> {% trans "Members" %}<span class="caret"></span></a>
@ -115,15 +106,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_view_app logs %}
<li><a href="{% url "logs:index" %}"><i class="fa fa-chart-area"></i> {% trans "Statistics" %}</a></li>
{% acl_end %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% can_view_app preferences %}
<li>
<a href="{% url 'preferences:display-options' %}">
<i class="fa fa-cogs"></i> {% trans "Preferences" %}
<i class="fa fa-cogs"></i> {% trans "Administration" %}
</a>
</li>
{% acl_end %}
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fas fa-info"></i> {% trans "Info" %}<span class="caret"></span></a>
<ul class="dropdown-menu">
@ -132,29 +123,40 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</ul>
</li>
{% if not request.user.is_authenticated %}
{% if var_sa %}
<li>
<a href="{% url 'users:new-user' %}">
<i class="fa fa-user-plus"></i> {% trans "Sign in" %}
</a>
</li>
{% endif %}
<li>
<a id="toggle_login" href="{% url 'login' %}">
<i class="fa fa-sign-in-alt"></i> {% trans "Log in" %}
</a>
</li>
{% if var_sa %}
<li>
<a href="{% url 'users:new-user' %}">
<i class="fa fa-user-plus"></i> {% trans "Sign in" %}
</a>
</li>
{% endif %}
<li>
<a id="toggle_login" href="{% url 'login' %}">
<i class="fa fa-sign-in-alt"></i> {% trans "Log in" %}
</a>
</li>
{% else %}
<li>
<form action="{% url "search:search"%}" class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-term" {% if search_term %}value="{{ search_term }}"{% endif %}>
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
<a href="{% url "search:searchp" %}" class="btn btn-default" role="button"><i class="fa fa-plus"></i></a>
{% can_view_any_app users machines cotisations %}
<li>
<form action="{% url "search:search"%}" class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-term" {% if search_term %}value="{{ search_term }}"{% endif %}>
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
<a href="{% url "search:searchp" %}" class="btn btn-default" role="button"><i class="fa fa-plus"></i></a>
</div>
</div>
</div>
</form>
</form>
</li>
{% acl_end %}
{% endif %}
{% if request.user.is_authenticated %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user-circle"></i> {{request.user.pseudo|slice:":15"}} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{% url "users:mon-profil" %}"><i class="fa fa-user"></i> {% trans "My profile" %}</a></li>
<li><a id="toggle_login" href="{% url 'logout' %}"><i class="fa fa-sign-out-alt"></i> {% trans "Log out" %}</a></li>
</ul>
</li>
{% endif %}
<li>
@ -252,7 +254,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<footer class="navbar">
<div class="containerfluid text-center">
<p> <a href="\\{{request.get_host}}/about/">Re2o 2016-2018</a> - Gabriel Détraz, <a href="https://gitlab.rezometz.org/lhark">Goulven Kermarec</a>, Augustin Lemesle, Maël Kervella, Hugo Levy-Falk</p>
<p> <a href="\\{{request.get_host}}/about/">Re2o 2016-2018</a> </p>
</div>
</footer>
{# Read the documentation for more information #}

View file

@ -31,8 +31,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}Profil{% endblock %}
{% block content %}
<div align="center">
<h2>Welcome {{ users.name }} {{ users.surname }}</h2>
<div align="center" class="title-dashboard">
{% if user == users %}
<h2>Welcome {{ users.name }} {{ users.surname }}</h2>
{% else %}
<h2>Profil de {{ users.name }} {{ users.surname }}</h2>
{% endif %}
</div>
<div class="dashboard_container">
<div class="row">
@ -41,7 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="panel panel-danger">
<div class="panel-heading dashboard">Your account has been banned</div>
<div class="panel-body dashboard">
<i class="text-danger">End of the ban: {{ user.end_ban | date:"SHORT_DATE_FORMAT" }}</i>
<i class="text-danger">End of the ban: {{ users.end_ban | date:"SHORT_DATE_FORMAT" }}</i>
</div>
</div>
{% elif not users.is_adherent %}
@ -61,7 +65,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="panel panel-success">
<div class="panel-heading dashboard">Connected</div>
<div class="panel-body dashboard">
<i class="text-success">End of connexion: {{ user.end_adhesion | date:"SHORT_DATE_FORMAT"}}</i>
<i class="text-success">End of connexion: {{ users.end_adhesion | date:"SHORT_DATE_FORMAT"}}</i>
</div>
</div>
{% endif %}
@ -70,11 +74,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="col-sm-6 col-md-4">
<div class="panel panel-info">
<div class="panel-heading dashboard" data-parent="#accordion" data-toggle="collapse" data-target="#collapse4">
{{ user.solde }}
{{ users.solde }} <i class="fas fa-euro-sign"></i>
</div>
<div class="panel-body dashboard">
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:credit-solde' users.id %}">
<i class="fa fa-euro-sign"></i> Pay for the balance
<i class="fa fa-euro-sign"></i> Recharger
</a>
</div>
</div>
@ -110,7 +114,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse1">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse1">
<h3 class="panel-title pull-left" >
<i class="fa fa-user"></i> Informations détaillées
</h3>
@ -303,7 +307,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
{% endif %}
<div class="panel panel-default">
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse3">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse3">
<h3 class="panel-title pull-left">
<i class="fa fa-desktop"></i>
Machines
@ -327,7 +331,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse4">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse4">
<h3 class="panel-title pull-left">
<i class="fa fa-euro-sign"></i>
Cotisations
@ -358,7 +362,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse5">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse5">
<h3 class="panel-title pull-left">
<i class="fa fa-ban"></i>
Bannissements
@ -383,7 +387,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse6">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse6">
<h3 class="panel-title pull-left">
<i class="fa fa-check-circle"></i>
Accès à titre gracieux
@ -408,7 +412,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading clearfix" data-parent="#accordion" data-toggle="collapse" data-target="#collapse7">
<div class="panel-heading clearfix profil" data-parent="#accordion" data-toggle="collapse" data-target="#collapse7">
<h3 class="panel-title pull-left">
<i class="fa fa-envelope"></i> Email settings
</h3>