Delete favorite button

I extract drop-down menu actions to make them as button action in the page header.
I removed the favorite button on the category list because it is a duplicate from the button action.
Now button action act as filters and you can combine them.

It is a test to see if we can keep it like that. There is still work to do to extract other actions from the drop-down list.
I did not want to change everything if we don't keep it.

See #376 and #277
This commit is contained in:
Alexis Degrugillier
2014-04-12 11:51:44 -04:00
parent 6a04683171
commit 3e665bcf9a
14 changed files with 113 additions and 91 deletions

View File

@@ -91,14 +91,11 @@ class FreshRSS_index_Controller extends Minz_ActionController {
$nb = Minz_Request::param ('nb', $this->view->conf->posts_per_page);
$first = Minz_Request::param ('next', '');
if ($state === 'not_read') { //Any unread article in this category at all?
if ($state === FreshRSS_Configuration::STATE_NOT_READ) { //Any unread article in this category at all?
switch ($getType) {
case 'a':
$hasUnread = $this->view->nb_not_read > 0;
break;
case 's':
$hasUnread = $this->view->nb_favorites['unread'] > 0;
break;
case 'c':
$hasUnread = (!isset($this->view->cat_aside[$getId])) || ($this->view->cat_aside[$getId]->nbNotRead() > 0);
break;
@@ -128,7 +125,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {
// Si on a récupéré aucun article "non lus"
// on essaye de récupérer tous les articles
if ($state === 'not_read' && empty($entries) && ($state_param === null)) {
if ($state === FreshRSS_Configuration::STATE_NOT_READ && empty($entries) && ($state_param === null)) {
Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG);
$this->view->state = 'all';
$entries = $entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min, true, $keepHistoryDefault);

View File

@@ -1,6 +1,11 @@
<?php
class FreshRSS_Configuration {
const STATE_READ = 1;
const STATE_NOT_READ = 2;
const STATE_FAVORITE = 4;
const STATE_NOT_FAVORITE = 8;
private $filename;
private $data = array(
@@ -13,7 +18,7 @@ class FreshRSS_Configuration {
'apiPasswordHash' => '', //CRYPT_BLOWFISH
'posts_per_page' => 20,
'view_mode' => 'normal',
'default_view' => 'not_read',
'default_view' => self::STATE_NOT_READ,
'auto_load_more' => true,
'display_posts' => false,
'onread_jump_next' => true,
@@ -131,7 +136,7 @@ class FreshRSS_Configuration {
}
}
public function _default_view ($value) {
$this->data['default_view'] = $value === 'all' ? 'all' : 'not_read';
$this->data['default_view'] = $value === 'all' ? 'all' : self::STATE_NOT_READ;
}
public function _display_posts ($value) {
$this->data['display_posts'] = ((bool)$value) && $value !== 'no';

View File

@@ -415,9 +415,6 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
$where .= 'f.priority > 0 ';
$joinFeed = true;
break;
case 's':
$where .= 'e1.is_favorite = 1 ';
break;
case 'c':
$where .= 'f.category = ? ';
$values[] = intval($id);
@@ -433,21 +430,28 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
default:
throw new FreshRSS_EntriesGetter_Exception ('Bad type in Entry->listByType: [' . $type . ']!');
}
switch ($state) {
case 'all':
break;
case 'not_read':
if ($state & FreshRSS_Configuration::STATE_NOT_READ) {
if (!($state & FreshRSS_Configuration::STATE_READ)) {
$where .= 'AND e1.is_read = 0 ';
break;
case 'read':
$where .= 'AND e1.is_read = 1 ';
break;
case 'favorite':
$where .= 'AND e1.is_favorite = 1 ';
break;
default:
throw new FreshRSS_EntriesGetter_Exception ('Bad state in Entry->listByType: [' . $state . ']!');
}
}
if ($state & FreshRSS_Configuration::STATE_READ) {
if (!($state & FreshRSS_Configuration::STATE_NOT_READ)) {
$where .= 'AND e1.is_read = 1 ';
}
}
if ($state & FreshRSS_Configuration::STATE_NOT_FAVORITE) {
if (!($state & FreshRSS_Configuration::STATE_FAVORITE)) {
$where .= 'AND e1.is_favorite = 0 ';
}
}
if ($state & FreshRSS_Configuration::STATE_FAVORITE) {
if (!($state & FreshRSS_Configuration::STATE_NOT_FAVORITE)) {
$where .= 'AND e1.is_favorite = 1 ';
}
}
switch ($order) {
case 'DESC':
case 'ASC':

View File

@@ -27,7 +27,6 @@ return array (
'subscription_management' => 'Subscriptions management',
'main_stream' => 'Main stream',
'all_feeds' => 'All feeds',
'favorite_feeds' => 'Favourites (%d)',
'not_read' => '%d unread',
'not_reads' => '%d unread',
@@ -51,7 +50,8 @@ return array (
'show_all_articles' => 'Show all articles',
'show_not_reads' => 'Show only unread',
'show_read' => 'Show only read',
'show_favorite' => 'Show favorites',
'show_favorite' => 'Show only favorites',
'show_not_favorite' => 'Show all but favorites',
'older_first' => 'Oldest first',
'newer_first' => 'Newer first',

View File

@@ -27,7 +27,6 @@ return array (
'subscription_management' => 'Gestion des abonnements',
'main_stream' => 'Flux principal',
'all_feeds' => 'Tous les flux',
'favorite_feeds' => 'Favoris (%d)',
'not_read' => '%d non lu',
'not_reads' => '%d non lus',
@@ -52,6 +51,7 @@ return array (
'show_not_reads' => 'Afficher les non lus',
'show_read' => 'Afficher les lus',
'show_favorite' => 'Afficher les favoris',
'show_not_favorite' => 'Afficher tout sauf les favoris',
'older_first' => 'Plus anciens en premier',
'newer_first' => 'Plus récents en premier',

View File

@@ -28,15 +28,6 @@
</div>
</li>
<li>
<div class="category favorites<?php echo $this->get_c == 's' ? ' active' : ''; ?>">
<a data-unread="<?php echo formatNumber($this->nb_favorites['unread']); ?>" class="btn<?php echo $this->get_c == 's' ? ' active' : ''; ?>" href="<?php $arUrl['params']['get'] = 's'; echo Minz_Url::display($arUrl); ?>">
<?php echo FreshRSS_Themes::icon('bookmark'); ?>
<?php echo Minz_Translate::t('favorite_feeds', formatNumber($this->nb_favorites['all'])); ?>
</a>
</div>
</li>
<?php
foreach ($this->cat_aside as $cat) {
$feeds = $cat->feeds ();

View File

@@ -11,6 +11,70 @@
<?php } ?>
<?php if ($this->loginOk) { ?>
<?php $url_state = $this->url;
if ($this->state & FreshRSS_Configuration::STATE_READ) {
$url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_READ;
$checked = 'true';
} else {
$url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_READ;
$checked = 'false';
}
?>
<a id="actualize"
class="btn"
aria-checked="<?php echo $checked; ?>"
href="<?php echo Minz_Url::display ($url_state); ?>"
title="<?php echo Minz_Translate::t ('show_read'); ?>">
<?php echo FreshRSS_Themes::icon('read'); ?>
</a>
<?php
if ($this->state & FreshRSS_Configuration::STATE_NOT_READ) {
$url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_NOT_READ;
$checked = 'true';
} else {
$url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_NOT_READ;
$checked = 'false';
}
?>
<a id="actualize"
class="btn"
aria-checked="<?php echo $checked; ?>"
href="<?php echo Minz_Url::display ($url_state); ?>"
title="<?php echo Minz_Translate::t ('show_not_reads'); ?>">
<?php echo FreshRSS_Themes::icon('unread'); ?>
</a>
<?php
if ($this->state & FreshRSS_Configuration::STATE_FAVORITE) {
$url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_FAVORITE;
$checked = 'true';
} else {
$url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_FAVORITE;
$checked = 'false';
}
?>
<a id="actualize"
class="btn"
aria-checked="<?php echo $checked; ?>"
href="<?php echo Minz_Url::display ($url_state); ?>"
title="<?php echo Minz_Translate::t ('show_favorite'); ?>">
<?php echo FreshRSS_Themes::icon('starred'); ?>
</a>
<?php
if ($this->state & FreshRSS_Configuration::STATE_NOT_FAVORITE) {
$url_state['params']['state'] = $this->state - FreshRSS_Configuration::STATE_NOT_FAVORITE;
$checked = 'true';
} else {
$url_state['params']['state'] = $this->state + FreshRSS_Configuration::STATE_NOT_FAVORITE;
$checked = 'false';
}
?>
<a id="actualize"
class="btn"
aria-checked="<?php echo $checked; ?>"
href="<?php echo Minz_Url::display ($url_state); ?>"
title="<?php echo Minz_Translate::t ('show_not_favorite'); ?>">
<?php echo FreshRSS_Themes::icon('non-starred'); ?>
</a>
<?php
$get = false;
$string_mark = Minz_Translate::t ('mark_all_read');
@@ -86,7 +150,7 @@
<ul class="dropdown-menu">
<li class="dropdown-close"><a href="#close"></a></li>
<li class="item"><a href="<?php echo $markReadUrl; ?>"><?php echo $string_mark; ?></a></li>
<li class="item"><a href="<?php echo $markReadUrl; ?>"><?php echo $string_mark; ?></a></li>
<li class="separator"></li>
<?php
$today = $this->today;
@@ -132,42 +196,6 @@
<li class="separator"></li>
<?php
$url_state = $this->url;
$url_state['params']['state'] = 'all';
?>
<li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'all') ? 'true' :'false'; ?>">
<a class="print_all" href="<?php echo Minz_Url::display ($url_state); ?>">
<?php echo Minz_Translate::t ('show_all_articles'); ?>
</a>
</li>
<?php
$url_state['params']['state'] = 'not_read';
?>
<li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'not_read') ? 'true' :'false'; ?>">
<a class="print_non_read" href="<?php echo Minz_Url::display ($url_state); ?>">
<?php echo Minz_Translate::t ('show_not_reads'); ?>
</a>
</li>
<?php
$url_state['params']['state'] = 'read';
?>
<li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'read') ? 'true' :'false'; ?>">
<a class="print_read" href="<?php echo Minz_Url::display ($url_state); ?>">
<?php echo Minz_Translate::t ('show_read'); ?>
</a>
</li>
<?php
$url_state['params']['state'] = 'favorite';
?>
<li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'favorite') ? 'true' :'false'; ?>">
<a class="print_favorite" href="<?php echo Minz_Url::display ($url_state); ?>">
<?php echo Minz_Translate::t ('show_favorite'); ?>
</a>
</li>
<li class="separator"></li>
<li class="item">
<?php
$url_order = $this->url;

View File

@@ -36,7 +36,7 @@
<?php echo Minz_Translate::t ('show_all_articles'); ?>
</label>
<label class="radio" for="radio_not_read">
<input type="radio" name="default_view" id="radio_not_read" value="not_read"<?php echo $this->conf->default_view === 'not_read' ? ' checked="checked"' : ''; ?> />
<input type="radio" name="default_view" id="radio_not_read" value="<?php echo FreshRSS_Configuration::STATE_NOT_READ; ?>"<?php echo $this->conf->default_view === FreshRSS_Configuration::STATE_NOT_READ ? ' checked="checked"' : ''; ?> />
<?php echo Minz_Translate::t ('show_not_reads'); ?>
</label>
</div>

View File

@@ -88,6 +88,11 @@
.nav_menu .search {
display:none;
}
.nav_menu .btn[aria-checked="true"]:before{
content: '✓';
font-size: 2.5rem;
position: absolute;
}
.favicon {
height: 16px;

View File

@@ -416,12 +416,6 @@ input, select, textarea {
background: #26303F;
color: #888;
}
.dropdown-menu > .item[aria-checked="true"] > a:before {
content: '✓ ';
font-weight: bold;
margin: 0 0 0 -1.2em;
padding: 0 0.2em 0 0;
}
.dropdown-menu > .item:hover > a {
color: #888;
text-decoration: none;

View File

@@ -87,6 +87,11 @@ body {
.nav_menu .search {
display:none;
}
.nav_menu .btn[aria-checked="true"]:before{
content: '✓';
font-size: 2.5rem;
position: absolute;
}
.favicon {
height: 16px;

View File

@@ -412,12 +412,6 @@ input, select, textarea {
background: #2980b9;
color: #fff;
}
.dropdown-menu > .item[aria-checked="true"] > a:before {
content: '✓ ';
font-weight: bold;
margin: 0 0 0 -1.2em;
padding: 0 0.2em 0 0;
}
.dropdown-menu > .item:hover > a {
color: #fff;
text-decoration: none;

View File

@@ -89,6 +89,11 @@
.nav_menu .search {
display:none;
}
.nav_menu .btn[aria-checked="true"]:before{
content: '✓';
font-size: 2.5rem;
position: absolute;
}
.favicon {
height: 16px;

View File

@@ -428,12 +428,6 @@ input, select, textarea {
background: #0062BE;
color: #fff;
}
.dropdown-menu > .item[aria-checked="true"] > a:before {
content: '✓ ';
font-weight: bold;
margin: 0 0 0 -1.2em;
padding: 0 0.2em 0 0;
}
.dropdown-menu > .item:hover > a {
color: #fff;
text-decoration: none;