Added twitter bootstrap layout. Adapt home page.

This commit is contained in:
benni 2012-10-06 17:14:57 +02:00
parent 31735f35ab
commit f20ae890dd
18 changed files with 334 additions and 264 deletions

View file

@ -1,6 +1,6 @@
class AppleBar
BAR_MAX_WITH = 600
attr_reader :ordergroup
def initialize(ordergroup)
@ordergroup = ordergroup
@ -8,32 +8,28 @@ class AppleBar
@global_avg = Ordergroup.avg_jobs_per_euro
end
def length_of_global_bar
BAR_MAX_WITH / 2.0
end
def length_of_group_bar
length = (@group_avg / @global_avg) * length_of_global_bar
length > BAR_MAX_WITH ? BAR_MAX_WITH : length
end
# Show group bar in following colors:
# Green if higher than 100
# Yellow if lower than 100 an higher than stop_ordering_under option value
# Red if below stop_ordering_under, the ordergroup isn't allowed to participate in an order anymore
def group_bar_color
def group_bar_state
if apples >= 100
"#78b74e"
'success'
else
if FoodsoftConfig[:stop_ordering_under].present? and
apples >= FoodsoftConfig[:stop_ordering_under]
'yellow'
'warning'
else
'red'
'danger'
end
end
end
# Use apples as percentage, but show at least 10 percent
def group_bar_width
@ordergroup.apples < 2 ? 2 : @ordergroup.apples
end
def mean_order_amount_per_job
(1/@global_avg).round
end