Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#2911 closed enhancement (fixed)

RFE: Add Ability to Define a Default Display Mode

Reported by: lordsauronthegreat@… Owned by: 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 (0)

Change History (4)

comment:1 Changed 6 years ago 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...

comment:2 Changed 6 years ago by lordsauronthegreat@…

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).

comment:3 Changed 6 years ago by Blackhex

  • Resolution set to fixed
  • Status changed from assigned to closed

Implemented in r3518.

comment:4 Changed 6 years ago by lordsauronthegreat@…

Wow, man, you're amazing! Thanks!

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from Blackhex. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.