diff --git a/app/models/account/seeder.rb b/app/models/account/seeder.rb index f2d01919e..989b56852 100644 --- a/app/models/account/seeder.rb +++ b/app/models/account/seeder.rb @@ -30,43 +30,71 @@ class Account::Seeder # --------------- # Bugs Collection # --------------- - bug_tracker = Collection.create!(name: "Bugs", creator: creator, all_access: true) + bug_tracker = Collection.create! name: "Bugs", creator: creator, all_access: true # Columns - triage_column = bug_tracker.columns.create!(name: "Triage", color: "#ef4444") - in_progress_column = bug_tracker.columns.create!(name: "In Progress", color: "#f97316") - resolved_column = bug_tracker.columns.create!(name: "Resolved", color: "#22c55e") + triage_column = bug_tracker.columns.create! name: "Triage", color: "#ef4444" + in_progress_column = bug_tracker.columns.create! name: "In Progress", color: "#f97316" + resolved_column = bug_tracker.columns.create! name: "Resolved", color: "#22c55e" # Cards - bug_tracker.cards.create!(creator: creator, column: triage_column, title: "Login button not responding on mobile", status: "published") - bug_tracker.cards.create!(creator: creator, column: triage_column, title: "Search results showing duplicates", status: "published") - profile_crash_card = bug_tracker.cards.create!(creator: creator, column: in_progress_column, title: "Profile page crashes when uploading large images", status: "published") - bug_tracker.cards.create!(creator: creator, column: in_progress_column, title: "Email notifications not being sent", status: "published") - bug_tracker.cards.create!(creator: creator, column: resolved_column, title: "Fix broken links in footer", status: "published") + bug_tracker.cards.create! creator: creator, column: triage_column, title: "Login button not responding on mobile", status: "published", description: <<~HTML +

Users are reporting that the login button is not responding on mobile devices.

+ +

Steps to reproduce:

+ + +

This appears to be affecting iOS devices primarily.

+ + + HTML + bug_tracker.cards.create! creator: creator, column: triage_column, title: "Search results showing duplicates", status: "published" + profile_crash_card = bug_tracker.cards.create! creator: creator, column: in_progress_column, title: "Profile page crashes when uploading large images", status: "published" + bug_tracker.cards.create! creator: creator, column: in_progress_column, title: "Email notifications not being sent", status: "published" + bug_tracker.cards.create! creator: creator, column: resolved_column, title: "Fix broken links in footer", status: "published" # Comments - profile_crash_card.comments.create!(creator: creator, body: "I can reproduce this with images over 5MB") - profile_crash_card.comments.create!(creator: creator, body: "Looking into adding client-side image compression before upload") + profile_crash_card.comments.create! creator: creator, body: "I can reproduce this with images over 5MB" + profile_crash_card.comments.create! creator: creator, body: "Looking into adding client-side image compression before upload" # ---------------------------- # Feature Requests Collection # ---------------------------- - feature_requests = Collection.create!(name: "Feature Requests", creator: creator, all_access: true) + feature_requests = Collection.create! name: "Feature Requests", creator: creator, all_access: true # Columns - backlog_column = feature_requests.columns.create!(name: "Backlog", color: "#6366f1") - planning_column = feature_requests.columns.create!(name: "Planning", color: "#8b5cf6") + backlog_column = feature_requests.columns.create! name: "Backlog", color: "#6366f1" + planning_column = feature_requests.columns.create! name: "Planning", color: "#8b5cf6" # Cards - feature_requests.cards.create!(creator: creator, column: backlog_column, title: "Add dark mode support", status: "published") - feature_requests.cards.create!(creator: creator, column: backlog_column, title: "Export data to CSV", status: "published") - feature_requests.cards.create!(creator: creator, column: backlog_column, title: "Add keyboard shortcuts for navigation", status: "published") - two_factor_card = feature_requests.cards.create!(creator: creator, column: planning_column, title: "Implement two-factor authentication", status: "published") - feature_requests.cards.create!(creator: creator, column: planning_column, title: "Add bulk actions for managing items", status: "published") + feature_requests.cards.create! creator: creator, column: backlog_column, title: "Add dark mode support", status: "published", description: <<~HTML +

Many users have requested a dark mode option for better usability in low-light environments.

+ +

Proposed features:

+ + +

This would improve accessibility and reduce eye strain for our users.

+ + + HTML + feature_requests.cards.create! creator: creator, column: backlog_column, title: "Export data to CSV", status: "published" + feature_requests.cards.create! creator: creator, column: backlog_column, title: "Add keyboard shortcuts for navigation", status: "published" + two_factor_card = feature_requests.cards.create! creator: creator, column: planning_column, title: "Implement two-factor authentication", status: "published" + feature_requests.cards.create! creator: creator, column: planning_column, title: "Add bulk actions for managing items", status: "published" # Comments - two_factor_card.comments.create!(creator: creator, body: "Should we support SMS and authenticator apps?") - two_factor_card.comments.create!(creator: creator, body: "Let's start with authenticator apps only to keep it simple") + two_factor_card.comments.create! creator: creator, body: "Should we support SMS and authenticator apps?" + two_factor_card.comments.create! creator: creator, body: "Let's start with authenticator apps only to keep it simple" end def delete_everything diff --git a/app/models/concerns/attachments.rb b/app/models/concerns/attachments.rb index f4328600e..1813e61e9 100644 --- a/app/models/concerns/attachments.rb +++ b/app/models/concerns/attachments.rb @@ -28,6 +28,14 @@ module Attachments attachments.any? end + def remote_images + rich_text_record&.body&.attachables&.grep(ActionText::Attachables::RemoteImage) || [] + end + + def has_remote_images? + remote_images.any? + end + private def rich_text_record @rich_text_record ||= begin diff --git a/app/views/action_text/attachables/_remote_image.html.erb b/app/views/action_text/attachables/_remote_image.html.erb new file mode 100644 index 000000000..174a95c5e --- /dev/null +++ b/app/views/action_text/attachables/_remote_image.html.erb @@ -0,0 +1,8 @@ +
+ <%= image_tag remote_image.url, width: remote_image.width, height: remote_image.height %> + <% if caption = remote_image.try(:caption) %> +
+ <%= caption %> +
+ <% end %> +
diff --git a/app/views/events/event/_attachments.html.erb b/app/views/events/event/_attachments.html.erb index 9a255e8cb..05b88e6ba 100644 --- a/app/views/events/event/_attachments.html.erb +++ b/app/views/events/event/_attachments.html.erb @@ -1,4 +1,4 @@ -<% if eventable&.has_attachments? %> +<% if eventable&.has_attachments? || eventable&.has_remote_images? %> <% eventable.attachments.each do |attachment| %> <% variant = Attachments::VARIANTS[:small] %> @@ -15,5 +15,9 @@ <% end %> <% end %> + + <% eventable.remote_images.each do |remote_image| %> + <%= image_tag remote_image.url, class: "attachment attachment--image", width: remote_image.width, height: remote_image.height, alt: remote_image.alt %> + <% end %> <% end %> diff --git a/lib/tasks/seed.rake b/lib/tasks/seed.rake index 97f28f233..31fada3a6 100644 --- a/lib/tasks/seed.rake +++ b/lib/tasks/seed.rake @@ -6,7 +6,7 @@ namespace :seed do tenant_id = args[:tenant_id].to_i ApplicationRecord.current_tenant = tenant_id account = Account.sole - Account::Seeder.new(account, User.first).seed! + Account::Seeder.new(account, User.active.first).seed! puts "✓ Seeded account #{account.name} (tenant: #{tenant_id})" end