Handle alert banners in alerts.rb

This commit is contained in:
Saivann 2013-07-14 01:04:26 -04:00
parent 9e25b71df5
commit b520e53047
11 changed files with 24 additions and 68 deletions

View file

@ -70,26 +70,7 @@ Any change in the english texts can be done through a pull request on github. If
## Advanced Usage ## Advanced Usage
### Alert banner ### Alerts
You can put an alert banner on the website by changing the ALERT and ALERT\_CLASS variables in _config.yml.
You can both set one fallback alert for all languages and many translated alerts for specific languages.
Example:
```
ALERT:
all: <strong>Security alert:</strong> Please upgrade to 0.8.1 as soon as possible!
fr: <strong>Alerte de sécurité:</strong> Mettez Bitcoin à jour vers la version 0.8.1 sans délais!
ALERT_CLASS:
all: error
fr: error
```
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)
### Network alerts
Network alerts should be placed in `_alerts/YYYY-MM-DD-SHORTITLE.html` and adhere to this format: Network alerts should be placed in `_alerts/YYYY-MM-DD-SHORTITLE.html` and adhere to this format:
@ -99,6 +80,7 @@ title: "11/12 March 2013 Chain Fork"
lastmod: "Fri Mar 16 22:58:00 UTC 2012" lastmod: "Fri Mar 16 22:58:00 UTC 2012"
alias: "chainfork" alias: "chainfork"
active: true active: true
banner: "<b>Chain fork</b> - Please stop mining on bitcoin version 0.8.0. Click here for more information."
--- ---
<p> <p>
@ -114,6 +96,7 @@ More information will follow.
* `lastmod: ...` will be used as the last modification date in the layout. * `lastmod: ...` will be used as the last modification date in the layout.
* `alias: ...` (optional) a short alias to be used for Bitcoin-Qt alerts. Ex. "dos" will produce /dos.html * `alias: ...` (optional) a short alias to be used for Bitcoin-Qt alerts. Ex. "dos" will produce /dos.html
* `active: ...` (true or false) define if the alert should appear as ongoing in the network status page. * `active: ...` (true or false) define if the alert should appear as ongoing in the network status page.
* `banner: ...` (optional) a short text that will be displayed in a red alert banner and link to the alert page.
### Release Notes ### Release Notes

View file

@ -3,6 +3,7 @@ title: "February 20, 2012 Protocol Changes"
lastmod: "Mon Feb 20 00:10:00 UTC 2012" lastmod: "Mon Feb 20 00:10:00 UTC 2012"
alias: "feb20" alias: "feb20"
active: false active: false
banner: ""
--- ---
<p> <p>
In June 2010 the Bitcoin reference software version 0.2.10 introduced In June 2010 the Bitcoin reference software version 0.2.10 introduced

View file

@ -3,6 +3,7 @@ title: "Potentially Critical Security Vulnerability"
lastmod: "Fri Mar 16 22:58:00 UTC 2012" lastmod: "Fri Mar 16 22:58:00 UTC 2012"
alias: "critfix" alias: "critfix"
active: false active: false
banner: ""
--- ---
<p> <p>
A potential security vulnerability has been discovered in the Windows A potential security vulnerability has been discovered in the Windows

View file

@ -3,6 +3,7 @@ title: "CVE-2012-2459: Critical Vulnerability (denial-of-service)"
lastmod: "Mon May 14 17:00:00 UTC 2012" lastmod: "Mon May 14 17:00:00 UTC 2012"
alias: "dos" alias: "dos"
active: false active: false
banner: ""
--- ---
<h2>Risks</h2> <h2>Risks</h2>
<p> <p>

View file

@ -3,6 +3,7 @@ title: "11/12 March 2013 Chain Fork Information"
lastmod: "16 May 2013 01:37 UTC" lastmod: "16 May 2013 01:37 UTC"
alias: "chainfork" alias: "chainfork"
active: false active: false
banner: ""
--- ---
<h2>What happened</h2> <h2>What happened</h2>
<p> <p>

View file

@ -3,6 +3,7 @@ title: "15 May 2013 Upgrade Deadline"
lastmod: "10 May 2013 21:30 UTC" lastmod: "10 May 2013 21:30 UTC"
alias: "may15" alias: "may15"
active: false active: false
banner: ""
--- ---
<h2>What is happening</h2> <h2>What is happening</h2>
<p> <p>

View file

@ -1,35 +1,5 @@
DOWNLOAD_VERSION: 0.8.3 DOWNLOAD_VERSION: 0.8.3
ALERT_CLASS:
all:
ar:
de:
en:
es:
fa:
fr:
it:
nl:
pl:
ru:
tr:
zh_TW:
ALERT:
all:
ar:
de:
en:
es:
fa:
fr:
it:
nl:
pl:
ru:
tr:
zh_TW:
langsorder: langsorder:
- id: de - id: de
- id: en - id: en

View file

@ -28,11 +28,9 @@ menu:
<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.all or site.ALERT[page.lang] %} {% if site.ALERT %}
{% 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 %} <div class="alert-message">
{% if site.ALERT.all %}{% assign alert = site.ALERT.all%}{% endif %}{% if site.ALERT[page.lang] %}{% assign alert = site.ALERT[page.lang] %}{% endif %} <div><div>{{ site.ALERT }}</div></div>
<div class="alert-message {{ class }}">
<div><div>{{ alert }}</div></div>
</div> </div>
{% endif %} {% endif %}
<div id="head"><div> <div id="head"><div>

View file

@ -127,22 +127,9 @@ li p{
font-style:italic; font-style:italic;
} }
.alert-message{
background-color:#fff;
}
.alert-message div{ .alert-message div{
background-color:#fff;
background-color:#c5251f; background-color:#c5251f;
} }
.alert-message.error div{
background-color:#c5251f;
}
.alert-message.success div{
background-color:#489e48;
}
.alert-message.info div{
background-color:#517ea7;
}
.alert-message div div{ .alert-message div div{
margin:auto; margin:auto;
width:960px; width:960px;
@ -151,6 +138,9 @@ li p{
.alert-message,.alert-message a,.alert-message a:link,.alert-message a:active,.alert-message a:visited{ .alert-message,.alert-message a,.alert-message a:link,.alert-message a:active,.alert-message a:visited{
color:#fff; color:#fff;
} }
.alert-message a:hover{
text-decoration:underline;
}
#head{ #head{
margin:30px 0px 30px 0px; margin:30px 0px 30px 0px;

View file

@ -17,6 +17,9 @@ module Jekyll
self.data['redirect'] = src.split('.')[0] self.data['redirect'] = src.split('.')[0]
else else
self.data['category'] = 'alert' self.data['category'] = 'alert'
if self.data.has_key?('banner') and !self.data['banner'].nil? and self.data['banner'].length>0
site.config['ALERT']='<a href="/'+dstdir+'/'+dst.gsub('.html','')+'">'+self.data['banner']+'</a>'
end
if self.data.has_key?('alias') if self.data.has_key?('alias')
site.pages << AlertPage.new(site, base, lang, srcdir, src, '', self.data['alias']+'.html', date) site.pages << AlertPage.new(site, base, lang, srcdir, src, '', self.data['alias']+'.html', date)
end end

View file

@ -72,6 +72,13 @@ h3 .ieimg{
margin-left:-40px; margin-left:-40px;
} }
.alert-message a:hover,
.alert-message a:hover:link,
.alert-message a:hover:active,
.alert-message a:hover:visited{
color:#fff;
}
.download span{ .download span{
/*This one is also required for IE7*/ /*This one is also required for IE7*/
zoom:1; zoom:1;