venus_media_library 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcec0bd91adffafd52e55f0eecca9146046813df1fdde5252affd856a4584bf8
4
- data.tar.gz: c84ee2c8fac6c7ac3faa00e7de4e4ae43ec4ab7bbb93b7213e466881e9ef8257
3
+ metadata.gz: ce5032a9127763374a274c46752c7160010d2427ea1c4bf079db43e02b85950c
4
+ data.tar.gz: 1d2956bd2a10b75a9b3b1a1c35226fdf43430f05bc63b970aa3c833039edc88b
5
5
  SHA512:
6
- metadata.gz: 15c65b27a87cc9e5e4b9d3d4e21050b3fcca50acffc9d0a36151f03b3d569a2cec51e15c9c1153454153518698ba189cb9f4c2bee54dd282305be2c5c60199f3
7
- data.tar.gz: c5631b4d32836f90b2e4eb90ec982e331b2ffef76f0dafbd819b5779259d17941e8277f548c56260d85750d5bbc2317eb543bae1ab223bdf56981b6eb4c8ca9d
6
+ metadata.gz: bb5c8d532bf99886edc8c2fa90c8c27c41e2bc375657c5ccaa6e615c9f684bedde843b8f288d66d149c54c63d04a640b880d08ae2aa2a1ef74703b8b40cfeb88
7
+ data.tar.gz: e4bcbb3d6d8bf262ce05d925106d86276b14317aeb019f969cf9f277a80d21b08c780e1c2871fce37e445ef1c75cf19b230cfb629a3721d3c3d17c12a351ee59
data/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ All notable changes to this project are documented here. The format is based on
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres
5
5
  to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.1.3] - 2026-08-19
8
+
9
+ ### Fixed
10
+ - The full-page library layout now links `layout.css` (left-nav) and `picker.css`
11
+ directly rather than the Sprockets `application.css` manifest, which does not
12
+ bundle `require_tree` under Propshaft — the default asset pipeline in modern
13
+ Rails. On Propshaft hosts the `/media` workspace rendered unstyled.
14
+
15
+ ## [1.1.2] - 2026-08-19
16
+
17
+ ### Changed
18
+ - The default admin predicate now recognises both the `admin?` **and**
19
+ `is_admin?` conventions (and returns non-admin for `nil`) instead of assuming
20
+ `admin?`. A host whose user model uses `is_admin?` no longer needs to set
21
+ `config.admin` just to avoid a `NoMethodError` from the role-gated library nav.
22
+ Any other scheme remains fully configurable via `config.admin`.
23
+
7
24
  ## [1.1.1] - 2026-08-19
8
25
 
9
26
  ### Fixed
@@ -4,12 +4,14 @@
4
4
  <title>Media library</title>
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
- <%= stylesheet_link_tag "venus_media_library/application", "venus_media_library/picker" %>
7
+ <%# Link each real stylesheet explicitly. application.css is a Sprockets
8
+ manifest (require_tree) that does NOT bundle under Propshaft — the default
9
+ pipeline in modern Rails — so referencing it alone leaves the layout
10
+ unstyled. Listing layout.css + picker.css works under both pipelines. %>
11
+ <%= stylesheet_link_tag "venus_media_library/layout", "venus_media_library/picker", media: "all" %>
8
12
  <%= javascript_include_tag "venus_media_library/venus_media_library", defer: true %>
9
13
 
10
14
  <%= yield :head %>
11
-
12
- <%= stylesheet_link_tag "venus_media_library/application", media: "all" %>
13
15
  </head>
14
16
  <body class="ml-body">
15
17
 
@@ -1,3 +1,3 @@
1
1
  module VenusMediaLibrary
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.3"
3
3
  end
@@ -62,6 +62,18 @@ module VenusMediaLibrary
62
62
  # does not enumerate a cloud bucket or expose storage-provider credentials.
63
63
  attr_accessor :cloud_assets
64
64
 
65
+ # Default admin predicate. A gem shouldn't break just because a host app names
66
+ # its flag differently, so try the two common conventions — `admin?` then
67
+ # `is_admin?` — and fall back to non-admin. Hosts with any other scheme set
68
+ # their own `config.admin = ->(user) { ... }`.
69
+ DEFAULT_ADMIN = lambda do |user|
70
+ return false if user.nil?
71
+ return !!user.admin? if user.respond_to?(:admin?)
72
+ return !!user.is_admin? if user.respond_to?(:is_admin?)
73
+
74
+ false
75
+ end
76
+
65
77
  def initialize
66
78
  @allowed_content_types = %w[image/png image/jpeg image/jpg image/gif image/webp image/svg+xml]
67
79
  @thumbnail_size = [ 300, 300 ]
@@ -71,7 +83,7 @@ module VenusMediaLibrary
71
83
  @url_type = :redirect
72
84
  @authenticate_with = nil
73
85
  @current_user = -> { current_user }
74
- @admin = ->(user) { user.admin? }
86
+ @admin = DEFAULT_ADMIN
75
87
  @asset_scope = ->(scope) { scope }
76
88
  @legacy_blob_scope = ->(scope) { scope.none }
77
89
  @static_assets = -> { [] }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: venus_media_library
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Good Works On Earth