You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2018/10/22 20:41:21 UTC
[3/3] allura git commit: [#8093] Initial mechanism for overriding
default templates with a responsive counterpart
[#8093] Initial mechanism for overriding default templates with a responsive counterpart
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/752cdf5f
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/752cdf5f
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/752cdf5f
Branch: refs/heads/kt/8093
Commit: 752cdf5fef656cf0cb0649deeac4030bee9ce93f
Parents: 1ffe208
Author: Kenton Taylor <kt...@slashdotmedia.com>
Authored: Mon Oct 22 20:40:46 2018 +0000
Committer: Kenton Taylor <kt...@slashdotmedia.com>
Committed: Mon Oct 22 20:40:46 2018 +0000
----------------------------------------------------------------------
Allura/allura/templates_responsive/__init__.py | 0
.../override/allura/templates/README.md | 5 +++
.../override/allura/templates/login.html | 38 +++++++++++++++++
.../override/allura/templates/site_admin.html | 45 ++++++++++++++++++++
.../responsive_overrides.py | 9 ++++
Allura/development.ini | 1 +
Allura/setup.py | 3 ++
7 files changed, 101 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/752cdf5f/Allura/allura/templates_responsive/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/templates_responsive/__init__.py b/Allura/allura/templates_responsive/__init__.py
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/allura/blob/752cdf5f/Allura/allura/templates_responsive/override/allura/templates/README.md
----------------------------------------------------------------------
diff --git a/Allura/allura/templates_responsive/override/allura/templates/README.md b/Allura/allura/templates_responsive/override/allura/templates/README.md
new file mode 100644
index 0000000..373afa0
--- /dev/null
+++ b/Allura/allura/templates_responsive/override/allura/templates/README.md
@@ -0,0 +1,5 @@
+# Responsive Migration
+
+As we plot a course to migrate allura's default layout to be responsive, new templates can be placed in this directory to supercede their legacy counterparts.
+
+To see the overridden templates take effect, ensure `disable_entry_points.allura.theme.override = responsive` is *disabled* (by commenting out or removing entirely) in your INI file.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/allura/blob/752cdf5f/Allura/allura/templates_responsive/override/allura/templates/login.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates_responsive/override/allura/templates/login.html b/Allura/allura/templates_responsive/override/allura/templates/login.html
new file mode 100644
index 0000000..60c7c81
--- /dev/null
+++ b/Allura/allura/templates_responsive/override/allura/templates/login.html
@@ -0,0 +1,38 @@
+{#-
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-#}
+
+{#
+ This file is a placeholder example demonstrating internally overriding
+ default templates with a responsive replacement
+#}
+
+{% set hide_left_bar = True %}
+{% extends g.theme.master %}
+
+{% block title %}{{ config['site_name'] }} Login BAR{% endblock %}
+
+{% block header %}Login{% endblock %}
+
+{% block content %}
+<div id="loginform">
+ <h2><span>Password Login</span></h2>
+ {{ c.form.display(action='./do_login', value=dict(return_to=return_to)) }}
+</div>
+
+{% endblock %}
http://git-wip-us.apache.org/repos/asf/allura/blob/752cdf5f/Allura/allura/templates_responsive/override/allura/templates/site_admin.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates_responsive/override/allura/templates/site_admin.html b/Allura/allura/templates_responsive/override/allura/templates/site_admin.html
new file mode 100644
index 0000000..3d13608
--- /dev/null
+++ b/Allura/allura/templates_responsive/override/allura/templates/site_admin.html
@@ -0,0 +1,45 @@
+{#-
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-#}
+
+{#
+ This file is a placeholder example demonstrating internally overriding
+ default templates with a responsive replacement
+#}
+
+{% from 'allura:templates/jinja_master/sidebar_menu.html' import sidebar_item with context %}
+
+{% extends g.theme.master %}
+
+{% block title %}Forge Site Admin{% endblock %}
+{% block header %}Forge Site Admin{% endblock %}
+
+{% block nav_menu %}
+ <h1 class="project_title">Site Admin</h1>
+{% endblock %}
+
+{% block sidebar_menu %}
+<div id="sidebar">
+ <div> </div>
+ {% for s in c.site_admin_sidebar_menu %}
+ {{sidebar_item(s)}}
+ {% endfor %}
+</div>
+{% endblock %}
+
+{% block inner_grid %}{% endblock %}
http://git-wip-us.apache.org/repos/asf/allura/blob/752cdf5f/Allura/allura/templates_responsive/responsive_overrides.py
----------------------------------------------------------------------
diff --git a/Allura/allura/templates_responsive/responsive_overrides.py b/Allura/allura/templates_responsive/responsive_overrides.py
new file mode 100644
index 0000000..a86f685
--- /dev/null
+++ b/Allura/allura/templates_responsive/responsive_overrides.py
@@ -0,0 +1,9 @@
+
+class ResponsiveOverrides(object):
+ '''
+ Placeholder to trigger usage of template overrides in the /override/ dir
+ Could put specific rules here if needed, but we don't need it.
+
+ See http://allura.sourceforge.net/docs/api/lib/package_path_loader.html
+ '''
+ pass
http://git-wip-us.apache.org/repos/asf/allura/blob/752cdf5f/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index a6932d8..9d00055 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -429,6 +429,7 @@ importer_upload_path = /tmp/importer_upload/{nbhd}/{project}
; Examples:
;disable_entry_points.allura.importers = github-tracker, github-wiki, github-repo
;disable_entry_points.allura.project_importers = github
+disable_entry_points.allura.theme.override = responsive
; Importers specifically, can be left enabled but not linked to. You have to know the URL to use it. Example:
;hidden_importers = trac-tickets
http://git-wip-us.apache.org/repos/asf/allura/blob/752cdf5f/Allura/setup.py
----------------------------------------------------------------------
diff --git a/Allura/setup.py b/Allura/setup.py
index 56ca78a..9d92f3e 100644
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -155,6 +155,9 @@ setup(
set-neighborhood-features = allura.command:SetNeighborhoodFeaturesCommand
reclone-repo = allura.command.reclone_repo:RecloneRepoCommand
+ [allura.theme.override]
+ responsive = allura.templates_responsive.responsive_overrides:ResponsiveOverrides
+
[easy_widgets.resources]
ew_resources=allura.config.resources:register_ew_resources