Making WordPress.org

Ticket #287: meta.287.diff

File meta.287.diff, 1.5 KB (added by nacin, 11 years ago)
  • conf/focuses.ini

     
     1[ticket-custom]
     2focuses = text
     3focuses.label = Focuses
     4focuses.format = list
     5
  • templates/site.html

     
    44     py:strip="">
    55
    66<?python
    7         scripts_version = '34'
     7        scripts_version = '35'
    88        project_slug = req.environ['HTTP_HOST'].split(':')[0].split('.')[0]
    99        wporg_endpoint = '//make.wordpress.org/core/'
    1010
     
    3232                                link['href'] = urllib.unquote(new_link[1])
    3333        except (IndexError, KeyError):
    3434                pass
     35
     36        field_types = [ 'milestone', 'priority', 'type', 'severity', 'version', 'component', 'keywords', 'focuses', ]
     37
     38        # Sorting function
     39        def sort_nicely(field1, field2):
     40                try:
     41                        idx1 = field_types.index(field1['name'])
     42                except ValueError:
     43                        idx1 = 1000 # no match, push to the end
     44
     45                try:
     46                        idx2 = field_types.index(field2['name'])
     47                except ValueError:
     48                        idx2 = 1000 # no match, push to the end
     49
     50                return cmp(idx1, idx2)
     51
     52        if ticket and 'fields' in locals():
     53                # Sort the fields
     54                fields.sort(cmp=sort_nicely)
     55
     56                # Re-generate fields_map for use within the ticket template
     57                fields_map = {}
     58                for i in xrange(0, len(fields)):
     59                        fields_map[ fields[i]['name'] ] = i
    3560?>
    3661
    3762<!--! styles and such -->