incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [40/45] git commit: [#6942] Dynamically generate tool icon css
Date Fri, 13 Dec 2013 05:08:26 GMT
[#6942] Dynamically generate tool icon css

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@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/b2c2be98
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b2c2be98
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b2c2be98

Branch: refs/heads/tv/6942
Commit: b2c2be98deb71bf6d3ff91f4add6ea85978b1561
Parents: 1082505
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Wed Dec 11 21:14:36 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Thu Dec 12 21:57:59 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/b2c2be98/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/b2c2be98/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/b2c2be98/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/b2c2be98/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/b2c2be98/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>


Mime
View raw message