summaryrefslogtreecommitdiff
path: root/per-service
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2016-10-13 15:22:12 -0500
committerAndy Doan <andy.doan@linaro.org>2016-10-14 14:24:32 +0000
commit13ec86eb745360a453335ea28a4bdd3e276c5654 (patch)
tree1312fa7e1adc65826f0b0cb8dfbdf9d4cd581729 /per-service
parent809f63bd0b384d981e120942c328d5f5f1831fd4 (diff)
downloadansible-playbooks-13ec86eb745360a453335ea28a4bdd3e276c5654.tar.gz
cgit: move to new cgit and header.html
It looks like upstream wants me to pursue a different method for managing collapsible sections. I've updated our cgit repo and these changes correspond to that. Change-Id: I663149ae163012af0ab849a943c5fa9912f18d47 Reviewed-on: https://review.linaro.org/14746 Reviewed-by: Ben Copeland <ben.copeland@linaro.org> Reviewed-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Diffstat (limited to 'per-service')
-rw-r--r--per-service/git-servers/group_vars/git18
-rw-r--r--per-service/git-servers/roles/cgit/tasks/main.yml3
-rw-r--r--per-service/git-servers/roles/cgit/templates/cgitrc19
-rw-r--r--per-service/git-servers/roles/cgit/templates/header.html41
4 files changed, 64 insertions, 17 deletions
diff --git a/per-service/git-servers/group_vars/git b/per-service/git-servers/group_vars/git
index d12ea16..30a4348 100644
--- a/per-service/git-servers/group_vars/git
+++ b/per-service/git-servers/group_vars/git
@@ -4,3 +4,21 @@ host_site_name: Linaro Git Hosting
host_site_desc: Git repositories hosted by Linaro
gitolite_help_url: https://wiki.linaro.org/Platform/Systems/Git
has_gerrit: true
+
+collapsible_sections:
+ - boot
+ - bsp
+ - ci
+ - devops
+ - gpgpu
+ - gwg
+ - hwpack
+ - infrastructure
+ - kernel-org
+ - landing-teams
+ - lava-team
+ - people
+ - pkg
+ - pmo-process
+ - ubuntu
+ - zephyrproject-org
diff --git a/per-service/git-servers/roles/cgit/tasks/main.yml b/per-service/git-servers/roles/cgit/tasks/main.yml
index 31a6ca5..d3dfbac 100644
--- a/per-service/git-servers/roles/cgit/tasks/main.yml
+++ b/per-service/git-servers/roles/cgit/tasks/main.yml
@@ -34,6 +34,9 @@
dest={{ apache_root }}/cgit/cgit-css/cgit.css
state=link
+- name: Install header.html
+ template: src=header.html dest={{ apache_root }}/cgit/header.html mode=0755
+
- name: Create a wrapper script to the cgit binary
copy: dest={{ apache_root }}/cgit/cgit owner=git group=git mode=0755
content="#!/bin/sh\n{{ tools_checkout_dir }}/cgit/cgit\n"
diff --git a/per-service/git-servers/roles/cgit/templates/cgitrc b/per-service/git-servers/roles/cgit/templates/cgitrc
index c940335..a95fd1f 100644
--- a/per-service/git-servers/roles/cgit/templates/cgitrc
+++ b/per-service/git-servers/roles/cgit/templates/cgitrc
@@ -13,6 +13,8 @@ enable-index-owner=0
clone-prefix=https://{{git_host}} ssh://git@{{git_host}}
snapshots=tar.gz
+header={{apache_root}}/cgit/header.html
+
root-title={{host_site_name}}
root-desc={{host_site_desc}}
logo=https://{{git_host}}/git-logo.png
@@ -52,20 +54,3 @@ about-filter={{tools_checkout_dir}}/cgit/filters/about-formatting.sh
section-from-path=1
scan-path={{repo_root}}
-
-section-collapse=boot
-section-collapse=bsp
-section-collapse=ci
-section-collapse=devops
-section-collapse=gpgpu
-section-collapse=gwg
-section-collapse=hwpack
-section-collapse=infrastructure
-section-collapse=kernel-org
-section-collapse=landing-teams
-section-collapse=lava-team
-section-collapse=people
-section-collapse=pkg
-section-collapse=pmo-process
-section-collapse=ubuntu
-section-collapse=zephyrproject-org
diff --git a/per-service/git-servers/roles/cgit/templates/header.html b/per-service/git-servers/roles/cgit/templates/header.html
new file mode 100644
index 0000000..2eb88fb
--- /dev/null
+++ b/per-service/git-servers/roles/cgit/templates/header.html
@@ -0,0 +1,41 @@
+<style>
+tr.nohover {
+ cursor: pointer;
+}
+tr.nohover td:before {
+ content: "▼ ";
+}
+tr.nohover.collapsed td:before {
+ content: "▶ ";
+}
+</style>
+
+<script>
+function toggle(tr) {
+ var collapsed = tr.classList.contains("collapsed");
+ if (collapsed)
+ tr.classList.remove("collapsed");
+ else
+ tr.classList.add("collapsed");
+
+ var next = tr.nextElementSibling;
+ while(next && next.firstChild.classList.contains("sublevel-repo")) {
+ if (collapsed)
+ next.style.display = "";
+ else
+ next.style.display = "none";
+ next = next.nextElementSibling;
+ }
+}
+document.addEventListener('DOMContentLoaded', function(event) {
+ var sections = document.getElementsByClassName("nohover");
+ for (var i = 0; i < sections.length; i++) {
+ sections[i].addEventListener("click", function(){
+ toggle(this);
+ });
+ }
+{% for section in collapsible_sections %}
+ toggle(document.getElementById("{{section}}"));
+{% endfor %}
+});
+</script>