Commit 7c91fe46fe9436c95a3a6833c8a1395362533f7c
Committed by
Antonio Terceiro
1 parent
32e3c06e
Exists in
master
and in
29 other branches
ActionItem834: port ecosol-specific changes into master branch
* renaming ferret_server.yml to ferret_server.yml.dist * adding workaround to list categories * hack to bypass ferret limitation * adding configuration to better-browse-promotion * adding form for enterprise activation
Showing
12 changed files
with
104 additions
and
29 deletions
Show diff stats
app/controllers/admin/categories_controller.rb
... | ... | @@ -5,7 +5,9 @@ class CategoriesController < AdminController |
5 | 5 | helper :categories |
6 | 6 | |
7 | 7 | def index |
8 | - @categories = environment.top_level_categories | |
8 | + # WORKAROUND: restricting the category trees to display. Region and | |
9 | + # ProductCategory have VERY LARGE trees. | |
10 | + @categories = environment.categories.find(:all, :conditions => "parent_id is null AND type is null") | |
9 | 11 | end |
10 | 12 | |
11 | 13 | ALLOWED_TYPES = CategoriesHelper::TYPES.map {|item| item[1] } | ... | ... |
app/models/environment.rb
... | ... | @@ -40,6 +40,9 @@ class Environment < ActiveRecord::Base |
40 | 40 | 'disable_contact_person' => _('Disable contact for people'), |
41 | 41 | 'disable_contact_community' => _('Disable contact for groups/communities'), |
42 | 42 | 'disable_join_community_popup' => _('Disable the popup that ask to join a group/community'), |
43 | + | |
44 | + 'enterprise_activation' => _('Enable activation of enterprises'), | |
45 | + 'warn_obsolete_browser' => _('Enable warning of obsolete browser'), | |
43 | 46 | } |
44 | 47 | end |
45 | 48 | ... | ... |
app/views/home/index.rhtml
1 | -<%= @environment.description %> | |
1 | +<%= environment.description %> | |
2 | + | |
3 | +<% if environment.enabled?('enterprise_activation') %> | |
4 | + | |
5 | + <div id='activation_enterprise'> | |
6 | + <% form_tag({:controller => 'account', :action => 'activation_question'}, {:method => 'get'}) do %> | |
7 | + <p><strong><%= __('Activate your enterprise') %></strong></p> | |
8 | + <%= labelled_form_field(__('Enterprise activation code') + ':', text_field_tag('enterprise_code')) %> | |
9 | + <%= submit_button(:ok, _('Ativar')) %> | |
10 | + <% end %> | |
11 | + </div> | |
12 | + | |
13 | +<% end %> | |
2 | 14 | |
3 | 15 | <div id='home-search' style='text-align: center'> |
4 | 16 | <% form_tag :controller => 'search', :action => 'index' do %> | ... | ... |
app/views/layouts/application.rhtml
... | ... | @@ -183,15 +183,19 @@ |
183 | 183 | <%= javascript_include_tag 'show-mouse-help' %> |
184 | 184 | <%= javascript_include_tag 'noosfero-show-help' %> |
185 | 185 | |
186 | - <div id="better-browser-promotion" style="display:none"> | |
187 | - <h3><%= | |
188 | - _('Your web browser is obsolete!') +'</h3><p/>'+ | |
189 | - _('This website will not look as good as it could. | |
190 | - Don\'t you want to use Firefox? That is a great web browser, free, | |
191 | - and made by people of all the world parts.') | |
192 | - %><p/> | |
193 | - <b id="bbp-getff"><a href="http://getfirefox.com" class="icon-firefox" target="getff"><%= _('Get Firefox Now!') %></a></b> | |
194 | - </div> | |
186 | + <% if environment.enabled?('warn_obsolete_browser') %> | |
187 | + | |
188 | + <div id="better-browser-promotion" style="display:none"> | |
189 | + <h3><%= | |
190 | + _('Your web browser is obsolete!') +'</h3><p/>'+ | |
191 | + _('This website will not look as good as it could. | |
192 | + Don\'t you want to use Firefox? That is a great web browser, free, | |
193 | + and made by people of all the world parts.') | |
194 | + %><p/> | |
195 | + <b id="bbp-getff"><a href="http://getfirefox.com" class="icon-firefox" target="getff"><%= _('Get Firefox Now!') %></a></b> | |
196 | + </div> | |
197 | + | |
198 | + <% end %> | |
195 | 199 | <%= javascript_include_tag 'better-browser-promotion' %> |
196 | 200 | |
197 | 201 | <% if is_testing_theme %> | ... | ... |
config/ferret_server.yml
... | ... | @@ -1,16 +0,0 @@ |
1 | -production: | |
2 | - host: localhost | |
3 | - port: 9011 | |
4 | - pid_file: log/ferret.pid | |
5 | -#development: | |
6 | -# host: localhost | |
7 | -# port: 9010 | |
8 | -# pid_file: log/ferret.pid | |
9 | -#test: | |
10 | -# host: localhost | |
11 | -# port: 9009 | |
12 | -# pid_file: log/ferret.pid | |
13 | -staging: | |
14 | - host: localhost | |
15 | - port: 9011 | |
16 | - pid_file: log/ferret.pid |
... | ... | @@ -0,0 +1,16 @@ |
1 | +production: | |
2 | + host: localhost | |
3 | + port: 9011 | |
4 | + pid_file: log/ferret.pid | |
5 | +#development: | |
6 | +# host: localhost | |
7 | +# port: 9010 | |
8 | +# pid_file: log/ferret.pid | |
9 | +#test: | |
10 | +# host: localhost | |
11 | +# port: 9009 | |
12 | +# pid_file: log/ferret.pid | |
13 | +staging: | |
14 | + host: localhost | |
15 | + port: 9011 | |
16 | + pid_file: log/ferret.pid | ... | ... |
lib/acts_as_searchable.rb
... | ... | @@ -12,7 +12,9 @@ class << ActiveRecord::Base |
12 | 12 | |
13 | 13 | ferret_options[:limit] = :all |
14 | 14 | |
15 | - ids = find_ids_with_ferret(query, ferret_options)[1].map{|r|r[:id].to_i} | |
15 | + # FIXME this is a HORRIBLE HACK | |
16 | + ids = find_ids_with_ferret(query, ferret_options)[1][0..8000].map{|r|r[:id].to_i} | |
17 | + | |
16 | 18 | if ids.empty? |
17 | 19 | ids << -1 |
18 | 20 | end | ... | ... |
lib/unifreire_terminology.rb
... | ... | @@ -30,6 +30,9 @@ class UnifreireTerminology < Noosfero::Terminology::Custom |
30 | 30 | 'Events' => N_('Schedule'), |
31 | 31 | 'Manage enterprise fields' => N_('Manage institutions fields'), |
32 | 32 | "%s's enterprises" => N_("%s's institutions"), |
33 | + 'Activate your enterprise' => N_('Activate your institution'), | |
34 | + 'Enterprise activation code' => N_('Institution activation code'), | |
35 | + 'Disable activation of enterprises' => N_('Disable activation of institutions'), | |
33 | 36 | }) |
34 | 37 | end |
35 | 38 | ... | ... |
lib/zen3_terminology.rb
... | ... | @@ -60,6 +60,9 @@ class Zen3Terminology < Noosfero::Terminology::Custom |
60 | 60 | 'Friends' => N_('Contacts'), |
61 | 61 | 'Creating new community' => N_('Creating new group'), |
62 | 62 | 'Do you want to join this community?' => N_('Do you want to join this group?'), |
63 | + 'Activate your enterprise' => N_('Activate your organization'), | |
64 | + 'Enterprise activation code' => N_('Organization activation code'), | |
65 | + 'Disable activation of enterprises' => N_('Disable activation of organizations'), | |
63 | 66 | }) |
64 | 67 | end |
65 | 68 | ... | ... |
public/stylesheets/blocks/main-block.css
... | ... | @@ -5,3 +5,20 @@ |
5 | 5 | .main-block .article-body, .main-block h1 { |
6 | 6 | overflow: hidden; |
7 | 7 | } |
8 | + | |
9 | +body div#activation_enterprise { | |
10 | + text-align: center; | |
11 | +} | |
12 | + | |
13 | +div#activation_enterprise { | |
14 | + border: 2px solid #DA3; | |
15 | + padding-bottom: 10px; | |
16 | + margin-bottom: 15px; | |
17 | + background-color: #FD8; | |
18 | +} | |
19 | + | |
20 | +div#activation_enterprise label, | |
21 | +div#activation_enterprise input, | |
22 | +div#activation_enterprise div { | |
23 | + display: inline | |
24 | +} | ... | ... |
test/functional/categories_controller_test.rb
... | ... | @@ -174,4 +174,15 @@ class CategoriesControllerTest < Test::Unit::TestCase |
174 | 174 | |
175 | 175 | assert_tag :tag => 'select', :attributes => { :name => "type" } |
176 | 176 | end |
177 | + | |
178 | + should 'not list regions and product categories' do | |
179 | + Environment.default.categories.destroy_all | |
180 | + c = Category.create!(:name => 'Regular category', :environment => Environment.default) | |
181 | + ProductCategory.create!(:name => 'Product category', :environment => Environment.default) | |
182 | + Region.create!(:name => 'Some region', :environment => Environment.default) | |
183 | + | |
184 | + get :index | |
185 | + assert_equal [c], assigns(:categories) | |
186 | + end | |
187 | + | |
177 | 188 | end | ... | ... |
test/functional/home_controller_test.rb
... | ... | @@ -21,5 +21,23 @@ all_fixtures |
21 | 21 | def test_valid_xhtml |
22 | 22 | assert_valid_xhtml |
23 | 23 | end |
24 | - | |
24 | + | |
25 | + should 'not display form for enterprise activation if disabled in environment' do | |
26 | + env = Environment.default | |
27 | + env.disable('enterprise_activation') | |
28 | + env.save! | |
29 | + | |
30 | + get :index | |
31 | + assert_no_tag :tag => 'div', :attributes => { :id => 'activation_enterprise' }, :descendant => {:tag => 'form', :attributes => {:action => '/account/activation_question'}} | |
32 | + end | |
33 | + | |
34 | + should 'display form for enterprise activation if enabled on environment' do | |
35 | + env = Environment.default | |
36 | + env.enable('enterprise_activation') | |
37 | + env.save! | |
38 | + | |
39 | + get :index | |
40 | + assert_tag :tag => 'div', :attributes => { :id => 'activation_enterprise' }, :descendant => {:tag => 'form', :attributes => {:action => '/account/activation_question'}} | |
41 | + end | |
42 | + | |
25 | 43 | end | ... | ... |