Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

2 questions (Table Layout & limiting to specific categories)

This discussion is related to the IndexDiscussionImage addon.
pitkmipitkmi New
edited December 6 in Vanilla 2.3 Help

Running 2.3.1 in WAMP at the moment.

Two quick questions about he Addon:

1. How would I go about making this work in Table Layout?

The images show up where I want them (Left side, next to the topics) when I set the Discussion view to Modern Layout and tweak the CSS a little bit, but switching to Table Layout dumps them all to the top of the index.

Modern:

Table:

2. Is it possible to limit the addon to specific categories?

I'm trying to make an art forum, so having a thumbnail for all art threads is lovely, but I don't necessarily need one for threads in, say, Support or General Discussion. Is there an easy way to limit to specific categories (say, Work in Progress and Gallery)?

I'm running Bootstrap as theme most of the time, but the behavior in Q1 happens in baseline and other themes as well. The only changes I've made are making it work with BBCode and some CSS tweaks:

.IndexImage img {
         height: 120px!important;
         width: 240px!important;
         float: left!important;
         padding-right:30px;!important;
         object-fit: cover;

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    I need a link to see the problem. It was not designed to work in table mode. but I can try to help you modify it .

  • It's only running locally at the moment, so unfortunately I don't have any links to give. I'll see if I can spin up a quick test forum online.

  • Ok, I got something up and running. I PMd you the link.

  • Another question...

    Since table layout is not going to work, is there an easy way to tweak the discussion meta?

    It currently consists of a possible tag (announcements and such), view count, post count, most recent poster and a date. Out of these view count is fairly useless to me (easy to hide with CSS), but I would really like to have thread starter listed and maybe change the order of items around a little. Is there a way to adjust these?

    I don't really mind the modern look itself, but it bugs me that it has less useful information than the table view.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator
    edited December 10

    @pitkmi said:

    Since table layout is not going to work

    Why? I would say that solving this issue would be the easiest approach

  • Vrijvlinder took a look at the site and came to the conclusion that solving the issue with CSS would be very difficult, since the addon is designed for modern layout, so I'm looking for options.

    The Colorbaseline addon actually sort of does what I'm looking for by moving post and view counts to their own boxes, but it's still missing thread author, which I would really like to have there.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    The easiest approach is to take something which is very close to what you like to achieve and change that.

    Take a look at what the plugin does. Copy it, give the copy a good name. Make it work with the table layout.

    If CSS is no help, a plugin is the best way to change the look of Vanilla.

  • Well, I have sort of a functional solution for Modern layout now. Discussion Photos plugin apparently adds DiscussionAuthor to the index with the profile picture. So, just get rid of the image (CSS, or just copy the plugin and remove the image part; haven't looked at the php yet), and you have a set up that works very similar to this forum actually.

    As far as I can tell the plugin grabs the first image it finds and drops it in front of the rest of the content, which works in Modern, because looking at the markup, it's essentially just a list. Table layout is an actual table, so you would need to add a column for the the images and insert them into each row.

    Now I'm debating whether it's easier to just tweak the CSS to make the list to look more like a table or to figure out the php to add an extra column to the table view.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    You would have to overwrite writeDiscussionHeading, because you can not insert a table column there.

    But wouldn't it be possible to add the picture before the title?

      <tr id="Discussion_<?php echo $discussion->DiscussionID; ?>" class="<?php echo $cssClass; ?>">
                <?php $sender->fireEvent('BeforeDiscussionContent'); ?>
                <?php echo adminCheck($discussion, ['<td class="CheckBoxColumn"><div class="Wrap">', '</div></td>']); ?>
                <td class="DiscussionName">
                    <div class="Wrap">
             <span class="Options">
                <?php
                echo optionsList($discussion);
                echo bookmarkButton($discussion);
                ?>
             </span>
                        <?php
                        $sender->fireEvent('BeforeDiscussionTitle');
                        echo anchor($discussionName, $discussionUrl, 'Title').' ';
    
    

    (taken from https://github.com/vanilla/vanilla/blob/master/applications/vanilla/views/discussions/table_functions.php)

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Just to be sure, let me add : not by adding something to this function but by using the event discussionsController_beforeDiscussionTitle

  • pitkmipitkmi New
    edited December 12

    That actually worked 100%. Didn't need to do anything else.

    So, in case anyone else needs to sort out Table layout: In the plugin code I change the two instances of
    public function DiscussionsController_BeforeDiscussionContent_Handler($Sender) {

    into
    public function DiscussionsController_BeforeDiscussionTitle_Handler($Sender) {

    and got this:

    Many thanks for your help @R_J =)

    [edit] Worth noting that this breaks the plugin in Modern layout, so if you switch back, you need to change the lines back.

    Also, GIFs totally work :awesome:

    R_J
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Glad it was that easy for you and you have found your solution :+1:

    For the plugin it would be best if either the css would be changed so that it works in both layouts or if both methods are included in the plugin and first piece of code in both methods would check which layout is active and return without action if it is the "wrong" layout

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    You have asked for restricting the plugin to some categories. The category name is passed as a class name in the body tag. So you could simply hide those pictures with css in the desired categories

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Interesting.. do you know if the tool tip still works ? It is supposed to give an excerpt of the discussion when hovering over the image.

  • pitkmipitkmi New
    edited December 12

    Yes, tooltips seem to work.

    You could probably add a couple of if statements in there (like the ones in indexphotos)
    (c('Vanilla.Discussions.Layout') != 'table') {
    and make the plugin work with both layouts pretty easily.

Sign In or Register to comment.