card-mod-rules 0.14.2 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/script/rules.js.coffee +52 -0
- data/assets/style/rules.scss +143 -0
- data/data/files/mod_rules_script_asset_output/file.js +2 -0
- data/data/files/mod_rules_script_local_machine_output/file.js +31 -0
- data/data/real.yml +27 -0
- data/locales/de.yml +1 -0
- data/locales/en.yml +1 -0
- data/set/abstract/virtual_set.rb +3 -0
- data/set/all/cardtype_groups.rb +1 -2
- data/set/all/related_sets.rb +2 -18
- data/set/all/set_select.rb +58 -0
- data/set/right/right.rb +7 -0
- data/set/right/self.rb +8 -0
- data/set/right/type.rb +7 -0
- data/set/right/type_plus_right.rb +9 -2
- data/set/rule/bar_view.rb +21 -32
- data/set/rule/bridge_rules_editor.rb +1 -1
- data/set/rule/editor.rb +29 -7
- data/set/rule/quick_editor/quick_edit.haml +2 -2
- data/set/rule/quick_editor.rb +1 -1
- data/set/rule/rule_form/rule_form.haml +1 -3
- data/set/rule/rule_form/rule_set_radio.rb +16 -13
- data/set/rule/rule_form/set_selection.rb +3 -20
- data/set/rule/rule_form.rb +19 -3
- data/set/self/cardtype.rb +0 -2
- data/set/self/recent_settings.rb +2 -0
- data/set/type/cardtype.rb +1 -1
- data/set/type/set/html_views/filtered_rule_lists.rb +23 -0
- data/set/type/set/html_views/rule_lists.rb +80 -22
- data/set/type/set/html_views/setting_filter.rb +38 -0
- data/set/type/set/html_views.rb +4 -31
- data/set/type/set/setting_categories.rb +67 -0
- data/set/type/set.rb +10 -4
- data/set/type/setting/core.haml +11 -0
- data/set/type/setting.rb +3 -1
- data/set/type_plus_right/set/setting.rb +12 -0
- data/set/type_plus_right/set/structure.rb +10 -0
- metadata +25 -14
- data/assets/script/script_rules.js.coffee +0 -23
- data/set/rule/rule_form/form_elements.rb +0 -52
- data/set/type/set/html_views/group_panel.haml +0 -14
- data/set/type/set/rules_filter.rb +0 -60
- data/set/type/set/setting_lists.rb +0 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ecb97a316ef0bfee6882f767ca857ee54fbf40ed881237ebd065242e673a48f
|
4
|
+
data.tar.gz: 23eb3ef3989cd20109fbc57bbaff9aaca02cdb7d40ea8a1c955cdb0b448ebe39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e27e841c4b8be319ab4bb181f2f90b69cb44a19dce7cf80f88e88bcb95052cee0a346300f82c14466cb4cac0e5a9080ac44d7968dc7503649be94cd02858ea5
|
7
|
+
data.tar.gz: a021b5396339c33ce1dd7e2f3a0ce2e902c317993ee688817df866d67232be39777b001bded3d681ae25aece75012601f8b76c39e0ea66feb125a5998d9b600c
|
@@ -0,0 +1,52 @@
|
|
1
|
+
decko.slot.ready (slot)->
|
2
|
+
slot.find('._setting-filter').each () ->
|
3
|
+
decko.filterRulesByCategory $(this).closest(".card-slot"), $(this).find('input._setting-category:checked').attr("id")
|
4
|
+
|
5
|
+
$.extend decko,
|
6
|
+
filterRulesByCategory: (container, category) ->
|
7
|
+
$(container).find('._setting-list ._setting-group').each (_i) ->
|
8
|
+
$list = $(this)
|
9
|
+
items = $list.find('._rule-item')
|
10
|
+
hiddenCount = 0
|
11
|
+
items.each () ->
|
12
|
+
$item = $(this)
|
13
|
+
wrapper = if $item.parent().is("li") then $item.parent() else $item
|
14
|
+
if $item.hasClass("_category-#{category}")
|
15
|
+
wrapper.show()
|
16
|
+
else
|
17
|
+
wrapper.hide()
|
18
|
+
hiddenCount += 1
|
19
|
+
|
20
|
+
if (hiddenCount == items.length)
|
21
|
+
$list.hide()
|
22
|
+
else
|
23
|
+
$list.show()
|
24
|
+
$list.find('._count').html(items.length - hiddenCount)
|
25
|
+
|
26
|
+
$(window).ready ->
|
27
|
+
# permissions mod
|
28
|
+
$('body').on 'click', '.perm-vals input', ->
|
29
|
+
$(this).slot().find('#inherit').attr('checked',false)
|
30
|
+
|
31
|
+
$('body').on 'click', '.perm-editor #inherit', ->
|
32
|
+
slot = $(this).slot()
|
33
|
+
slot.find('.perm-group input:checked').attr('checked', false)
|
34
|
+
slot.find('.perm-indiv input').val('')
|
35
|
+
|
36
|
+
# rstar mod
|
37
|
+
$('body').on 'click', '._rule-submit-button', ->
|
38
|
+
f = $(this).closest('form')
|
39
|
+
checked = f.find('._set-editor input:checked')
|
40
|
+
if checked.val()
|
41
|
+
if checked.attr('warning')
|
42
|
+
confirm checked.attr('warning')
|
43
|
+
else
|
44
|
+
true
|
45
|
+
else
|
46
|
+
f.find('._set-editor').addClass('warning')
|
47
|
+
$(this).notify 'To what Set does this Rule apply?'
|
48
|
+
false
|
49
|
+
|
50
|
+
$('body').on 'click', 'input._setting-category', ->
|
51
|
+
category = $(this).attr("id")
|
52
|
+
decko.filterRulesByCategory($(this).closest('.card-slot'), category)
|
@@ -0,0 +1,143 @@
|
|
1
|
+
|
2
|
+
/*-------------------------- */
|
3
|
+
/*- SETS, SETTINGS, RULES - */
|
4
|
+
/*-------------------------- */
|
5
|
+
|
6
|
+
.setting-klass,
|
7
|
+
.rule-setting {
|
8
|
+
font-weight: bold;
|
9
|
+
}
|
10
|
+
|
11
|
+
.rule-set {
|
12
|
+
white-space: nowrap;
|
13
|
+
}
|
14
|
+
|
15
|
+
.closed-rule {
|
16
|
+
height: 30px;
|
17
|
+
.rule-content {
|
18
|
+
width: 350px;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
.rule-content-container {
|
23
|
+
max-width: 350px;
|
24
|
+
overflow: hidden;
|
25
|
+
text-overflow: ellipsis;
|
26
|
+
line-height: inherit;
|
27
|
+
background: inherit;
|
28
|
+
white-space: nowrap;
|
29
|
+
.closed-content,
|
30
|
+
.closed-content .pointer-list,
|
31
|
+
.closed-content .search-list {
|
32
|
+
margin: 0;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
.rule-setting {
|
36
|
+
padding-top: 4px;
|
37
|
+
}
|
38
|
+
.open-rule > .rule-setting {
|
39
|
+
width: 28%;
|
40
|
+
float: left;
|
41
|
+
}
|
42
|
+
.open-rule .d0-card-body {
|
43
|
+
clear: both;
|
44
|
+
}
|
45
|
+
.open-rule .rule-instruction {
|
46
|
+
float: right;
|
47
|
+
text-align: left;
|
48
|
+
max-width: 68%;
|
49
|
+
}
|
50
|
+
.edit-rule,
|
51
|
+
.set-list{
|
52
|
+
.set-editor {
|
53
|
+
ul {
|
54
|
+
list-style-type: none;
|
55
|
+
}
|
56
|
+
.current-set-label {
|
57
|
+
font-weight: bold;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
.edit-button-area {
|
61
|
+
clear: both;
|
62
|
+
padding-top: 5px;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
.rule-delete-section {
|
66
|
+
float: right;
|
67
|
+
}
|
68
|
+
.guide-line-number {
|
69
|
+
display: inline-block;
|
70
|
+
background: #000;
|
71
|
+
color: $white;
|
72
|
+
border-radius: 100%;
|
73
|
+
width: 21px;
|
74
|
+
height: 21px;
|
75
|
+
font-size: 61%;
|
76
|
+
text-align: center;
|
77
|
+
padding-top: 3px;
|
78
|
+
font-weight: bold;
|
79
|
+
margin-left: -1.7rem;
|
80
|
+
position: relative;
|
81
|
+
top: -5px;
|
82
|
+
left: -4px;
|
83
|
+
}
|
84
|
+
|
85
|
+
.guide-line {
|
86
|
+
border-left: 1px solid $border-color;
|
87
|
+
}
|
88
|
+
|
89
|
+
.rule-section {
|
90
|
+
padding-left: 20px;
|
91
|
+
margin-left: 12px;
|
92
|
+
margin-right: 5px;
|
93
|
+
h4 {
|
94
|
+
position: relative;
|
95
|
+
top: -4px;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
.template_link-view {
|
100
|
+
display: inline;
|
101
|
+
}
|
102
|
+
|
103
|
+
.rule-item {
|
104
|
+
h5 {
|
105
|
+
font-weight: bold;
|
106
|
+
}
|
107
|
+
background-color: $list-group-bg;
|
108
|
+
border: 1px solid $list-group-border-color;
|
109
|
+
border-left: 5px solid $list-group-border-color;
|
110
|
+
margin-bottom: -1px;
|
111
|
+
padding: 5px;
|
112
|
+
&:hover, &.active {
|
113
|
+
border-left-color: $list-group-active-bg;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
// reduce bottom margins
|
118
|
+
.card-slot.set-info {
|
119
|
+
.form-group {
|
120
|
+
margin-bottom: 0.3rem;
|
121
|
+
label {
|
122
|
+
margin-bottom: 0.2rem;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
p {
|
126
|
+
margin-bottom: 0.5rem;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
.help-text.rule-instruction > div p:last-child {
|
131
|
+
margin-bottom: 0;
|
132
|
+
}
|
133
|
+
|
134
|
+
a.setting-link {
|
135
|
+
font-style: italic;
|
136
|
+
margin-left: 2%;
|
137
|
+
font-weight: normal;
|
138
|
+
color: $black;
|
139
|
+
white-space: nowrap;
|
140
|
+
}
|
141
|
+
h2.set-label {
|
142
|
+
padding-bottom: 10px;
|
143
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
// rules.js.coffee
|
2
|
+
(function(){decko.slot.ready(function(t){return t.find("._setting-filter").each(function(){return decko.filterRulesByCategory($(this).closest(".card-slot"),$(this).find("input._setting-category:checked").attr("id"))})}),$.extend(decko,{filterRulesByCategory:function(t,i){return $(t).find("._setting-list ._setting-group").each(function(){var t,n,e;return e=(t=$(this)).find("._rule-item"),n=0,e.each(function(){var t,e;return e=(t=$(this)).parent().is("li")?t.parent():t,t.hasClass("_category-"+i)?e.show():(e.hide(),n+=1)}),n===e.length?t.hide():(t.show(),t.find("._count").html(e.length-n))})}}),$(window).ready(function(){return $("body").on("click",".perm-vals input",function(){return $(this).slot().find("#inherit").attr("checked",!1)}),$("body").on("click",".perm-editor #inherit",function(){var t;return(t=$(this).slot()).find(".perm-group input:checked").attr("checked",!1),t.find(".perm-indiv input").val("")}),$("body").on("click","._rule-submit-button",function(){var t,i;return(t=(i=$(this).closest("form")).find("._set-editor input:checked")).val()?!t.attr("warning")||confirm(t.attr("warning")):(i.find("._set-editor").addClass("warning"),$(this).notify("To what Set does this Rule apply?"),!1)}),$("body").on("click","input._setting-category",function(){var t;return t=$(this).attr("id"),decko.filterRulesByCategory($(this).closest(".card-slot"),t)})})}).call(this);
|
@@ -0,0 +1,31 @@
|
|
1
|
+
// script_rules.js.coffee
|
2
|
+
(function() {
|
3
|
+
$(window).ready(function() {
|
4
|
+
$('body').on('click', '.perm-vals input', function() {
|
5
|
+
return $(this).slot().find('#inherit').attr('checked', false);
|
6
|
+
});
|
7
|
+
$('body').on('click', '.perm-editor #inherit', function() {
|
8
|
+
var slot;
|
9
|
+
slot = $(this).slot();
|
10
|
+
slot.find('.perm-group input:checked').attr('checked', false);
|
11
|
+
return slot.find('.perm-indiv input').val('');
|
12
|
+
});
|
13
|
+
return $('body').on('click', '._rule-submit-button', function() {
|
14
|
+
var checked, f;
|
15
|
+
f = $(this).closest('form');
|
16
|
+
checked = f.find('.set-editor input:checked');
|
17
|
+
if (checked.val()) {
|
18
|
+
if (checked.attr('warning')) {
|
19
|
+
return confirm(checked.attr('warning'));
|
20
|
+
} else {
|
21
|
+
return true;
|
22
|
+
}
|
23
|
+
} else {
|
24
|
+
f.find('.set-editor').addClass('attention');
|
25
|
+
$(this).notify('To what Set does this Rule apply?');
|
26
|
+
return false;
|
27
|
+
}
|
28
|
+
});
|
29
|
+
});
|
30
|
+
|
31
|
+
}).call(this);
|
data/data/real.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
- :name: Setting
|
3
|
+
:type: :cardtype
|
4
|
+
:codename: setting
|
5
|
+
:fields:
|
6
|
+
:description: |-
|
7
|
+
Settings affect how cards look and behave.
|
8
|
+
[[http://www.decko.org/Setting|Learn more about settings.]]
|
9
|
+
:self:
|
10
|
+
:fields:
|
11
|
+
:update: Administrator
|
12
|
+
- :name: Set
|
13
|
+
:type: :cardtype
|
14
|
+
:codename: set
|
15
|
+
:fields:
|
16
|
+
:description: |-
|
17
|
+
Sets define a group of cards to which settings can apply.
|
18
|
+
[[http://www.decko.org/Set|Learn more about sets.]]
|
19
|
+
:self:
|
20
|
+
:fields:
|
21
|
+
:structure: |-
|
22
|
+
<p>{{+description}}</p>
|
23
|
+
<h1>{{_self|name}} Cards</h1>
|
24
|
+
<blockquote>
|
25
|
+
<p>{{+:type+:by_name}}</p>
|
26
|
+
</blockquote>
|
27
|
+
|
data/locales/de.yml
CHANGED
data/locales/en.yml
CHANGED
data/set/all/cardtype_groups.rb
CHANGED
@@ -7,8 +7,7 @@ GROUP = {
|
|
7
7
|
"Organize" => ["List", "Pointer", "Search", "Link list", "Nest list"],
|
8
8
|
"Template" => ["Notification template", "Email template", "Twitter template"],
|
9
9
|
"Admin" => ["Cardtype", "User", "Role", "Sign up", "Session", "Set", "Setting"],
|
10
|
-
"Styling" => ["Layout", "Skin", "Bootswatch skin", "
|
11
|
-
"CSS", "SCSS"],
|
10
|
+
"Styling" => ["Layout", "Skin", "Bootswatch skin", "CSS", "SCSS"],
|
12
11
|
"Scripting" => %w[JSON JavaScript CoffeeScript]
|
13
12
|
}.freeze
|
14
13
|
|
data/set/all/related_sets.rb
CHANGED
@@ -3,23 +3,7 @@ def related_sets with_self=false
|
|
3
3
|
# NOT to sets to which the current card belongs
|
4
4
|
|
5
5
|
[].tap do |sets|
|
6
|
-
sets <<
|
7
|
-
sets <<
|
6
|
+
sets << Card.fetch(name, :self) if with_self
|
7
|
+
sets << Card.fetch(name, :right) if known? && simple?
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
11
|
-
def self_set_name
|
12
|
-
Name[name, :self]
|
13
|
-
end
|
14
|
-
|
15
|
-
def self_set_label
|
16
|
-
Card::Set::Self.label name
|
17
|
-
end
|
18
|
-
|
19
|
-
def right_set_name
|
20
|
-
Name[name, :right]
|
21
|
-
end
|
22
|
-
|
23
|
-
def right_set_label
|
24
|
-
Card::Set::Right.label name
|
25
|
-
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
format :html do
|
2
|
+
def set_select set_list_type,
|
3
|
+
setting_list_view=:filtered_accordion_rule_list,
|
4
|
+
path_opts={}
|
5
|
+
card_select card.set_list(set_list_type), setting_list_view, path_opts, "Select set"
|
6
|
+
end
|
7
|
+
|
8
|
+
def card_select cards, view, path_opts={}, placeholder=nil
|
9
|
+
form_tag path(path_opts.merge(view: view, mark: "")),
|
10
|
+
remote: true, method: "get", role: "filter",
|
11
|
+
"data-slot-selector": ".card-slot._fixed-slot",
|
12
|
+
class: "nodblclick slotter" do
|
13
|
+
output [
|
14
|
+
set_select_tag(cards, placeholder),
|
15
|
+
content_tag(:div, "", class: "card-slot _fixed-slot")
|
16
|
+
]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
view :card_select, wrap: :slot do
|
21
|
+
card_select card.set_list(:related),
|
22
|
+
:filtered_accordion_rule_list, {}, "Select set"
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def set_select_tag cards, placeholder=nil
|
28
|
+
options = cards.map(&:label_and_url_key)
|
29
|
+
options.unshift("") if placeholder
|
30
|
+
select_tag(:mark, options_for_select(options),
|
31
|
+
class: "_submit-on-select form-control _close-rule-overlay-on-select",
|
32
|
+
"data-minimum-results-for-search": "Infinity",
|
33
|
+
"data-placeholder": "Select set",
|
34
|
+
"data-select2-id": "#{unique_id}-#{Time.now.to_i}")
|
35
|
+
end
|
36
|
+
|
37
|
+
def set_alert set_list_type
|
38
|
+
wrap_with :div, class: "alert alert-info" do
|
39
|
+
[
|
40
|
+
"Rules apply to:",
|
41
|
+
card.set_list(set_list_type).first.name,
|
42
|
+
link_to_card(card, "More sets and settings",
|
43
|
+
path: { view: :rules }, target: "_blank")
|
44
|
+
]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def set_list set_list_type
|
50
|
+
case set_list_type
|
51
|
+
when :related
|
52
|
+
related_sets(true)
|
53
|
+
when :broader
|
54
|
+
broader_sets
|
55
|
+
else
|
56
|
+
[Card[self, :self]]
|
57
|
+
end
|
58
|
+
end
|
data/set/right/right.rb
ADDED
data/set/right/self.rb
CHANGED
data/set/right/type.rb
ADDED
@@ -1,4 +1,11 @@
|
|
1
|
+
include_set Abstract::VirtualSet
|
2
|
+
|
3
|
+
assign_type :set
|
4
|
+
|
5
|
+
def cql_content
|
6
|
+
{ left: { type: "_LL" }, right: "_LR" }
|
7
|
+
end
|
8
|
+
|
1
9
|
def related_sets _with_self=false
|
2
|
-
[
|
3
|
-
["#{name[1]}+*right", Card::Set::Right.label(name[1])]]
|
10
|
+
[self, Card.fetch(name[1], :right)]
|
4
11
|
end
|
data/set/rule/bar_view.rb
CHANGED
@@ -1,20 +1,17 @@
|
|
1
1
|
format :html do
|
2
|
-
|
3
|
-
|
2
|
+
mini_bar_cols 6, 6
|
3
|
+
bar_cols 5, 4, 3
|
4
4
|
|
5
5
|
def existing_rule_card
|
6
6
|
@existing_rule_card ||= find_existing_rule_card
|
7
7
|
end
|
8
8
|
|
9
9
|
view :bar, unknown: true do
|
10
|
+
class_up "card-slot", "_rule-item #{category_classes}"
|
10
11
|
voo.hide :bar_nav unless existing_rule_card
|
11
12
|
super()
|
12
13
|
end
|
13
14
|
|
14
|
-
view :expanded_bar, unknown: true do
|
15
|
-
super()
|
16
|
-
end
|
17
|
-
|
18
15
|
view :one_line_content,
|
19
16
|
wrap: { div: { class: "text-muted one-line" } }, unknown: true do
|
20
17
|
return render_mini_unknown unless existing_rule_card
|
@@ -40,15 +37,11 @@ format :html do
|
|
40
37
|
end
|
41
38
|
|
42
39
|
view :bar_middle, unknown: true do
|
43
|
-
rule_info
|
44
|
-
end
|
45
|
-
|
46
|
-
view :bar_left, unknown: true do
|
47
|
-
super()
|
40
|
+
# rule_info
|
48
41
|
end
|
49
42
|
|
50
43
|
view :bar_right, unknown: true do
|
51
|
-
|
44
|
+
rule_short_content
|
52
45
|
end
|
53
46
|
|
54
47
|
def rule_short_content
|
@@ -59,35 +52,31 @@ format :html do
|
|
59
52
|
{ set_context: card.name.trunk_name }
|
60
53
|
end
|
61
54
|
|
62
|
-
|
63
|
-
return super() if voo.show? :full_name
|
64
|
-
|
65
|
-
linking_to_existing_rule { card.rule_setting_title }
|
66
|
-
end
|
55
|
+
private
|
67
56
|
|
68
57
|
# LOCALIZE
|
69
58
|
def rule_info
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
59
|
+
if existing_rule_card
|
60
|
+
wrap_with :span,
|
61
|
+
"#{rule_setting_link} rule that applies to #{existing_rule_set_link}"
|
62
|
+
else
|
63
|
+
wrap_with :em, "no existing #{rule_setting_link} rule"
|
64
|
+
end
|
75
65
|
end
|
76
66
|
|
77
67
|
def rule_setting_link
|
78
|
-
link_to_card card.rule_setting, card.rule_setting_name
|
68
|
+
link_to_card card.rule_setting, card.rule_setting_name, class: "_over-card-link"
|
79
69
|
end
|
80
70
|
|
81
|
-
def
|
82
|
-
|
83
|
-
"#{link_to_card card.rule_set, existing_rule.trunk&.label&.downcase} (#{count})"
|
71
|
+
def existing_rule_set_link
|
72
|
+
rule_set_link existing_rule_card
|
84
73
|
end
|
85
74
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
75
|
+
def rule_set_link existing_rule
|
76
|
+
count = link_to_card [card.rule_set, :by_name], card.rule_set.count
|
77
|
+
link = link_to_card card.rule_set,
|
78
|
+
existing_rule.trunk&.label&.downcase,
|
79
|
+
class: "_over-card-link"
|
80
|
+
"#{link} (#{count})"
|
92
81
|
end
|
93
82
|
end
|
data/set/rule/editor.rb
CHANGED
@@ -5,7 +5,7 @@ def left_type_for_nest_editor_set_selection
|
|
5
5
|
when TypeID
|
6
6
|
rule_set.anchor_name
|
7
7
|
when SelfID
|
8
|
-
rule_set.anchor.type_name
|
8
|
+
rule_set.anchor&.type_name || Card.new(name: rule_set.anchor_name).type_name
|
9
9
|
else
|
10
10
|
super
|
11
11
|
end
|
@@ -27,12 +27,34 @@ format :html do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
view :rule_nest_editor_link, unknown: true do
|
31
|
+
pill_rule_link :modal_rule
|
32
|
+
end
|
33
|
+
|
30
34
|
view :rule_bridge_link, unknown: true do
|
31
|
-
|
32
|
-
|
33
|
-
|
35
|
+
pill_rule_link :overlay_rule
|
36
|
+
end
|
37
|
+
|
38
|
+
def pill_rule_link target_view
|
39
|
+
link_to_view target_view, (setting_title + short_help_text),
|
40
|
+
pill_rule_link_opts
|
41
|
+
end
|
42
|
+
|
43
|
+
def pill_rule_link_opts
|
44
|
+
opts = bridge_link_opts(
|
45
|
+
class: "edit-rule-link nav-link _rule-item #{category_classes}",
|
46
|
+
"data-bs-toggle": "pill",
|
47
|
+
"data-category": card.rule_set.categories(card.rule_setting.codename).join(" "),
|
48
|
+
"data-cy": "#{setting_title.to_name.key}-pill"
|
49
|
+
)
|
34
50
|
opts[:path].delete(:layout)
|
35
|
-
|
51
|
+
opts
|
52
|
+
end
|
53
|
+
|
54
|
+
def category_classes
|
55
|
+
card.rule_set.categories(card.rule_setting.codename)
|
56
|
+
.map { |cat| "_category-#{cat}" }
|
57
|
+
.join(" ")
|
36
58
|
end
|
37
59
|
|
38
60
|
def edit_link_view
|
@@ -41,7 +63,7 @@ format :html do
|
|
41
63
|
|
42
64
|
def edit_rule_title
|
43
65
|
output [
|
44
|
-
wrap_with(:h5, setting_title, class: "title
|
66
|
+
wrap_with(:h5, setting_title, class: "title fw-bold")
|
45
67
|
# render_overlay_rule_help
|
46
68
|
]
|
47
69
|
end
|
@@ -78,7 +100,7 @@ format :html do
|
|
78
100
|
success = @edit_rule_success
|
79
101
|
wrap_type_formgroup do
|
80
102
|
type_field(
|
81
|
-
href: path(mark: success[:id], view: :
|
103
|
+
href: path(mark: success[:id], view: :rule_form_card_editor, assign: true),
|
82
104
|
class: "type-field rule-type-field _live-type-field",
|
83
105
|
"data-remote" => true
|
84
106
|
)
|
data/set/rule/quick_editor.rb
CHANGED
@@ -30,7 +30,7 @@ format :html do
|
|
30
30
|
|
31
31
|
def undo_button
|
32
32
|
link_to "undo", method: :post, rel: "nofollow", remote: true,
|
33
|
-
class: "btn btn-secondary
|
33
|
+
class: "btn btn-secondary ms-2 btn-sm btn-reduced-padding slotter",
|
34
34
|
"data-slot-selector": ".card-slot.quick_edit-view",
|
35
35
|
path: { action: :update,
|
36
36
|
revert_actions: [card.last_action_id],
|