[#8071] Fix "Create Wiki Page" ACL issue for non-admin groups
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index f4ec78f..8e9754e 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -33,9 +33,9 @@
{% do g.register_forge_css('css/forge/tooltipster.css') %}
{% do g.register_forge_css('css/font-awesome.min.css', compress=False) %}
{% do g.theme.require() %}
+{% do g.register_forge_js('js/admin_modal.js') %}
+{% do g.register_js('js/jquery.lightbox_me.js') %}
{% if h.has_access(c.project, 'admin')() %}
- {% do g.register_forge_js('js/admin_modal.js') %}
- {% do g.register_js('js/jquery.lightbox_me.js') %}
{# this would be better placed in top_nav.html but that file is included later so its too late for it to register
any css. (Unlike other html files which are the top-level file and extend this master.html) #}
{% do g.register_forge_css('css/navbar.css') %}
diff --git a/ForgeWiki/forgewiki/templates/wiki/admin_add_page.html b/ForgeWiki/forgewiki/templates/wiki/create_page.html
similarity index 96%
rename from ForgeWiki/forgewiki/templates/wiki/admin_add_page.html
rename to ForgeWiki/forgewiki/templates/wiki/create_page.html
index ae3c0aa..4a36879 100644
--- a/ForgeWiki/forgewiki/templates/wiki/admin_add_page.html
+++ b/ForgeWiki/forgewiki/templates/wiki/create_page.html
@@ -19,7 +19,7 @@
<script type="text/javascript">
$(function () {
$("form").submit(function () {
- location.href = '{{ app.url }}' +
+ location.href = '{{ c.app.url }}' +
encodeURIComponent($('input[name=name]', $(this)).val().replace(new RegExp('/', 'g'), '-')) + '/edit';
return false;
});
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 1621f62..0c87a3c 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -219,7 +219,7 @@ def sitemap(self):
def create_common_wiki_menu(self, has_create_access, admin_menu=False):
links = []
if has_create_access:
- links += [SitemapEntry('Create Page', self.admin_url + 'create_wiki_page',
+ links += [SitemapEntry('Create Page', self.url + 'create_wiki_page/',
ui_icon=g.icons['add'],
className='admin_modal')]
if not admin_menu:
@@ -488,6 +488,11 @@ def browse_tags(self, sort='alpha', page=0, limit=None, **kw):
name_labels=name_labels[start:start + limit])
@with_trailing_slash
+ @expose('jinja:forgewiki:templates/wiki/create_page.html')
+ def create_wiki_page(self):
+ return dict(allow_create=has_access(c.app, 'create')())
+
+ @with_trailing_slash
@expose('jinja:allura:templates/markdown_syntax.html')
def markdown_syntax(self):
'Display a page about how to use markdown.'
@@ -887,11 +892,6 @@ def home(self):
home=self.app.root_page_name,
allow_config=has_access(self.app, 'configure')())
- @expose('jinja:forgewiki:templates/wiki/admin_add_page.html')
- def create_wiki_page(self):
- return dict(app=self.app,
- allow_config=has_access(self.app, 'configure')())
-
@without_trailing_slash
@expose('jinja:forgewiki:templates/wiki/admin_options.html')
def options(self):