Some UI Tweaks

22 views
Skip to first unread message

Sam Halliday

unread,
Aug 18, 2012, 9:18:23 AM8/18/12
to trac-...@googlegroups.com
Hi all,

I've been playing around with site.html and I've implemented a few cool tweaks that make my TRAC experience more personalised.

However, there are a couple of changes I'd like to make and I cannot figure out how to make them.

Could you please advise how to:

1. reduce the width of the "mainnav" so that it is only as wide as the menu entries within it? (This is a failure of my CSS skillz)

2. remove the "ctxtnav", but only for wiki pages (but keeping the "action=diff" ctxtnav,  because it is pretty cool)

3. add an "action=history" link to the bottom of all wiki pages, right beside the "edit" button.

4. hide all buttons at the bottom of a wiki page (except "edit" and "history"), and show them instead when "action=edit". I want to keep the "reading" experience as clean as possible and I feel "attach file", "rename", "delete version" and "delete page" are all edit commands.

(Actually, if someone can help me with point 3 then point 4 will involve doing the same thing when "action=edit" but with a few extra parameters added into the calls. I'd also need to know how to detect when "action=edit".)

Thanks!

Steffen Hoffmann

unread,
Aug 18, 2012, 9:59:45 AM8/18/12
to trac-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 18.08.2012 15:18, schrieb Sam Halliday:
> 3. add an "action=history" link to the bottom of all wiki pages, right
> beside the "edit" button.
>
> 4. hide all buttons at the bottom of a wiki page (except "edit" and
> "history"), and show them instead when "action=edit". I want to keep the
> "reading" experience as clean as possible and I feel "attach file",
> "rename", "delete version" and "delete page" are all edit commands.
>
> (Actually, if someone can help me with point 3 then point 4 will involve
> doing the same thing when "action=edit" but with a few extra parameters
> added into the calls. I'd also need to know how to detect when
> "action=edit".)
>

Look at existing plugin code, how this is done there. This is how I
approach these kind of tasks myself. As a pointer you could have a look
at TagsPlugin: tractags.wiki.WikiTagInterface adds some content to each
wiki page, depending on action. As easy as there's an input field
inserted next to the comment field by method '_wiki_edit' you could
insert a button (input type="button") too. The key here is an
appropriate XPATH selector and some Genshi builder code (the tag()
function from genshi.builder).

Hinding buttons could be done by an implementation of the
ITemplateStreamFilter [1] (see the same script file of TagsPlugin for an
example). But this time you'll need another XPATH selector to match the
buttons and remove them (see Genshi documentation [1]) for details.

Sincerely,

Steffen Hoffmann

[1] http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints
[2] http://genshi.edgewall.org/wiki/ApiDocs/genshi.filters.transform
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAvn9AACgkQ31DJeiZFuHe/rACgp/2yvOAAmWFpghsXz5ZMUoMu
0CEAn1h7zmQI/JGzlIg/ywqDrVvhmS8f
=08Zg
-----END PGP SIGNATURE-----

Sam Halliday

unread,
Aug 18, 2012, 8:06:57 PM8/18/12
to trac-...@googlegroups.com
On Saturday, 18 August 2012 14:18:23 UTC+1, Sam Halliday wrote:
1. reduce the width of the "mainnav" so that it is only as wide as the menu entries within it? (This is a failure of my CSS skillz) 

I'm getting somewhere with this

#mainnav {
    max-width: 390px;
    margin-left: auto;
}

but having to set the width is a bit arbitrary - anyone know what the best way to do it would be so that there is no need to put in an explicit pixel width? 
Reply all
Reply to author
Forward
0 new messages