foodsoft/app/views/home/index.html.haml
wvengen 3f032e5dd9 make apple points optional
a next step would be to move this to a plugin
2014-05-13 17:01:25 +02:00

65 lines
2.6 KiB
Text

- title t('.title'), false
- content_for(:sidebar) do
= render :partial => 'start_nav'
- unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks.size == 0
%section.row-fluid
- unless @next_tasks.empty?
.span3.well
%h4= t '.your_tasks'
%dl
- @next_tasks.each do |task|
%dt= l task.due_date, format: t('.due_date_format')
%dd= link_to task.name, task_path(task)
- unless @unaccepted_tasks.empty?
.span3.well
%h4= t '.tasks_move.title'
= t '.tasks_move.desc'
= link_to t('.tasks_move.action'), user_tasks_path
- unless @unassigned_tasks.size == 0
.span3.well
%h4= t '.tasks_open.title'
= t '.tasks_open.desc', size: @unassigned_tasks.size
= link_to t('.tasks_open.action'), tasks_path
- if current_user.ordergroup
= render :partial => 'shared/open_orders', :locals => {:ordergroup => current_user.ordergroup}
// Stats
- if current_user.ordergroup and FoodsoftConfig[:use_apple_points]
%section
%h2= t '.ordergroup.title'
= render :partial => "apple_bar", :locals => {:apple_bar => AppleBar.new(current_user.ordergroup)}
- unless Message.public.empty?
%section
%h2= t '.messages.title'
= render 'messages/messages', messages: Message.public.order('created_at DESC').limit(5), pagination: false
%p= link_to t('.messages.view_all'), messages_path
- if current_user.ordergroup
// Ordergroup overview
%section
%h2= t '.my_ordergroup.title'
%p
%b= current_user.ordergroup.name
= t '.my_ordergroup.funds'
= number_to_currency(current_user.ordergroup.get_available_funds)
%small= t '.my_ordergroup.last_update', when: distance_of_time_in_words(Time.now, current_user.ordergroup.account_updated)
%h3= t '.my_ordergroup.transactions.title'
%table.table.table-striped
%tr
%th= heading_helper FinancialTransaction, :created_on
%th= heading_helper FinancialTransaction, :user
%th= heading_helper FinancialTransaction, :note
%th= heading_helper FinancialTransaction, :amount
- for ft in current_user.ordergroup.financial_transactions.limit(5).order('created_on DESC')
%tr
%td= format_time(ft.created_on)
%td= h(show_user(ft.user))
%td= h(ft.note)
- color = ft.amount < 0 ? 'red' : 'black'
%td{:style => "color:#{color}; width:5em", :class => "currency"}= number_to_currency(ft.amount)
%br/
%p= link_to t('.my_ordergroup.transactions.view'), my_ordergroup_path