mconf/mconf-web

View on GitHub
app/views/events/index.html.haml

Summary

Maintainability
Test Coverage
= content_for :page_header_subtitle do
  = t('.subtitle')
= page_title t('.title')

= content_for :sidebar do

  .sidebar-top-action-button
    - if user_signed_in?
      = link_to t('.create_new_event'), new_event_path, :class => "btn btn-primary btn-large btn-block"
    - else
      - if current_site.registration_enabled?
        = link_to t('register.one'), register_path, :class => "btn btn-success btn-large btn-block"
      - else
        = link_to t('_other.login'), login_path, :class => "btn btn-success btn-large btn-block"

  .content-block-container
    .content-block
      .content-block-middle
        %p= t('.select_at_left')
      - @events.each do |event|
        -# TODO: everybody has access?
        - has_access = true
        .content-block-middle{ :id => "#{event.slug}-description", :style => "display:none;" }
          .event-logo-wrapper
            = event_logo_link(event, :class => "logo logo-event")
          - if has_access
            = link_to event_path(event) do
              %h3.break-word= sanitize(event.name)
          - else
            %h3.break-word= sanitize(event.name)
          - unless event.summary.blank?
            %p.description= sanitize(event.summary) + '...'
          %p.details
            - if event.participants.include?(current_user)
              %span.is-participant= t('.user_is_participant')
            %span= t('.participant_count', :count => event.participants.count)
          - if has_access
            %p.action-links
              = link_to t('more'), event_path(event)

#event-filter-wrapper

  - tabs = {'upcoming' => 'upcoming_events', '.now' => 'happening_now', 'all' => 'all', 'past' => 'past_events'}
  .btn-group{ :"data-toggle" => "buttons-radio" }
    - tabs.each do |k, v|
      - new_params = params.merge(:show => v).except(:page)
      = link_to t(k), events_path(new_params), :id => v, :class => "btn btn-small #{'active' if params[:show] == v or (k == 'upcoming' && !params[:show])}"

  .btn-group{ :"data-toggle" => "buttons-radio" }
    = link_to events_path(:view => params[:view], :show => 'all'), :id => "show-events-all", :class => "btn #{'active' unless params[:my_events]}", :type => "button" do
      = t('.filters.all_events')
    - if user_signed_in?
      = link_to events_path(:view => params[:view], :my_events => true), :id => "show-events-mine", :class => "btn #{'active' if params[:my_events]}", :type => "button" do
        = t('.filters.my_events')

    = hidden_field_tag :event_filter_text


- if @events.count > 0
  - nav = page_navigation_links @events
  .content-block-header
    = nav unless nav.nil?
    #event-filter-result
      - your = t('.filters.your_events') if params[:my_events]
      - show = params[:show] || 'upcoming_events'
      - time = t(".filters.#{show}")
      %p
        = t('.filters.description', :your => your, :time => time.to_s)
        = t('.count', :count => @events.total_entries)

#events.content-block
  .content-block-middle.clearfix
    = icon_date
    = t('events.summary.your_time_info', time_zone: Time.zone.name)

  .content-block-middle.clearfix
    = render "list_view", :events => @events

- nav = page_navigation_links @events
- unless nav.nil?
  .content-block-footer= nav