Commit 639b6bc1de8047287841b523b234a90f2de3efc5
1 parent
8ba7ba56
Exists in
master
corrigido o par?metro de cor da barra para escolher dinamicamente
Showing
4 changed files
with
24 additions
and
22 deletions
Show diff stats
app/barrabrasil.py
| ... | ... | @@ -9,7 +9,7 @@ def pagina_teste(): |
| 9 | 9 | <head></head> |
| 10 | 10 | <body> |
| 11 | 11 | <div id="barra-brasil"><a href="http://brasil.gov.br" style="background:#7F7F7F; height: 20px; padding:4px 0 4px 10px; display: block; font-family:sans,sans-serif; text-decoration:none; color:white; ">Portal do Governo Brasileiro</a></div> |
| 12 | - <script src="barra.js?cor=preto" type="text/javascript"></script> | |
| 12 | + <script src="barra.js?cor=verde" type="text/javascript"></script> | |
| 13 | 13 | </body> |
| 14 | 14 | </html> |
| 15 | 15 | ''' |
| ... | ... | @@ -20,7 +20,7 @@ def barra(): |
| 20 | 20 | nome_cor = request.args.get('cor', 'azul') |
| 21 | 21 | paleta = { |
| 22 | 22 | 'azul': '#004B82', |
| 23 | - 'preto': '#000000', | |
| 23 | + 'preta': '#000000', | |
| 24 | 24 | 'cinza': '#7F7F7F', |
| 25 | 25 | 'verde': '#00500F', |
| 26 | 26 | } | ... | ... |
assets/barra-brasil.coffee
| ... | ... | @@ -5,16 +5,18 @@ |
| 5 | 5 | |
| 6 | 6 | # src.nodeValue = "http://barra.brasil.gov.br/estilo-barra.css"; |
| 7 | 7 | # href.nodeValue = "http://189.9.137.173/estilo-barra.css"; |
| 8 | - href.nodeValue = "static/estilo-barra.css" | |
| 9 | - tipo = document.createAttribute("type") | |
| 10 | - tipo.nodeValue = "text/css" | |
| 11 | - rel = document.createAttribute("rel") | |
| 12 | - rel.nodeValue = "stylesheet" | |
| 13 | - media = document.createAttribute("media") | |
| 14 | - media.nodeValue = "all" | |
| 15 | - link.setAttributeNode href | |
| 16 | - link.setAttributeNode tipo | |
| 17 | - link.setAttributeNode rel | |
| 18 | - link.setAttributeNode media | |
| 19 | - head.appendChild link | |
| 8 | + # href.nodeValue = "static/estilo-barra.css" | |
| 9 | + window._barrabrasil = | |
| 10 | + insere_css: (css) -> | |
| 11 | + style = document.createElement("style") | |
| 12 | + tipo = document.createAttribute("type") | |
| 13 | + tipo.nodeValue = "text/css" | |
| 14 | + media = document.createAttribute("media") | |
| 15 | + media.nodeValue = "all" | |
| 16 | + conteudo = document.createTextNode(css) | |
| 17 | + style.setAttributeNode tipo | |
| 18 | + style.setAttributeNode media | |
| 19 | + style.appendChild conteudo | |
| 20 | + head.appendChild style | |
| 21 | + | |
| 20 | 22 | divBarra.innerHTML = conteudoBarra | ... | ... |
assets/estilo-barra.scss
| ... | ... | @@ -28,7 +28,8 @@ body { |
| 28 | 28 | position: relative; |
| 29 | 29 | overflow: hidden; |
| 30 | 30 | min-width: 1000px; |
| 31 | - background: #7f7f7f embed("imagens/barra-brasil-v3-bgx.png") center bottom no-repeat; | |
| 31 | + $cor: \{\{ cor \}\}; | |
| 32 | + background: $cor embed("imagens/barra-brasil-v3-bgx.png") center bottom no-repeat; | |
| 32 | 33 | .barra { |
| 33 | 34 | display: block; |
| 34 | 35 | width: 960px; |
| ... | ... | @@ -49,13 +50,13 @@ body { |
| 49 | 50 | width: 161px; |
| 50 | 51 | height: 28px; |
| 51 | 52 | text-indent: -99999px; |
| 52 | - background: #7f7f7f embed("imagens/ai.png") no-repeat 0 4px; | |
| 53 | + background: $cor embed("imagens/ai.png") no-repeat 0 4px; | |
| 53 | 54 | } |
| 54 | 55 | .brasilgov { |
| 55 | 56 | display: block; |
| 56 | 57 | width: 108px; |
| 57 | 58 | height: 28px; |
| 58 | 59 | text-indent: -99999px; |
| 59 | - background: #7f7f7f embed("imagens/brasil.png") no-repeat 0 4px; | |
| 60 | + background: $cor embed("imagens/brasil.png") no-repeat 0 4px; | |
| 60 | 61 | } |
| 61 | -} | |
| 62 | 62 | \ No newline at end of file |
| 63 | +} | ... | ... |
barra-brasil-1.yaml
| ... | ... | @@ -8,11 +8,10 @@ generate: |
| 8 | 8 | source: |
| 9 | 9 | - assets/conteudo-barra.html |
| 10 | 10 | - assets/barra-brasil.coffee |
| 11 | + - raw: "})();" # fechamento do escopo da funcao anonima | |
| 11 | 12 | template: | |
| 12 | 13 | (function(){ |
| 13 | - var conteudoBarra = '${source|trim,jsliteral}'; | |
| 14 | - })(); | |
| 15 | - | |
| 14 | + var conteudoBarra = '${source|trim}'; | |
| 16 | 15 | |
| 17 | 16 | - estilo-barra.css: |
| 18 | 17 | source: |
| ... | ... | @@ -26,7 +25,7 @@ generate: |
| 26 | 25 | source: |
| 27 | 26 | - build/estilo-barra.css |
| 28 | 27 | template: | |
| 29 | - barrabrasil.insere_css('${source|trim,jsliteral}'); | |
| 28 | + window._barrabrasil.insere_css('${source|trim}'); | |
| 30 | 29 | |
| 31 | 30 | css.embed: true |
| 32 | 31 | css.embed.only: true | ... | ... |