bullet_train 1.36.0 → 1.37.1

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: 5c1d33c15093050889618d0a58e53899f22dbbee55e6792adad049b36107eec6
4
- data.tar.gz: a7a547ddbb60545ee9b2f37e984aa1b293a84ddd231a3233542ea85e5a2c5a61
3
+ metadata.gz: 1dabb35a975775f9912af481e118c8e7a500e0ae622c10f50e999a2f22a86482
4
+ data.tar.gz: 946f16163a0e7a71530f7d4ce9cf71c593b1251fa9e4b2e645d023a048ba8917
5
5
  SHA512:
6
- metadata.gz: dafe1f7e4ec075acbd7fd8417a2080b7dc51c496eaf2b8d3b63e14262d9a43b2bce61e8ed8b42678688ba48c4346026c2ae3ce87e4b778532e7bec7931dab8e7
7
- data.tar.gz: f25805b74ba7e7f77ccadfe2404350a312f6de5d4f223b4940f8a881c5017cccc4aa2d348fa9fca3acd3a247d2fd9b994b85dfa63b1d0c46727ee683ea85e9e8
6
+ metadata.gz: 6f4d1a1cafc2d2087fea34ce131b809e154ee9a61d2fe42c9d0fcffd97ccbe7ef25a74d867ae77f780d70e06050ff94dc2c4a6af5ece94ece67179bcba0bb0e3
7
+ data.tar.gz: 1987c53b1c4d33badb48edf8202aba6d1d0a882f2e2df2863976d61960b48e2e31feb4ef6f0ba5dda980e8ad64744315a0c4f8cc0a78a98da2288ecba5725588
@@ -0,0 +1,29 @@
1
+ <figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
2
+ <% if blob.video? %>
3
+ <video controls width="<%= local_assigns[:in_gallery] ? 800 : 1024 %>" preload="metadata" class="max-w-full h-auto rounded-md"
4
+ poster="<%= url_for(blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ])) %>"
5
+ >
6
+ <source src="<%= rails_blob_url(blob) %>" type="<%= blob.content_type %>">
7
+ </video>
8
+ <% elsif blob.representable? %>
9
+ <%
10
+ # loader_options are passed through to lib-vips: https://www.libvips.org/API/current/ctor.Image.gifload.html
11
+ # By default the loader uses page = 1, and n = 1 to pick just the first "page" (aka frame) of a GIF.
12
+ # We pass -1 for n to indicate that it should pull all the frames and give us a scaled verison of the whole GIF.
13
+ loader_options = {}
14
+ if blob.filename.extension.casecmp("gif")
15
+ loader_options[:n] = -1
16
+ end
17
+ %>
18
+ <%= image_tag blob.representation(loader: loader_options, resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
19
+ <% end %>
20
+
21
+ <figcaption class="attachment__caption">
22
+ <% if caption = blob.try(:caption) %>
23
+ <%= caption %>
24
+ <% else %>
25
+ <span class="attachment__name"><%= blob.filename %></span>
26
+ <span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
27
+ <% end %>
28
+ </figcaption>
29
+ </figure>
@@ -0,0 +1,3 @@
1
+ <div class="trix-content">
2
+ <%= yield -%>
3
+ </div>
@@ -0,0 +1,15 @@
1
+ # This is to render previews for video attachments in Action Text
2
+ # Source: https://mileswoodroffe.com/articles/action-text-video-support
3
+ #
4
+ # NOTE: This is all way more verbose that I'd like it to be. Maybe we can
5
+ # slim it down if this Rails issue is ever fixed:
6
+ # https://github.com/rails/rails/issues/54478
7
+ Rails.application.config.after_initialize do
8
+ default_allowed_attributes = Rails::HTML5::Sanitizer.safe_list_sanitizer.allowed_attributes + ActionText::Attachment::ATTRIBUTES.to_set
9
+ custom_allowed_attributes = Set.new(%w[controls poster type])
10
+ ActionText::ContentHelper.allowed_attributes = (default_allowed_attributes + custom_allowed_attributes).freeze
11
+
12
+ default_allowed_tags = Rails::HTML5::Sanitizer.safe_list_sanitizer.allowed_tags + Set.new([ActionText::Attachment.tag_name, "figure", "figcaption"])
13
+ custom_allowed_tags = Set.new(%w[audio video source])
14
+ ActionText::ContentHelper.allowed_tags = (default_allowed_tags + custom_allowed_tags).freeze
15
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # We're using this monkey patch: https://github.com/rails/rails/pull/39113#issuecomment-1729082686
4
+ # To work around this long-standing bug: https://github.com/rails/rails/issues/38027
5
+ # If PR #39113 is ever merged and released in Rails we can ditch this entire file.
6
+
7
+ require "active_support/core_ext/object/try"
8
+ module ActionText
9
+ module Attachments
10
+ module TrixConversion
11
+ def to_trix_attachment(content = trix_attachment_content)
12
+ attributes = full_attributes.dup
13
+ attributes["content"] = content if content
14
+ attributes["url"] = trix_attachable_url if previewable_attachable? && previewable?
15
+ TrixAttachment.from_attributes(attributes)
16
+ end
17
+
18
+ def trix_attachable_url
19
+ Rails.application.routes.url_helpers.rails_blob_url(preview_image.blob, only_path: true)
20
+ end
21
+ end
22
+ end
23
+ end
data/docs/stylesheets.md CHANGED
@@ -13,4 +13,8 @@ You can eject only the theme files you wish to override or you can eject the who
13
13
 
14
14
  To add your own custom CSS, add to the `app/assets/stylesheets/application.css` file found in your app. In this file, you'll be able to use Tailwind `@apply` directives and add `@import` statements to include the CSS from third-party `npm` packages.
15
15
 
16
- For further modifications to the theme's style sheet (for example, to change the order in which base Tailwind stylesheets are included), you can eject the theme's css by using the command `rake bullet_train:themes:light:eject_css`.
16
+ For further modifications to the theme's style sheet (for example, to change the order in which base Tailwind stylesheets are included), you can eject the theme's css by using the command `rake bullet_train:themes:light:eject_css`.
17
+
18
+ ## Using Custom Fonts
19
+
20
+ For information on customizing fonts in your application, see the [Customizing Fonts](/docs/themes.md#customizing-fonts) section in the Themes documentation.
data/docs/themes.md CHANGED
@@ -52,6 +52,52 @@ themeConfig.theme.extend.colors = ({colors}) => ({
52
52
  Here you need to include `primary` and `secondary` as well as `base`. The settings in `tailwind.config.js` will **mostly** clobber the settings
53
53
  in `theme.rb`, but not entirely. So for the best results you should make sure that those two files agree about the primary and secondary colors.
54
54
 
55
+ ## Customizing Fonts
56
+
57
+ By default, Bullet Train uses [Inter](https://rsms.me/inter/) as its font family. You can customize this to use your own fonts.
58
+
59
+ ### Removing the Default Font
60
+
61
+ To remove the default Inter font, which appears as a stylesheet `<link>` tag in the `<head>`, you'll need to eject the `shared/layouts/head/_fonts.html.erb` partial locally and modify or remove the link tag. To eject this partial, use `bin/resolve shared/layouts/head/fonts --eject` (see [Dealing with Indirection](#dealing-with-indirection) below for more details).
62
+
63
+ Once ejected to `app/views/themes/light/layouts/head/_fonts.html.erb` (or your custom theme directory), you can remove the stylesheet `<link>` tag.
64
+
65
+ ### Adding a Custom Font
66
+
67
+ To add your own custom fonts, hosted locally:
68
+
69
+ _Note: if you'd like to use a CDN-hosted font different than `inter`, you can replace the stylesheet `<link>` tag for inter found in the head (see Removing the Default Font above) and skip to step 3 below on updating the Tailwind config._
70
+
71
+ 1. **Add font files** to your application's `app/assets/fonts/` directory.
72
+
73
+ 2. **Add `@font-face` rules** in your `app/assets/stylesheets/application.css` file:
74
+
75
+ ```css
76
+ @font-face {
77
+ font-family: 'YourFontName';
78
+ src: url('YourFontFile.woff2') format('woff2');
79
+ font-weight: normal;
80
+ font-style: normal;
81
+ }
82
+ ```
83
+
84
+ Note: When you use `url('FontFileName.woff2')`, Propshaft will automatically replace it with a full fingerprinted public path to the font file.
85
+
86
+ 3. **Update `tailwind.config.js`** to use your custom font in the Tailwind configuration:
87
+
88
+ ```javascript
89
+ const defaultTheme = require('tailwindcss/defaultTheme')
90
+
91
+ // ... existing config ...
92
+
93
+ themeConfig.theme.extend.fontFamily.sans = [
94
+ 'YourFontName',
95
+ ...defaultTheme.fontFamily.sans,
96
+ ]
97
+ ```
98
+
99
+ This configuration sets your custom font as the primary sans-serif font while keeping the default system font stack as fallbacks.
100
+
55
101
  ## The Theme Subsystem
56
102
 
57
103
  Bullet Train has a theme subsystem designed to allow you the flexibility to either extend or completely replace the stock “Light” UI theme.
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.36.0"
2
+ VERSION = "1.37.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.36.0
4
+ version: 1.37.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
@@ -506,6 +506,7 @@ files:
506
506
  - app/views/account/users/_oauth.html.erb
507
507
  - app/views/account/users/edit.html.erb
508
508
  - app/views/account/users/show.html.erb
509
+ - app/views/active_storage/blobs/_blob.html.erb
509
510
  - app/views/bullet_train/partial_resolver.html.erb
510
511
  - app/views/devise/confirmations/new.html.erb
511
512
  - app/views/devise/mailer/confirmation_instructions.html.erb
@@ -524,6 +525,7 @@ files:
524
525
  - app/views/devise/shared/_oauth.html.erb
525
526
  - app/views/devise/unlocks/new.html.erb
526
527
  - app/views/layouts/account.html.erb
528
+ - app/views/layouts/action_text/contents/_content.html.erb
527
529
  - app/views/layouts/devise.html.erb
528
530
  - app/views/layouts/docs.html.erb
529
531
  - app/views/layouts/mailer.html.erb
@@ -534,6 +536,8 @@ files:
534
536
  - app/views/user_mailer/welcome.html.erb
535
537
  - config/addresses/countries.json
536
538
  - config/addresses/states.json
539
+ - config/initializers/action_text_sanitzer.rb
540
+ - config/initializers/actiontext_override.rb
537
541
  - config/initializers/concerns/inflections_base.rb
538
542
  - config/initializers/concerns/turbo_failure_app.rb
539
543
  - config/locales/en/addresses.en.yml