Improve usability specially for small screen

- add buttons class to fix alignments
- add responsive info to big tables
- use visibility instead of display to avoid jumping rows
- reorganize menu in responsive
This commit is contained in:
Brice Maron 2019-07-24 15:45:57 +02:00 committed by Alexis Metaireau
parent 773fbec5b2
commit 92ce7d4d48
5 changed files with 40 additions and 22 deletions

View file

@ -20,7 +20,9 @@ body {
.navbar .secondary-nav { .navbar .secondary-nav {
text-align: right; text-align: right;
flex-direction: row-reverse; flex-direction: row-reverse;
}
.secondary-nav .nav-link {
padding: .5rem 1rem;
} }
.navbar-brand{ font-family: 'Lobster', arial, serif; } .navbar-brand{ font-family: 'Lobster', arial, serif; }
@ -116,7 +118,7 @@ footer{
margin-top: 30px; margin-top: 30px;
position: fixed; position: fixed;
bottom: 0px; bottom: 0px;
height: 20px; height: 2em;
width: 100%; width: 100%;
text-align: center; text-align: center;
background-color: #fff; background-color: #fff;
@ -254,12 +256,12 @@ tr.payer_line .balance-name {
.balance.table .action, .balance.table .action,
.extra-info { .extra-info {
display: none; visibility: hidden;
} }
.balance.table tr:hover .action, .balance.table tr:hover .action,
tr:hover .extra-info { tr:hover .extra-info {
display: initial; visibility: visible;
} }
/* Fluid Offsets for Boostrap */ /* Fluid Offsets for Boostrap */

View file

@ -24,10 +24,10 @@
<div class="actions"> <div class="actions">
<button type="submit" class="btn btn-primary">{{ field.name }}</button> <button type="submit" class="btn btn-primary">{{ field.name }}</button>
{% if home %} {% if home %}
<a href="{{ url_for(".remind_password") }}">{{ _("Can't remember the password?") }}</a> <a href="{{ url_for(".remind_password") }}" class="btn btn-link">{{ _("Can't remember the password?") }}</a>
{% endif %} {% endif %}
{% if cancel %} {% if cancel %}
<button type="reset" class="btn">{{ _("Cancel") }}</button> <button type="reset" class="btn btn-light">{{ _("Cancel") }}</button>
{% endif %} {% endif %}
</div> </div>
{% endmacro %} {% endmacro %}
@ -110,7 +110,7 @@
</fieldset> </fieldset>
<div class="actions"> <div class="actions">
{{ form.submit(class="btn btn-primary") }} {{ form.submit(class="btn btn-primary") }}
{% if not edit %} {{ form.submit2(class="btn") }}{% endif %} {% if not edit %} {{ form.submit2(class="btn btn-light") }}{% endif %}
</div> </div>
{% endmacro %} {% endmacro %}
@ -121,7 +121,9 @@
<div class="input-group"> <div class="input-group">
<label class="sr-only" for="name">_("Type user name here")</label> <label class="sr-only" for="name">_("Type user name here")</label>
{{ form.name(placeholder=_("Type user name here"), class="form-control") }} {{ form.name(placeholder=_("Type user name here"), class="form-control") }}
<button class=" input-group-addon btn">{{ _("Add") }}</button> <div class="input-group-append">
<button class="btn btn-outline-secondary input-group-addon" type="submit">{{ _("Add") }}</button>
</div>
</div> </div>
{% endmacro %} {% endmacro %}

View file

@ -35,7 +35,7 @@
{{ forms.create_project(project_form, home=True) }} {{ forms.create_project(project_form, home=True) }}
</fieldset> </fieldset>
<div class="controls"> <div class="controls">
<button class="btn" type="submit">{{ _("let's get started") }}</button> <button class="btn btn-primary" type="submit">{{ _("let's get started") }}</button>
</div> </div>
</form> </form>
{% else %} {% else %}

View file

@ -31,21 +31,27 @@
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="navbarToggler">
<h1><a class="navbar-brand" href="{{ url_for("main.home") }}">#! money?</a></h1> <h1><a class="navbar-brand" href="{{ url_for("main.home") }}">#! money?</a></h1>
{% if g.project %}<strong class="d-block d-sm-none text-white">{{ g.project.name }}</strong>{% endif %}
<div class="collapse navbar-collapse" id="navbarToggler">
<ul class="navbar-nav ml-auto mr-auto"> <ul class="navbar-nav ml-auto mr-auto">
{% if g.project %} {% if g.project %}
<li class="nav-item">
</li>
{% block navbar %} {% block navbar %}
<li class="nav-item{% if current_view == 'list_bills' %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.list_bills") }}">{{ _("Bills") }}</a></li> <li class="nav-item{% if current_view == 'list_bills' %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.list_bills") }}">{{ _("Bills") }}</a></li>
<li class="nav-item{% if current_view == 'settle_bill' %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.settle_bill") }}">{{ _("Settle") }}</a></li> <li class="nav-item{% if current_view == 'settle_bill' %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.settle_bill") }}">{{ _("Settle") }}</a></li>
<li class="nav-item{% if current_view == 'statistics' %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.statistics") }}">{{ _("Statistics") }}</a></li> <li class="nav-item{% if current_view == 'statistics' %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.statistics") }}">{{ _("Statistics") }}</a></li>
{% endblock %} {% endblock %}
{% endif %} {% endif %}
</ul>
<ul class="navbar-nav secondary-nav">
{% if g.project %} {% if g.project %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><strong>{{ g.project.name }}</strong> {{ _("options") }} <b class="caret"></b></a> <a href="#" class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<strong class="d-none d-sm-inline">{{ g.project.name }}</strong> {{ _("options") }}
<b class="caret"></b>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> <ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="{{ url_for("main.edit_project") }}">{{ _("Project settings") }}</a></li> <li><a class="dropdown-item" href="{{ url_for("main.edit_project") }}">{{ _("Project settings") }}</a></li>
<li class="dropdown-divider"></li> <li class="dropdown-divider"></li>
@ -55,16 +61,21 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<li><a class="dropdown-item" href="{{ url_for("main.create_project") }}">{{ _("Start a new project") }}</a></li> <li><a class="dropdown-item" href="{{ url_for("main.create_project") }}">{{ _("Start a new project") }}</a></li>
{% if g.show_admin_dashboard_link %}
<li class="dropdown-divider"></li>
<li class="nav-item{% if request.url_rule.endpoint == "main.dashboard" %} active{% endif %}">
<a class="dropdown-item" href="{{ url_for("main.dashboard") }}">{{ _("Dashboard") }}</a>
</li>
{% endif %}
<li class="dropdown-divider"></li> <li class="dropdown-divider"></li>
<li><a class="dropdown-item" href="{{ url_for("main.exit") }}">{{ _("Logout") }}</a></li> <li><a class="dropdown-item" href="{{ url_for("main.exit") }}">{{ _("Logout") }}</a></li>
</ul> </ul>
</li> </li>
{% endif %} {% endif %}
</ul>
<ul class="navbar-nav secondary-nav">
<li class="nav-item{% if g.lang == "fr" %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.change_lang", lang="fr") }}">fr</a></li> <li class="nav-item{% if g.lang == "fr" %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.change_lang", lang="fr") }}">fr</a></li>
<li class="nav-item{% if g.lang == "en" %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.change_lang", lang="en") }}">en</a></li> <li class="nav-item{% if g.lang == "en" %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.change_lang", lang="en") }}">en</a></li>
{% if g.show_admin_dashboard_link %}
<li class="nav-item{% if request.url_rule.endpoint == "main.dashboard" %} active{% endif %}"><a class="nav-link" href="{{ url_for("main.dashboard") }}">{{ _("Dashboard") }}</a></li>
{% endif %}
</ul> </ul>
</div> </div>
</nav> </nav>
@ -86,7 +97,10 @@
{% block footer %} {% block footer %}
<footer> <footer>
<p><a href="https://github.com/spiral-project/ihatemoney">{{ _("This is a free software") }}</a>, {{ _("you can contribute and improve it!") }}</p> <p>
<a href="https://github.com/spiral-project/ihatemoney">{{ _("This is a free software") }}</a><span class="d-none d-sm-inline">,
{{ _("you can contribute and improve it!") }}</span>
</p>
</footer> </footer>
{% endblock %} {% endblock %}

View file

@ -79,7 +79,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="identifier"><a href="{{ url_for(".invite") }}">{{ _("Invite people to join this project!") }}</a></div> <div class="identifier"><a class="btn btn-link" href="{{ url_for(".invite") }}">{{ _("Invite people to join this project!") }}</a></div>
<a id="new-bill" href="{{ url_for(".add_bill") }}" class="btn btn-primary" data-toggle="modal" data-target="#bill-form">{{ _("Add a new bill") }}</a> <a id="new-bill" href="{{ url_for(".add_bill") }}" class="btn btn-primary" data-toggle="modal" data-target="#bill-form">{{ _("Add a new bill") }}</a>
<div id="bill-form" class="modal fade show" role="dialog"> <div id="bill-form" class="modal fade show" role="dialog">
@ -97,7 +97,7 @@
</div> </div>
{% if bills.count() > 0 %} {% if bills.count() > 0 %}
<table id="bill_table" class="col table table-striped table-hover"> <table id="bill_table" class="col table table-striped table-hover table-responsive-sm">
<thead><tr><th>{{ _("Added on") }}</th><th>{{ _("When?") }}</th><th>{{ _("Who paid?") }}</th><th>{{ _("For what?") }}</th><th>{{ _("For whom?") }}</th><th>{{ _("How much?") }}</th><th>{{ _("Actions") }}</th></tr></thead> <thead><tr><th>{{ _("Added on") }}</th><th>{{ _("When?") }}</th><th>{{ _("Who paid?") }}</th><th>{{ _("For what?") }}</th><th>{{ _("For whom?") }}</th><th>{{ _("How much?") }}</th><th>{{ _("Actions") }}</th></tr></thead>
<tbody> <tbody>
{% for bill in bills %} {% for bill in bills %}