Commit fdbbe06c634e5a3753cc008e0cc75ca740151a6d
1 parent
28dd8dad
Exists in
master
and in
28 other branches
ActionItem856: adding block for disabled enterprise message and css
Showing
4 changed files
with
73 additions
and
0 deletions
Show diff stats
app/controllers/my_profile/profile_design_controller.rb
@@ -22,6 +22,7 @@ class ProfileDesignController < BoxOrganizerController | @@ -22,6 +22,7 @@ class ProfileDesignController < BoxOrganizerController | ||
22 | if profile.enterprise? | 22 | if profile.enterprise? |
23 | blocks << ProfileImageBlock | 23 | blocks << ProfileImageBlock |
24 | blocks << LocalizationBlock | 24 | blocks << LocalizationBlock |
25 | + blocks << DisabledEnterpriseMessageBlock | ||
25 | end | 26 | end |
26 | 27 | ||
27 | # product block exclusive for enterprises in environments that permits it | 28 | # product block exclusive for enterprises in environments that permits it |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +class DisabledEnterpriseMessageBlock < Block | ||
2 | + | ||
3 | + def self.description | ||
4 | + _('Disabled enterprise message block') | ||
5 | + end | ||
6 | + | ||
7 | + def help | ||
8 | + _('Shows a message for disabled enterprises.') | ||
9 | + end | ||
10 | + | ||
11 | + def default_title | ||
12 | + _('Localization Map') | ||
13 | + end | ||
14 | + | ||
15 | + def content | ||
16 | + message = self.owner.environment.message_for_disabled_enterprise || '' | ||
17 | + content_tag('div', message, :class => 'enterprise-disabled') | ||
18 | + end | ||
19 | + | ||
20 | + def editable? | ||
21 | + false | ||
22 | + end | ||
23 | +end |
public/stylesheets/blocks/disabled-enterprise-message-block.css
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | + | ||
2 | +.disabled-enterprise-message-block { | ||
3 | + text-align: center; | ||
4 | +} | ||
5 | + | ||
6 | +.enterprise-disabled { | ||
7 | + border: 1px solid #944; | ||
8 | + text-align: left; | ||
9 | + margin: auto; | ||
10 | + padding: 5px; | ||
11 | + padding-left: 10px; | ||
12 | + min-height: 40px; | ||
13 | + font-size: 80%; | ||
14 | + background: url("../images/icons-app/alert.png") no-repeat 5px #ffffa9; | ||
15 | +} |
@@ -0,0 +1,34 @@ | @@ -0,0 +1,34 @@ | ||
1 | +require File.dirname(__FILE__) + '/../test_helper' | ||
2 | + | ||
3 | +class DisabledEnterpriseMessageBlockTest < Test::Unit::TestCase | ||
4 | + | ||
5 | + should 'provide description' do | ||
6 | + assert_not_equal Block.description, DisabledEnterpriseMessageBlock.description | ||
7 | + end | ||
8 | + | ||
9 | + should 'display message for disabled enterprise' do | ||
10 | + e = Environment.create(:name => 'test_env') | ||
11 | + e.expects(:message_for_disabled_enterprise).returns('This message is for disabled enterprises') | ||
12 | + block = DisabledEnterpriseMessageBlock.new | ||
13 | + p = Profile.new | ||
14 | + block.expects(:owner).returns(p) | ||
15 | + p.expects(:environment).returns(e) | ||
16 | + | ||
17 | + assert_tag_in_string block.content, :tag => 'div', :content => /This message is for disabled enterprises/ | ||
18 | + end | ||
19 | + | ||
20 | + should 'display nothing if environment has no message' do | ||
21 | + e = Environment.create(:name => 'test_env') | ||
22 | + block = DisabledEnterpriseMessageBlock.new | ||
23 | + p = Profile.new | ||
24 | + block.expects(:owner).returns(p) | ||
25 | + p.expects(:environment).returns(e) | ||
26 | + | ||
27 | + assert_no_tag_in_string block.content, :tag => 'div', :content => /This message is for disabled enterprises/ | ||
28 | + end | ||
29 | + | ||
30 | + should 'not be editable' do | ||
31 | + assert !DisabledEnterpriseMessageBlock.new.editable? | ||
32 | + end | ||
33 | + | ||
34 | +end |