diff --git a/app/models/environment.rb b/app/models/environment.rb
index baf5653..aa7973f 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -131,6 +131,14 @@ class Environment < ActiveRecord::Base
! self.settings['terms_of_use'].nil?
end
+ def message_for_disabled_enterprise
+ self.settings['message_for_disabled_enterprise']
+ end
+
+ def message_for_disabled_enterprise=(value)
+ self.settings['message_for_disabled_enterprise'] = value
+ end
+
# returns the approval method used for this environment. Possible values are:
#
# Defaults to :admim.
diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml
index f4a565d..59bd391 100644
--- a/app/views/content_viewer/view_page.rhtml
+++ b/app/views/content_viewer/view_page.rhtml
@@ -48,6 +48,12 @@
<% end %>
+<% unless profile.enabled? %>
+
diff --git a/app/views/profile/index.rhtml b/app/views/profile/index.rhtml
index 146b232..9f85426 100644
--- a/app/views/profile/index.rhtml
+++ b/app/views/profile/index.rhtml
@@ -1,3 +1,9 @@
+<% unless profile.enabled? %>
+
+ <%= environment.message_for_disabled_enterprise %>
+
+<% end %>
+
<%= _("%s's profile") % profile.identifier %>
diff --git a/public/images/icons-app/README b/public/images/icons-app/README
index 7000d85..9f2a57c 100644
--- a/public/images/icons-app/README
+++ b/public/images/icons-app/README
@@ -43,6 +43,7 @@ gtk-folder.png Nuovo
epiphany-bookmarks.png dlg-neu
mozilla-mail.png dlg-neu
gtk-cancel.png dlg-neu
+emblem-important.png dlg-neu
### END OF ICONS LISTING ###
Icons rasterization
diff --git a/public/images/icons-app/alert.png b/public/images/icons-app/alert.png
new file mode 120000
index 0000000..a540276
--- /dev/null
+++ b/public/images/icons-app/alert.png
@@ -0,0 +1 @@
+emblem-important.png
\ No newline at end of file
diff --git a/public/images/icons-app/emblem-important.png b/public/images/icons-app/emblem-important.png
new file mode 100644
index 0000000..6ee4565
Binary files /dev/null and b/public/images/icons-app/emblem-important.png differ
diff --git a/public/stylesheets/common.css b/public/stylesheets/common.css
index 8f2838e..9fb2abc 100644
--- a/public/stylesheets/common.css
+++ b/public/stylesheets/common.css
@@ -91,6 +91,17 @@ div#errorExplanation h2 {
color: #555;
}
+div#profile-disabled {
+ border: 2px solid #944;
+ text-align: center;
+ margin: auto;
+ padding: 5px;
+ padding-left: 60px;
+ min-height: 40px;
+ width: 400px;
+ background: url("../images/icons-app/alert.png") no-repeat 5px #ffffa9;
+}
+
/*********************************************************/
diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb
index 087da63..0ce3430 100644
--- a/test/functional/content_viewer_controller_test.rb
+++ b/test/functional/content_viewer_controller_test.rb
@@ -259,4 +259,11 @@ class ContentViewerControllerTest < Test::Unit::TestCase
assert_response 404
end
+ should 'show message for disabled enterprises' do
+ login_as(@profile.identifier)
+ ent = Enterprise.create!(:name => 'my test enterprise', :identifier => 'my-test-enterprise', :enabled => false)
+ get :view_page, :profile => ent.identifier, :page => []
+ assert_tag :tag => 'div', :attributes => { :id => 'profile-disabled' }, :content => Environment.default.message_for_disabled_enterprise
+ end
+
end
diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb
index fba1dec..12f6da5 100644
--- a/test/functional/profile_controller_test.rb
+++ b/test/functional/profile_controller_test.rb
@@ -213,4 +213,11 @@ class ProfileControllerTest < Test::Unit::TestCase
assert_no_tag :tag => 'a', :content => 'Add friend'
end
+ should 'show message for disabled enterprises' do
+ login_as(@profile.identifier)
+ ent = Enterprise.create!(:name => 'my test enterprise', :identifier => 'my-test-enterprise', :enabled => false)
+ get :index, :profile => ent.identifier
+ assert_tag :tag => 'div', :attributes => { :id => 'profile-disabled' }, :content => Environment.default.message_for_disabled_enterprise
+ end
+
end
diff --git a/test/unit/environment_test.rb b/test/unit/environment_test.rb
index 22ed23e..a1eede0 100644
--- a/test/unit/environment_test.rb
+++ b/test/unit/environment_test.rb
@@ -295,4 +295,10 @@ class EnvironmentTest < Test::Unit::TestCase
assert_not_includes env.people, ent
end
+ should 'have a message_for_disabled_enterprise attribute' do
+ env = Environment.new
+ env.message_for_disabled_enterprise = 'this enterprise was disabled'
+ assert_equal 'this enterprise was disabled', env.message_for_disabled_enterprise
+ end
+
end
--
libgit2 0.21.2