bullet_train-themes 1.6.30 → 1.6.31

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: 1f5ce8a94a8cacb685c65758c67c91a620c92a2733586cb4c9a5b9296db3385f
4
- data.tar.gz: efd9d1d953bc690e0265cab3e87df8e12eebb1e57d9a6b3aa93ed8a0d6324781
3
+ metadata.gz: 1fd2d4c82002aef84b2c00cf34f2c99ed8acaccf9a111ac3f63333a6d8d6f0cb
4
+ data.tar.gz: d3d509f673de65aaa5cbe60749c8c6ca42063247b870e9c27904fa148c02e5c6
5
5
  SHA512:
6
- metadata.gz: 8f467c540017b6042eb5880ab5b9be95e4355b2550f6054552477f6338ce1a6bcbedf09177dbefb4cf2d005563f3aa09e2e8acc483c55a9be820baa479b86d8b
7
- data.tar.gz: cc09b6a013aac0556beed08493e65fdc9abbd146469d49ccbdd27a4b6c8d10a39ea0ea0eeb19c9191b58f66f542a220f6ebf09324d2121f4598ee4991317ba9b
6
+ metadata.gz: ad4f07e024fc5d60dbbdeda73484850a348435d98b60346b43ab217bf474ce995213ea22d3cb096c5d306cc252d27a31ead687a986b5584a549a8070b62d7918
7
+ data.tar.gz: eb14def6d667fba77f400e26fe7bfce7e74c6ece9375f4c33cc294b53028b98eeb4935cdd31373123bf595a1c60b0684cd5bb51b2540f591dee2252e21cc33b2
@@ -1,4 +1,4 @@
1
- module ThemeHelper
1
+ module CurrentThemeHelper
2
2
  def current_theme_object
3
3
  @current_theme_object ||= "BulletTrain::Themes::#{current_theme.to_s.classify}::Theme".constantize.new
4
4
  end
@@ -0,0 +1,7 @@
1
+ module ImagesHelper
2
+ def image_width_for_height(filename, target_height)
3
+ source_width, source_height = FastImage.size("#{Rails.root}/app/assets/images/#{filename}")
4
+ ratio = source_width.to_f / source_height.to_f
5
+ (target_height * ratio).to_i
6
+ end
7
+ end
@@ -3,6 +3,6 @@
3
3
  <% url ||= nil %>
4
4
 
5
5
  <%= render 'shared/attributes/base', strategy: strategy, url: url do |p| %>
6
- <% p.heading t("#{object.class.name.pluralize.underscore}.fields.#{attribute}.heading") %>
6
+ <% p.heading t("#{object.class.name.pluralize.underscore}.fields.#{attribute}.heading", default: object.class.human_attribute_name(attribute)) %>
7
7
  <% p.body yield %>
8
8
  <% end %>
@@ -4,7 +4,9 @@ stimulus_controller = 'fields--password'
4
4
  form ||= current_fields_form
5
5
  options ||= {}
6
6
 
7
- if options[:show_strength_indicator] && BulletTrain::Configuration.strong_passwords
7
+ strong_passwords = Object.const_defined?("BulletTrain::Configuration") ? BulletTrain::Configuration.strong_passwords : true
8
+
9
+ if options[:show_strength_indicator] && strong_passwords
8
10
  options = options.merge({ data: {"action": "keyup->fields--password#estimateStrength" }})
9
11
  end
10
12
 
@@ -5,11 +5,13 @@ options ||= {}
5
5
  options[:class] = "formatted_content trix-content #{options[:class]}"
6
6
  options[:placeholder] ||= labels.placeholder if labels.placeholder
7
7
  options[:data] ||= {}
8
- options[:data][:mentions] ||= ([current_team].map { |team|
9
- {key: team.name, value: team.id, protocol: 'bullettrain', model: 'teams', id: team.id, label: team.name, photo: photo_for(team)}
10
- } + current_team.memberships.current_and_invited.map { |membership|
11
- {key: membership.name, value: membership.id, protocol: 'bullettrain', model: 'memberships', id: membership.id, label: membership.name, photo: membership_profile_photo_url(membership)}
12
- }).to_json
8
+ if defined?(current_team)
9
+ options[:data][:mentions] ||= ([current_team].map { |team|
10
+ {key: team.name, value: team.id, protocol: 'bullettrain', model: 'teams', id: team.id, label: team.name, photo: photo_for(team)}
11
+ } + current_team.memberships.current_and_invited.map { |membership|
12
+ {key: membership.name, value: membership.id, protocol: 'bullettrain', model: 'memberships', id: membership.id, label: membership.name, photo: membership_profile_photo_url(membership)}
13
+ }).to_json
14
+ end
13
15
  options[:data][:topics] ||= []
14
16
  # current_team.scaffolding_things.map { |scaffolding_thing|
15
17
  # {key: scaffolding_thing.name, value: scaffolding_thing.id, protocol: 'bullettrain', model: 'scaffolding/things', id: scaffolding_thing.id, label: scaffolding_thing.name, photo: photo_for(scaffolding_thing)}
@@ -1,4 +1,8 @@
1
1
  module BulletTrain
2
+ unless respond_to?(:linked_gems)
3
+ mattr_accessor :linked_gems, default: ["bullet_train-themes"]
4
+ end
5
+
2
6
  module Themes
3
7
  class Engine < ::Rails::Engine
4
8
  end
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Themes
3
- VERSION = "1.6.30"
3
+ VERSION = "1.6.31"
4
4
  end
5
5
  end
@@ -1,6 +1,7 @@
1
1
  require "bullet_train/themes/version"
2
2
  require "bullet_train/themes/engine"
3
3
  # require "bullet_train/themes/base/theme"
4
+ require "nice_partials"
4
5
 
5
6
  module BulletTrain
6
7
  module Themes
@@ -1,5 +1,32 @@
1
1
  require_relative "../application"
2
2
 
3
+ namespace :bt do
4
+ desc "Symlink registered gems in `./tmp/gems` so their views, etc. can be inspected by Tailwind CSS."
5
+ task link: :environment do
6
+ if Dir.exist?("tmp/gems")
7
+ puts "Removing previously linked gems."
8
+ `rm -f tmp/gems/*`
9
+ else
10
+ if File.exist?("tmp/gems")
11
+ raise "A file named `tmp/gems` already exists? It has to be removed before we can create the required directory."
12
+ end
13
+
14
+ puts "Creating 'tmp/gems' directory."
15
+ `mkdir tmp/gems`
16
+ end
17
+
18
+ `touch tmp/gems/.keep`
19
+
20
+ BulletTrain.linked_gems.each do |linked_gem|
21
+ target = `bundle show #{linked_gem}`.chomp
22
+ if target.present?
23
+ puts "Linking '#{linked_gem}' to '#{target}'."
24
+ `ln -s #{target} tmp/gems/#{linked_gem}`
25
+ end
26
+ end
27
+ end
28
+ end
29
+
3
30
  namespace :bullet_train do
4
31
  namespace :themes do
5
32
  task :install, [:theme_name] => :environment do |task, args|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-themes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.30
4
+ version: 1.6.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-07 00:00:00.000000000 Z
11
+ date: 2024-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 6.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: nice_partials
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.9'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bullet_train-fields
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: Bullet Train Themes
42
70
  email:
43
71
  - andrew.culver@gmail.com
@@ -50,7 +78,8 @@ files:
50
78
  - README.md
51
79
  - Rakefile
52
80
  - app/assets/config/bullet_train_themes_manifest.js
53
- - app/helpers/theme_helper.rb
81
+ - app/helpers/current_theme_helper.rb
82
+ - app/helpers/images_helper.rb
54
83
  - app/views/themes/base/attributes/_address.html.erb
55
84
  - app/views/themes/base/attributes/_attribute.html.erb
56
85
  - app/views/themes/base/attributes/_belongs_to.html.erb