Standardize ALERTs between layouts

This commit is contained in:
Saivann 2013-04-29 23:29:44 -04:00
parent 6c3c65c44a
commit 4ce5098c8c
7 changed files with 40 additions and 25 deletions

View file

@ -44,19 +44,22 @@ Each time that a commit needs to be translated in other languages, a link to thi
### Alerts ### Alerts
You can easily put a global alert on the website by changing the ALERT and ALERT\_CLASS variables in _config.yml. You can easily put an alert on the website by changing the ALERT and ALERT\_CLASS variables in _config.yml.
And you can also set an alert specific to a language by appending the language code to the ALERT. You can both set one fallback alert for all languages and many translated alerts for specific languages.
Example: Example:
``` ```
ALERT_CLASS: error ALERT_CLASS:
ALERT: <strong>Security alert:</strong> Please upgrade to 0.3.25 as soon as possible! all: <strong>Security alert:</strong> Please upgrade to 0.8.1 as soon as possible!
ALERT_fr: <strong>Alerte de sécurité:</strong> Mettez Bitcoin à jour vers la version 0.3.25 sans délais! fr: <strong>Alerte de sécurité:</strong> Mettez Bitcoin à jour vers la version 0.8.1 sans délais!
ALERT:
all: error
fr: error
``` ```
will produce an english red alert box for all languages, and a translated red alert box for french language. This will produce an english red alert box for all languages, and a translated red alert box for french language.
Possible classes are: error (red), info (blue), success (green) and warning (yellow) Possible classes are: **error** (red), **info** (blue), **success** (green) and **warning** (yellow)
### Release Notes ### Release Notes

View file

@ -1,6 +1,18 @@
DOWNLOAD_VERSION: 0.8.1 DOWNLOAD_VERSION: 0.8.1
ALERT_CLASS:
ALERT: ALERT_CLASS:
all:
en:
es:
fr:
nl:
ALERT:
all:
en:
es:
fr:
nl:
langsorder: langsorder:
- id: en - id: en

View file

@ -10,11 +10,11 @@ cp _layouts/base-en.html _layouts/base-${1}.html
sed -i "s_layout: base-en_layout: base-${1}_g" ${1}/*.html sed -i "s_layout: base-en_layout: base-${1}_g" ${1}/*.html
sed -i "s_lang: en_lang: ${1}_g" ${1}/*.html sed -i "s_lang: en_lang: ${1}_g" ${1}/*.html
sed -i "s_lang: en_lang: ${1}_g" _layouts/base-${1}.html sed -i "s_lang: en_lang: ${1}_g" _layouts/base-${1}.html
sed -i "s/ALERT_CLASS_en/ALERT_CLASS_${1}/g" _layouts/base-${1}.html sed -i "/id: ${1}/d" _config.yml
sed -i "s/ALERT_en/ALERT_${1}/g" _layouts/base-${1}.html sed -i "/${1}: /d" _config.yml
sed -i "/${1}: ${2}/d" _config.yml
sed -i "/langs:/a - ${1}: ${2}" _config.yml sed -i "/langs:/a - ${1}: ${2}" _config.yml
sed -i "s_- ${1}: ${2}_ ${1}: ${2}_g" _config.yml sed -i "s_- ${1}: ${2}_ ${1}: ${2}_g" _config.yml
sed -i "/- id: ${1}/d" _config.yml
sed -i "/langsorder:/a- id: ${1}" _config.yml sed -i "/langsorder:/a- id: ${1}" _config.yml
sed -i "s_- id:${1}_- id: ${1}_g" _config.yml sed -i "s_- id:${1}_- id: ${1}_g" _config.yml
sed -i "/all:/a- ${1}: " _config.yml
sed -i "s_- ${1}_ ${1}_g" _config.yml

View file

@ -45,9 +45,9 @@ footer: © Bitcoin Project 20092013 Released under the <a href="http://creati
<link rel="apple-touch-icon-precomposed" href="/img/logo_ios.png"/> <link rel="apple-touch-icon-precomposed" href="/img/logo_ios.png"/>
</head> </head>
<body> <body>
{% if site.ALERT or site.ALERT_en %} {% if site.ALERT.all or site.ALERT[page.lang] %}
{% if site.ALERT_CLASS %}{% assign class = site.ALERT_CLASS%}{% endif %}{% if site.ALERT_CLASS_en %}{% assign class = site.ALERT_CLASS_en%}{% endif %} {% if site.ALERT_CLASS.all %}{% assign class = site.ALERT_CLASS.all%}{% endif %}{% if site.ALERT_CLASS[page.lang] %}{% assign class = site.ALERT_CLASS[page.lang]%}{% endif %}
{% if site.ALERT %}{% assign alert = site.ALERT%}{% endif %}{% if site.ALERT_en %}{% assign alert = site.ALERT_en%}{% endif %} {% if site.ALERT.all %}{% assign alert = site.ALERT.all%}{% endif %}{% if site.ALERT[page.lang] %}{% assign alert = site.ALERT[page.lang]%}{% endif %}
<div class="alert-message {{ class }}"> <div class="alert-message {{ class }}">
<div><div>{{ alert }}</div></div> <div><div>{{ alert }}</div></div>
</div> </div>

View file

@ -43,9 +43,9 @@ footer: © Bitcoin Project 20092013 Publicado bajo la <a href="http://creativ
<link rel="apple-touch-icon-precomposed" href="/img/logo_ios.png"/> <link rel="apple-touch-icon-precomposed" href="/img/logo_ios.png"/>
</head> </head>
<body> <body>
{% if site.ALERT or site.ALERT_es %} {% if site.ALERT.all or site.ALERT[page.lang] %}
{% if site.ALERT_CLASS %}{% assign class = site.ALERT_CLASS%}{% endif %}{% if site.ALERT_CLASS_es %}{% assign class = site.ALERT_CLASS_es%}{% endif %} {% if site.ALERT_CLASS.all %}{% assign class = site.ALERT_CLASS.all%}{% endif %}{% if site.ALERT_CLASS[page.lang] %}{% assign class = site.ALERT_CLASS[page.lang]%}{% endif %}
{% if site.ALERT %}{% assign alert = site.ALERT%}{% endif %}{% if site.ALERT_es %}{% assign alert = site.ALERT_es%}{% endif %} {% if site.ALERT.all %}{% assign alert = site.ALERT.all%}{% endif %}{% if site.ALERT[page.lang] %}{% assign alert = site.ALERT[page.lang]%}{% endif %}
<div class="alert-message {{ class }}"> <div class="alert-message {{ class }}">
<div><div>{{ alert }}</div></div> <div><div>{{ alert }}</div></div>
</div> </div>

View file

@ -43,9 +43,9 @@ footer: © Bitcoin Project 20092013 Publié sous la <a href="http://creativec
<link rel="apple-touch-icon-precomposed" href="/img/logo_ios.png"/> <link rel="apple-touch-icon-precomposed" href="/img/logo_ios.png"/>
</head> </head>
<body> <body>
{% if site.ALERT or site.ALERT_fr %} {% if site.ALERT.all or site.ALERT[page.lang] %}
{% if site.ALERT_CLASS %}{% assign class = site.ALERT_CLASS%}{% endif %}{% if site.ALERT_CLASS_fr %}{% assign class = site.ALERT_CLASS_fr%}{% endif %} {% if site.ALERT_CLASS.all %}{% assign class = site.ALERT_CLASS.all%}{% endif %}{% if site.ALERT_CLASS[page.lang] %}{% assign class = site.ALERT_CLASS[page.lang]%}{% endif %}
{% if site.ALERT %}{% assign alert = site.ALERT%}{% endif %}{% if site.ALERT_fr %}{% assign alert = site.ALERT_fr%}{% endif %} {% if site.ALERT.all %}{% assign alert = site.ALERT.all%}{% endif %}{% if site.ALERT[page.lang] %}{% assign alert = site.ALERT[page.lang]%}{% endif %}
<div class="alert-message {{ class }}"> <div class="alert-message {{ class }}">
<div><div>{{ alert }}</div></div> <div><div>{{ alert }}</div></div>
</div> </div>

View file

@ -43,9 +43,9 @@ footer: © Bitcoin Project 20092013 Beschikbaar onder de <a href="http://crea
<link rel="apple-touch-icon-precomposed" href="/img/logo_ios.png"/> <link rel="apple-touch-icon-precomposed" href="/img/logo_ios.png"/>
</head> </head>
<body> <body>
{% if site.ALERT or site.ALERT_nl %} {% if site.ALERT.all or site.ALERT[page.lang] %}
{% if site.ALERT_CLASS %}{% assign class = site.ALERT_CLASS%}{% endif %}{% if site.ALERT_CLASS_nl %}{% assign class = site.ALERT_CLASS_nl%}{% endif %} {% if site.ALERT_CLASS.all %}{% assign class = site.ALERT_CLASS.all%}{% endif %}{% if site.ALERT_CLASS[page.lang] %}{% assign class = site.ALERT_CLASS[page.lang]%}{% endif %}
{% if site.ALERT %}{% assign alert = site.ALERT%}{% endif %}{% if site.ALERT_nl %}{% assign alert = site.ALERT_nl%}{% endif %} {% if site.ALERT.all %}{% assign alert = site.ALERT.all%}{% endif %}{% if site.ALERT[page.lang] %}{% assign alert = site.ALERT[page.lang]%}{% endif %}
<div class="alert-message {{ class }}"> <div class="alert-message {{ class }}">
<div><div>{{ alert }}</div></div> <div><div>{{ alert }}</div></div>
</div> </div>