[PATCH] my pull requests: fix page title when no site branding is set

Mads Kiilerich mads at kiilerich.com
Mon Feb 23 10:21:57 EST 2015


On 02/23/2015 04:10 PM, Thomas De Schampheleire wrote:
> On Mon, Feb 23, 2015 at 3:57 PM, Mads Kiilerich <mads at kiilerich.com> wrote:
>> On 02/22/2015 10:19 PM, Thomas De Schampheleire wrote:
>>> On Sun, Feb 22, 2015 at 4:44 PM, Mads Kiilerich <mads at kiilerich.com>
>>> wrote:
>>>> On 02/21/2015 08:48 PM, Thomas De Schampheleire wrote:
>>>>> # HG changeset patch
>>>>> # User Thomas De Schampheleire
>>>>> <thomas.de_schampheleire at alcatel-lucent.com>
>>>>> # Date 1423170039 -3600
>>>>> #      Thu Feb 05 22:00:39 2015 +0100
>>>>> # Node ID d5ca82fa417e49d1cec4989e895bb95397fccdc2
>>>>> # Parent  9df497f29cf2538f29440e66013bc7f864395082
>>>>> my pull requests: fix page title when no site branding is set
>>>>>
>>>>> Just like any other page, the 'middot' between the page name and site
>>>>> name
>>>>> should only be visible if a site name has been specified.
>>>>
>>>> It seems like it would be even better to remove the duplication of code
>>>> and
>>>> move all the site_name header handling to root.html?
>>>>
>>>> (Next step could be to also show repo_name if there is one in the
>>>> context.)
>>> I had a brief look to this second step: templates are currently adding
>>> context variables explicitly when appropriate. This could be a
>>> repository name, but also a username, user group, repo group, ...
>>> How do you suggest to handle this?
>>> In the case of repository name for example, the string is typically
>>> '%s $title' % c.repo_name, but should we assume this is always the
>>> case and that '$title %s' may not be more appropriate?
>>> And does it make sense to treat the repository context from root.html,
>>> but other relevant context like username from the template itself?
>>
>> Yes. "Pages working in the context of a repo (and usually a
>> changeset/branch)" is so common and important that I think it makes sense to
>> have extra support and convenience functions for that.
>>
>> It would perhaps be nice to have a separate template for such pages.
>> https://bitbucket.org/conservancy/kallithea/pull-request/52/replaced-the-old-switch-to-dropdown-with
>> would also fit in nicely there.
> When you say 'would fit nicely there' you mean to extract the code
> added in that pullrequest would be moved away from base.html to this
> new template?
> And would you create a separate base_repo.html (or something) or
> rather inherit from base.html ?

Yes, something like that. That would however be scope creep. So let's 
just take your initial fix and keep this in mind.

>> root.html has some special hacks for using c.repo_name when it is defined.
>> For now I think it would be fine to handle branding and repo name the same
>> way.
>>
>> (A related "feature request": People often have multiple tabs open and they
>> only see 10 characters of the page title. They want to see the most
>> important info there so they can tell them apart. But for some users that
>> will be the hostname/branding, for others it will be the repo name, for
>> others it will be the branch name, for others it will be the pull request
>> number or name (when applicable). I don't see a good solution to that. But
>> let's keep the branding at the end.)
>>
> And here your feature request is to keep the branding at the end?
> Or would the feature be the configuration of the page title based on
> some %foo modifiers?

I don't know a good solution but I kind of understand the problem. You 
can perhaps help keeping it in mind and see if a solution / improvement 
pops up.

/Mads


More information about the kallithea-general mailing list