dongyue934001 2018-02-14 14:19
浏览 67

concrete5 ccm_activateTabBar()未登录时未定义

I have a specific question, I did build a component with tabs in concrete5 v8 with this tutorial:

Creating tabbed panels in concrete5

It worked just fine, as long as I was logged in into concrete5, as soon as I am not logged in I get the following error in the console, and therefor I'm not able to click on the different tabs:

Uncaught ReferenceError: ccm_activateTabBar is not defined at HTMLDocument. (entsorgung-von-abfaellen:84) at j (jquery.js:2) at Object.fireWith [as resolveWith] (jquery.js:2) at Function.ready (jquery.js:2) at HTMLDocument.J (jquery.js:2)

The error references to this part of the line 84:

<script type="text/javascript">$(function() { ccm_activateTabBar($('#ccm-tabs-1077221103'));});</script>

which follows directly after the ul element and seems to got generated by concrete5.

I was not able to find anything related at all, I guess it has something to do with missing assets that are only loaded when logged in as administrator.

I'm currently only loading the following assets when not logged in:

$u = new User();
if(!$u->isLoggedIn()) {
  $this->requireAsset('javascript', 'jquery');
  $this->requireAsset('jquery/ui');
}

Maybe someone already worked with the concrete5 tabs and can help me with this error.

  • 写回答

1条回答 默认 最新

  • downloadTemp2014 2018-02-15 08:43
    关注

    Ass suggested by Michele Locati, you should probably use jquery/ui or bootstrap components to build you tab component.

    But if you find yourself in the same situation as I was, a very simple fix is to copy the tabs.js from

    concrete/js/build/core/app/tabs.js

    to your theme folder and include it if the user is not logged in.

    For example like this:

    <?php
    $u = new User();
    if(!$u->isLoggedIn()) : ?>
      <script src="<?php echo $view->getThemePath(); ?>/js/c5_tabs/tabs.js"></script>
    <?php endif; ?>
    

    The tabs.js is part of app.js which is quite big, so I only used tabs.js, which only contains the needed function I was missing.

    Credits for this information to MrKDilkington from the concrete5 forum:

    评论

报告相同问题?

悬赏问题

  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真
  • ¥15 任务A:大数据平台搭建(容器环境)怎么做呢?
  • ¥15 YOLOv8obb获取边框坐标时报错AttributeError: 'NoneType' object has no attribute 'xywhr'