Skip to content

Custom Board Stats Widget

Moved Let's Build It
28 4 10.1k 1
  • wrote on last edited by phenomlab
    #1

    I had someone mention to me yesterday that they liked the footer widget present on the Categories page, which looks like the below

    86490b64-c376-4d65-bb58-7ab6974b3531-image.png

    This isn’t custom code at all, but in fact the “Board Stats” widget which is added when nodebb-widget-board-stats is installed. However, there were various elements I didn’t like - particularly, the layout, which by default (on here) would have looked like this

    8afe3e4a-3d0b-4600-94ee-2f49fc9755e1-image.png

    There’s nothing “wrong” with it (apart from the fact that the calculations seem a little off with actual users vs guests - not a show stopper for me), but I didn’t want some elements to be displayed, and so I used the below CSS to hide them, and then modify the alignment so it looks like the first image

    .widget-board-stats {
        display: flex;
        flex-direction: row-reverse;
        justify-content: space-around;
    }
    .widget-board-stats h3 {
        display: none;
    }
    

    This basically hides anything in that widget that uses h3 as the header, and then arranges the widget itself so that flex-direction and justify-content are included which lines up everything nicely.

    If you’d like the widget to look like a card, you can set that in the widget itself by adding the below code into the widget container

    <div class="card"><h5 class="card-header">{{title}}</h5><div class="card-body">{{body}}</div></div>
    

    Effectively, the below.

    72cd64c2-cd44-4195-8906-438d9126ee45-image.png

    Or, you can drag the card element into the container area like the below, and drop it

    fabebce6-0b44-4ad9-9160-023103dc0aa5-image.png

    Enjoy.

  • phenomlab phenomlab moved this topic from Code Respository on
  • wrote on last edited by
    #2

    @phenomlab , thanks for the explanation. it looks great!
    a quite traditional stats box, just like how it has been in old forums 🙂

  • phenomlab phenomlab referenced this topic on
  • wrote on last edited by
    #3

    @phenomlab how can i add board statics?

  • @phenomlab how can i add board statics?

    wrote on last edited by
    #4

    @cagatay once you’ve installed the plugin, you’ll need to add it as a widget.

  • wrote on last edited by
    #5

    i can not find this plugin in plugins search

    image.png

  • i can not find this plugin in plugins search

    image.png

    wrote on last edited by
    #6

    @cagatay install it via CLI

  • wrote on last edited by
    #7
    This post is deleted!
  • wrote on last edited by
    #8

    Mark hi i istalled and added the stats but in english language. How can i change it in turkish one?

  • Mark hi i istalled and added the stats but in english language. How can i change it in turkish one?

    wrote on last edited by
    #9

    @cagatay that’s a question for the NodeBB devs I think. You could perhaps use the nodebb-plugin-customize to do the translations.

    Not sure if they exist in Transiflex either, so you may need to add these manually.

  • Mark hi i istalled and added the stats but in english language. How can i change it in turkish one?

    wrote on last edited by
    #10

    @cagatay if you can share the github page of the plugin, I can send Turkish translation as “pull request” …

  • @cagatay if you can share the github page of the plugin, I can send Turkish translation as “pull request” …

    wrote on last edited by
    #11

    @crazycells that would be very useful

  • wrote on last edited by
    #12
  • wrote on last edited by
    #13

    I asked @barisusakli to add multi-language support to this plugin… I will send an update after him…

    As an alternative (but more laborious) method, you can fork the plugin to your github profile and change the translation here on this page:

    https://github.com/psychobunny/nodebb-widget-board-stats/blob/master/public/templates/widgets/board-stats.tpl

    and then, install the plugin from your github page to the forum instead of the regular plugin…

  • wrote on last edited by
    #14

    if i can found where is this plugin saved in my files of nodebb, i can edit byself but cant found in modules files or plugin files …

  • if i can found where is this plugin saved in my files of nodebb, i can edit byself but cant found in modules files or plugin files …

    wrote on last edited by
    #15

    @cagatay is it’s installed, it’ll be there. Sometimes they aren’t necessarily in the order you’d expect.

  • if i can found where is this plugin saved in my files of nodebb, i can edit byself but cant found in modules files or plugin files …

    wrote on last edited by
    #16

    @cagatay yes, that is also good idea, but I do not know if it stays overwritten all the time (does doing “plugin reset” reset the files? I do not know)

  • @cagatay yes, that is also good idea, but I do not know if it stays overwritten all the time (does doing “plugin reset” reset the files? I do not know)

    wrote on last edited by
    #17

    @crazycells it’ll be overwritten. My recommendation here in the absence of Transiflex would be to use the customize plugin

  • wrote on last edited by
    #18

    @phenomlab @barisusakli updated the plugin but with another name.
    so could you please update your edit code also on it?

    new plugin name;

     @nodebb/nodebb-widget-board-stats@2.0.0
    
  • @phenomlab @barisusakli updated the plugin but with another name.
    so could you please update your edit code also on it?

    new plugin name;

     @nodebb/nodebb-widget-board-stats@2.0.0
    
    wrote on last edited by
    #19

    @cagatay there’s no chages needed?

  • wrote on last edited by DownPW
    #20

    No just css maybe @phenomlab

    I have installed the plugin and ask modification to @barisusakli

    see here, here and [here](https://community.nodebb.org/post/97623

    With no bugs, i can use it, and even combined with the other plugin

    🙂


Related Topics