Procházet zdrojové kódy

fixed css classes for reading mode buttons #1714

Kevin Papst před 8 roky
rodič
revize
047fa17aeb
2 změnil soubory, kde provedl 19 přidání a 7 odebrání
  1. 18 6
      app/Models/ReadingMode.php
  2. 1 1
      app/layout/nav_menu.phtml

+ 18 - 6
app/Models/ReadingMode.php

@@ -5,6 +5,10 @@
  */
 class FreshRSS_ReadingMode {
 
+	/**
+	 * @var string
+	 */
+	protected $id;
 	/**
 	 * @var string
 	 */
@@ -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
 	 */
@@ -112,19 +124,19 @@ class FreshRSS_ReadingMode {
 
 		$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')

+ 1 - 1
app/layout/nav_menu.phtml

@@ -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