Ask for Suggestions: Add topic fields, visualize them



  • Hi guys,

    I took the question-and-answer plugin, modified slightly and now I can "search" for the topics that Admins set as "Official" (like "Questions").

    Now I would like to add these topic some fields (predefined), what I thought are these two ways:

    1. that on topic's post/save, a form would appear (in an emoji "chooser" way) and after filling it could definitely be saved.
    2. if the topic is "Official" in the topic tools a button is showed as "Set fields", and then same as above.

    Now my question are:

    • how can I make the form "appear" in the "emoji chooser way"?
    • In case I would like to do the first way, how can I "avoid" the post to be submitted before the form is filled?

    Also, which hook should I look for to add these field well displayed after the title in the topic view?

    Thanks a lot,
    Luigi



  • In the end I decided for the second way, I used bootstrap modal: creating one with jQuery from string after click in the "topic tool button".

    Now my only question is:

    which hook should I look to add these field well displayed after the title in the topic view?


  • Global Moderator

    @Giggiux Can you sketch out what exactly you mean with regard to the positioning of the data?

    which hook should I look to add these field well displayed after the title in the topic view?

    There are a lot of ways to do this. The way a lot of people do it is adding some kind of markup in the post body and parsing that into an HTML element inside filter:parse.post.



  • @PitaJ I think I found a way, I use client-side on 'action:ajaxify.end': components.get('topic').append(html) where html is the parsed (by jQuery) element I want to show.

    If there is a way to do that server side instead of client side, I would really appreciate if you let me know 😂

    And also I don't really get how can I understand what every hook method takes as parameters, when I click on one of them in the hooks list on GitHub, it just show me a line of code, and I don't get what that line means (for example in filters:parse.post goes where there is an if statement, what that means?)


Log in to reply
 


Star

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.