Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

paises conflictivos en 2009

  • Loading branch information...
commit 7a479e38ecb4f82f7ba154f2a769e554aafa6a5e 1 parent e75293a
Dani Latorre authored
31 grails-app/services/de/eldisparate/CountriesService.groovy
... ... @@ -0,0 +1,31 @@
  1 +package de.eldisparate
  2 +
  3 +class CountriesService {
  4 +
  5 + static transactional = false
  6 +
  7 + def conflictives(){
  8 + def countries = [
  9 + [name: "ANGOLA", realName:"Angola", code:"AO"],
  10 + [name: "ARABIA SAUDI", realName:"Arabia Saudí", code:"SA"],
  11 + [name: "BOLIVIA", realName:"Bolivia", code:"BO"],
  12 + [name: "COLOMBIA", realName:"Colombia", code:"CO"],
  13 + [name: "ESTADOS UNIDOS DE AMERICA", realName:"Estados Unidos", code:"US"],
  14 + [name: "GEORGIA", realName:"Georgia", code:"GE"],
  15 + [name: "GHANA", realName:"Ghana", code:"GH"],
  16 + [name: "GUINEA", realName:"Guinea", code:"GN"],
  17 + [name: "INDONESIA", realName:"Indonesia", code:"ID"],
  18 + [name: "IRAN", realName:"Irán", code:"IR"],
  19 + [name: "ISRAEL", realName:"Israel", code:"IL"],
  20 + [name: "LIBANO", realName:"Líbano", code:"LB"],
  21 + [name: "MALASIA", realName:"Malasia", code:"MY"],
  22 + [name: "MARRUECOS", realName:"Marruecos", code:"MA"],
  23 + [name: "PAKISTAN", realName:"Pakistán", code:"PK"],
  24 + [name: "SRI LANKA", realName:"Sri Lanka", code:"LK"],
  25 + [name: "SUDAFRICA", realName:"Sudáfrica", code:"ZA"],
  26 + [name: "TAILANDIA", realName:"Tailandia", code:"TH"],
  27 + [name: "TURQUIA", realName:"Turquía", code:"TR"],
  28 + [name: "VENEZUELA", realName:"Venezuela", code:"VE"]
  29 + ]
  30 + }
  31 +}
16 grails-app/taglib/de/eldisparate/GoogleChartsTagLib.groovy
... ... @@ -1,6 +1,8 @@
1 1 package de.eldisparate
2 2
3 3 class GoogleChartsTagLib {
  4 + def countriesService
  5 +
4 6 def barChart = { attrs, body ->
5 7 //def autonomy = attrs.autonomy
6 8 //def countries = autonomy.exportCountries
@@ -17,10 +19,20 @@ class GoogleChartsTagLib {
17 19 def worldMap = { attrs, body ->
18 20 //def autonomy = attrs.autonomy
19 21 //def countries = autonomy.exportCountries
20   - def countrycCodes = "ESAO"
  22 +
  23 + def conflictiveCountries = countriesService.conflictives()
  24 +
  25 + def countryCodes = conflictiveCountries.collect{it.code}.join()
21 26 def background = "FFEBBE"
22 27 def countryColor = "B8002D"
23   - String imageSrc = "http://chart.apis.google.com/chart?chf=bg,s,${background}&chs=440x220&cht=t&chco=${background}|${countryColor}&chld=${countrycCodes}&chd=s:____&chtm=world"
  28 + String imageSrc = "http://chart.apis.google.com/chart?chf=bg,s,${background}&chs=440x220&cht=t&chco=${background}|${countryColor}&chld=${countryCodes}&chd=s:____&chtm=world"
24 29 out << imageSrc
25 30 }
  31 +
  32 + def conflictiveCountries = { attrs, body ->
  33 + def conflictiveCountries = countriesService.conflictives()
  34 + conflictiveCountries.each{
  35 + out << "<span class=\"text_paises\">${it.realName}: 23.000</span><br /> "
  36 + }
  37 + }
26 38 }
17 test/unit/de/eldisparate/CountriesServiceTests.groovy
... ... @@ -0,0 +1,17 @@
  1 +package de.eldisparate
  2 +
  3 +import grails.test.*
  4 +
  5 +class CountriesServiceTests extends GrailsUnitTestCase {
  6 + protected void setUp() {
  7 + super.setUp()
  8 + }
  9 +
  10 + protected void tearDown() {
  11 + super.tearDown()
  12 + }
  13 +
  14 + void testSomething() {
  15 +
  16 + }
  17 +}

0 comments on commit 7a479e3

Please sign in to comment.
Something went wrong with that request. Please try again.