tnantoka/wizu

View on GitHub
app/views/welcome/dashboard.html.slim

Summary

Maintainability
Test Coverage
- if @wikis.present?
  - @wikis.each_slice(4) do |wikis|
    .card-deck
      - wikis.each do |wiki|
        .card
          .card-block
            - if wiki.persisted?
              h4.card-title
                = link_to wiki.title, wiki
                small.text-muted= wiki_icon(wiki)
              - if wiki.content.present?
                p.card-text.markdown-body= wiki.summary(80).presence
              p.card-text
                small.text-muted
                  = t('.last_updated')
                  =< time_ago(wiki.updated_at)
              .btn-group.btn-group-sm
                = render 'wikis/links', page: wiki, item_class: 'btn btn-secondary', with_icon: true
            - else
              h4.card-title= link_to t('global.new_wiki'), :new_wiki
      - (4 - wikis.size).times do |i|
        .card.invisible
          .card-block
- else
  .card.card-block
    h4.card-title= t('.no_wiki_found')
    p.card-text
      = link_to t('global.new_wiki'), :new_wiki, class: 'card-link'