Commit 5683f4175d3fb972a450214fe499e8821d10754c
1 parent
7eff9852
Exists in
master
and in
29 other branches
boxes-helper: convert slash to underscore on namespaced blocks class
Showing
3 changed files
with
13 additions
and
11 deletions
Show diff stats
app/helpers/boxes_helper.rb
@@ -232,7 +232,7 @@ module BoxesHelper | @@ -232,7 +232,7 @@ module BoxesHelper | ||
232 | end | 232 | end |
233 | 233 | ||
234 | def block_css_class_name(block) | 234 | def block_css_class_name(block) |
235 | - block.class.name.underscore.gsub('_', '-') | 235 | + block.class.name.underscore.gsub('_', '-').gsub('/','_') |
236 | end | 236 | end |
237 | def block_css_classes(block) | 237 | def block_css_classes(block) |
238 | classes = block_css_class_name(block) | 238 | classes = block_css_class_name(block) |
plugins/container_block/public/style.css
1 | -#content .boxes .container-block-plugin/container-block .container_block_child, .container-block-plugin/container-block .block-outer { | 1 | +#content .boxes .container-block-plugin_container-block .container_block_child, .container-block-plugin_container-block .block-outer { |
2 | display: inline-block; | 2 | display: inline-block; |
3 | vertical-align: top; | 3 | vertical-align: top; |
4 | margin-left: -2px; | 4 | margin-left: -2px; |
5 | margin-right: -2px; | 5 | margin-right: -2px; |
6 | } | 6 | } |
7 | 7 | ||
8 | -.container-block-plugin/container-block .block-target { | 8 | +.container-block-plugin_container-block .block-target { |
9 | clear: both; | 9 | clear: both; |
10 | } | 10 | } |
11 | 11 | ||
12 | -.container-block-plugin/container-block .block-target[id^='end-of-box-'] { | 12 | +.container-block-plugin_container-block .block-target[id^='end-of-box-'] { |
13 | display: none; | 13 | display: none; |
14 | } | 14 | } |
15 | 15 | ||
16 | -#content .boxes .container-block-plugin/container-block .block .icon-down, #content .boxes .container-block-plugin/container-block .block .icon-down-disabled { | 16 | +#content .boxes .container-block-plugin_container-block .block .icon-down, #content .boxes .container-block-plugin_container-block .block .icon-down-disabled { |
17 | background-image: url(/designs/icons/default/Tango/16x16/actions/go-next.png); | 17 | background-image: url(/designs/icons/default/Tango/16x16/actions/go-next.png); |
18 | } | 18 | } |
19 | 19 | ||
20 | -#content .boxes .container-block-plugin/container-block .block .icon-up, #content .boxes .container-block-plugin/container-block .block .icon-up-disabled { | 20 | +#content .boxes .container-block-plugin_container-block .block .icon-up, #content .boxes .container-block-plugin_container-block .block .icon-up-disabled { |
21 | background-image: url(/designs/icons/default/Tango/16x16/actions/go-previous.png); | 21 | background-image: url(/designs/icons/default/Tango/16x16/actions/go-previous.png); |
22 | } | 22 | } |
23 | 23 | ||
24 | -#content .boxes .container-block-plugin/container-block .block { | 24 | +#content .boxes .container-block-plugin_container-block .block { |
25 | outline-offset: -2px; | 25 | outline-offset: -2px; |
26 | } | 26 | } |
27 | 27 | ||
28 | -#content .boxes .container-block-plugin/container-block .block .ui-resizable-handle { | 28 | +#content .boxes .container-block-plugin_container-block .block .ui-resizable-handle { |
29 | width: 10px; | 29 | width: 10px; |
30 | height: 28px; | 30 | height: 28px; |
31 | z-index: 0; | 31 | z-index: 0; |
32 | } | 32 | } |
33 | 33 | ||
34 | -#content .boxes .container-block-plugin/container-block .block .ui-resizable-e { | 34 | +#content .boxes .container-block-plugin_container-block .block .ui-resizable-e { |
35 | right: -2px; | 35 | right: -2px; |
36 | background-image: url(/plugins/container_block/images/handle_e.png); | 36 | background-image: url(/plugins/container_block/images/handle_e.png); |
37 | } | 37 | } |
38 | 38 | ||
39 | -#content .boxes .container-block-plugin/container-block .block .ui-resizable-w { | 39 | +#content .boxes .container-block-plugin_container-block .block .ui-resizable-w { |
40 | left: -2px; | 40 | left: -2px; |
41 | background-image: url(/plugins/container_block/images/handle_w.png); | 41 | background-image: url(/plugins/container_block/images/handle_w.png); |
42 | } | 42 | } |
43 | 43 | ||
44 | -.container-block-plugin/container-block .button-bar .icon-resize { | 44 | +.container-block-plugin_container-block .button-bar .icon-resize { |
45 | background-image: url(/designs/icons/default/Tango/16x16/actions/view-fullscreen.png); | 45 | background-image: url(/designs/icons/default/Tango/16x16/actions/view-fullscreen.png); |
46 | } | 46 | } |
test/unit/boxes_helper_test.rb
@@ -97,8 +97,10 @@ class BoxesHelperTest < ActiveSupport::TestCase | @@ -97,8 +97,10 @@ class BoxesHelperTest < ActiveSupport::TestCase | ||
97 | end | 97 | end |
98 | 98 | ||
99 | should 'calculate CSS class names correctly' do | 99 | should 'calculate CSS class names correctly' do |
100 | + class NamespacedBlock < Block; end | ||
100 | assert_equal 'slideshow-block', block_css_class_name(SlideshowBlock.new) | 101 | assert_equal 'slideshow-block', block_css_class_name(SlideshowBlock.new) |
101 | assert_equal 'main-block', block_css_class_name(MainBlock.new) | 102 | assert_equal 'main-block', block_css_class_name(MainBlock.new) |
103 | + assert_equal 'boxes-helper-test_namespaced-block', block_css_class_name(NamespacedBlock.new) | ||
102 | end | 104 | end |
103 | 105 | ||
104 | should 'add invisible CSS class name for invisible blocks' do | 106 | should 'add invisible CSS class name for invisible blocks' do |