• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Group plugin: Combining template files but javascript interactions don't work

Scheduled Pinned Locked Moved Plugin Development
11 Posts 4 Posters 4.1k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to agd1 on last edited by
    #2

    @agd1 It sounds like the necessary scripts aren't being loaded. Can you post the original group/details.tpl and category.tpl and then the combined file?

    1 Reply Last reply
    0
  • agd1A Offline
    agd1A Offline
    agd1 GNU/Linux
    wrote on last edited by agd1
    #3

    @PitaJ sorry it took me a second to get back to you. I threw the code in Github https://github.com/aggied/nodebb-plugin-groupthink.

    You'll see in the templates directory that there is a category.tpl. This is the combined version. These are the links to the originals from the Persona theme:

    https://github.com/NodeBB/nodebb-theme-persona/blob/master/templates/category.tpl
    https://github.com/NodeBB/nodebb-theme-persona/blob/master/templates/groups/details.tpl

    The plugin is working w/ NodeBB 0.9 & the Persona theme. Thanks for any input!

    1 Reply Last reply
    0
  • psychobunnyP Offline
    psychobunnyP Offline
    psychobunny
    wrote on last edited by psychobunny
    #4

    Did you change the route for this page, or is it still /groups/groupname?

    1 Reply Last reply
    0
  • agd1A Offline
    agd1A Offline
    agd1 GNU/Linux
    wrote on last edited by agd1
    #5

    @psychobunny need to update the Git repo, but in my sandbox where I was toying with this plugin I actually overwrote the groups/list.tpl so that when a group is selected it doesn't take the user to groups/:groupName but instead to to the url for the category associated with the group: category/:cid/groupName

    1 Reply Last reply
    0
  • agd1A Offline
    agd1A Offline
    agd1 GNU/Linux
    wrote on last edited by
    #6

    and to clarify the intent here a little bit: I'm very impressed with NodeBB, and I'd like to see a plugin that enables functionality not unlike Facebook groups.

    1 Reply Last reply
    0
  • psychobunnyP Offline
    psychobunnyP Offline
    psychobunny
    wrote on last edited by
    #7

    So that's the problem then, NodeBB automatically loads via requirejs the JS file for a certain route.

    Let's say you went to /group/groupname

    It would auto load public/src/forum/group.js

    (I'm on mobile now the routes are probably wrong, but hope you get what I mean)

    So to solve this, you would have to detect page load of your new route via the action:ajaxify.end route and load the groups.js file as well

    1 Reply Last reply
    0
  • agd1A Offline
    agd1A Offline
    agd1 GNU/Linux
    wrote on last edited by
    #8

    @psychobunny that was exactly the trick. I have updated the repo and everything seems to be working pretty well right now. Very pleased with how it is turning out!

    The only seeming major block left is a problem with privileges. If I remove the read privileges from non-group members, NodeBB prevents them from seeing the "frankensteined" category/group view. I merged both views, so the user seems the same thing at both /groups/:groupname and /category/:cid/:slug, and both are restricted from viewing if the read privilege isn't given to a user.

    My solution was to give the access but strip the topics out from the JSON response before sending to the client. One major problem -- they are still visible in the Recent and Popualr feeds. This tells me my solution is not really robust enough.

    Any thoughts from anyone on how to get around this? I need to be able to embed a category topic list inside the group view and still let non-group members view the group page to join (without of course seeing the topics until they are a member).

    Here's a screeenshot of the frankensteined view:

    0_1449354246354_Screen Shot 2015-12-05 at 5.23.31 PM.png

    1 Reply Last reply
    1
  • agd1A Offline
    agd1A Offline
    agd1 GNU/Linux
    wrote on last edited by agd1
    #9

    Thinking out loud here, perhaps a good lead on this would be to figure out what generates this error. The HTTP response to get this group comes back as 403 Forbidden, which means it must be coming from the category ACL.

    0_1449354423567_upload-785b73be-f8d0-49c2-8e5f-362c8f508ad8

    1 Reply Last reply
    0
  • agd1A Offline
    agd1A Offline
    agd1 GNU/Linux
    wrote on last edited by
    #10

    UPDATE

    I think I got most -- if not all -- of this figured out. I learned about NodeBB in the process -- very impressed with it!

    For posterity, take a look at the nodebb-plugin-groupthink plugin. The way I ended up solving this is rethinking the privilege setup from what I first did. Nobody has any privileges to a group's category except group members. If a user visits a group page at /groups/:groupname the group metadata is still passed to the client so the user can join the group, but the category is not retrieved. Due to some strange bug in the Persona theme (or in templates.js-- not sure) I couldn't wrap <!-- IMPORT partials/topics_list.tpl --> in <!-- IF group.isMember -->, but I solved this by rearranging some of the template html.

    The plugin seems to be working well. Users can now "Post to a group" similar to how they would on other social networks.

    1 Reply Last reply
    1
  • L Offline
    L Offline
    Leonardo Galani
    wrote on last edited by
    #11

    I did a try and i liked it 🙂

    It would be awesome if you could choose what category works that way and what category works on the standard forum way 🙂

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development