juan_gandhi: (VP)
Juan-Carlos Gandhi ([personal profile] juan_gandhi) wrote2015-11-10 06:16 pm

just a little bit of code...

from VERY expensive contractors


lazy val chartData = JArray(List(
("label" -> "Enabled") ~ ("data" -> enabled) ~ ("color" -> "#78c063"),
("label" -> "Not Enabled") ~ ("data" -> (total - enabled)) ~ ("color" -> "#f7d975")))

def render: CssSel =
".cname" #> name.getOrElse("") &
".total [href]" #> link &
".count-total *" #> total &
".count-enabled *" #> enabled &
".count-active *" #> active &
".count-not-enabled *" #> (total - enabled) &
".count-not-active *" #> (total - active) &
".enabled-pc *" #> asPercent(enabled.toDouble / total.toDouble) &
".chart-data" #> <lift:tail>{ Script(JsCrVar("clients_enabled", chartData) & OnLoad(Run("""$.plot($("#clients-enabled-chart"), clients_enabled, donut_options)"""))) }</lift:tail>

}

[identity profile] zeit-raffer.livejournal.com 2015-11-11 08:40 am (UTC)(link)
Результат делаем в виде свободной монады, а потом ее интерпретируем в XML?
Включая имена цветов.
Edited 2015-11-11 08:41 (UTC)

[identity profile] juan-gandhi.livejournal.com 2015-11-11 03:06 pm (UTC)(link)
Цвета вообще должны быть вынесены в стили, понятное дело. Представьте, менять skin для разных партнеров.
Edited 2015-11-11 15:07 (UTC)