Ticket #2911 (closed enhancement: fixed)

Opened 3 months ago

Last modified 3 months ago

RFE: Add Ability to Define a Default Display Mode

Reported by: lordsauronthegreat@gmail.com Assigned to: Blackhex
Priority: normal Component: DiscussionPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Right now the forum defaults to a tree view, which can get crowded towards the right side of the screen after a while. It would be really nice if administrators could control the default display mode. I read through the code base, and I think I found where the default mode is set:

http://trac-hacks.org/browser/discussionplugin/0.11/tracdiscussion/api.py#L763

Attachments

Change History

04/15/08 00:35:32 changed by Blackhex

  • status changed from new to assigned.
  • summary changed from Add Ability to Define a Default Display Mode to RFE: Add Ability to Define a Default Display Mode.

Ok. Actually the modification should be done at http://trac-hacks.org/browser/discussionplugin/0.11/tracdiscussion/api.py#L764 where will be test if display type is present in session and if not loaded from configuration option which will be defined at the top...

04/15/08 00:53:01 changed by lordsauronthegreat@gmail.com

Cool, I successfully isolated the right line of code. The more I read, the better I'm getting at this Python stuff. I still wouldn't feel safe trying to make a really big change - I'm liable to break something!

In the mean time, I managed to make an ugly nasty evil hack to do what I wanted by reorganizing the structure of that if-elseif-else block:

        # Prepare display of messages.
        display = context.req.session.get('message-list-display')
        self.data['display'] = display
        if display == 'flat-asc':
            self.data['messages'] = self.get_flat_messages(context,
              topic['id'], visit_time)
        elif display == 'flat-desc':
            self.data['messages'] = self.get_flat_messages(context,
              topic['id'], visit_time, 'ORDER BY time DESC')
	elif display == 'tree':
	    self.data['messages'] = self.get_messages(context, 
	      topic['id'], visit_time)
        else:
            self.data['messages'] = self.get_flat_messages(context, 
	      topic['id'], visit_time)

I would not suggest it for anything beyond my site (which didn't blow up, so I guess it works).

04/16/08 03:00:36 changed by Blackhex

  • status changed from assigned to closed.
  • resolution set to fixed.

Implemented in r3518.

04/16/08 12:19:58 changed by lordsauronthegreat@gmail.com

Wow, man, you're amazing! Thanks!


Add/Change #2911 (RFE: Add Ability to Define a Default Display Mode)




Change Properties
Action