bullet_train 1.4.6 → 1.4.7

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: 07a965daba64c07c54a925adad5ca51fcfd30496790e350d2846de6c864fda65
4
- data.tar.gz: 4c0fbeabceb820a417340e8d27a588ece5482622db32016b74b504989bbbb7b1
3
+ metadata.gz: b37d49a851243ce6ee4762eb3939db28bbe9566fc7897f3dde6f46639d41cf6b
4
+ data.tar.gz: 54e743ef8e8859657bd43e0294c96d7c9f9b91eae5b08f49e7f3c5350d189ca4
5
5
  SHA512:
6
- metadata.gz: da6e96885f39b697c2bb1e6b4a80fbd3532ca174b2b807d8b17d31882764b26131fa03457d31b4dd02471ceaa4724f12b841fb752ae3eecbcc809cccff5b8c10
7
- data.tar.gz: 638389f69f535a1bfd49fe4ded96026dc83b7f444d449b1e69be9a8b78b9ea0f633a9b4020d0734424d56a8c93e01af70bcf4ae4894d5fa423475b235621bb71
6
+ metadata.gz: 7a694f756dcb9f8defd2f3a731ac981328f22e793937b68b5117600c83f880d60e9fb092714de7da50da03cf9167e11ad4c25ada0776062b165e6976b087a7ea
7
+ data.tar.gz: 38ebed0df0636b49bda73a1d5d11a2f5edf2db7e01a4e9a16882a7efbc4bdee1fbc139bcb4cd7a1f4533ea5d5b55d3f299ac892d35b6f80288186f77d44e65dd
@@ -110,13 +110,20 @@ module Account::Teams::ControllerBase
110
110
 
111
111
  # # DELETE /teams/1
112
112
  # # DELETE /teams/1.json
113
- # def destroy
114
- # @team.destroy
115
- # respond_to do |format|
116
- # format.html { redirect_to account_teams_url, notice: 'Team was successfully destroyed.' }
117
- # format.json { head :no_content }
118
- # end
119
- # end
113
+ def destroy
114
+ if current_user.teams.size == 1
115
+ respond_to do |format|
116
+ format.html { redirect_to edit_account_team_url(@team), alert: t("account.teams.notifications.cannot_delete_last_team") }
117
+ format.json { head :no_content }
118
+ end
119
+ else
120
+ @team.destroy
121
+ respond_to do |format|
122
+ format.html { redirect_to account_teams_url, notice: t("account.teams.notifications.destroyed") }
123
+ format.json { head :no_content }
124
+ end
125
+ end
126
+ end
120
127
 
121
128
  private
122
129
 
@@ -17,6 +17,9 @@
17
17
 
18
18
  <div class="buttons">
19
19
  <%= form.submit (form.object.persisted? ? t('.buttons.update') : t('.buttons.create')), class: "button" %>
20
+ <% if controller.action_name == "edit" %>
21
+ <%= link_to t('account.teams.buttons.destroy'), [:account, team], method: :delete, data: { confirm: t('account.teams.buttons.confirmations.destroy') } %>
22
+ <% end %>
20
23
  <%= link_to t('global.buttons.cancel'), form.object.persisted? ? [:account, team] : [:account, :teams], class: "button-secondary" %>
21
24
  </div>
22
25
  <% end %>
@@ -13,6 +13,9 @@ en:
13
13
  create: Create Team
14
14
  edit: Edit Team
15
15
  update: Update Team
16
+ destroy: Delete Team
17
+ confirmations:
18
+ destroy: Are you sure you want to delete this team?
16
19
  index:
17
20
  section: Teams
18
21
  header: Your Teams
@@ -40,7 +43,9 @@ en:
40
43
  notifications:
41
44
  created: Team was successfully created.
42
45
  updated: Team was successfully updated.
46
+ destroyed: Team was successfully destroyed.
43
47
  invitation_only: Creating new teams is currently limited to users who have been invited for early access. If you've received an early access URL, please visit it before trying again.
48
+ cannot_delete_last_team: You cannot delete the last team you belong to.
44
49
  form:
45
50
  buttons: *buttons
46
51
  fields: &fields
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.4.6"
2
+ VERSION = "1.4.7"
3
3
  end
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.4.6
4
+ version: 1.4.7
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-09-20 00:00:00.000000000 Z
11
+ date: 2023-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard