ugtastic/uglst

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

Summary

Maintainability
Test Coverage
= content_for(:rss) do
  = auto_discovery_link_tag(:rss, user_groups_url(format: :rss))

= content_for(:breadcrumb) do
  %li User-Groups

= content_for :twitter_card do
  %meta{content: "summary", name: "twitter:card"}
  %meta{content: "@uglst", name: "twitter:site"}
  %meta{content: "User-Group List", name: "twitter:title"}
  %meta{content: "Discover User-Group community in your backyard and around the world on UGl.st", name: "twitter:description"}
  %meta{content: "@uglst", name: "twitter:creator"}
  %meta{content: "https://pbs.twimg.com/profile_images/2343634389/isvctl4ndfajfittw3px.png", name: "twitter:image:src"}
  %meta{content: "https://ugl.st", name: "twitter:domain"}

- if @user_groups.empty?
  %h3 Uh, oh! Looks like there are no User-Groups registered!

- row_length = 3
- placeholder_shown = false
- @user_groups.in_groups_of(row_length) do |row|
  .row
    - row.each do |user_group|
      - if user_group
        .col-lg-4
          .well(style="height: 264px; position: relative;")
            = link_to user_group, class: 'pull-left' do
              = image_tag user_group.logo.present? ? user_group.logo_url : 'user_group_avatar_fallback.png', class: 'media-object', style: 'max-height: 96px; max-width: 96px; padding-right: 8px; padding-bottom: 4px;'
            %h4= user_group.name
            %p.description
              = Sanitize.clean(user_group.description, Sanitize::Config::BASIC).truncate(144)
            %div(style="text-align: right; position: absolute; bottom: 16px; right: 16px;")
              = link_to user_group, class: 'btn btn-default' do
                %span.glyphicons.zoom_in
                Full Profile
      - else
        - unless placeholder_shown
          - placeholder_shown = true
          - placeholder_span = row_length - row.compact.length
          - if placeholder_span == 1
            .col-lg-4
              .well(style="height: 264px; position: relative;")
                %h2.text-center YOUR USER-GROUP HERE!
                %p.description
                  <strong>YOU</strong> can increase your User-Group's social footprint by adding them to User-Group List. Click to add them now. It's free and quick!
                %div(style="text-align: right; position: absolute; bottom: 16px; right: 16px;")
                  = link_to new_user_group_path, class: 'btn btn-info', style: 'color: white; font-weight: bold' do
                    %span.glyphicons.plus
                    Register your User-Group!
          - elsif placeholder_span == 2
            .col-lg-8
              .well(style="height: 264px; position: relative;")
                %h2.text-center THIS COULD BE YOUR USER-GROUP!
                %p.description
                  <strong>YOU</strong> can increase your User-Group's social footprint by adding them to User-Group List. Click the button and register your favorite User-Group (or more) in seconds.
                %p.description
                  You only need to be a friend of your favorite User-Group to register it on User-Group List. Organizers are welcome to claim the UG later.
                %div(style="text-align: right; position: absolute; bottom: 16px; right: 16px;")
                  = link_to new_user_group_path, class: 'btn btn-info', style: 'color: white; font-weight: bold' do
                    %span.glyphicons.plus
                    Click and add your favorite User-Group!

.row.text-center
  = paginate @user_groups