Commit 128862a2f876aabafb77d63ea6735da3dadd36b7

Authored by JoenioCosta
1 parent d0645bf0

ActionItem427: display message for disabled enterprises


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2030 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/environment.rb
... ... @@ -131,6 +131,14 @@ class Environment < ActiveRecord::Base
131 131 ! self.settings['terms_of_use'].nil?
132 132 end
133 133  
  134 + def message_for_disabled_enterprise
  135 + self.settings['message_for_disabled_enterprise']
  136 + end
  137 +
  138 + def message_for_disabled_enterprise=(value)
  139 + self.settings['message_for_disabled_enterprise'] = value
  140 + end
  141 +
134 142 # returns the approval method used for this environment. Possible values are:
135 143 #
136 144 # Defaults to <tt>:admim</tt>.
... ...
app/views/content_viewer/view_page.rhtml
... ... @@ -48,6 +48,12 @@
48 48 </div>
49 49 <% end %>
50 50  
  51 +<% unless profile.enabled? %>
  52 + <div id='profile-disabled'>
  53 + <%= environment.message_for_disabled_enterprise %>
  54 + </div>
  55 +<% end %>
  56 +
51 57 <%= @page.to_html %>
52 58  
53 59 <div id="article-cat">
... ...
app/views/profile/index.rhtml
  1 +<% unless profile.enabled? %>
  2 + <div id='profile-disabled'>
  3 + <%= environment.message_for_disabled_enterprise %>
  4 + </div>
  5 +<% end %>
  6 +
1 7 <h2><%= _("%s's profile") % profile.identifier %></h2>
2 8  
3 9 <ul>
... ...
public/images/icons-app/README
... ... @@ -43,6 +43,7 @@ gtk-folder.png Nuovo
43 43 epiphany-bookmarks.png dlg-neu
44 44 mozilla-mail.png dlg-neu
45 45 gtk-cancel.png dlg-neu
  46 +emblem-important.png dlg-neu
46 47 ### END OF ICONS LISTING ###
47 48  
48 49 Icons rasterization
... ...
public/images/icons-app/alert.png 0 → 120000
... ... @@ -0,0 +1 @@
  1 +emblem-important.png
0 2 \ No newline at end of file
... ...
public/images/icons-app/emblem-important.png 0 → 100644

2.16 KB

public/stylesheets/common.css
... ... @@ -91,6 +91,17 @@ div#errorExplanation h2 {
91 91 color: #555;
92 92 }
93 93  
  94 +div#profile-disabled {
  95 + border: 2px solid #944;
  96 + text-align: center;
  97 + margin: auto;
  98 + padding: 5px;
  99 + padding-left: 60px;
  100 + min-height: 40px;
  101 + width: 400px;
  102 + background: url("../images/icons-app/alert.png") no-repeat 5px #ffffa9;
  103 +}
  104 +
94 105 /*********************************************************/
95 106  
96 107  
... ...
test/functional/content_viewer_controller_test.rb
... ... @@ -259,4 +259,11 @@ class ContentViewerControllerTest &lt; Test::Unit::TestCase
259 259 assert_response 404
260 260 end
261 261  
  262 + should 'show message for disabled enterprises' do
  263 + login_as(@profile.identifier)
  264 + ent = Enterprise.create!(:name => 'my test enterprise', :identifier => 'my-test-enterprise', :enabled => false)
  265 + get :view_page, :profile => ent.identifier, :page => []
  266 + assert_tag :tag => 'div', :attributes => { :id => 'profile-disabled' }, :content => Environment.default.message_for_disabled_enterprise
  267 + end
  268 +
262 269 end
... ...
test/functional/profile_controller_test.rb
... ... @@ -213,4 +213,11 @@ class ProfileControllerTest &lt; Test::Unit::TestCase
213 213 assert_no_tag :tag => 'a', :content => 'Add friend'
214 214 end
215 215  
  216 + should 'show message for disabled enterprises' do
  217 + login_as(@profile.identifier)
  218 + ent = Enterprise.create!(:name => 'my test enterprise', :identifier => 'my-test-enterprise', :enabled => false)
  219 + get :index, :profile => ent.identifier
  220 + assert_tag :tag => 'div', :attributes => { :id => 'profile-disabled' }, :content => Environment.default.message_for_disabled_enterprise
  221 + end
  222 +
216 223 end
... ...
test/unit/environment_test.rb
... ... @@ -295,4 +295,10 @@ class EnvironmentTest &lt; Test::Unit::TestCase
295 295 assert_not_includes env.people, ent
296 296 end
297 297  
  298 + should 'have a message_for_disabled_enterprise attribute' do
  299 + env = Environment.new
  300 + env.message_for_disabled_enterprise = 'this enterprise was disabled'
  301 + assert_equal 'this enterprise was disabled', env.message_for_disabled_enterprise
  302 + end
  303 +
298 304 end
... ...