summaryrefslogtreecommitdiff
path: root/app/views/posts/_list.html.slim
blob: 64b68fcc8d6a860ac5ce7cf741ff2976b2bb98e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/ accepts :info_row (captured HTML) as a .block__content inserted between header and the image list itself,
  :header_links as content inserted in the header (inserted in the right corner),
  :random_image_href as the random image destination (default value is random_images_path, which is not always accurate)
ruby:
  page_layout :wide
  render_images ||= 'posts/display_posts'.freeze
  pagination = if posts.empty?
                 nil
               elsif @pagination_params
                 paginate(posts, **@pagination_params)
               else
                 paginate(posts)
               end

.block#imagelist_container
  section.block__header.flex
    h1.block__header__title.hide-mobile => header
    = pagination
    .flex__right
      = local_assigns[:header_links]
      a href=(local_assigns[:random_image_href] || search_path(q: '*', random_image: 'y')) title="Random Post"
        i.fa.fa-random
        span.hide-mobile.hide-limited-desktop<> Random Post
      - if current_user && (params[:hidden] == '1'.freeze)
        a href=url_for(params.permit!.merge(hidden: nil)) title='Hide Hidden Posts'
          i.fa.fa-eye-slash>
          span.hide-mobile.hide-limited-desktop Hide Hidden
      - elsif current_user
        a href=url_for(params.permit!.merge(hidden: '1'.freeze)) title='Show Hidden Posts'
          i.fa.fa-eye-slash>
          span.hide-mobile.hide-limited-desktop Show Hidden
      = toggle_deleted_images
      - if can? :batch_update, Tag
        a.js-batch-select href='#' title='Batch select posts on this page'
          i.fa.fa-object-group
          span.hide-mobile.hide-limited-desktop<> Batch
        a.js-batch-select-abort.hidden href='#'
          i.fa.fa-exclamation-triangle
          span.hide-mobile.hide-limited-desktop<> Abort
        a.js-batch-select-tag.hidden href='#'
          i.fa.fa-tags
          span.hide-mobile.hide-limited-desktop<> Tag
        - if can? :batch_delete, Post
          a.js-batch-select-delete.hidden href='#'
            i.fa.fa-trash
            span.hide-mobile.hide-limited-desktop<> Delete
      - if local_assigns[:dumpable] && can?(:manage, Post)
        a href=search_dump_path(params.permit(:q, :del)) title='Dump these results as JSON'
          i.fa.fa-file-export
          span.hide-mobile.hide-limited-desktop<> Dump
      - if local_assigns[:info_row]
        a href="#" data-click-toggle=".js-imagelist-info" title="More Info"
          i.fa.fa-info-circle
          span.hide-mobile.hide-limited-desktop<> More Info

  - if local_assigns[:info_row]
    = info_row

  .block__content.post-grid[class=(dense_thumbnails? ? 'post-grid--dense'.freeze : 'post-grid--whatever'.freeze)]
    = render partial: render_images, locals: { posts: posts }

  .block__header.block__header--light.flex
    = pagination
    span.block__header__title = pagination_info(posts)
    .flex__right
      a href='/settings/edit' title='Display Settings'
        i.fa.fa-cog
        span.hide-mobile.hide-limited-desktop<> Display Settings
      |
      =<> toggle_deleted_images