Skip to content

Commit

Permalink
Merge pull request FreshRSS#1773 from kevinpapst/fix-css-classes
Browse files Browse the repository at this point in the history
Fix css classes for reading modes FreshRSS#1714 FreshRSS#1758
  • Loading branch information
aledeg committed Jan 26, 2018
2 parents ec4346a + 3582d3f commit e1749b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
24 changes: 18 additions & 6 deletions app/Models/ReadingMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
*/
class FreshRSS_ReadingMode {

/**
* @var string
*/
protected $id;
/**
* @var string
*/
Expand All @@ -24,18 +28,26 @@ class FreshRSS_ReadingMode {

/**
* ReadingMode constructor.
* @param string $name
* @param string $id
* @param string $title
* @param string[] $urlParams
* @param bool $active
*/
public function __construct($name, $title, $urlParams, $active) {
$this->name = $name;
public function __construct($id, $title, $urlParams, $active) {
$this->id = $id;
$this->name = _i($id);
$this->title = $title;
$this->urlParams = $urlParams;
$this->isActive = $active;
}

/**
* @return string
*/
public function getId() {
return $this->id;
}

/**
* @return string
*/
Expand Down Expand Up @@ -112,19 +124,19 @@ public static function getReadingModes() {

$readingModes = array(
new FreshRSS_ReadingMode(
_i("view-normal"),
"view-normal",
_t('index.menu.normal_view'),
array_merge($urlOutput, array('c' => $defaultCtrl, 'a' => 'normal')),
($isDefaultCtrl && $actualView === 'normal')
),
new FreshRSS_ReadingMode(
_i("view-global"),
"view-global",
_t('index.menu.global_view'),
array_merge($urlOutput, array('c' => $defaultCtrl, 'a' => 'global')),
($isDefaultCtrl && $actualView === 'global')
),
new FreshRSS_ReadingMode(
_i("view-reader"),
"view-reader",
_t('index.menu.reader_view'),
array_merge($urlOutput, array('c' => $defaultCtrl, 'a' => 'reader')),
($isDefaultCtrl && $actualView === 'reader')
Expand Down
2 changes: 1 addition & 1 deletion app/layout/nav_menu.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
/** @var FreshRSS_ReadingMode $mode */
foreach ($readingModes as $mode) {
?>
<a class="view_normal btn <?php if ($mode->isActive()) { echo 'active'; } ?>" title="<?php echo $mode->getTitle(); ?>" href="<?php echo Minz_Url::display($mode->getUrlParams()); ?>">
<a class="<?php echo $mode->getId(); ?> btn <?php if ($mode->isActive()) { echo 'active'; } ?>" title="<?php echo $mode->getTitle(); ?>" href="<?php echo Minz_Url::display($mode->getUrlParams()); ?>">
<?php echo $mode->getName(); ?>
</a>
<?php
Expand Down

0 comments on commit e1749b8

Please sign in to comment.