rails_tipjar 1.0.1 → 1.0.4

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: 2acacf788da12d40f7f2b20ae9042e0adf416bb17475c20cd309a737120143fa
4
- data.tar.gz: ed97fb19a2935a38bc26c29c86be548c1d33a08c33081dfc336e88af83957a36
3
+ metadata.gz: a9ed6ef66307fcfc411261085d63d47db03e5b1eec57c18ac9ce09d00e2b9b88
4
+ data.tar.gz: 8206ee7011c23b59e0038ac580e8fe732cedc9c4fb5e284876b895c965c96eb1
5
5
  SHA512:
6
- metadata.gz: 604ce459a6e71e0b16aef786e0c146b01c3fe4805dbf3fbf880e8df105168520b8fe967dbc8dd195a6efd16622cf0be56c9edee722073e9fb88873b293f5563c
7
- data.tar.gz: 9adf68a419979b2d4e5e8a96d3ec92a0cf4135e074cf4c03c6d17879d056cbd08861d12b5e1561a5436c7af5d4f7d668279b3976684f65fb6e4fa5f117a67b20
6
+ metadata.gz: f604fb762bd7950cf3d4eca97b1a98f956910b4239330a1d49e2a1c1ae6ea245bc9b954e1a7fcb0ffb06c798feafcaaaabb1208a09384ac47c0189fdeacc36f4
7
+ data.tar.gz: afaad68332124f981074c91c9e95e1ee144a1ba75b05d0b26b0e7f1cc3d0d0aaaaa1eed42b6e536cbff16b4b4e488eb1ea27831a98ddc7f907201703c497a9b4
data/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  A reusable, customizable tip jar feature for Rails applications. Add a beautiful tip jar to any Rails app with just a few lines of code! Works with any payment provider - Stripe, PayPal, Buy Me a Coffee, Ko-fi, or any custom payment link.
4
4
 
5
+ Hat example:
6
+ |Standard|Hovered|
7
+ |--------|-------|
8
+ |<img width="63" height="66" alt="Screenshot 2025-09-12 at 10 22 51 AM" src="https://github.com/user-attachments/assets/56ebad46-ce77-4a26-8d93-525ecea8ef6a" />|<img height="66" alt="Screenshot 2025-09-12 at 10 20 50 AM" src="https://github.com/user-attachments/assets/beebe18e-a5bb-486b-835b-0caf18813781" />|
9
+
5
10
  ## Features
6
11
 
7
12
  - 🎨 Customizable floating button with multiple icon options (coffee, heart, star, dollar, jar)
@@ -11,7 +16,6 @@ A reusable, customizable tip jar feature for Rails applications. Add a beautiful
11
16
  - 📱 Fully responsive design with inline styles (no CSS dependencies)
12
17
  - 🎯 Multiple positioning options (bottom-right, bottom-left, top-right, top-left)
13
18
  - 🌙 Light/Dark theme support for modal
14
- - 📊 Built-in analytics tracking
15
19
  - ⚡ Stimulus.js powered interactions
16
20
  - 🔧 Zero configuration to get started
17
21
  - 🚀 Simple mode: Direct link without modal
@@ -34,21 +38,12 @@ Add this gem to your Rails application's Gemfile:
34
38
  # From RubyGems
35
39
  gem 'rails_tipjar'
36
40
 
37
- # Or from GitHub for latest features
38
- gem 'rails_tipjar', git: 'https://github.com/justinpaulson/rails_tipjar'
39
- ```
40
-
41
41
  Then execute:
42
42
 
43
43
  ```bash
44
44
  bundle install
45
45
  ```
46
46
 
47
- Optionally run the generator (only needed for backwards compatibility with v0.3.0 and earlier):
48
- ```bash
49
- rails generate tipjar:install
50
- ```
51
-
52
47
  ## Quick Start
53
48
 
54
49
  ### 1. Create Payment Links
@@ -79,7 +74,7 @@ Add directly to any view:
79
74
  <!-- With all customization options -->
80
75
  <%= tip_jar payment_link: 'https://your.payment.link',
81
76
  message: 'Support This Project', # Text shown on hover
82
- icon: :heart, # :coffee, :heart, :star, :dollar, :jar, or custom SVG
77
+ icon: :heart, # :coffee, :heart, :star, :dollar, :jar, :hat, or custom SVG
83
78
  position: :bottom_right, # :bottom_right, :bottom_left, :top_right, :top_left
84
79
  color: '#8b5cf6', # Button background color
85
80
  text_color: '#ffffff', # Button text color
@@ -104,8 +99,7 @@ Add directly to any view:
104
99
  { amount: 10, label: '$10', default: true },
105
100
  { amount: 25, label: '$25', default: false }
106
101
  ],
107
- theme: :light, # :light, :dark, :auto
108
- analytics_enabled: true %>
102
+ theme: :light %> # :light, :dark, :auto
109
103
 
110
104
  <!-- Force modal mode with single link -->
111
105
  <%= tip_jar payment_link: 'https://your.payment.link',
@@ -125,7 +119,7 @@ Add to `app/views/layouts/application.html.erb`:
125
119
  </head>
126
120
  <body>
127
121
  <%= yield %>
128
-
122
+
129
123
  <!-- Add floating tip jar button -->
130
124
  <%= tip_jar payment_link: 'https://your.payment.link',
131
125
  position: :bottom_right %>
@@ -135,10 +129,6 @@ Add to `app/views/layouts/application.html.erb`:
135
129
 
136
130
  That's it! You now have a working tip jar on your site.
137
131
 
138
- ## Helper Options
139
-
140
- All configuration is done directly in the view helper:
141
-
142
132
  ### Common Options
143
133
 
144
134
  | Option | Description | Default | Values |
@@ -146,7 +136,7 @@ All configuration is done directly in the view helper:
146
136
  | `payment_link` | Single payment URL for simple mode | - | URL string |
147
137
  | `payment_links` | Hash of payment URLs for modal mode | - | Hash with keys like `:small`, `:medium`, `:large` |
148
138
  | `message` / `button_text` | Text shown on button (on hover) | `"Tip Jar"` | String |
149
- | `icon` | Button icon | `:jar` | `:coffee`, `:heart`, `:star`, `:dollar`, `:jar`, or custom SVG |
139
+ | `icon` | Button icon | `:jar` | `:coffee`, `:heart`, `:star`, `:dollar`, `:jar`, `:hat`, or custom SVG |
150
140
  | `position` | Button position on screen | `:bottom_right` | `:bottom_right`, `:bottom_left`, `:top_right`, `:top_left` |
151
141
  | `color` | Button background color | `"#3b82f6"` | Hex color string |
152
142
  | `text_color` | Button text color | `"#ffffff"` | Hex color string |
@@ -163,7 +153,6 @@ All configuration is done directly in the view helper:
163
153
  | `modal_description` | Modal description text | `"Your support helps..."` |
164
154
  | `theme` | Modal color theme | `:light` |
165
155
  | `custom_amounts` | Array of amount options | See example below |
166
- | `analytics_enabled` | Track user interactions | `false` |
167
156
 
168
157
  ### Custom Amounts Example
169
158
 
@@ -175,36 +164,6 @@ custom_amounts: [
175
164
  { amount: 50, label: "$50", default: false }
176
165
  ]
177
166
 
178
- ## Additional Helpers
179
-
180
- ### Custom Tip Links
181
-
182
- ```erb
183
- <!-- Create a custom tip link (requires initializer config) -->
184
- <%= tipjar_link "Support this project", amount: :large %>
185
-
186
- <!-- With custom styling -->
187
- <%= tipjar_link "Tip $5", amount: :small, class: "btn btn-primary" %>
188
- ```
189
-
190
- ### Modal Only
191
-
192
- ```erb
193
- <!-- Render just the modal (for custom triggers) -->
194
- <%= tipjar_modal %>
195
- ```
196
-
197
- ## Backwards Compatibility
198
-
199
- If you're upgrading from v0.3.0 or earlier and want to keep using the initializer-based configuration:
200
-
201
- ```erb
202
- <!-- Use the deprecated tipjar_button helper -->
203
- <%= tipjar_button %>
204
- ```
205
-
206
- This requires having a `config/initializers/tipjar.rb` file. We recommend migrating to the new `tip_jar` helper with inline options for easier customization.
207
-
208
167
  ## Styling
209
168
 
210
169
  As of v0.2.0, the gem is fully self-contained with inline styles - no external CSS required! The button works out of the box without any app-side styling.
@@ -236,20 +195,6 @@ As of v0.2.0, the gem is fully self-contained with inline styles - no external C
236
195
  .tipjar-submit-button { }
237
196
  ```
238
197
 
239
- ## Analytics
240
-
241
- When `analytics_enabled` is true, the following events are tracked:
242
-
243
- - `tipjar_loaded` - Button loaded on page
244
- - `tipjar_modal_opened` - User opened the modal
245
- - `tipjar_amount_selected` - User selected an amount
246
- - `tipjar_submitted` - User clicked to proceed to payment
247
-
248
- Works automatically with:
249
- - Google Analytics 4 (gtag)
250
- - Plausible Analytics
251
- - Custom events via `document.addEventListener('tipjar:event', ...)`
252
-
253
198
  ## Development
254
199
 
255
200
  After checking out the repo:
@@ -267,17 +212,21 @@ gem 'rails_tipjar', path: '../path/to/rails_tipjar'
267
212
 
268
213
  ## Icon Options
269
214
 
270
- The gem includes 5 built-in icons:
215
+ The gem includes 6 built-in icons:
271
216
  - `:jar` - Tip jar with animated coin (default)
272
- - `:coffee` - Coffee cup
217
+ - `:coffee` - Coffee cup with steam animation
273
218
  - `:heart` - Heart shape
274
219
  - `:star` - Star
275
220
  - `:dollar` - Dollar sign in circle
221
+ - `:hat` - Upside-down busker hat with animated coin drop
276
222
 
277
223
  You can also provide a custom SVG string for complete customization.
278
224
 
279
225
  ## Version History
280
226
 
227
+ - **v1.0.4** - Fixed Safari animation rendering issue with black backgrounds (added fill to animated coins)
228
+ - **v1.0.3** - Removed deprecated features: analytics, backwards compatibility helpers (tipjar_button, tipjar_link, tipjar_modal), and generators
229
+ - **v1.0.2** - Added new `:hat` icon option (busker-style upside-down hat with animated coin drop)
281
230
  - **v1.0.1** - Changed default button text to "Tip Jar" and default icon to jar
282
231
  - **v1.0.0** - Stable release with all configuration in view helper options (no initializer needed!)
283
232
  - **v0.3.0** - Made payment provider agnostic (works with any payment link service)
@@ -286,30 +235,10 @@ You can also provide a custom SVG string for complete customization.
286
235
  - **v0.2.0** - Made gem fully self-contained with inline styles
287
236
  - **v0.1.0** - Initial release
288
237
 
289
- ## Troubleshooting
290
-
291
- ### Button not appearing
292
-
293
- 1. Check that `<%= tipjar_button %>` is in your layout
294
- 2. Verify Stimulus is working in your app
295
- 3. Check browser console for JavaScript errors
296
-
297
- ### Modal not opening (modal mode only)
298
-
299
- 1. Ensure Stimulus controller is registered
300
- 2. Verify no z-index conflicts with your existing styles
301
- 3. Make sure `use_modal = true` if using single payment_link
302
-
303
- ### Payment links not working
304
-
305
- 1. Ensure your payment links are active with your provider
306
- 2. Check that URLs are correctly configured in initializer
307
- 3. Test links directly in browser
308
-
309
238
  ## Contributing
310
239
 
311
240
  Bug reports and pull requests are welcome on GitHub at https://github.com/justinpaulson/rails_tipjar.
312
241
 
313
242
  ## License
314
243
 
315
- The gem is available as open source under the terms of the MIT License.
244
+ The gem is available as open source under the terms of the MIT License.
@@ -25,7 +25,6 @@ module TipjarHelper
25
25
  { amount: 25, label: "$25", default: false },
26
26
  { amount: 50, label: "$50", default: false }
27
27
  ]
28
- analytics_enabled = options[:analytics_enabled] || false
29
28
 
30
29
  # Ensure color has # prefix
31
30
  color = "##{color}" unless color.start_with?('#')
@@ -45,7 +44,6 @@ module TipjarHelper
45
44
  custom_amounts: custom_amounts,
46
45
  button_class: custom_class,
47
46
  z_index: z_index,
48
- analytics_enabled: analytics_enabled,
49
47
  color: color,
50
48
  text_color: text_color,
51
49
  pulse: pulse
@@ -68,35 +66,6 @@ module TipjarHelper
68
66
  raise ArgumentError, "You must provide either :payment_link or :payment_links option to tip_jar helper"
69
67
  end
70
68
  end
71
-
72
- # Deprecated - kept for backwards compatibility
73
- def tipjar_button(options = {})
74
- config = RailsTipjar.config if defined?(RailsTipjar)
75
-
76
- if config && (config.payment_link || config.payment_links.any?)
77
- # Use config from initializer for backwards compatibility
78
- tip_jar(
79
- payment_link: config.payment_link,
80
- payment_links: config.payment_links.any? ? config.payment_links : nil,
81
- use_modal: config.use_modal,
82
- position: options[:position] || config.position,
83
- icon: config.icon,
84
- button_text: config.button_text,
85
- color: config.color,
86
- text_color: config.text_color,
87
- pulse: config.pulse,
88
- z_index: options[:z_index] || config.z_index,
89
- class: options[:class] || config.button_class,
90
- modal_title: config.modal_title,
91
- modal_description: config.modal_description,
92
- custom_amounts: config.custom_amounts,
93
- theme: config.theme,
94
- analytics_enabled: config.analytics_enabled
95
- )
96
- else
97
- raise ArgumentError, "tipjar_button requires configuration. Use tip_jar helper with options instead."
98
- end
99
- end
100
69
 
101
70
  private
102
71
 
@@ -149,8 +118,7 @@ module TipjarHelper
149
118
  tipjar_theme_value: options[:theme],
150
119
  tipjar_modal_title_value: options[:modal_title],
151
120
  tipjar_modal_description_value: options[:modal_description],
152
- tipjar_custom_amounts_value: options[:custom_amounts].to_json,
153
- tipjar_analytics_enabled_value: options[:analytics_enabled]
121
+ tipjar_custom_amounts_value: options[:custom_amounts].to_json
154
122
  } do
155
123
  render partial: "tipjar/button", locals: {
156
124
  position: options[:position],
@@ -194,38 +162,6 @@ module TipjarHelper
194
162
  end
195
163
  end
196
164
 
197
- def tipjar_link(text = nil, options = {})
198
- config = RailsTipjar.config
199
- text ||= config.button_text
200
- amount = options[:amount] || :medium
201
-
202
- link_url = if amount.is_a?(Symbol)
203
- config.payment_links[amount]
204
- else
205
- config.payment_links[:custom] || config.payment_links[:medium]
206
- end
207
-
208
- link_options = {
209
- target: "_blank",
210
- rel: "noopener",
211
- class: "tipjar-link #{options[:class]}",
212
- data: {
213
- tipjar_amount: amount,
214
- tipjar_analytics: config.analytics_enabled
215
- }
216
- }
217
-
218
- link_to text, link_url, link_options.merge(options.except(:amount, :class))
219
- end
220
-
221
- def tipjar_modal(options = {})
222
- config = RailsTipjar.config
223
-
224
- render partial: "tipjar/modal", locals: {
225
- config: config,
226
- options: options
227
- }
228
- end
229
165
 
230
166
  def config_position_classes(position)
231
167
  case position
@@ -355,7 +291,60 @@ module TipjarHelper
355
291
  <ellipse cx="13" cy="19" rx="1.3" ry="0.4" stroke-linecap="round"/>
356
292
  <!-- Falling coin - starts above jar outside -->
357
293
  <g class="tipjar-coin-drop-new">
358
- <ellipse cx="12" cy="1.5" rx="1.5" ry="0.5" stroke-linecap="round"/>
294
+ <ellipse cx="12" cy="1.5" rx="1.5" ry="0.5" stroke-linecap="round" fill="currentColor"/>
295
+ </g>
296
+ </svg>'
297
+ when :hat
298
+ '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
299
+ <defs>
300
+ <style>
301
+ @keyframes hat-coin-drop {
302
+ 0% {
303
+ transform: translateY(0px);
304
+ opacity: 0;
305
+ }
306
+ 10% {
307
+ opacity: 1;
308
+ transform: translateY(1px);
309
+ }
310
+ 50% {
311
+ transform: translateY(8px);
312
+ opacity: 1;
313
+ }
314
+ 80% {
315
+ transform: translateY(13px);
316
+ opacity: 1;
317
+ }
318
+ 100% {
319
+ transform: translateY(14px);
320
+ opacity: 0;
321
+ }
322
+ }
323
+ .hat-coin-drop {
324
+ animation: hat-coin-drop 2.5s ease-in infinite;
325
+ }
326
+ </style>
327
+ </defs>
328
+ <!-- Upside down fedora/trilby style hat -->
329
+ <!-- Wide brim at top (since upside down) -->
330
+ <ellipse cx="12" cy="8" rx="9" ry="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>
331
+ <!-- Brim edge detail -->
332
+ <path stroke-linecap="round" stroke-linejoin="round" fill="none" d="M3 8c0 0.5 0 0.5 0 0.5"/>
333
+ <path stroke-linecap="round" stroke-linejoin="round" fill="none" d="M21 8c0 0.5 0 0.5 0 0.5"/>
334
+ <!-- Crown of hat (narrower at bottom) -->
335
+ <path stroke-linecap="round" stroke-linejoin="round" fill="none" d="M6.5 8.5c0 0 0.5 8 1.5 9.5c0.5 0.75 1.5 1 4 1s3.5-0.25 4-1c1-1.5 1.5-9.5 1.5-9.5"/>
336
+ <!-- Inner opening visible from top -->
337
+ <ellipse cx="12" cy="9" rx="5.5" ry="1.3" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.4"/>
338
+ <!-- Hat crease/pinch detail -->
339
+ <path stroke-linecap="round" stroke-linejoin="round" fill="none" d="M10 10c0 0 0.2 5 0.3 6" opacity="0.3"/>
340
+ <path stroke-linecap="round" stroke-linejoin="round" fill="none" d="M14 10c0 0 -0.2 5 -0.3 6" opacity="0.3"/>
341
+ <!-- Coins sitting in the hat -->
342
+ <ellipse cx="11" cy="16" rx="1.3" ry="0.4" stroke-linecap="round" fill="none"/>
343
+ <ellipse cx="13" cy="15.5" rx="1.3" ry="0.4" stroke-linecap="round" fill="none"/>
344
+ <ellipse cx="12" cy="17" rx="1.2" ry="0.35" stroke-linecap="round" fill="none"/>
345
+ <!-- Animated falling coin -->
346
+ <g class="hat-coin-drop">
347
+ <ellipse cx="12" cy="3" rx="1.5" ry="0.5" stroke-linecap="round" fill="currentColor"/>
359
348
  </g>
360
349
  </svg>'
361
350
  else
data/blog_post.md ADDED
@@ -0,0 +1,28 @@
1
+ # Content Busking: The Ad-Free Revolution We've Been Waiting For! 💎
2
+
3
+ Forget everything you know about monetizing your Rails apps – there's a new sheriff in town, and it's bringing busking into the digital age! Rails Tip Jar is the gem that's about to change how we support our favorite developers and content creators. No more intrusive pop-ups, no more tracking cookies, no more selling your soul (and your users' data) to the ad networks. Just a simple, elegant tip button that lets your grateful users show their appreciation with cold, hard cash!
4
+
5
+ I'm all in on this tipping revolution, folks. Every time I see this little tip jar icon on a website, my wallet will be unloading itself. Why? Because I know my money is going directly to the developer who put in the work (assuming they aren't also bombarding me with ads). It's personal, it's direct, and it feels *good*. Plus, let's be real – tipping culture isn't going anywhere in the USA, so we might as well embrace it in the digital realm as well! Plus, [no taxes on tips](https://www.congress.gov/bill/119th-congress/senate-bill/129) right??
6
+
7
+ The installation is dead simple – just `gem install rails_tipjar`, add a single line to your view, and boom, you're ready to receive the gratitude of the internet. No lengthy terms of service, no revenue sharing agreements, no minimum payout thresholds. Just pure, unadulterated tips flowing directly to you. Long live the tip jar, long live the independent developer, and long live the ad-free internet we all deserve! 🎉
8
+
9
+ ## Quick Setup Guide
10
+
11
+ Getting started with [Rails Tip Jar](https://rubygems.org/gems/rails_tipjar) takes literally 30 seconds:
12
+
13
+ 1. Add to your Gemfile: `gem 'rails_tipjar'`
14
+ 2. Run `bundle install`
15
+ 3. Drop this line wherever you want tips: `<%= tip_jar payment_link: 'https://your.payment.link' %>`
16
+
17
+ That's it! No configuration files, no initializers, nothing. Want to customize it? Just pass options directly:
18
+
19
+ ```erb
20
+ <%= tip_jar payment_link: 'https://your.payment.link',
21
+ message: 'Support my work', # Custom button text (default: "Tip Jar")
22
+ icon: :heart, # Choose from 5 icons
23
+ color: '#8b5cf6', # Custom colors
24
+ pulse: true, # Pulsing animation
25
+ position: :bottom_left %> # Position on screen
26
+ ```
27
+
28
+ The gem handles all the payment provider integration (works with Stripe, PayPal, Ko-fi, Buy Me a Coffee – literally any payment link), and includes beautiful inline styles so it looks perfect out of the box. No CSS dependencies, no JavaScript frameworks needed – just pure Rails helper goodness.