From b3b77eca5d658b9a77c847efe200273eb40d30c9 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 14 Mar 2021 15:00:00 +0100 Subject: [PATCH] feat: add variable gitea_extra_links to customize nav bar BREAKING CHANGE: The variable `gitea_footer_custom_links` was renamed to `gitea_extra_links_footer`. --- defaults/main.yml | 17 ++++++++--------- tasks/install.yml | 7 +++++-- .../custom/templates/custom/extra_links.tmpl.j2 | 4 ++++ .../templates/custom/extra_links_footer.tmpl.j2 | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 templates/custom/templates/custom/extra_links.tmpl.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 75d7d76..cc3ff7a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -197,9 +197,7 @@ gitea_markdown_file_ext: gitea_lfs_enabled: False gitea_lfs_jwt_secret: gitea_lfs_jwt_secret -# @var gitea_org_creation_enabled: description: > -# Allow regular (non-admin) users to create organizations. -# @end +# @var gitea_org_creation_enabled: description: Allow regular (non-admin) users to create organizations. gitea_org_creation_enabled: True gitea_gravatar_enabled: False @@ -238,20 +236,21 @@ gitea_api_default_git_trees_per_page: 1000 gitea_footer_show_branding: False gitea_footer_show_version: False gitea_footer_show_template_load_time: False -# @var gitea_footer_custom_links:description: > -# Add custom links e.g. legal notice to gitea footer. -# @end -# @var gitea_footer_custom_links:example: > -# gitea_footer_custom_links: + +# @var gitea_extra_links_footer:description: Add custom links e.g. legal notice to gitea footer. +# @var gitea_extra_links_footer:example: > +# gitea_extra_links_footer: # - name: Legal Notice # href: https://example.com/legal_notice # @end -gitea_footer_custom_links: [] +gitea_extra_links_footer: [] +gitea_extra_links: [] gitea_oauth_provider_enabled: False gitea_access_token_expiration_time: 3600 gitea_refresh_token_expiration_time: 730 gitea_invalidate_refresh_tokens: False + # @bar gitea_jwt_secret:description: > # OAuth2 authentication secret for access and refresh tokens. # Should be replaced by your own secret. diff --git a/tasks/install.yml b/tasks/install.yml index 8be304e..962dc24 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -40,9 +40,12 @@ - name: Copy template files template: - src: "templates/custom/templates/custom/extra_links_footer.tmpl.j2" - dest: "{{ gitea_template_dir }}/custom/extra_links_footer.tmpl" + src: "templates/custom/templates/custom/{{ item }}.tmpl.j2" + dest: "{{ gitea_template_dir }}/custom/{{ item }}.tmpl" mode: 0600 + loop: + - extra_links_footer + - extra_links notify: __gitea_restart become: True become_user: "{{ gitea_user }}" diff --git a/templates/custom/templates/custom/extra_links.tmpl.j2 b/templates/custom/templates/custom/extra_links.tmpl.j2 new file mode 100644 index 0000000..c0e9ad5 --- /dev/null +++ b/templates/custom/templates/custom/extra_links.tmpl.j2 @@ -0,0 +1,4 @@ +#jinja2: lstrip_blocks: True +{% for link in gitea_extra_links %} +{{ link.name }} +{% endfor %} diff --git a/templates/custom/templates/custom/extra_links_footer.tmpl.j2 b/templates/custom/templates/custom/extra_links_footer.tmpl.j2 index f559447..65fd549 100644 --- a/templates/custom/templates/custom/extra_links_footer.tmpl.j2 +++ b/templates/custom/templates/custom/extra_links_footer.tmpl.j2 @@ -1,4 +1,4 @@ #jinja2: lstrip_blocks: True -{% for link in gitea_footer_custom_links %} +{% for link in gitea_extra_links_footer %} {{ link.name }} {% endfor %}