1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Implemented itemCount Support For Custom Tabs

Discussion in 'Closed Suggestions' started by digitalpoint, Mar 15, 2012.

  1. digitalpoint

    digitalpoint Well-Known Member

    A simple change to the navigation template would allow an optional item count to be used with custom tabs (it's optional so it would also maintain backward compatibility).

    In the navigation template, if this:
    Code:
    <a href="{$extraTab.href}" class="navLink">{$extraTab.title}</a>
    was changed to this:
    Code:
    <a href="{$extraTab.href}" class="navLink">{$extraTab.title}<xen:if is="{$extraTab.counter}"><strong class="itemCount"><span class="Total">{$extraTab.counter}</span><span class="arrow"></span></strong></xen:if></a>
    You could pass a "counter" parameter when building the custom tab and it would look something like so:
    [​IMG]
     
  2. Marcus

    Marcus Well-Known Member

    I think you can add that without template changes with jquery:

    Code:
    $("a:contains('{$extraTab.title}')").appends("{$extraTab.counterHTML}");
    Not as nice as doing it in HTML, that's for sure.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    If you add this feature then I would like to request that this function be changed to accept an array of forumids:

    XenForo_Model_Forum::getUnreadThreadCountInForum

    This would be useful for my Nodes As Tabs addon.
     
    Tracy Perry, erich37, Andy.N and 3 others like this.
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Accompanying this feature should be an API to serve AJAX updates to the count like what is done for alerts and PMs.
     
    Andy.N likes this.
  5. digitalpoint

    digitalpoint Well-Known Member

    While that would be nice, it adds a lot more complexity to things since now you are mucking with the xenforo.js JavaScript, and trying to attach values every time an AJAX request is made. In theory you could do it already now (mostly) by appending the values to any AJAX output, and then have the xenforo.js be a little more generic... like it could look for ajaxData._tabCounter_[DOM ID of tab], parse the DOM ID and fire XenForo.balloonCounterUpdate() against that tab ID with that value.
     
    Andy.N, Adam Howard and Jake Bunce like this.
  6. Mike

    Mike XenForo Developer Staff Member

    I've done the core change requested here - the subsequent changes should be resuggested if they're still applicable.
     
    Andy.N, Jake Bunce, Marcus and 2 others like this.
  7. Shelley

    Shelley Well-Known Member

    Awesome. Just so I got this correct Mike, The ability is now there for add-on creators to implement their own alerts on the custom Tab of their add-ons? Say, if they wanted to have an alert on the resource manager tab?
     
    0xym0r0n and Digital Doctor like this.
  8. Mike

    Mike XenForo Developer Staff Member

    Correct.
     
    0xym0r0n, kkm323 and Shelley like this.
  9. Chris D

    Chris D XenForo Developer Staff Member

    Yeah, this one would be a good one, please, Mike:
     
    Alien likes this.
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  11. Digital Doctor

    Digital Doctor Well-Known Member

    It would be nice to get alerts for New Resources in the RM ... would help drive activity as well :)
     
    erich37 likes this.
  12. digitalpoint

    digitalpoint Well-Known Member

    Don't you already get full-blown alerts for anything you watch under the Alerts menu?
     
  13. Shelley

    Shelley Well-Known Member

    I don't think there's an option currently where say a new resource was posted and an alert pops up. I guess we would if we watched the resource in question which I think DD was referring to and someone posted in it or an update was made. Not 100% though with the latter since i don't think i watch any resources.
     
  14. Dan

    Dan Well-Known Member

    I wouldn't say that this is implemented.

    At least it's not working for me.

    1. it's only visible if there's a linkTemplate
    Code:
    <xen:if is="{$extraTab.linksTemplate}">
    <li class="navTab {$extraTabId} {xen:if $extraTab.selected, 'selected', 'Popup PopupControl PopupClosed'}">
     
    <a href="{$extraTab.href}" class="navLink">{$extraTab.title}<xen:if is="{$extraTab.counter}"><strong class="itemCount"><span class="Total">{$extraTab.counter}</span><span class="arrow"></span></strong></xen:if></a>
    <a href="{$extraTab.href}" class="SplitCtrl" rel="Menu"></a>
     
    <div class="{xen:if {$extraTab.selected}, 'tabLinks', 'Menu JsOnly tabMenu'} {$extraTabId}TabLinks">
    <div class="primaryContent menuHeader">
    <h3>{$extraTab.title}</h3>
    <div class="muted">{xen:phrase quick_links}</div>
    </div>
    {xen:raw $extraTab.linksTemplate}
    </div>
    </li>
    <xen:else />
    <li class="navTab {$extraTabId} {xen:if $extraTab.selected, 'selected', 'PopupClosed'}">
    <a href="{$extraTab.href}" class="navLink">{$extraTab.title}</a>
    <xen:if is="{$extraTab.selected}"><div class="tabLinks"></div></xen:if>
    </li>
    </xen:if>
    2. if the tab is selected, the itemCount element is misplaced.
     

    Attached Files:

    • b.png
      b.png
      File size:
      11 KB
      Views:
      20
  15. Andrej

    Andrej Well-Known Member

    Report as bug :) ?
     
  16. Mike

    Mike XenForo Developer Staff Member

    Part 2 of his report has already been fixed. The first bit can be reported as a bug though.
     
  17. erich37

    erich37 Well-Known Member

    super suggestion (y)

    Alerts for Resources would be a valuable addition.....
     
    Shelley likes this.
  18. Shelley

    Shelley Well-Known Member

    Been watching this thread since day1 and eagerly awaiting for the ability to have alerts to be shown in the rm. Still "More waiting is required" unfortunately. And I agree.
     
    erich37 likes this.
  19. Shelley

    Shelley Well-Known Member

    Here's a thread you might be interested in and keep an eye out on since chances are a developer will sooner or later (once item count support is fixed and released) will post with something we can use in the way of an add-on eventually being made. Personally I'd prefer it built into the core but chances are we will see an add-on made before that. :) http://xenforo.com/community/threads/item-count-support-for-rm.48303/

    edit: it's well worth getting a discussion/brainstorming thread started (which is why i created it) before so developers know what people are looking for.
     
    erich37 likes this.
  20. erich37

    erich37 Well-Known Member

    Thanks!
    IMHO, this feature should be in the core...... no need to mess around with buggy Addons :cool:
     
    Shelley likes this.

Share This Page