Skip to content

Commit

Permalink
Better display of the folder titles in MoveTo menu of the files tool.
Browse files Browse the repository at this point in the history
This became possible because we need to use the name (and not the title)
as the data source, for performance reasons.
  • Loading branch information
reebalazs committed Oct 25, 2014
1 parent db315f1 commit 50a63b0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions karl/content/views/files.py
Expand Up @@ -1245,6 +1245,10 @@ def get_file_folder_path(context):
assert context_path.startswith(root_path)
return context_path[len(root_path):]

def deslugify(txt):
"a-slugified-name => A Slugified Name"
return ' '.join([txt.capitalize() for txt in txt.split('-')])

def get_target_folders(context):
# Return the target folders for this community.
#
Expand Down Expand Up @@ -1280,9 +1284,9 @@ def get_target_folders(context):
for docid in docids:
path = catalog.document_map.address_for_docid(docid)
# XXX Do _not_ wake up the object for the title,
# XXX instead use the name from the path segment.
# XXX instead use the deslugified name from the path segment.
# (See LP #1347066)
title = path.split('/')[-1]
title = deslugify(path.split('/')[-1])
## item = resolver(docid)
## title = item.title
target_items.append(dict(path=path, title=title))
Expand Down

0 comments on commit 50a63b0

Please sign in to comment.