You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/02/27 13:50:37 UTC
[04/26] allura git commit: [#5467] Made "Create ticket" visible to
users without permission.
[#5467] Made "Create ticket" visible to users without permission.
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/fa4c23d3
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/fa4c23d3
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/fa4c23d3
Branch: refs/heads/ib/7830
Commit: fa4c23d3f1e0113b2b0537a8b842510ff69dc198
Parents: b9225b8
Author: Heith Seewald <hs...@slashdotmedia.com>
Authored: Wed Feb 18 15:59:45 2015 -0500
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Thu Feb 19 23:29:53 2015 +0000
----------------------------------------------------------------------
Allura/allura/app.py | 3 ++-
Allura/allura/nf/allura/css/site_style.css | 11 ++++++++++-
Allura/allura/templates/jinja_master/sidebar_menu.html | 9 ++++++---
ForgeTracker/forgetracker/tests/functional/test_root.py | 6 ++++--
ForgeTracker/forgetracker/tracker_main.py | 7 +++++++
5 files changed, 29 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/fa4c23d3/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 5a6db3e..b9fd6b7 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -81,7 +81,7 @@ class SitemapEntry(object):
"""
def __init__(self, label, url=None, children=None, className=None,
- ui_icon=None, small=None, tool_name=None, matching_urls=None):
+ ui_icon=None, small=None, tool_name=None, matching_urls=None, extra_html_attrs=None):
"""Create a new SitemapEntry.
"""
@@ -95,6 +95,7 @@ class SitemapEntry(object):
self.children = children or []
self.tool_name = tool_name
self.matching_urls = matching_urls or []
+ self.extra_html_attrs = extra_html_attrs or {}
def __getitem__(self, x):
"""Automatically expand the list of sitemap child entries with the
http://git-wip-us.apache.org/repos/asf/allura/blob/fa4c23d3/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index 9f8f1b3..01f6c8e 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -1952,7 +1952,16 @@ nav .ico {
#sidebar li > a:last-child {
border-bottom: none !important;
}
-
+a.sidebar-disabled {
+ opacity: 0.4;
+}
+a.sidebar-disabled:focus:hover{
+ pointer-events: none;
+}
+a.sidebar-disabled:hover,
+a.sidebar-disabled:focus {
+ cursor: not-allowed;
+}
.pad {
margin: 14px 0 10px 0 !important;
min-height: 600px;
http://git-wip-us.apache.org/repos/asf/allura/blob/fa4c23d3/Allura/allura/templates/jinja_master/sidebar_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/sidebar_menu.html b/Allura/allura/templates/jinja_master/sidebar_menu.html
index 08beed2..b51a15b 100644
--- a/Allura/allura/templates/jinja_master/sidebar_menu.html
+++ b/Allura/allura/templates/jinja_master/sidebar_menu.html
@@ -23,9 +23,12 @@
<ul class="sidebarmenu">
{% do ul_active.append(True) %}
{% endif %}
- <li{% if request.path.find(s.url,-s.url.__len__()) != -1 %} class="active"{% endif %}>
- <a href="{{s.url}}"{% if s.className %} class="{{s.className or ''}}"{% endif %}>{% if s.ui_icon %}<b data-icon="{{s.ui_icon.char}}" class="ico {{s.ui_icon.css}}"></b> {% endif %}<span{% if s.small != None %} class="has_small"{% endif %}>{{h.really_unicode(s.label)}}</span>{% if s.small != None %}<small>{{s.small}}</small>{% endif %}</a>
- </li>
+ <li{% if request.path.find(s.url,-s.url.__len__()) != -1 %} class="active"{% endif %}>
+ <a href="{{ s.url }}" {{ s.extra_html_attrs|xmlattr }} {% if s.className %} class="{{ s.className or '' }}" {% endif %} >
+ {% if s.ui_icon %} <b data-icon="{{ s.ui_icon.char }}" class="ico {{ s.ui_icon.css }}"></b>{% endif %}
+ <span{% if s.small != None %} class="has_small"{% endif %}>{{ h.really_unicode(s.label) }}</span>
+ {% if s.small != None %}<small>{{ s.small }}</small>{% endif %} </a>
+ </li>
{% else %}
{% if ul_active[-1] %}
</ul>
http://git-wip-us.apache.org/repos/asf/allura/blob/fa4c23d3/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 46cf8ce..b2c5c11 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -656,9 +656,11 @@ class TestFunctionalController(TrackerTestController):
index_view = self.app.get('/bugs/')
assert 'No open tickets found.' in index_view
assert 'Create Ticket' in index_view
- # No 'Create Ticket' button for user without 'create' perm
+
+ # Make sure the 'Create Ticket' button is disabled for user without 'create' perm
r = self.app.get('/bugs/', extra_environ=dict(username='*anonymous'))
- assert 'Create Ticket' not in r
+ create_button = r.html.find('a', attrs={'href': u'/p/test/bugs/new/'})
+ assert_equal(create_button['class'], 'sidebar-disabled')
def test_render_markdown_syntax(self):
r = self.app.get('/bugs/markdown_syntax')
http://git-wip-us.apache.org/repos/asf/allura/blob/fa4c23d3/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index a7c4e61..aedf6ff 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -304,6 +304,13 @@ class ForgeTrackerApp(Application):
if has_access(self, 'create')():
links.append(SitemapEntry('Create Ticket',
self.config.url() + 'new/', ui_icon=g.icons['plus']))
+ else:
+ extra_attrs = {"title": "To create a new ticket, you must be authorized by the project admin."}
+ links.append(SitemapEntry('Create Ticket',
+ self.config.url() + 'new/',
+ extra_html_attrs=extra_attrs,
+ className='sidebar-disabled',
+ ui_icon=g.icons['plus']))
if has_access(self, 'configure')():
links.append(SitemapEntry('Edit Milestones', self.config.url()
+ 'milestones', ui_icon=g.icons['table']))