mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
Smaller aircraft photos, one-row-per-item detail cards, push diagnostics
- Aircraft photos get 192px and 960x432 copies made on upload; the header, share page and Fleet cards use them (and the offline copies), instead of the full original. - Flight, engine data, component and major record details show one label and value per row on phones (wide items no longer add grid columns). - Profile re-records this device's push subscription on every visit, and says why if it can't; Send test delivers now and lists each device's result; Google's other push hosts are accepted; turning notifications on shows the browser's actual error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f314a13bb
commit
d4b71d17a1
21 files changed
+234
-96
No files matched your search
+12
-1
@@ -1,7 +1,12 @@
|
||||
class Aircraft < ApplicationRecord
|
||||
STATUSES = LabelSet.new("aircraft.statuses", %w[AVAILABLE MX GROUND UNAVAILABLE])
|
||||
|
||||
has_one_attached :picture
|
||||
# Small copies of the photo for the pages (the original can be several MB):
|
||||
# made when it's uploaded; see #picture_for.
|
||||
has_one_attached :picture do |picture|
|
||||
picture.variant :thumb, resize_to_fill: [ 192, 192 ], preprocessed: true
|
||||
picture.variant :card, resize_to_fill: [ 960, 432 ], preprocessed: true
|
||||
end
|
||||
|
||||
has_many :roles, class_name: "AircraftRole", dependent: :destroy
|
||||
has_many :users, through: :roles
|
||||
@@ -77,6 +82,12 @@ class Aircraft < ApplicationRecord
|
||||
events.create!(category: category, event_name: event_name, user: user, notes: notes)
|
||||
end
|
||||
|
||||
# The photo at a page's size (:thumb or :card), or the original when it
|
||||
# isn't a kind that can be resized.
|
||||
def picture_for(size)
|
||||
picture.variable? ? picture.variant(size) : picture
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def picture_is_image
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
class PushSubscription < ApplicationRecord
|
||||
# The browsers' push services. The server posts to the endpoint, so only
|
||||
# these hosts are accepted (not, say, an address inside the network).
|
||||
PUSH_SERVICES = /\A(fcm\.googleapis\.com|updates\.push\.services\.mozilla\.com|([\w-]+\.)*push\.apple\.com|([\w-]+\.)*notify\.windows\.com)\z/
|
||||
PUSH_SERVICES = /\A(([\w-]+\.)*googleapis\.com|([\w-]+\.)*google\.com|updates\.push\.services\.mozilla\.com|([\w-]+\.)*push\.apple\.com|([\w-]+\.)*notify\.windows\.com)\z/
|
||||
|
||||
belongs_to :user
|
||||
|
||||
|
||||
Reference in new issue
Block a user