Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Hierarchy classes are now rendered sorted by their name.

  • Loading branch information...
commit 9a36fc671a0492c807d96ea61f642cc9e8151ae1 1 parent 75c1371
@tomaz authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 Generating/GBHTMLTemplateVariablesProvider.m
View
12 Generating/GBHTMLTemplateVariablesProvider.m
@@ -411,17 +411,25 @@ - (NSArray *)arrayFromHierarchyLevel:(NSDictionary *)level {
// A helper method that recursively descends the given hierarchy level dictionary and converts it to array suitable for template engine processing.
NSMutableArray *result = [NSMutableArray arrayWithCapacity:[level count]];
[level enumerateKeysAndObjectsUsingBlock:^(NSString *name, NSDictionary *data, BOOL *stop) {
+ // Get all sublasses by recursively descending down the hierarchy.
NSArray *subclasses = [self arrayFromHierarchyLevel:[data objectForKey:@"subclasses"]];
+
+ // Get current class from the store and href to it.
GBClassData *class = [self.store classWithName:name];
NSString *href = [self hrefForObject:class fromObject:nil];
+
+ // Prepare class data.
NSMutableDictionary *classData = [NSMutableDictionary dictionary];
[classData setObject:name forKey:@"name"];
- if (href) [classData setObject:href forKey:@"href"];
[classData setObject:subclasses forKey:@"classes"];
[classData setObject:[subclasses count] > 0 ? [GRYes yes] : [GRNo no] forKey:@"hasClasses"];
+ if (href) [classData setObject:href forKey:@"href"];
[result addObject:classData];
}];
- return result;
+
+ // Sort the array by class names.
+ NSArray *descriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]];
+ return [result sortedArrayUsingDescriptors:descriptors];
}
- (void)registerObjectsUsageForIndexInDictionary:(NSMutableDictionary *)dict {
Please sign in to comment.
Something went wrong with that request. Please try again.