bullet_train 1.3.11 → 1.3.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/controllers/base.rb +3 -4
- data/app/controllers/concerns/documentation_support.rb +3 -2
- data/app/models/concerns/invitations/base.rb +1 -1
- data/app/models/concerns/memberships/base.rb +2 -0
- data/app/models/concerns/users/base.rb +1 -1
- data/config/locales/en/base.yml +2 -2
- data/config/locales/en/invitations.en.yml +1 -0
- data/docs/field-partials/file-field.md +28 -0
- data/lib/bullet_train/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cebee7b2e16992167700e7be651823752180c0a94ac4dceb2000bb1363b62d9e
|
4
|
+
data.tar.gz: bb64b9ea40fea04936812eabf14cc9b0261c4d11a2f8ff9c62de17ea756de55d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4861d4e94ad6060fae8d4ea6859c6569c9acb3c1f7765675cee1d6d473850657ae2a7c6fcdff2f5e89b5524575ff11b9dca3d962ab732502b6615c255bd06ff
|
7
|
+
data.tar.gz: dec3c199b727d7dac9e9f9b188b332aa049dddbf3380c7d156b07ca91903d46ccf473ee339d1b238d0588953035bd28454fce16acf1a68ba14baf3e415386063
|
@@ -85,15 +85,14 @@ module Controllers::Base
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
def set_locale
|
89
|
-
|
88
|
+
def set_locale(&action)
|
89
|
+
locale = [
|
90
90
|
current_user&.locale,
|
91
91
|
current_user&.current_team&.locale,
|
92
92
|
http_accept_language.compatible_language_from(I18n.available_locales),
|
93
93
|
I18n.default_locale.to_s
|
94
94
|
].compact.find { |potential_locale| I18n.available_locales.include?(potential_locale.to_sym) }
|
95
|
-
|
96
|
-
I18n.locale = I18n.default_locale
|
95
|
+
I18n.with_locale(locale, &action)
|
97
96
|
end
|
98
97
|
|
99
98
|
# Whitelist the account namespace and prevent JavaScript
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module DocumentationSupport
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
|
+
BULLET_TRAIN_BASE_PATH = `bundle show bullet_train`.chomp
|
5
|
+
|
4
6
|
def docs
|
5
7
|
target = params[:page].presence || "index"
|
6
8
|
|
@@ -8,8 +10,7 @@ module DocumentationSupport
|
|
8
10
|
# all_paths = ([Rails.root.to_s] + `bundle show --paths`.lines.map(&:chomp))
|
9
11
|
# @path = all_paths.map { |path| path + "/docs/#{target}.md" }.detect { |path| File.exist?(path) }
|
10
12
|
|
11
|
-
|
12
|
-
@path = `bundle show bullet_train`.chomp + "/docs/#{target}.md"
|
13
|
+
@path = "#{BULLET_TRAIN_BASE_PATH}/docs/#{target}.md"
|
13
14
|
|
14
15
|
render :docs, layout: "docs"
|
15
16
|
end
|
@@ -21,6 +21,8 @@ module Memberships::Base
|
|
21
21
|
# Image uploading
|
22
22
|
has_one_attached :user_profile_photo
|
23
23
|
|
24
|
+
validates :user_email, uniqueness: {scope: :team}
|
25
|
+
|
24
26
|
after_destroy do
|
25
27
|
# if we're destroying a user's membership to the team they have set as
|
26
28
|
# current, then we need to remove that so they don't get an error.
|
@@ -71,7 +71,7 @@ module Users::Base
|
|
71
71
|
def create_default_team
|
72
72
|
# This creates a `Membership`, because `User` `has_many :teams, through: :memberships`
|
73
73
|
default_team = teams.create(name: I18n.t("teams.new.default_team_name"), time_zone: time_zone)
|
74
|
-
memberships.find_by(team: default_team).update role_ids: [Role.admin.id]
|
74
|
+
memberships.find_by(team: default_team).update(user_email: email, role_ids: [Role.admin.id])
|
75
75
|
update(current_team: default_team)
|
76
76
|
end
|
77
77
|
|
data/config/locales/en/base.yml
CHANGED
@@ -10,9 +10,9 @@
|
|
10
10
|
#
|
11
11
|
# <%= t("hello") %>
|
12
12
|
#
|
13
|
-
# To use a different locale, set it with `I18n.
|
13
|
+
# To use a different locale, set it with `I18n.with_locale`:
|
14
14
|
#
|
15
|
-
# I18n.
|
15
|
+
# I18n.with_locale(:es, &block)
|
16
16
|
#
|
17
17
|
# This would use the information in config/locales/es.yml.
|
18
18
|
#
|
@@ -59,6 +59,7 @@ en:
|
|
59
59
|
resent: 'Invitation was successfully resent.'
|
60
60
|
resent_error: Sorry, we couldn't find an invitation to resend.
|
61
61
|
doesnt_exist: Sorry, but we couldn't find your invitation. Please contact an administrator on the team to have them send you another one.
|
62
|
+
duplicate: 'Sorry, a member with the email %{user_email} has already been invited.'
|
62
63
|
values:
|
63
64
|
name: 'Invitation to Join %{team_name}'
|
64
65
|
account:
|
@@ -9,6 +9,7 @@ In addition, Bullet Train has integrated the direct-uploads feature of Active St
|
|
9
9
|
## Example
|
10
10
|
|
11
11
|
The following steps illustrate how to add a `document` file attachment to a `Post` model.
|
12
|
+
|
12
13
|
Add the following to `app/models/post.rb`:
|
13
14
|
|
14
15
|
```ruby
|
@@ -22,3 +23,30 @@ Run the following command to generate the scaffolding for the `document` field o
|
|
22
23
|
```bash
|
23
24
|
./bin/super-scaffold crud-field Post document:file_field
|
24
25
|
```
|
26
|
+
|
27
|
+
## Multiple Attachment Example
|
28
|
+
|
29
|
+
The following steps illustrate how to add multiple `document` file attachments to a `Post` model.
|
30
|
+
|
31
|
+
Add the following to `app/models/post.rb`:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
has_many_attached :documents
|
35
|
+
```
|
36
|
+
|
37
|
+
Note, no database migration is required as ActiveStorage uses its own tables to store the attachments.
|
38
|
+
|
39
|
+
Run the following command to generate the scaffolding for the `documents` field on the `Post` model:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
./bin/super-scaffold crud-field Post documents:file_field{multiple}
|
43
|
+
```
|
44
|
+
|
45
|
+
## Generating a Model & Super Scaffold Example
|
46
|
+
|
47
|
+
If you're starting fresh, and don't have an existing model you can do something like this:
|
48
|
+
|
49
|
+
```
|
50
|
+
rails g model Project team:references name:string specification:attachment documents:attachments
|
51
|
+
bin/super-scaffold crud Project Team name:text_field specification:file_field documents:file_field{multiple}
|
52
|
+
```
|
data/lib/bullet_train/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|