bullet_train 1.1.5 → 1.1.6
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/account/memberships/controller_base.rb +4 -9
- data/app/helpers/account/teams_helper.rb +0 -10
- data/app/models/concerns/memberships/base.rb +1 -1
- data/app/models/concerns/records/base.rb +0 -4
- data/app/models/concerns/teams/base.rb +0 -10
- data/app/views/account/invitations/_breadcrumbs.html.erb +1 -1
- data/app/views/account/invitations/_form.html.erb +38 -40
- data/app/views/account/memberships/_form.html.erb +1 -0
- data/app/views/account/memberships/_index.html.erb +53 -56
- data/lib/bullet_train/version.rb +1 -1
- metadata +1 -2
- data/app/models/billing/mock_limiter.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e088bbba7d158e14c1bb6f6e573842f90b05b598b480f80210c2a021c6d9755a
|
4
|
+
data.tar.gz: 64a3ae2acafde00c0ea3c2f2fdcafbcefa67a43983c2a4b45b5e03c7747a5b85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6200ec9cc117de6868a7061a372ba2f6b0641272b8ce183a01e0e94387a4dc8cdfbe4f6a35ee154e713804b230ffcc507e8de0160f46ab09b6a0918222c7f37
|
7
|
+
data.tar.gz: a25fcf36a418be54b27cb2b4697ce40697dc78315fbfeede66d6ddc91eca02695dea99b0c9bc65046c8b036d351ce0a91439ca30b932d445891979bda819e95f
|
@@ -84,16 +84,11 @@ module Account::Memberships::ControllerBase
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def reinvite
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
redirect_to [:account, @team, :memberships], notice: I18n.t("account.memberships.notifications.reinvited")
|
91
|
-
else
|
92
|
-
redirect_to [:account, @team, :memberships], notice: "There was an error creating the invitation (#{@invitation.errors.full_messages.to_sentence})"
|
93
|
-
end
|
87
|
+
@invitation = Invitation.new(membership: @membership, team: @team, email: @membership.user_email, from_membership: current_membership)
|
88
|
+
if @invitation.save
|
89
|
+
redirect_to [:account, @team, :memberships], notice: I18n.t("account.memberships.notifications.reinvited")
|
94
90
|
else
|
95
|
-
|
96
|
-
redirect_to [:account, @team, :memberships]
|
91
|
+
redirect_to [:account, @team, :memberships], notice: "There was an error creating the invitation (#{@invitation.errors.full_messages.to_sentence})"
|
97
92
|
end
|
98
93
|
end
|
99
94
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Account::TeamsHelper
|
2
2
|
def current_team
|
3
|
-
# TODO We do not want this to be based on the `current_team_id`.
|
4
|
-
# TODO We want this to be based on the current resource being loaded.
|
5
3
|
current_user&.current_team
|
6
4
|
end
|
7
5
|
|
@@ -79,12 +77,4 @@ module Account::TeamsHelper
|
|
79
77
|
def can_invite?
|
80
78
|
can?(:create, Invitation.new(team: current_team))
|
81
79
|
end
|
82
|
-
|
83
|
-
def current_limits
|
84
|
-
@limiter ||= if billing_enabled? && defined?(Billing::Limiter)
|
85
|
-
Billing::Limiter.new(current_team)
|
86
|
-
else
|
87
|
-
Billing::MockLimiter.new(current_team)
|
88
|
-
end
|
89
|
-
end
|
90
80
|
end
|
@@ -4,10 +4,6 @@ module Records::Base
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
-
if billing_enabled? && defined?(Billing::UsageSupport)
|
8
|
-
include Billing::UsageSupport
|
9
|
-
end
|
10
|
-
|
11
7
|
if defined?(Webhooks::Outgoing::IssuingModel)
|
12
8
|
include Webhooks::Outgoing::IssuingModel
|
13
9
|
end
|
@@ -27,10 +27,6 @@ module Teams::Base
|
|
27
27
|
if defined?(Billing::Stripe::Subscription)
|
28
28
|
has_many :billing_stripe_subscriptions, class_name: "Billing::Stripe::Subscription", dependent: :destroy, foreign_key: :team_id
|
29
29
|
end
|
30
|
-
|
31
|
-
if defined?(Billing::Usage::TeamSupport)
|
32
|
-
include Billing::Usage::TeamSupport
|
33
|
-
end
|
34
30
|
end
|
35
31
|
|
36
32
|
# validations
|
@@ -66,12 +62,6 @@ module Teams::Base
|
|
66
62
|
|
67
63
|
# TODO Probably we can provide a way for gem packages to define these kinds of extensions.
|
68
64
|
if billing_enabled?
|
69
|
-
def current_billing_subscription
|
70
|
-
# If by some bug we have two subscriptions, we want to use the one that existed first.
|
71
|
-
# The reasoning here is that it's more likely to be on some legacy plan that benefits the customer.
|
72
|
-
billing_subscriptions.active.order(:created_at).first
|
73
|
-
end
|
74
|
-
|
75
65
|
def needs_billing_subscription?
|
76
66
|
return false if freemium_enabled?
|
77
67
|
billing_subscriptions.active.empty?
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% invitation ||= @invitation %>
|
2
2
|
<% team ||= @team || invitation&.team %>
|
3
3
|
<%= render 'account/teams/breadcrumbs', team: team %>
|
4
|
-
<%= render 'account/shared/breadcrumb', label: t('
|
4
|
+
<%= render 'account/shared/breadcrumb', label: t('.label'), url: [:account, team, :memberships] %>
|
5
5
|
<%= render 'account/shared/breadcrumb', label: t('.label'), url: [:account, team, :invitations] %>
|
6
6
|
<% if invitation&.persisted? %>
|
7
7
|
<%= render 'account/shared/breadcrumb', label: invitation.label_string, url: [:account, invitation] %>
|
@@ -1,51 +1,49 @@
|
|
1
1
|
<%= form_with(model: [:account, (@team unless invitation.persisted?), invitation], class: 'form', local: true) do |form| %>
|
2
|
-
<%= render
|
3
|
-
<%= render 'account/shared/forms/errors', form: form %>
|
2
|
+
<%= render 'account/shared/forms/errors', form: form %>
|
4
3
|
|
5
|
-
|
4
|
+
<%= render 'shared/fields/email_field', form: form, method: :email, options: {autofocus: true} %>
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
<%= form.fields_for :membership do |membership_form| %>
|
7
|
+
<div class="grid grid-cols-1 gap-y gap-x sm:grid-cols-6">
|
8
|
+
<div class="sm:col-span-3">
|
9
|
+
<%= render 'shared/fields/text_field', form: membership_form, method: :user_first_name %>
|
10
|
+
</div>
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
</div>
|
12
|
+
<div class="sm:col-span-3">
|
13
|
+
<%= render 'shared/fields/text_field', form: membership_form, method: :user_last_name %>
|
16
14
|
</div>
|
17
|
-
|
15
|
+
</div>
|
16
|
+
<% end %>
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
<% end %>
|
18
|
+
<% if can? :manage, @team %>
|
19
|
+
<%= form.fields_for :membership do |fields| %>
|
20
|
+
<%= fields.hidden_field :team_id, value: @team.id %>
|
21
|
+
<div class="space-y-3">
|
22
|
+
<% Membership.assignable_roles.each do |role| %>
|
23
|
+
<% if current_membership.can_manage_role?(role) %>
|
24
|
+
<div class="flex items-top">
|
25
|
+
<%= fields.check_box :role_ids, {multiple: true, class: "h-4 w-4 text-blue focus:ring-blue-dark border-gray-300 rounded mt-0.5"}, role.id, nil %>
|
26
|
+
<label for="invitation_membership_attributes_role_ids_<%= role.id %>" class="ml-2 block select-none">
|
27
|
+
<span><%= t('invitations.form.invite_as', role_key: t("memberships.fields.role_ids.options.#{role.key}.label")) %></span>
|
28
|
+
<div class="mt-0.5 text-gray-400 font-light leading-normal">
|
29
|
+
<%= t("memberships.fields.role_ids.options.#{role.key}.description") %>
|
30
|
+
</div>
|
31
|
+
</label>
|
32
|
+
</div>
|
35
33
|
<% end %>
|
36
|
-
|
37
|
-
|
34
|
+
<% end %>
|
35
|
+
</div>
|
38
36
|
<% end %>
|
37
|
+
<% end %>
|
39
38
|
|
40
|
-
|
39
|
+
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
<% end %>
|
41
|
+
<div class="buttons">
|
42
|
+
<%= form.submit (form.object.persisted? ? t('.buttons.update') : t('.buttons.create')), class: "button" %>
|
43
|
+
<% if form.object.persisted? %>
|
44
|
+
<%= link_to t('global.buttons.cancel'), account_invitation_path(invitation), class: "button-secondary" %>
|
45
|
+
<% else %>
|
46
|
+
<%= link_to t('global.buttons.cancel'), @cancel_path || account_team_invitations_path(@team), class: "button-secondary" %>
|
47
|
+
<% end %>
|
48
|
+
</div>
|
51
49
|
<% end %>
|
@@ -2,68 +2,65 @@
|
|
2
2
|
<% hide_actions ||= false %>
|
3
3
|
<% hide_back ||= false %>
|
4
4
|
|
5
|
-
<%=
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<%= render "shared/limits/index", model: memberships.model %>
|
11
|
-
<% end %>
|
5
|
+
<%= render 'account/shared/box' do |p| %>
|
6
|
+
<% p.content_for :title, t(".contexts.#{context.class.name.underscore}.header") %>
|
7
|
+
<% p.content_for :description do %>
|
8
|
+
<%= raw t(".contexts.#{context.class.name.underscore}.#{memberships.any? ? 'description' : 'description_empty'}") %>
|
9
|
+
<% end %>
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
11
|
+
<% p.content_for :table do %>
|
12
|
+
<% if memberships.any? %>
|
13
|
+
<table class="table">
|
14
|
+
<thead>
|
15
|
+
<tr>
|
16
|
+
<th><%= t('memberships.singular') %></th>
|
17
|
+
<th><%= t('memberships.fields.role_ids.heading') %></th>
|
18
|
+
<%# 🚅 super scaffolding will insert new field headers above this line. %>
|
19
|
+
<th></th>
|
20
|
+
</tr>
|
21
|
+
</thead>
|
22
|
+
<tbody data-model="Membership" data-scope="current">
|
23
|
+
<% memberships.each do |membership| %>
|
24
|
+
<tr data-id="<%= membership.id %>">
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
<td class="px-6 py-4 whitespace-nowrap">
|
27
|
+
<%= link_to [:account, membership], class: 'block flex items-center group hover:no-underline no-underline' do %>
|
28
|
+
<div class="flex-shrink-0 h-10 w-10">
|
29
|
+
<%= image_tag membership_profile_photo_url(membership), title: membership.label_string, class: 'h-10 w-10 rounded-full' %>
|
30
|
+
</div>
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
32
|
+
<div class="ml-3">
|
33
|
+
<span class="group-hover:underline"><%= membership.label_string %></span>
|
34
|
+
<% if membership.unclaimed? %>
|
35
|
+
<span class="ml-1.5 px-2 inline-flex text-xs text-green-dark bg-green-light border border-green-dark rounded-md">
|
36
|
+
Invited
|
37
|
+
</span>
|
38
|
+
<% end %>
|
39
|
+
</div>
|
40
|
+
<% end %>
|
41
|
+
</td>
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
<% end %>
|
43
|
+
<td>
|
44
|
+
<% if membership.roles_without_defaults.any? %>
|
45
|
+
<%= membership.roles_without_defaults.map { |role| t("memberships.fields.role_ids.options.#{role.key}.label") }.to_sentence %>
|
46
|
+
<% else %>
|
47
|
+
<%= t("memberships.fields.role_ids.options.default.label") %>
|
48
|
+
<% end %>
|
49
|
+
</td>
|
50
|
+
<td class="text-right">
|
51
|
+
<%= link_to t('.buttons.show'), [:account, membership], class: 'button-secondary button-smaller' %>
|
52
|
+
</td>
|
53
|
+
</tr>
|
54
|
+
<% end %>
|
55
|
+
</tbody>
|
56
|
+
</table>
|
60
57
|
<% end %>
|
58
|
+
<% end %>
|
61
59
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
<% end %>
|
60
|
+
<% unless hide_actions %>
|
61
|
+
<% p.content_for :actions do %>
|
62
|
+
<%= link_to t('invitations.buttons.new'), new_account_team_invitation_path(@team, cancel_path: account_team_memberships_path(@team)), class: "#{first_button_primary}" %>
|
63
|
+
<%= link_to t('global.buttons.back'), [:account, context], class: "#{first_button_primary} back" unless hide_back %>
|
67
64
|
<% end %>
|
68
65
|
<% end %>
|
69
66
|
<% end %>
|
data/lib/bullet_train/version.rb
CHANGED
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.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
@@ -483,7 +483,6 @@ files:
|
|
483
483
|
- app/mailers/concerns/mailers/base.rb
|
484
484
|
- app/mailers/devise_mailer.rb
|
485
485
|
- app/mailers/user_mailer.rb
|
486
|
-
- app/models/billing/mock_limiter.rb
|
487
486
|
- app/models/concerns/current_attributes/base.rb
|
488
487
|
- app/models/concerns/invitations/base.rb
|
489
488
|
- app/models/concerns/memberships/base.rb
|