You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/12/16 23:16:14 UTC
[14/37] git commit: [#6942] Dynamically generate tool icon css
[#6942] Dynamically generate tool icon css
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a00f2cde
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a00f2cde
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a00f2cde
Branch: refs/heads/db/5424
Commit: a00f2cdeed9cdb1944eecc206078b7f25fbb33e8
Parents: d584471
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Dec 11 21:14:36 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Dec 16 17:58:45 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/static.py | 5 +++++
Allura/allura/lib/app_globals.py | 10 ++++++++++
Allura/allura/templates/jinja_master/master.html | 1 +
Allura/allura/templates/jinja_master/top_nav.html | 3 +--
Allura/allura/templates/widgets/project_summary.html | 2 +-
5 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a00f2cde/Allura/allura/controllers/static.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/static.py b/Allura/allura/controllers/static.py
index dded144..87687f0 100644
--- a/Allura/allura/controllers/static.py
+++ b/Allura/allura/controllers/static.py
@@ -41,3 +41,8 @@ class NewForgeController(object):
else:
html = g.markdown.convert(markdown)
return html
+
+ @expose()
+ def tool_icon_css(self):
+ response.content_type = 'text/css'
+ return g.tool_icon_css
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a00f2cde/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 6ded51a..07b8e09 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -470,6 +470,16 @@ class Globals(object):
p1.wait()
return server_name
+ @LazyProperty
+ def tool_icon_css(self):
+ css = ''
+ for tool_name in self.entry_points['tool']:
+ for size in (24, 32, 48):
+ url = self.theme.app_icon_url(tool_name.lower(), size)
+ css += '.ui-icon-tool-%s-%i {background: url(%s) no-repeat;}\n' % (
+ tool_name, size, url)
+ return css
+
@property
def resource_manager(self):
return ew_core.widget_context.resource_manager
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a00f2cde/Allura/allura/templates/jinja_master/master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index 25e9e45..f574635 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -28,6 +28,7 @@
{% do g.register_forge_js('js/pb.transformie.min.js') %}
{% do g.register_forge_js('js/allura-base.js') %}
{% do g.register_forge_css('css/forge/hilite.css') %}
+{% do g.register_css('/nf/tool_icon_css') %}
{% do g.theme.require() %}
{% do g.resource_manager.register_widgets(c) %}
{# paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ #}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a00f2cde/Allura/allura/templates/jinja_master/top_nav.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/top_nav.html b/Allura/allura/templates/jinja_master/top_nav.html
index 90e1d9e..8fdfb34 100644
--- a/Allura/allura/templates/jinja_master/top_nav.html
+++ b/Allura/allura/templates/jinja_master/top_nav.html
@@ -20,8 +20,7 @@
<ul class="dropdown">
{% for s in c.project.grouped_navbar_entries() %}
<li class="{% if s.matches_url(request) %}selected{% endif %}">
- <a href="{{s.url}}"
- style="background-repeat: no-repeat; background-image: url({{ g.theme.app_icon_url((s.tool_name or 'admin').lower(), 32) }});">
+ <a href="{{s.url}}" class="ui-icon-tool-{{(s.tool_name or 'admin').lower()}}-32">
{{s.label}}
</a>
{% set grouped_tool_count = s.matching_urls|length %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a00f2cde/Allura/allura/templates/widgets/project_summary.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/project_summary.html b/Allura/allura/templates/widgets/project_summary.html
index 8f772d3..75c9527 100644
--- a/Allura/allura/templates/widgets/project_summary.html
+++ b/Allura/allura/templates/widgets/project_summary.html
@@ -49,7 +49,7 @@
<p class="desc">{% if value.summary %}{{value.summary}}{% else %}{{h.text.truncate(value.short_description, 50)}}{% endif %}</p>
<div class="quik">
{% for s in sitemap %}
- <a href="{{s.url}}" class="ui-icon-{{(s.ui_icon or 'admin').lower()}}" title="{{s.label}}"><span>{{s.label}}</span></a>
+ <a href="{{s.url}}" class="ui-icon-{{(s.ui_icon or 'admin').lower()}}-24" title="{{s.label}}"><span>{{s.label}}</span></a>
{% endfor %}
</div>
</div>