【问题标题】:Remove unwanted panels from SilverStripe Dashboard Module从 SilverStripe 仪表板模块中删除不需要的面板
【发布时间】:2016-02-04 12:53:21
【问题描述】:

我正在使用dashboard 模块,但不希望我的用户能够选择任何类型的面板。有没有办法在不删除整个班级的情况下从可用面板列表中删除“天气”或“谷歌分析”等面板?

【问题讨论】:

    标签: silverstripe


    【解决方案1】:

    不是真正的解决方案,更多的是一种解决方法。但它做了它应该做的。

      $("[data-create-url*='DashboardRSSFeedPanel'], [data-create-url*='DashboardGoogleAnalyticsPanel'], [data-create-url*='DashboardGridFieldPanel'], [data-create-url*='DashboardModelAdminPanel'], [data-create-url*='DashboardSectionEditorPanel'], [data-create-url*='DashboardWeatherPanel'], [data-create-url*='DashboardRecentEditsPanel']").entwine({
        onmatch: function() {
          $(this).remove();
          $('.available-panel').removeClass('even');
          $('.available-panel').removeClass('odd');
          $('.available-panel:even').addClass('odd');
          $('.available-panel:odd').addClass('even');
        }
      });
    

    【讨论】:

      【解决方案2】:

      仪表板模块具有recently been updated,允许通过 yml 配置文件(例如 mysite/_config/config.yml)启用和禁用面板。

      以下规则将禁用DashboardGoogleAnalyticsPanel

      DashboardGoogleAnalyticsPanel:
        enabled: false
      

      以下规则将禁用所有面板并启用CustomPanel

      DashboardPanel:
        enabled: false
      
      CustomPanel:
        enabled: true
      

      【讨论】:

      • 但用户应该只能添加特定的面板。我不需要全部关闭/开启;)
      • @csy_dot_io 我已经用更好的方法通过config.yml 文件更改了我的答案。如果您想尝试此方法,请确保将您的仪表板模块更新到最新版本。
      • 谢谢。我在github上遵循了这个过程。并且已经进行了更新
      猜你喜欢
      • 1970-01-01
      • 2018-03-14
      • 1970-01-01
      • 1970-01-01
      • 2020-02-19
      • 2021-03-09
      • 1970-01-01
      • 1970-01-01
      • 2013-03-09
      相关资源
      最近更新 更多