openproject-primer_view_components 0.52.3 → 0.52.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/app/components/primer/open_project/danger_confirmation_dialog.html.erb +2 -2
- data/app/components/primer/open_project/danger_confirmation_dialog.rb +5 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/previews/primer/open_project/danger_confirmation_dialog_preview/playground.html.erb +3 -1
- data/previews/primer/open_project/danger_confirmation_dialog_preview/with_form.html.erb +1 -1
- data/previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form.html.erb +2 -1
- data/previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form_test.html.erb +13 -0
- data/previews/primer/open_project/danger_confirmation_dialog_preview/with_form_test.html.erb +11 -0
- data/previews/primer/open_project/danger_confirmation_dialog_preview.rb +18 -0
- data/static/info_arch.json +26 -0
- data/static/previews.json +26 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c76bbbbf5c9b25dc9b49102a7a91b822c54d4a0e8973ce35ef7072bc07c44b63
|
4
|
+
data.tar.gz: 57c633f3c5164e60355955d9bc828d1e4e66bcf60ad355485e4ff28b7e2b2a98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4fb0afc8b4040994f8367864a43eabbcd1ac709231a349521fcf276164ff6cf6550b165633e41630f52b8ba169c7a386863308efe3369a7678bf087b0d36078
|
7
|
+
data.tar.gz: f7f39cf1ea0edd409bab750c750593fa300ed9398154e8d4d4f0ad3f7f1e4f14a88030a8a0bc0e175c6c8a8cd99547b29b181bb0042c45a73d76cc865f00fb3e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.52.4
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#232](https://github.com/opf/primer_view_components/pull/232) [`3cf8fe4`](https://github.com/opf/primer_view_components/commit/3cf8fe408dfe9995f90af3a08f5e04c21f3ed30a) Thanks [@HDinger](https://github.com/HDinger)! - Allow custom texts for cancel and confirm button in DangerConfirmationDialog
|
8
|
+
|
9
|
+
- [#231](https://github.com/opf/primer_view_components/pull/231) [`10cf9d2`](https://github.com/opf/primer_view_components/commit/10cf9d20660815b4ba78bc8bb7b9e18f3a60ce88) Thanks [@HDinger](https://github.com/HDinger)! - Fix form preview of DangerConfirmationDialog
|
10
|
+
|
3
11
|
## 0.52.3
|
4
12
|
|
5
13
|
### Patch Changes
|
@@ -11,8 +11,8 @@
|
|
11
11
|
<% end %>
|
12
12
|
</scrollable-region>
|
13
13
|
<%= render(Primer::Alpha::Dialog::Footer.new(show_divider: false)) do %>
|
14
|
-
<%= render(Primer::Beta::Button.new(data: { "close-dialog-id": dialog_id })) {
|
15
|
-
<%= render(Primer::Beta::Button.new(type: (@form_wrapper.shows_form? ? :submit : :button), scheme: :danger, data: { "submit-dialog-id": dialog_id })) {
|
14
|
+
<%= render(Primer::Beta::Button.new(data: { "close-dialog-id": dialog_id })) { @cancel_button_text } %>
|
15
|
+
<%= render(Primer::Beta::Button.new(type: (@form_wrapper.shows_form? ? :submit : :button), scheme: :danger, data: { "submit-dialog-id": dialog_id })) { @confirm_button_text } %>
|
16
16
|
<% end %>
|
17
17
|
<% end %>
|
18
18
|
</danger-confirmation-dialog-form-helper>
|
@@ -67,12 +67,17 @@ module Primer
|
|
67
67
|
def initialize(
|
68
68
|
form_arguments: {},
|
69
69
|
id: self.class.generate_id,
|
70
|
+
confirm_button_text: I18n.t("button_delete_permanently"),
|
71
|
+
cancel_button_text: I18n.t("button_cancel"),
|
70
72
|
**system_arguments
|
71
73
|
)
|
72
74
|
@check_box_name = form_arguments.delete(:name) || "confirm_dangerous_action"
|
73
75
|
@form_wrapper = FormWrapper.new(**form_arguments)
|
74
76
|
@dialog_id = id.to_s
|
75
77
|
|
78
|
+
@confirm_button_text = confirm_button_text
|
79
|
+
@cancel_button_text = cancel_button_text
|
80
|
+
|
76
81
|
@system_arguments = system_arguments
|
77
82
|
@system_arguments[:id] = @dialog_id
|
78
83
|
@system_arguments[:classes] = class_names(
|
@@ -1,4 +1,6 @@
|
|
1
|
-
<%= render(Primer::OpenProject::DangerConfirmationDialog.new(id: "my-dialog"
|
1
|
+
<%= render(Primer::OpenProject::DangerConfirmationDialog.new(id: "my-dialog",
|
2
|
+
confirm_button_text: confirm_button_text,
|
3
|
+
cancel_button_text: cancel_button_text)) do |dialog| %>
|
2
4
|
<% dialog.with_show_button { "Click me" } %>
|
3
5
|
<% dialog.with_confirmation_message(icon_arguments: { icon: icon, color: icon_color }) do |message| %>
|
4
6
|
<% message.with_heading(tag: :h2).with_content("Proceed with danger?") %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= render(Primer::OpenProject::DangerConfirmationDialog.new(
|
2
2
|
title: "Delete dialog",
|
3
|
-
form_arguments: { action:
|
3
|
+
form_arguments: { action: "" } # Use the correct form action here.
|
4
4
|
)) do |dialog| %>
|
5
5
|
<% dialog.with_show_button { "Click me" } %>
|
6
6
|
<% dialog.with_confirmation_message do |message|
|
data/previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form.html.erb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
<!-- Use the correct form URL here. -->
|
2
|
+
<%= form_with(url: "") do |f| %>
|
2
3
|
<%= render(Primer::OpenProject::DangerConfirmationDialog.new(
|
3
4
|
title: "Delete dialog",
|
4
5
|
form_arguments: { builder: f, name: "confirm_very_dangerous_action" }
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= form_with(url: generic_form_submission_path(route_format)) do |f| %>
|
2
|
+
<%= render(Primer::OpenProject::DangerConfirmationDialog.new(
|
3
|
+
title: "Delete dialog",
|
4
|
+
form_arguments: { builder: f, name: "confirm_very_dangerous_action" }
|
5
|
+
)) do |dialog| %>
|
6
|
+
<% dialog.with_show_button { "Click me" } %>
|
7
|
+
<% dialog.with_confirmation_message do |message|
|
8
|
+
message.with_heading(tag: :h2).with_content("Permanently delete?")
|
9
|
+
message.with_description_content("This action is not reversible. Please proceed with caution.")
|
10
|
+
end %>
|
11
|
+
<% dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed") %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= render(Primer::OpenProject::DangerConfirmationDialog.new(
|
2
|
+
title: "Delete dialog",
|
3
|
+
form_arguments: { action: generic_form_submission_path(route_format) }
|
4
|
+
)) do |dialog| %>
|
5
|
+
<% dialog.with_show_button { "Click me" } %>
|
6
|
+
<% dialog.with_confirmation_message do |message|
|
7
|
+
message.with_heading(tag: :h2).with_content("Permanently delete?")
|
8
|
+
message.with_description_content("This action is not reversible. Please proceed with caution.")
|
9
|
+
end %>
|
10
|
+
<% dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed") %>
|
11
|
+
<% end %>
|
@@ -25,18 +25,24 @@ module Primer
|
|
25
25
|
# @param icon_color [Symbol] select [default, muted, subtle, accent, success, attention, severe, danger, open, closed, done, sponsors, on_emphasis, inherit]
|
26
26
|
# @param show_description toggle
|
27
27
|
# @param show_additional_details toggle
|
28
|
+
# @param confirm_button_text [String]
|
29
|
+
# @param cancel_button_text [String]
|
28
30
|
# @param check_box_text [String]
|
29
31
|
def playground(
|
30
32
|
icon: :"alert",
|
31
33
|
icon_color: :danger,
|
32
34
|
show_description: true,
|
33
35
|
show_additional_details: false,
|
36
|
+
confirm_button_text: "Understood",
|
37
|
+
cancel_button_text: "NO!",
|
34
38
|
check_box_text: "I understand that this deletion cannot be reversed"
|
35
39
|
)
|
36
40
|
render_with_template(locals: { icon: icon,
|
37
41
|
icon_color: icon_color,
|
38
42
|
show_description: show_description,
|
39
43
|
show_additional_details: show_additional_details,
|
44
|
+
confirm_button_text: confirm_button_text,
|
45
|
+
cancel_button_text: cancel_button_text,
|
40
46
|
check_box_text: check_box_text })
|
41
47
|
end
|
42
48
|
|
@@ -66,6 +72,18 @@ module Primer
|
|
66
72
|
dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed")
|
67
73
|
end
|
68
74
|
end
|
75
|
+
|
76
|
+
# @label With form using FormBuilder for testing puposes
|
77
|
+
# @hidden
|
78
|
+
def with_form_builder_form_test(route_format: :html)
|
79
|
+
render_with_template(locals: { route_format: route_format })
|
80
|
+
end
|
81
|
+
|
82
|
+
# @label With form for testing purposes
|
83
|
+
# @hidden
|
84
|
+
def with_form_test(route_format: :html)
|
85
|
+
render_with_template(locals: { route_format: route_format })
|
86
|
+
end
|
69
87
|
end
|
70
88
|
end
|
71
89
|
end
|
data/static/info_arch.json
CHANGED
@@ -17673,6 +17673,32 @@
|
|
17673
17673
|
"color-contrast"
|
17674
17674
|
]
|
17675
17675
|
}
|
17676
|
+
},
|
17677
|
+
{
|
17678
|
+
"preview_path": "primer/open_project/danger_confirmation_dialog/with_form_builder_form_test",
|
17679
|
+
"name": "with_form_builder_form_test",
|
17680
|
+
"snapshot": "false",
|
17681
|
+
"skip_rules": {
|
17682
|
+
"wont_fix": [
|
17683
|
+
"region"
|
17684
|
+
],
|
17685
|
+
"will_fix": [
|
17686
|
+
"color-contrast"
|
17687
|
+
]
|
17688
|
+
}
|
17689
|
+
},
|
17690
|
+
{
|
17691
|
+
"preview_path": "primer/open_project/danger_confirmation_dialog/with_form_test",
|
17692
|
+
"name": "with_form_test",
|
17693
|
+
"snapshot": "false",
|
17694
|
+
"skip_rules": {
|
17695
|
+
"wont_fix": [
|
17696
|
+
"region"
|
17697
|
+
],
|
17698
|
+
"will_fix": [
|
17699
|
+
"color-contrast"
|
17700
|
+
]
|
17701
|
+
}
|
17676
17702
|
}
|
17677
17703
|
],
|
17678
17704
|
"subcomponents": [
|
data/static/previews.json
CHANGED
@@ -3191,6 +3191,32 @@
|
|
3191
3191
|
"color-contrast"
|
3192
3192
|
]
|
3193
3193
|
}
|
3194
|
+
},
|
3195
|
+
{
|
3196
|
+
"preview_path": "primer/open_project/danger_confirmation_dialog/with_form_builder_form_test",
|
3197
|
+
"name": "with_form_builder_form_test",
|
3198
|
+
"snapshot": "false",
|
3199
|
+
"skip_rules": {
|
3200
|
+
"wont_fix": [
|
3201
|
+
"region"
|
3202
|
+
],
|
3203
|
+
"will_fix": [
|
3204
|
+
"color-contrast"
|
3205
|
+
]
|
3206
|
+
}
|
3207
|
+
},
|
3208
|
+
{
|
3209
|
+
"preview_path": "primer/open_project/danger_confirmation_dialog/with_form_test",
|
3210
|
+
"name": "with_form_test",
|
3211
|
+
"snapshot": "false",
|
3212
|
+
"skip_rules": {
|
3213
|
+
"wont_fix": [
|
3214
|
+
"region"
|
3215
|
+
],
|
3216
|
+
"will_fix": [
|
3217
|
+
"color-contrast"
|
3218
|
+
]
|
3219
|
+
}
|
3194
3220
|
}
|
3195
3221
|
]
|
3196
3222
|
},
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openproject-primer_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.52.
|
4
|
+
version: 0.52.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-01-
|
12
|
+
date: 2025-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionview
|
@@ -1032,6 +1032,8 @@ files:
|
|
1032
1032
|
- previews/primer/open_project/danger_confirmation_dialog_preview/with_additional_details.html.erb
|
1033
1033
|
- previews/primer/open_project/danger_confirmation_dialog_preview/with_form.html.erb
|
1034
1034
|
- previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form.html.erb
|
1035
|
+
- previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form_test.html.erb
|
1036
|
+
- previews/primer/open_project/danger_confirmation_dialog_preview/with_form_test.html.erb
|
1035
1037
|
- previews/primer/open_project/drag_handle_preview.rb
|
1036
1038
|
- previews/primer/open_project/feedback_dialog_preview.rb
|
1037
1039
|
- previews/primer/open_project/feedback_dialog_preview/playground.html.erb
|