Class: VenusMediaLibrary::PickersController

Inherits:
ApplicationController show all
Includes:
ImagesHelper
Defined in:
app/controllers/venus_media_library/pickers_controller.rb

Overview

Renders the picker modal body as a Turbo Frame. target is the DOM id of the host input that a chosen asset's URL / signed_id is written into. accept carries the opening field's accepted content types so the modal can filter which assets are selectable and constrain uploads. category selects which asset collection (images / legacy / static / cloud / community) to show; each category is a tab that reloads this same frame.

Constant Summary collapse

CATEGORIES =

Selectable asset collections, in tab order. Legacy is admin-only, mirroring the LegacyAssetsController gate, so the picker never offers it to members.

[
  { key: "library",   label: "Images" },
  { key: "legacy",    label: "Legacy",    admin: true },
  { key: "static",    label: "Static" },
  { key: "cloud",     label: "Cloud" },
  { key: "community", label: "Community" }
].freeze

Instance Method Summary collapse

Methods included from ImagesHelper

#ml_blob_url, #ml_image_payload, #ml_previewable?, #ml_thumb_url

Instance Method Details

#showObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/venus_media_library/pickers_controller.rb', line 21

def show
  @target   = params[:target].to_s
  @category = requested_category
  @accepted = picker_accepted_types
  @accept_attr = picker_input_accept
  @tabs     = picker_tabs
  @items    = picker_items

  render partial: "venus_media_library/pickers/picker",
         locals: {
           target: @target, category: @category, accept: params[:accept].to_s.presence,
           accept_attr: @accept_attr, tabs: @tabs, items: @items,
           page: @page, has_more: @has_more
         },
         layout: false
end