Merge pull request #3541 from Simounet/feature/nav-label-replaced-by-buttons

Nav actions updated
This commit is contained in:
Nicolas Lœuillet 2018-01-12 23:10:21 +01:00 committed by GitHub
commit fd637b9a5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 100 additions and 101 deletions

View file

@ -2,8 +2,7 @@
/* ==========================================================================
Nav
========================================================================== */
nav,
.nav-wrapper {
nav {
height: auto;
line-height: initial;
}
@ -18,14 +17,7 @@ nav {
}
}
.nav-wrapper {
display: flex;
padding: 0.6rem 0.4rem 0.6rem 0.75rem;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
.button-collapse {
.nav-panel-item .button-collapse {
margin-left: 0;
margin-right: 0.5rem;
padding: 0 0.5rem;
@ -33,10 +25,17 @@ nav {
line-height: 1;
background-color: transparent;
border: none;
}
}
nav .nav-wrapper i {
.nav-panel-item {
display: flex;
padding: 0.6rem 0.4rem 0.6rem 0.75rem;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
}
.nav-panel-item .material-icons {
height: 46px;
line-height: 46px;
}
@ -51,8 +50,8 @@ nav .nav-wrapper i {
justify-content: flex-end;
}
.nav-panel-add .add,
.nav-panel-search .search,
.nav-panel-item .add,
.nav-panel-item .search,
.nav-panels .close {
color: #444 !important;
}
@ -68,9 +67,7 @@ nav .nav-wrapper i {
.input-field input {
display: block;
line-height: inherit;
padding-left: 4rem !important;
width: calc(100% - 8rem);
height: 4.1rem;
height: 3rem;
}
.input-field input:focus {
@ -87,36 +84,45 @@ nav .nav-wrapper i {
}
.input-field {
&.nav-panel-add label,
&.nav-panel-search label {
&.nav-panel-item label {
left: 1rem;
}
&.nav-panel-add .close,
&.nav-panel-search .close {
position: absolute;
top: 0;
right: 1rem;
&.nav-panel-item .close {
color: transparent;
cursor: pointer;
font-size: 2rem;
transition: 0.3s color;
}
&.nav-panel-add,
&.nav-panel-add form,
&.nav-panel-search,
&.nav-panel-search form {
&.nav-panel-item {
display: flex;
flex: 1;
flex-wrap: nowrap;
align-items: center;
}
&.nav-panel-add form.disabled,
&.nav-panel-add form.disabled input {
&.nav-panel-add.disabled,
&.nav-panel-add.disabled input {
background-color: whitesmoke;
}
}
.nav-form-button {
padding: 0;
background-color: transparent;
border: none;
&:focus {
background-color: inherit;
}
}
.nav-form-button,
.nav-panel-item .close {
margin: 0 1%;
}
#button_filters {
display: none;
}

View file

@ -21,6 +21,7 @@ div.settings div.file-field {
nav .input-field input {
margin: 0;
padding-left: 0.5rem;
}
.tabs {

View file

@ -35,6 +35,13 @@ $(document).ready(() => {
initFilters();
initExport();
const toggleNav = (toShow, toFocus) => {
$('.nav-panel-actions').hide(100);
$(toShow).show(100);
$('.nav-panels').css('background', 'white');
$(toFocus).focus();
};
$('#nav-btn-add-tag').on('click', () => {
$('.nav-panel-add-tag').toggle(100);
$('.nav-panel-menu').addClass('hidden');
@ -42,34 +49,21 @@ $(document).ready(() => {
return false;
});
$('#nav-btn-add').on('click', () => {
$('.nav-panel-buttom').hide(100);
$('.nav-panel-add').show(100);
$('.nav-panels .action').hide(100);
$('.nav-panel-menu').addClass('hidden');
$('.nav-panels').css('background', 'white');
$('#entry_url').focus();
toggleNav('.nav-panel-add', '#entry_url');
return false;
});
const materialAddForm = $('.nav-panel-add form[name=entry]');
const materialAddForm = $('.nav-panel-add');
materialAddForm.on('submit', () => {
materialAddForm.addClass('disabled');
$('input#entry_url', materialAddForm).prop('readonly', true).trigger('blur');
});
$('#nav-btn-search').on('click', () => {
$('.nav-panel-buttom').hide(100);
$('.nav-panel-search').show(100);
$('.nav-panels .action').hide(100);
$('.nav-panel-menu').addClass('hidden');
$('.nav-panels').css('background', 'white');
$('#search_entry_term').focus();
toggleNav('.nav-panel-search', '#search_entry_term');
return false;
});
$('.close').on('click', () => {
$('.nav-panel-add').hide(100);
$('.nav-panel-search').hide(100);
$('.nav-panel-buttom').show(100);
$('.nav-panels .action').show(100);
$('.nav-panel-menu').removeClass('hidden');
$('.close').on('click', (e) => {
$(e.target).parent('.nav-panel-item').hide(100);
$('.nav-panel-actions').show(100);
$('.nav-panels').css('background', 'transparent');
return false;
});

View file

@ -9,7 +9,7 @@
<div class="determinate"></div>
</div>
<nav class="hide-on-large-only">
<div class="nav-wrapper cyan darken-1">
<div class="nav-panel-item cyan darken-1">
<ul>
<li>
<a href="#" data-activates="slide-out" class="button-collapse">

View file

@ -1,13 +1,15 @@
<form name="entry" method="post" action="{{ path('new_entry')}}">
<form class="input-field nav-panel-item nav-panel-add" style="display: none" name="entry" method="post" action="{{ path('new_entry')}}">
{% if form_errors(form) %}
<span class="black-text">{{ form_errors(form) }}</span>
{% endif %}
<button type="submit" class="nav-form-button"><i class="material-icons add">add</i></button>
{% if form_errors(form.url) %}
<span class="black-text">{{ form_errors(form.url) }}</span>
{% endif %}
{{ form_widget(form.url, { 'attr': {'autocomplete': 'off', 'placeholder': 'entry.new.placeholder'} }) }}
<i class="material-icons close">clear</i>
{{ form_rest(form) }}
</form>

View file

@ -1,7 +1,8 @@
<form name="search" method="GET" action="{{ path('search')}}">
<form class="input-field nav-panel-item nav-panel-search" style="display: none" name="search" method="GET" action="{{ path('search')}}">
{% if form_errors(form) %}
<span class="black-text">{{ form_errors(form) }}</span>
{% endif %}
<button type="submit" class="nav-form-button"><i class="material-icons search">search</i></button>
{% if form_errors(form.term) %}
<span class="black-text">{{ form_errors(form.term) }}</span>
@ -10,6 +11,7 @@
<input type="hidden" name="currentRoute" value="{{ currentRoute }}" />
{{ form_widget(form.term, { 'attr': {'autocomplete': 'off', 'placeholder': 'entry.search.placeholder'} }) }}
<i class="material-icons close">clear</i>
{{ form_rest(form) }}
</form>

View file

@ -93,7 +93,8 @@
<a class="waves-effect icon icon-power" href="{{ path('fos_user_security_logout') }}">{{ 'menu.left.logout'|trans }}</a>
</li>
</ul>
<div class="nav-wrapper nav-panels">
<div class="nav-panels">
<div class="nav-panel-actions nav-panel-item">
<div class="nav-panel-top">
<button data-activates="slide-out" class="nav-panel-menu button-collapse"><i class="material-icons">menu</i></button>
<h1 class="left action">
@ -123,16 +124,9 @@
</a>
</li>
</ul>
<div class="input-field nav-panel-search" style="display: none">
</div>
{{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': app.request.attributes.get('_route')})) }}
<label for="search"><i class="material-icons search">search</i></label>
<i class="material-icons close">clear</i>
</div>
<div class="input-field nav-panel-add" style="display: none">
{{ render(controller("WallabagCoreBundle:Entry:addEntryForm")) }}
<label for="add"><i class="material-icons add">add</i></label>
<i class="material-icons close">clear</i>
</div>
</div>
</nav>
{% endblock %}

View file

@ -17,7 +17,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
$crawler = $client->request('GET', '/developer/client/create');
$this->assertSame(200, $client->getResponse()->getStatusCode());
$form = $crawler->filter('button[type=submit]')->form();
$form = $crawler->filter('button[id=client_save]')->form();
$data = [
'client[name]' => 'My app',

View file

@ -476,7 +476,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertSame(200, $client->getResponse()->getStatusCode());
$form = $crawler->filter('button[type=submit]')->form();
$form = $crawler->filter('button[id=entry_save]')->form();
$data = [
'entry[title]' => 'My updated title hehe :)',
@ -509,7 +509,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertSame(200, $client->getResponse()->getStatusCode());
$form = $crawler->filter('button[type=submit]')->form();
$form = $crawler->filter('button[id=entry_save]')->form();
$data = [
'entry[title]' => 'My updated title hehe :)',

View file

@ -14,7 +14,7 @@ class PocketControllerTest extends WallabagCoreTestCase
$crawler = $client->request('GET', '/import/pocket');
$this->assertSame(200, $client->getResponse()->getStatusCode());
$this->assertSame(1, $crawler->filter('button[type=submit]')->count());
$this->assertSame(1, $crawler->filter('button[name=action]')->count());
}
public function testImportPocketWithRabbitEnabled()
@ -27,7 +27,7 @@ class PocketControllerTest extends WallabagCoreTestCase
$crawler = $client->request('GET', '/import/pocket');
$this->assertSame(200, $client->getResponse()->getStatusCode());
$this->assertSame(1, $crawler->filter('button[type=submit]')->count());
$this->assertSame(1, $crawler->filter('button[name=action]')->count());
$client->getContainer()->get('craue_config')->set('import_with_rabbitmq', 0);
}
@ -43,7 +43,7 @@ class PocketControllerTest extends WallabagCoreTestCase
$crawler = $client->request('GET', '/import/pocket');
$this->assertSame(200, $client->getResponse()->getStatusCode());
$this->assertSame(1, $crawler->filter('button[type=submit]')->count());
$this->assertSame(1, $crawler->filter('button[name=action]')->count());
$client->getContainer()->get('craue_config')->set('import_with_redis', 0);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long