ideasbugs 0.7.6 → 0.7.7

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: 659f5e82f9d21b72a031e45469050b6fe445d1fe84d651bcb4278cdf0d7b1593
4
- data.tar.gz: 4f528fa59bdadfcef7068a941946f278f1aa2364edc32a6c4584f9b4144d12c5
3
+ metadata.gz: e054b5c1fcb3a26c77783e54d044550ca8a395bad3189540451b79498e36fe0b
4
+ data.tar.gz: 567787250431c93054d02c0cca2a0366515138c35f9d2ac7a9ed87162d318d9f
5
5
  SHA512:
6
- metadata.gz: 5b4f1a43a56ba6886d0613a302b6fb0f1ca3aa50b72ecd948079c47adad26a6e8f08d59b45aef0171343a2c42518a3dc9b277a88596b2ec8f2a1cafd9204abf5
7
- data.tar.gz: a268ac3feb78f5ca3325141e4e7af87bd87fd60d0774d0df912fccd62a1a6f9ce2408c3e6e2fee0d3fd72f11c5ef7ae6d004c5b3a4b28b8ddf7ce67718de7ff9
6
+ metadata.gz: f8542b1c572317d929ae744c2caaeb2e0e59240ad68e740c290d3a15ab4761b9a55cf54b4332b6334667585f45603f9ce9444a3362ccc0a7762ab9c856ee330e
7
+ data.tar.gz: 8da898919668edb4d3f7d87e76e4223a295bea3374c8e7a355b446277ed08b8983606aecb81544ccf765e1640d26c34f01febaf447bc1950b0e1aa89a771e7fc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.7 (2026-08-01)
4
+
5
+ - Added `Ideasbugs::Seeds.load!` and a `rake ideasbugs:seed_demo` task that
6
+ create or refresh a small set of demo feedback records, so a freshly mounted
7
+ dashboard has realistic content to look at. Seeding is idempotent and
8
+ accepts an optional `tenant:`.
9
+
3
10
  ## 0.7.6 (2026-07-31)
4
11
 
5
12
  - Fixed the trusted publishing workflow by building and pushing the gem
data/README.md CHANGED
@@ -47,6 +47,16 @@ bin/rails db:migrate
47
47
  That's it. A floating **Feedback** button appears bottom-right; submissions
48
48
  land at `/feedback`.
49
49
 
50
+ Optional demo data:
51
+
52
+ ```bash
53
+ bin/rails ideasbugs:seed_demo
54
+ ```
55
+
56
+ It creates three idempotent sample submissions across the open, in-review, and
57
+ resolved states. Running the task again refreshes those records instead of
58
+ duplicating them.
59
+
50
60
  > [!IMPORTANT]
51
61
  > The dashboard defaults to **development only**. Set `authorize_admin` before
52
62
  > you deploy — see [Configure](#configure).
@@ -28,6 +28,7 @@ module Ideasbugs
28
28
  def post_install
29
29
  say "\nideasbugs installed. Run `rails db:migrate`, then add", :green
30
30
  say '`<%= ideasbugs_tag %>` before </body> in your layout.'
31
+ say 'Optional: run `bin/rails ideasbugs:seed_demo` for sample feedback.'
31
32
  say "Browse submissions at /feedback (development only until you set config.authorize_admin).\n"
32
33
  end
33
34
 
@@ -4,6 +4,10 @@ module Ideasbugs
4
4
  class Engine < ::Rails::Engine
5
5
  isolate_namespace Ideasbugs
6
6
 
7
+ rake_tasks do
8
+ load File.expand_path('../tasks/ideasbugs_tasks.rake', __dir__)
9
+ end
10
+
7
11
  initializer 'ideasbugs.helper' do
8
12
  ActiveSupport.on_load(:action_view) do
9
13
  include Ideasbugs::WidgetHelper
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ideasbugs
4
+ module Seeds
5
+ FEEDBACK = [
6
+ {
7
+ seed_id: 'checkout-error',
8
+ kind: 'bug',
9
+ section: 'Checkout',
10
+ message: 'The payment form shows "Something went wrong" after entering a valid card.',
11
+ status: 'open',
12
+ page_url: '/checkout',
13
+ author_label: 'Demo Customer'
14
+ },
15
+ {
16
+ seed_id: 'saved-filters',
17
+ kind: 'feature',
18
+ section: 'Reports',
19
+ message: 'It would save time if I could save this report filter and reuse it next week.',
20
+ status: 'in_review',
21
+ page_url: '/reports/revenue',
22
+ author_label: 'Demo Product Manager'
23
+ },
24
+ {
25
+ seed_id: 'export-confusing',
26
+ kind: 'other',
27
+ section: 'Settings',
28
+ message: 'The CSV export worked, but I expected the button to say when the file was ready.',
29
+ status: 'resolved',
30
+ page_url: '/settings/exports',
31
+ author_label: 'Demo Admin'
32
+ }
33
+ ].freeze
34
+
35
+ def self.load!(tenant: nil)
36
+ FEEDBACK.map do |attributes|
37
+ seed_id = attributes.fetch(:seed_id)
38
+ feedback = Ideasbugs::Feedback.find_or_initialize_by(
39
+ author_id: "ideasbugs-demo:#{seed_id}",
40
+ tenant: tenant.presence
41
+ )
42
+ seed_attributes = attributes.except(:seed_id).merge(
43
+ kind: kind_for(attributes.fetch(:kind)),
44
+ tenant: tenant.presence,
45
+ user_agent: 'ideasbugs demo seed'
46
+ )
47
+ feedback.assign_attributes(seed_attributes)
48
+ feedback.save!
49
+ feedback
50
+ end
51
+ end
52
+
53
+ def self.kind_for(preferred)
54
+ kinds = Ideasbugs.config.kinds.map(&:to_s)
55
+ return preferred if kinds.include?(preferred)
56
+ return kinds.first if kinds.any?
57
+
58
+ preferred
59
+ end
60
+ private_class_method :kind_for
61
+ end
62
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ideasbugs
4
- VERSION = '0.7.6'
4
+ VERSION = '0.7.7'
5
5
  end
data/lib/ideasbugs.rb CHANGED
@@ -4,6 +4,7 @@ require 'ideasbugs/version'
4
4
  require 'ideasbugs/configuration'
5
5
  require 'ideasbugs/widget'
6
6
  require 'ideasbugs/has_feedback'
7
+ require 'ideasbugs/seeds'
7
8
  require 'ideasbugs/engine'
8
9
 
9
10
  # In-app product feedback collection for Rails. A drop-in widget lets users
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :ideasbugs do
4
+ desc 'Create or refresh ideasbugs demo feedback'
5
+ task seed_demo: :environment do
6
+ feedback = Ideasbugs::Seeds.load!
7
+ puts "Seeded #{feedback.size} ideasbugs demo feedback records."
8
+ end
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ideasbugs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Shmarov
@@ -86,9 +86,11 @@ files:
86
86
  - lib/ideasbugs/dashboard.css
87
87
  - lib/ideasbugs/engine.rb
88
88
  - lib/ideasbugs/has_feedback.rb
89
+ - lib/ideasbugs/seeds.rb
89
90
  - lib/ideasbugs/version.rb
90
91
  - lib/ideasbugs/widget.js
91
92
  - lib/ideasbugs/widget.rb
93
+ - lib/tasks/ideasbugs_tasks.rake
92
94
  homepage: https://github.com/yshmarov/ideasbugs
93
95
  licenses:
94
96
  - MIT