Skip to content
Extraits de code Groupes Projets
Valider 62acfde1 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #5212 improved left menu stylesheet which works better with Morpheus now,...

refs #5212 improved left menu stylesheet which works better with Morpheus now, turned it into a plugin and made it configurable. not finished yet
parent cd2ec823
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -327,7 +327,7 @@ abstract class Settings implements StorageInterface ...@@ -327,7 +327,7 @@ abstract class Settings implements StorageInterface
private function checkHasEnoughPermission(Setting $setting) private function checkHasEnoughPermission(Setting $setting)
{ {
// When the request is a Tracker request, allow plugins to read/write settings // When the request is a Tracker request, allow plugins to read/write settings
if(SettingsServer::isTrackerApiRequest()) { if (SettingsServer::isTrackerApiRequest()) {
return; return;
} }
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
{% for attr, val in setting.uiControlAttributes %} {% for attr, val in setting.uiControlAttributes %}
{{ attr|e('html_attr') }}="{{ val|e('html_attr') }}" {{ attr|e('html_attr') }}="{{ val|e('html_attr') }}"
{% endfor %} {% endfor %}
{% if settingValue==key %} {% if settingValue is sameas(key) %}
checked="checked" checked="checked"
{% endif %} {% endif %}
type="radio" type="radio"
......
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\LeftMenu;
/**
* API for plugin LeftMenu
*
* @method static \Piwik\Plugins\LeftMenu\API getInstance()
*/
class API extends \Piwik\Plugin\API
{
/**
* Returns true if the left menu is enabled for the current user.
*
* @return bool
*/
public function isEnabled()
{
return true;
$settings = new Settings('LeftMenu');
$global = $settings->globalEnabled->getValue();
$user = $settings->userEnabled->getValue();
if (empty($user) || 'no' === $user) {
return false;
}
if ($user === 'default' && !$global) {
return false;
}
return true;
}
}
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\LeftMenu;
class LeftMenu extends \Piwik\Plugin
{
public function getListHooksRegistered()
{
return array(
'AssetManager.getStylesheetFiles' => array('function' => 'getStylesheetFiles', 'after' => true)
);
}
public function getStylesheetFiles(&$stylesheets)
{
if (API::getInstance()->isEnabled()) {
$stylesheets[] = "plugins/LeftMenu/stylesheets/theme.less";
}
}
}
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\LeftMenu;
use Piwik\Settings\SystemSetting;
use Piwik\Settings\UserSetting;
/**
* Defines Settings for LeftMenu.
*/
class Settings extends \Piwik\Plugin\Settings
{
/** @var SystemSetting */
public $globalEnabled;
/** @var UserSetting */
public $userEnabled;
protected function init()
{
$this->setIntroduction('The left menu plugin will move the reporting menu from the top to the left if enabled. This is especially useful for large screens.');
$this->createGlobalEnabledSetting();
$this->createUserEnabledSetting();
}
private function createGlobalEnabledSetting()
{
$this->globalEnabled = new SystemSetting('globalEnabled', 'Left menu enabled by default for all users');
$this->globalEnabled->type = static::TYPE_BOOL;
$this->globalEnabled->description = 'Defines the system default for all of your users.';
$this->globalEnabled->inlineHelp = 'Users are able to disable/enable the left menu independent of the system default';
$this->globalEnabled->defaultValue = true;
$this->addSetting($this->globalEnabled);
}
private function createUserEnabledSetting()
{
$this->userEnabled = new UserSetting('userEnabled', 'Enable left reporting menu');
$this->userEnabled->type = static::TYPE_STRING;
$this->userEnabled->uiControlType = static::CONTROL_RADIO;
$this->userEnabled->availableValues = array('default' => 'System Default', 'yes' => 'Yes', 'no' => 'No');
$this->userEnabled->inlineHelp = 'This will enable or disable the left menu only for you and not affect any other users. A Super User can change the default for all users.';
$this->addSetting($this->userEnabled);
}
}
{ {
"description": "Position the dashboard menu to the left.", "description": "Position the dashboard menu to the left.",
"theme": true, "theme": false
"stylesheet": "stylesheets/theme.less"
} }
\ No newline at end of file
...@@ -2,6 +2,19 @@ ...@@ -2,6 +2,19 @@
clear: left; clear: left;
} }
.top_controls {
clear: none;
}
#root .Menu--dashboard {
border-top: 0px !important;
}
.sites_selector_in_dashboard {
margin-top: 0px;
margin-left: 5px;
}
#content.home { #content.home {
padding-top: 15px; padding-top: 15px;
display:inline-block; display:inline-block;
...@@ -23,7 +36,7 @@ ...@@ -23,7 +36,7 @@
} }
.Menu--dashboard > .Menu-tabList { .Menu--dashboard > .Menu-tabList {
padding-left: 5px; margin-left: 5px !important;
margin-bottom: 0; margin-bottom: 0;
margin-top: 0.1em; margin-top: 0.1em;
border: 1px solid #ddd; border: 1px solid #ddd;
...@@ -64,11 +77,14 @@ ...@@ -64,11 +77,14 @@
padding: 5px 10px; padding: 5px 10px;
font-size: 18px; font-size: 18px;
line-height: 24px; line-height: 24px;
color: #7E7363;
text-decoration: none; text-decoration: none;
float: none; float: none;
} }
.Menu--dashboard > .Menu-tabList a {
height: auto !important;
}
.Menu--dashboard > .Menu-tabList li li { .Menu--dashboard > .Menu-tabList li li {
float: none; float: none;
text-align: left; text-align: left;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter