diff options
author | Mike Crute <mcrute@gmail.com> | 2015-05-18 20:22:56 -0700 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2015-05-18 20:22:56 -0700 |
commit | bbca1d6b3875df82af3b2c11b57efef2fb8e319d (patch) | |
tree | ddf5dfb59c0619124ad9d140e8ff6e25bf6f8f8c /mcrute_theme | |
download | moin_mcrute_theme-master.tar.bz2 moin_mcrute_theme-master.tar.xz moin_mcrute_theme-master.zip |
Diffstat (limited to 'mcrute_theme')
-rw-r--r-- | mcrute_theme/__init__.py | 0 | ||||
-rw-r--r-- | mcrute_theme/crute_modernized.py | 68 |
2 files changed, 68 insertions, 0 deletions
diff --git a/mcrute_theme/__init__.py b/mcrute_theme/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/mcrute_theme/__init__.py | |||
diff --git a/mcrute_theme/crute_modernized.py b/mcrute_theme/crute_modernized.py new file mode 100644 index 0000000..0e04abe --- /dev/null +++ b/mcrute_theme/crute_modernized.py | |||
@@ -0,0 +1,68 @@ | |||
1 | from MoinMoin.theme.modernized import Theme as _Theme | ||
2 | from MoinMoin.Page import Page | ||
3 | from MoinMoin import wikiutil | ||
4 | |||
5 | |||
6 | class Theme(_Theme): | ||
7 | |||
8 | # Hook to add an override stylesheet, favicon, iPhone icon, and viewport | ||
9 | # tag | ||
10 | def universal_edit_button(self, d, **k): | ||
11 | return u'\n'.join([ | ||
12 | ('<meta name="viewport" content="width=device-width, ' | ||
13 | 'initial-scale=1" />'), | ||
14 | |||
15 | ('<link rel="shortcut icon" href="/WikiStatic?' | ||
16 | 'action=AttachFile&do=get&target=favicon.ico">'), | ||
17 | |||
18 | ('<link rel="apple-touch-icon-precomposed" href="/WikiStatic?' | ||
19 | 'action=AttachFile&do=get&target=iphone-icon.png"/>'), | ||
20 | |||
21 | ('<link rel="stylesheet" type="text/css" charset="utf-8" ' | ||
22 | 'media="all" href="/WikiStatic?' | ||
23 | 'action=AttachFile&do=get&target=mcrute.css">'), | ||
24 | |||
25 | ('<script type="text/javascript" src="/WikiStatic?' | ||
26 | 'action=AttachFile&do=get&target=dnd-upload.js">' | ||
27 | '</script>'), | ||
28 | ]) + _Theme.universal_edit_button(self, d, **k) | ||
29 | |||
30 | # Hook to add a Home link to the header links next to the logo | ||
31 | def username(self, d): | ||
32 | html = _Theme.username(self, d) | ||
33 | first_tag = html.index('>') + 1 | ||
34 | |||
35 | page = wikiutil.getFrontPage(self.request) | ||
36 | |||
37 | return u'{} {} <span class="sep"> | </span> {}'.format( | ||
38 | html[:first_tag], page.link_to_raw(self.request, "Home"), | ||
39 | html[first_tag:]) | ||
40 | |||
41 | def editbarItems(self, page): | ||
42 | actions = _Theme.editbarItems(self, page) | ||
43 | |||
44 | # Add quick link actions for starting/stopping activities | ||
45 | if page.pi['format'] == 'timecsv': | ||
46 | actions.insert(len(actions) - 1, page.link_to( | ||
47 | self.request, text='Start Activity', | ||
48 | querystr={ 'action': 'StartActivity' }, rel='nofollow')) | ||
49 | |||
50 | actions.insert(len(actions) - 1, page.link_to( | ||
51 | self.request, text='Stop Activity', | ||
52 | querystr={ 'action': 'StopActivity' }, rel='nofollow')) | ||
53 | |||
54 | return actions | ||
55 | |||
56 | def send_title(self, text, **keywords): | ||
57 | if 'editor_mode' in keywords: | ||
58 | if 'body_attr' in keywords: | ||
59 | keywords['body_attr'] += 'id="page-editor"' | ||
60 | else: | ||
61 | keywords['body_attr'] = 'id="page-editor"' | ||
62 | |||
63 | return _Theme.send_title(self, text, **keywords) | ||
64 | |||
65 | |||
66 | def execute(request): | ||
67 | return Theme(request) | ||
68 | |||