%h2 Karten
%div#maps
- i = 1
- row_size = 3
- rows = (@maps.count / row_size) + 1
- min = 0
- max = 2
- max = @maps.count if @maps.count < row_size
- for r in 1..rows do
- # maps #{@maps.count}, rows #{rows}, min #{min}, max #{max}
%section
- @maps[min..max].each do |map|
- if map.public
- klass = "grid public"
- else
- klass = "grid"
%article{:class=>klass}
%div.image
= link_to image_tag("default_map_image3_0#{i}.png"), map
- i = i+1
- i = 1 if i > row_size
%div.metas
%h5
= link_to "#{map.title}", map
%p.info
- if !map.subtitle.blank?
= map.subtitle
\|
- if map.public
Öffentlich
- else
Versteckt
\|
#{map.placemarks.count} Orte
- if current_user
%div.actions
%p
- if map.layers.count > 0
= link_to 'Ort hinzufügen', new_placemark_path(:map => "#{map.id}"), :class => "button"
- if current_user.has_role? :admin
%p
- if map.public
= link_to 'Verstecken', unpublish_map_path(map), :class=>"button"
- elsif map.layers.count > 0 && map.placemarks.count > 0
= link_to 'Veröffentlichen', publish_map_path(map) , :class=>"button"
- else
Keine Orte angelegt!
%p
= link_to 'Bearbeiten', edit_map_path(map), :class=>"button"
- if current_user.has_role? :admin
%p
= link_to 'Löschen', map, :confirm => 'Soll diese Karte wirklich gelöscht werden?', :method => :delete, :class=> "warn_button"
%div.clear
- min = min + row_size
- max = max + row_size
- if current_user.has_role? :admin
%hr.clear
%article#admin_panel
%p
= link_to 'Neue Karte', new_map_path, :class=>"button"