allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject allura git commit: [#8093] Initial mechanism for overriding default templates with a responsive counterpart
Date Tue, 23 Oct 2018 15:44:31 GMT
Repository: allura
Updated Branches:
  refs/heads/master d140a56e8 -> 10b2dda71


[#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/10b2dda7
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/10b2dda7
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/10b2dda7

Branch: refs/heads/master
Commit: 10b2dda7149970d4f202d00d4ca138f692c3ae91
Parents: d140a56
Author: Kenton Taylor <ktaylor@slashdotmedia.com>
Authored: Mon Oct 22 20:40:46 2018 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Oct 23 15:44:07 2018 +0000

----------------------------------------------------------------------
 Allura/allura/templates_responsive/__init__.py  |  0
 .../override/allura/templates/README.md         |  6 +++
 .../override/allura/templates/login.html        | 38 +++++++++++++++++
 .../override/allura/templates/site_admin.html   | 45 ++++++++++++++++++++
 .../responsive_overrides.py                     | 26 +++++++++++
 Allura/development.ini                          |  1 +
 Allura/setup.py                                 |  3 ++
 rat-excludes.txt                                |  1 +
 8 files changed, 120 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/10b2dda7/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/10b2dda7/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..48b2085
--- /dev/null
+++ b/Allura/allura/templates_responsive/override/allura/templates/README.md
@@ -0,0 +1,6 @@
+
+# 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/10b2dda7/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/10b2dda7/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>&nbsp;</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/10b2dda7/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..0478620
--- /dev/null
+++ b/Allura/allura/templates_responsive/responsive_overrides.py
@@ -0,0 +1,26 @@
+#       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.
+
+
+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/10b2dda7/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/10b2dda7/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
 

http://git-wip-us.apache.org/repos/asf/allura/blob/10b2dda7/rat-excludes.txt
----------------------------------------------------------------------
diff --git a/rat-excludes.txt b/rat-excludes.txt
index f2b474f..37dff64 100644
--- a/rat-excludes.txt
+++ b/rat-excludes.txt
@@ -76,4 +76,5 @@ solr_config/allura/core.properties
 # tmp can have tons of files from the broccoli build process
 tmp/**
 Allura/allura/public/nf/js/checklist.js
+Allura/allura/templates_responsive/override/allura/templates/README.md
 


Mime
View raw message