Add feedback block to all pages (#16474)

This commit is contained in:
Franck Nijhof 2021-02-09 21:24:56 +01:00 committed by GitHub
parent b7f76b05a0
commit ba6d8174ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 92 additions and 58 deletions

View File

@ -1,17 +1,33 @@
module Jekyll module Jekyll
class EnvironmentVariablesGenerator < Generator class EnvironmentVariablesGenerator < Generator
def generate(site) def generate(site)
# https://www.netlify.com/docs/continuous-deployment/#build-environment-variables # https://www.netlify.com/docs/continuous-deployment/#build-environment-variables
repo_url = ENV['REPOSITORY_URL'] || 'https://github.com/home-assistant/home-assistant.io' repository_url = ENV['REPOSITORY_URL'] || 'https://github.com/home-assistant/home-assistant.io'
# Rewrite urls if repo url is the ssh format. # Rewrite urls if repo url is the ssh format.
if repo_url.start_with? 'git@github.com:' if repository_url.start_with? 'git@github.com:'
repo_url = repo_url.sub 'git@github.com:', 'https://github.com/' repository_url = repository_url.sub 'git@github.com:', 'https://github.com/'
end end
# These values will be available as {{ site.NLY_REPOSITORY_URL }} # Figure out deployment URL
site.config['NLY_REPOSITORY_URL'] = repo_url url = site.config['url']
site.config['NLY_HEAD'] = ENV['HEAD'] || 'current' if ENV['context'].eql?('production')
url = ENV['URL'] || url
elsif ENV['context'].eql?('branch-deploy')
url = ENV['DEPLOY_URL'] || url
end
url = url.chomp('/')
# These values will be available as {{ site.netlify.* }}
site.config['netlify'] = {
'repository_url' => repository_url,
'branch' => ENV['BRANCH'] || 'current',
'commit' => ENV['COMMIT_REF'] || '',
'head' => ENV['HEAD'] || 'current',
'url' => url,
'pull_request' => ENV['PULL_REQUEST'].eql?('true'),
}
end end
end end
end end

View File

@ -47,6 +47,10 @@ $primary-color: #049cdb;
padding-right: 5px; padding-right: 5px;
padding-left: 5px; padding-left: 5px;
} }
.feedback {
margin-bottom: 32px;
}
} }
.hero { .hero {

View File

@ -1,27 +1,26 @@
<section class="aside-module grid__item one-whole lap-one-half"> <section class="aside-module grid__item one-whole lap-one-half">
{% include edit_github.html %}
{% assign cookbook = site.cookbook | sort_natural: 'title' %} {% assign cookbook = site.cookbook | sort_natural: 'title' %}
<div class='section'> <div class="section">
<a href='/cookbook'>Back to the cookbook</a> <a href="/cookbook">Back to the cookbook</a>
</div> </div>
<div class='section'> <div class="section">
<h1 class="title delta">{{page.ha_category}}</h1> <h1 class="title delta">{{page.ha_category}}</h1>
<ul class='divided'> <ul class="divided">
{% for recipe in cookbook %} {% for recipe in cookbook %} {% if recipe.ha_category == page.ha_category
{% if recipe.ha_category == page.ha_category %} %}
<li> <li>
{% if recipe.url == page.url %} {% if recipe.url == page.url %} {{recipe.title}} {% elsif
{{recipe.title}} recipe.ha_external_link %}
{% elsif recipe.ha_external_link %} <a href="{{recipe.ha_external_link}}"
<a href='{{recipe.ha_external_link}}'>{{recipe.title}} <i class="icon-external-link"></i></a> >{{recipe.title}} <i class="icon-external-link"></i
{% else %} ></a>
<a href='{{recipe.url}}'>{{recipe.title}}</a> {% else %}
{% endif %} <a href="{{recipe.url}}">{{recipe.title}}</a>
</li>
{% endif %} {% endif %}
{% endfor %} </li>
{% endif %} {% endfor %}
</ul> </ul>
</div> </div>
</section> </section>

View File

@ -1,15 +1,21 @@
<section class="aside-module grid__item one-whole lap-one-half"> <section class="aside-module grid__item one-whole lap-one-half">
{% include edit_github.html %} <div class="section">
<div class='section'>
<h1 class="title delta">Getting Started</h1> <h1 class="title delta">Getting Started</h1>
<ul class='divided sidebar-menu'> <ul class="divided sidebar-menu">
<li>{% active_link /getting-started/ Installation %} <li>{% active_link /getting-started/ Installation %}</li>
<li>{% active_link /getting-started/onboarding/ Onboarding %}</li> <li>{% active_link /getting-started/onboarding/ Onboarding %}</li>
<li>{% active_link /getting-started/automation/ Automation %}</li> <li>{% active_link /getting-started/automation/ Automation %}</li>
<li>{% active_link /getting-started/presence-detection/ Presence detection %}</li> <li>
<li>{% active_link /getting-started/join-the-community/ Join the community %}</li> {% active_link /getting-started/presence-detection/ Presence detection
<li>{% active_link /getting-started/configuration/ Advanced Configuration %}</li> %}
</li>
<li>
{% active_link /getting-started/join-the-community/ Join the community
%}
</li>
<li>
{% active_link /getting-started/configuration/ Advanced Configuration %}
</li>
</ul> </ul>
</div> </div>
</section> </section>

View File

@ -1,21 +1,20 @@
<section class="aside-module grid__item one-whole lap-one-half"> <section class="aside-module grid__item one-whole lap-one-half">
{% include edit_github.html %}
<div class="section"> <div class="section">
<h1 class="title delta">&nbsp;</h1> <h1 class="title delta">&nbsp;</h1>
<ul class="divided sidebar-menu"> <ul class="divided sidebar-menu">
<li>{% active_link /help/ Help %}</li>
<li> <li>
{% active_link /help/ Help %} <a href="https://developers.home-assistant.io"
</li> >Developer documentation
<li>
<a href="https://developers.home-assistant.io">Developer documentation
<i class="icon-external-link"></i> <i class="icon-external-link"></i>
</a> </a>
</li> </li>
<li> <li>
Governance Governance
<ul> <ul>
<li>{% active_link /developers/cla/ Contributor License Agreement %}</li> <li>
{% active_link /developers/cla/ Contributor License Agreement %}
</li>
<li>{% active_link /privacy/ Privacy Policy %}</li> <li>{% active_link /privacy/ Privacy Policy %}</li>
<li>{% active_link /tos/ Terms of Service %}</li> <li>{% active_link /tos/ Terms of Service %}</li>
<li>{% active_link /code_of_conduct/ Code of Conduct %}</li> <li>{% active_link /code_of_conduct/ Code of Conduct %}</li>

View File

@ -1,5 +1,4 @@
<section class="aside-module grid__item one-whole lap-one-half"> <section class="aside-module grid__item one-whole lap-one-half">
<!-- {% include edit_github.html %} -->
{% assign cards = site.lovelace | sort_natural: 'title' %} {% assign cards = site.lovelace | sort_natural: 'title' %}
<div class="section"> <div class="section">
@ -19,7 +18,9 @@
<li>{% active_link /lovelace/badges/ Badges %}</li> <li>{% active_link /lovelace/badges/ Badges %}</li>
<li>{% active_link /lovelace/actions/ Actions %}</li> <li>{% active_link /lovelace/actions/ Actions %}</li>
<li> <li>
<a href="https://developers.home-assistant.io/docs/frontend/custom-ui/lovelace-custom-card.html">Developing Custom Cards <a
href="https://developers.home-assistant.io/docs/frontend/custom-ui/lovelace-custom-card.html"
>Developing Custom Cards
<i class="icon-external-link"></i> <i class="icon-external-link"></i>
</a> </a>
</li> </li>
@ -30,7 +31,7 @@
<h1 class="title delta">Cards</h1> <h1 class="title delta">Cards</h1>
<ul class="divided sidebar-menu"> <ul class="divided sidebar-menu">
{% for card in cards %} {% for card in cards %}
<li>{% active_link {{card.url}} {{card.sidebar_label}} %}</li> <li>{% active_link {{card.url}} {{card.sidebar_label}} %}</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>

View File

@ -1,4 +1,21 @@
{% assign url_parts = page.url | split: '/' %}
{% if page.hide_github_edit != true %} {% if page.hide_github_edit != true %}
<div class='edit-github'><a target="_blank" rel="noopener noreferrer" href='{{ site.NLY_REPOSITORY_URL }}/tree/{{ site.NLY_HEAD }}/source/{{ page.path }}'>Edit this page on GitHub</a></div> <div class="material-card text feedback">
<b>Help us to improve our documentation</b><br />
Suggest an edit to this page, or provide/view feedback for this page.
<div class="links">
<a
href="{{ site.netlify.repository_url }}/tree/{{ site.netlify.head }}/source/{{ page.path }}"
><i class="icon-edit" /> Edit</a
>
<a
href="{{ site.netlify.repository_url }}/issues/new?template=feedback.yml&url={{ site.netlify.url | url_encode }}{{ page.url | url_encode }}&version={{ site.current_major_version }}.{{
site.current_minor_version }}.{{ site.current_patch_version }}&labels={{ site.netlify.branch }}"
><i class="icon-comment" /> Provide feedback</a
>
<a
href="{{ site.netlify.repository_url }}/issues?utf8=%E2%9C%93&q=%22{{ site.netlify.url | url_encode }}{{ page.url | url_encode }}%22&in=body"
><i class="icon-comments" /> View pending feedback</a
>
</div>
</div>
{% endif %} {% endif %}

View File

@ -3,24 +3,16 @@ layout: default
--- ---
<article class="page"> <article class="page">
{% assign url_parts = page.url | split: '/' %}
{% if url_parts[1] != 'components' and
url_parts[1] != 'cookbook' and
url_parts[1] != 'developers' and
url_parts[1] != 'help' and
url_parts[1] != 'getting-started' %}
{% include edit_github.html %}
{% endif %}
{% if page.title and page.show_title != false %} {% if page.title and page.show_title != false %}
<header> <header>
<h1 class="title indent"> <h1 class="title indent">
{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %} {% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title
}}{% endif %}
</h1> </h1>
</header> </header>
<hr class="divider"> <hr class="divider" />
{% endif %} {% endif %}
{{ content }} {{ content }}
{% include edit_github.html %}
</article> </article>