Renamed view_mode by list_mode and hide excerpt

This commit is contained in:
Nicolas Lœuillet 2016-11-28 12:08:51 +01:00
parent 56a7ce17f3
commit 9aa991281d
No known key found for this signature in database
GPG key ID: BDC1EFB5CA0145F2
10 changed files with 43 additions and 32 deletions

View file

@ -8,7 +8,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Added view_mode in user config. * Added list_mode in user config.
*/ */
class Version20161128084725 extends AbstractMigration implements ContainerAwareInterface class Version20161128084725 extends AbstractMigration implements ContainerAwareInterface
{ {
@ -33,9 +33,9 @@ class Version20161128084725 extends AbstractMigration implements ContainerAwareI
public function up(Schema $schema) public function up(Schema $schema)
{ {
$configTable = $schema->getTable($this->getTable('config')); $configTable = $schema->getTable($this->getTable('config'));
$this->skipIf($configTable->hasColumn('view_mode'), 'It seems that you already played this migration.'); $this->skipIf($configTable->hasColumn('list_mode'), 'It seems that you already played this migration.');
$configTable->addColumn('view_mode', 'integer'); $configTable->addColumn('list_mode', 'integer');
} }
/** /**
@ -44,6 +44,6 @@ class Version20161128084725 extends AbstractMigration implements ContainerAwareI
public function down(Schema $schema) public function down(Schema $schema)
{ {
$configTable = $schema->getTable($this->getTable('config')); $configTable = $schema->getTable($this->getTable('config'));
$configTable->dropColumn('view_mode'); $configTable->dropColumn('list_mode');
} }
} }

View file

@ -617,6 +617,10 @@ div.pagination ul .current {
background-color: #ccc; background-color: #ccc;
} }
.hide {
display: none;
}
/* ========================================================================== /* ==========================================================================
2.1 = "save a link" related styles 2.1 = "save a link" related styles
========================================================================== */ ========================================================================== */
@ -1203,10 +1207,6 @@ pre code {
} }
@media screen and (max-width: 500px) { @media screen and (max-width: 500px) {
.hide {
display: none;
}
.entry { .entry {
width: 100%; width: 100%;
margin-left: 0; margin-left: 0;

View file

@ -555,6 +555,14 @@ a.original {
margin-right: 5px !important; margin-right: 5px !important;
} }
.card-stacked:hover ul.tools-list {
display: block;
}
.card-stacked ul.tools-list {
display: none;
}
.card .card-action a { .card .card-action a {
color: #fff; color: #fff;
margin: 0; margin: 0;
@ -600,7 +608,6 @@ a.original {
background-position: 50%; background-position: 50%;
} }
/* ========================================================================== /* ==========================================================================
5 = Article 5 = Article
========================================================================== */ ========================================================================== */

View file

@ -376,7 +376,7 @@ class ConfigController extends Controller
public function changeViewModeAction(Request $request) public function changeViewModeAction(Request $request)
{ {
$user = $this->getUser(); $user = $this->getUser();
$user->getConfig()->setViewMode(!$user->getConfig()->getViewMode()); $user->getConfig()->setListMode(!$user->getConfig()->getListMode());
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($user); $em->persist($user);

View file

@ -100,9 +100,9 @@ class Config
/** /**
* @var int * @var int
* *
* @ORM\Column(name="view_mode", type="integer", nullable=true) * @ORM\Column(name="list_mode", type="integer", nullable=true)
*/ */
private $viewMode; private $listMode;
/** /**
* @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config") * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
@ -349,19 +349,19 @@ class Config
/** /**
* @return int * @return int
*/ */
public function getViewMode() public function getListMode()
{ {
return $this->viewMode; return $this->listMode;
} }
/** /**
* @param int $viewMode * @param int $listMode
* *
* @return Config * @return Config
*/ */
public function setViewMode($viewMode) public function setListMode($listMode)
{ {
$this->viewMode = $viewMode; $this->listMode = $listMode;
return $this; return $this;
} }

View file

@ -13,11 +13,11 @@
{% block content %} {% block content %}
{% set viewMode = app.user.config.viewMode %} {% set listMode = app.user.config.listMode %}
<div class="results"> <div class="results">
<div class="nb-results">{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}</div> <div class="nb-results">{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}</div>
<div class="pagination"> <div class="pagination">
<a href="{{ path('switch_view_mode') }}"><i class="viewmode-btn material-icons md-36">{% if viewMode == 0 %}list{% else %}view_module{% endif %}</i></a> <a href="{{ path('switch_view_mode') }}"><i class="listMode-btn material-icons md-36">{% if listMode == 0 %}list{% else %}view_module{% endif %}</i></a>
<i class="btn-clickable download-btn material-icons md-36">file_download</i> <i class="btn-clickable download-btn material-icons md-36">file_download</i>
<i class="btn-clickable filter-btn material-icons md-36">filter_list</i> <i class="btn-clickable filter-btn material-icons md-36">filter_list</i>
{% if entries.getNbPages > 1 %} {% if entries.getNbPages > 1 %}
@ -27,7 +27,7 @@
</div> </div>
{% for entry in entries %} {% for entry in entries %}
<div id="entry-{{ entry.id|e }}" class="{% if viewMode == 0 %}entry{% else %}listmode entry{% endif %}"> <div id="entry-{{ entry.id|e }}" class="{% if listMode == 0 %}entry{% else %}listmode entry{% endif %}">
<h2><a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title|raw }}">{{ entry.title|raw }}</a></h2> <h2><a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title|raw }}">{{ entry.title|raw }}</a></h2>
{% set readingTime = entry.readingTime / app.user.config.readingSpeed %} {% set readingTime = entry.readingTime / app.user.config.readingSpeed %}
@ -52,13 +52,13 @@
<li><a title="{{ 'entry.list.delete'|trans }}" class="tool delete icon-trash icon" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{{ 'entry.list.delete'|trans }}</span></a></li> <li><a title="{{ 'entry.list.delete'|trans }}" class="tool delete icon-trash icon" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{{ 'entry.list.delete'|trans }}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.list.original_article'|trans }} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.domainName|removeWww }}</span></a></li> <li><a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.list.original_article'|trans }} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.domainName|removeWww }}</span></a></li>
</ul> </ul>
{% if (entry.previewPicture is null or viewMode == 1) %} {% if (entry.previewPicture is null or listMode == 1) %}
<ul class="card-entry-tags"> <ul class="card-entry-tags">
{% for tag in entry.tags %} {% for tag in entry.tags %}
<li><a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a></li> <li><a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
<p {% if viewMode == 1 %}class="hide"{% endif %}>{{ entry.content|striptags|slice(0, 300) }}&hellip;</p> <p {% if listMode == 1 %}class="hide"{% endif %}>{{ entry.content|striptags|slice(0, 300) }}&hellip;</p>
{% else %} {% else %}
<ul class="card-entry-labels"> <ul class="card-entry-labels">
{% for tag in entry.tags | slice(0, 3) %} {% for tag in entry.tags | slice(0, 3) %}

View file

@ -3,12 +3,16 @@
<div class="card-content"> <div class="card-content">
<span class="card-title dot-ellipsis dot-resize-update"> <span class="card-title dot-ellipsis dot-resize-update">
<a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | raw | striptags }}"> <a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title | raw | striptags }}">
{{ entry.title| striptags | truncate(120, true, '…') | raw }} {{ entry.title| striptags | truncate(120, true, '…') | raw }}
</a> </a>
</span> </span>
<p class="hide-on-med-and-down">{{ entry.content|striptags|slice(0, 500)|raw }}&hellip;</p> <ul class="tools-list right">
<li>
<a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}redo{% endif %}</i></a>
<a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a>
<a title="{{ 'entry.list.delete'|trans }}" class="tool grey-text delete" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons">delete</i></a>
</li>
</ul>
</div> </div>
{% include "@WallabagCore/themes/material/Entry/_card_actions.html.twig" with {'entry': entry} only %}
</div> </div>
</div> </div>

View file

@ -12,11 +12,11 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% set viewMode = app.user.config.viewMode %} {% set listMode = app.user.config.listMode %}
<div class="results clearfix"> <div class="results clearfix">
<div class="nb-results left"> <div class="nb-results left">
{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }} {{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}
<a href="{{ path('switch_view_mode') }}"><i class="material-icons">{% if viewMode == 0 %}view_list{% else %}view_module{% endif %}</i></a> <a href="{{ path('switch_view_mode') }}"><i class="material-icons">{% if listMode == 0 %}view_list{% else %}view_module{% endif %}</i></a>
</div> </div>
{% if entries.getNbPages > 1 %} {% if entries.getNbPages > 1 %}
{{ pagerfanta(entries, 'twitter_bootstrap_translated', {'proximity': 1}) }} {{ pagerfanta(entries, 'twitter_bootstrap_translated', {'proximity': 1}) }}
@ -26,8 +26,8 @@
<br /> <br />
<ul class="row data"> <ul class="row data">
{% for entry in entries %} {% for entry in entries %}
<li id="entry-{{ entry.id|e }}" class="col {% if viewMode == 0 %}l3 m6{% endif %} s12"> <li id="entry-{{ entry.id|e }}" class="col {% if listMode == 0 %}l3 m6{% endif %} s12">
{% if viewMode == 1 %} {% if listMode == 1 %}
{% include "@WallabagCore/themes/material/Entry/_card_list.html.twig" with {'entry': entry} only %} {% include "@WallabagCore/themes/material/Entry/_card_list.html.twig" with {'entry': entry} only %}
{% elseif entry.previewPicture is null %} {% elseif entry.previewPicture is null %}
{% include "@WallabagCore/themes/material/Entry/_card_no_preview.html.twig" with {'entry': entry} only %} {% include "@WallabagCore/themes/material/Entry/_card_no_preview.html.twig" with {'entry': entry} only %}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long