Modify

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#11573 closed enhancement (fixed)

Show projects as dropdown in custom query form

Reported by: endquote Owned by: falkb
Priority: normal Component: SimpleMultiProjectPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

On the custom query form, if you filter on a project, the filter rule is a text-entry field. It would be nice if that were a dropdown list of open projects.

Attachments (1)

SimpleMultiProject_plugin_11573.patch (4.2 KB) - added by Cinc 9 years ago.
Patch to use 'select' ticket custom field instead of 'text' for project information

Download all attachments as: .zip

Change History (15)

comment:1 Changed 9 years ago by Cinc

I created a patch to use a 'select' field instead of a 'text' for the ticket custom field. This way a drop down list is automatically used on the query page. The items for the select field are taken from the db and kept internally. No need to add them to trac.ini.

This works ok for me so far. For current installations just change the definition for the field from 'text' to 'select' in trac.ini and you are set. No need for database changes and stuff. You may reverse the change at any time because there is just text saved in the database but no information about the field type used to gather the text.

The patch is against sources with patch for #12113 applied.

Changed 9 years ago by Cinc

Patch to use 'select' ticket custom field instead of 'text' for project information

comment:2 Changed 9 years ago by falkb

Seems to be an awesome fix!! Gonna hurry up to test it soon... stay tuned, Cheers, F@lk

comment:3 Changed 9 years ago by falkb

Status: newaccepted

comment:4 Changed 9 years ago by falkb

Resolution: fixed
Status: acceptedclosed

In 14335:

, fixes #11573:
Thanks and kudos to Cinc for 2 nice patches!:

  • better support of custom themes (fixes #12113)
  • with [ticket-custom] option project = select , custom queries show project list as drop-down now
  • additionally: show version drop-down in ticket-change form as ordered list now

comment:5 Changed 9 years ago by falkb

Works well here, too. Even still if not set to 'select' type.

BTW: Cinc, do you see how to get an alphabetically ordered list of versions in a custom-query?

comment:6 Changed 9 years ago by anonymous

Resolution: fixed
Status: closedreopened

I found one annoyance with multi environment installations.

Please remove the lines

Option("ticket-custom", "project", "select", doc="Ticket custom field needed for SimpleMultiProject plugin. This must be of type select.")
Option("ticket-custom", "project.label", "Project", doc="Label for ticket custom field used by SimpleMultiProject plugin.")

from ticket.py.

Otherwise the ticket custom field will be added to trac environments even if the plugin is disabled.

comment:7 Changed 9 years ago by falkb

Status: reopenedaccepted

OK

comment:8 in reply to:  5 ; Changed 9 years ago by anonymous

Replying to falkb:

Works well here, too. Even still if not set to 'select' type.

BTW: Cinc, do you see how to get an alphabetically ordered list of versions in a custom-query?

You mean in a drop down list or in the ticket table?

/me confused

comment:9 in reply to:  8 Changed 9 years ago by falkb

Replying to anonymous:

You mean in a drop down list or in the ticket table?

The drop down list of the common 'version' field, seems not to be ordered here, alphabetically

comment:10 Changed 9 years ago by falkb

see also the addon commit [14336]

comment:11 Changed 9 years ago by falkb

Resolution: fixed
Status: acceptedclosed

Cinc, it seems to me an ordered version list in the dropdown box on the custom query form is out of reach for this plugin, right? Any idea?

comment:12 Changed 9 years ago by endquote

This is great, thanks. I updated the plugin from source before realizing that I just needed to change php.ini. Seems to work ok.

For me the project list is sorted alphabetically, but all items with lowercase titles appear after all items with uppercase titles.

comment:13 in reply to:  12 Changed 9 years ago by falkb

Replying to endquote:

This is great, thanks. I updated the plugin from source before realizing that I just needed to change php.ini. Seems to work ok.

For me the project list is sorted alphabetically, but all items with lowercase titles appear after all items with uppercase titles.

Hi endquote, does this work for you sufficiently?:

  • simplemultiprojectplugin/trunk/simplemultiproject/model.py

     
    479479                        p.id_project = m.id_project"""
    480480
    481481        cursor.execute(query, [project])
    482         return sorted(cursor.fetchall())
     482        return sorted(cursor.fetchall(), key=lambda t: t[0].lower())
    483483
    484484    def get_versions_for_projectid(self,projectid):
    485485        if VERSION < '0.12':

comment:14 Changed 9 years ago by endquote

I'm not super worried about it... but after applying this patch, the sort seems the same to me. Screenshot: https://www.dropbox.com/s/o6npf6iche8velg/Screenshot%202014-12-23%2011.20.04.png

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain falkb.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.