Commit 645451ed8537af4d79a8004038d466d19de11872
1 parent
c7ef7029
Exists in
master
and in
29 other branches
Remove deprecated "terminology" feature
Showing
5 changed files
with
0 additions
and
85 deletions
Show diff stats
app/controllers/application_controller.rb
@@ -56,8 +56,6 @@ class ApplicationController < ActionController::Base | @@ -56,8 +56,6 @@ class ApplicationController < ActionController::Base | ||
56 | 56 | ||
57 | attr_reader :environment | 57 | attr_reader :environment |
58 | 58 | ||
59 | - before_filter :load_terminology | ||
60 | - | ||
61 | # declares that the given <tt>actions</tt> cannot be accessed by other HTTP | 59 | # declares that the given <tt>actions</tt> cannot be accessed by other HTTP |
62 | # method besides POST. | 60 | # method besides POST. |
63 | def self.post_only(actions, redirect = { :action => 'index'}) | 61 | def self.post_only(actions, redirect = { :action => 'index'}) |
@@ -127,13 +125,6 @@ class ApplicationController < ActionController::Base | @@ -127,13 +125,6 @@ class ApplicationController < ActionController::Base | ||
127 | end | 125 | end |
128 | end | 126 | end |
129 | 127 | ||
130 | - def load_terminology | ||
131 | - # cache terminology for performance | ||
132 | - @@terminology_cache ||= {} | ||
133 | - @@terminology_cache[environment.id] ||= environment.terminology | ||
134 | - Noosfero.terminology = @@terminology_cache[environment.id] | ||
135 | - end | ||
136 | - | ||
137 | def render_not_found(path = nil) | 128 | def render_not_found(path = nil) |
138 | @no_design_blocks = true | 129 | @no_design_blocks = true |
139 | @path ||= request.path | 130 | @path ||= request.path |
app/models/environment.rb
@@ -382,22 +382,6 @@ class Environment < ActiveRecord::Base | @@ -382,22 +382,6 @@ class Environment < ActiveRecord::Base | ||
382 | self.settings[:organization_approval_method] = actual_value | 382 | self.settings[:organization_approval_method] = actual_value |
383 | end | 383 | end |
384 | 384 | ||
385 | - def terminology | ||
386 | - if self.settings[:terminology] | ||
387 | - self.settings[:terminology].constantize.instance | ||
388 | - else | ||
389 | - Noosfero.terminology | ||
390 | - end | ||
391 | - end | ||
392 | - | ||
393 | - def terminology=(value) | ||
394 | - if value | ||
395 | - self.settings[:terminology] = value.class.name | ||
396 | - else | ||
397 | - self.settings[:terminology] = nil | ||
398 | - end | ||
399 | - end | ||
400 | - | ||
401 | def custom_person_fields | 385 | def custom_person_fields |
402 | self.settings[:custom_person_fields].nil? ? {} : self.settings[:custom_person_fields] | 386 | self.settings[:custom_person_fields].nil? ? {} : self.settings[:custom_person_fields] |
403 | end | 387 | end |
lib/noosfero/terminology.rb
@@ -1,27 +0,0 @@ | @@ -1,27 +0,0 @@ | ||
1 | -module Noosfero | ||
2 | - class Terminology | ||
3 | - | ||
4 | - def get(x) | ||
5 | - raise NotImplementedError | ||
6 | - end | ||
7 | - | ||
8 | - # the default terminology. Just returns the same message as is. | ||
9 | - class Default | ||
10 | - include Singleton | ||
11 | - def get(x) | ||
12 | - x | ||
13 | - end | ||
14 | - end | ||
15 | - | ||
16 | - class Custom | ||
17 | - include Singleton | ||
18 | - def initialize(hash) | ||
19 | - @messages = hash | ||
20 | - end | ||
21 | - def get(x) | ||
22 | - @messages[x] || x | ||
23 | - end | ||
24 | - end | ||
25 | - | ||
26 | - end | ||
27 | -end |
test/functional/application_controller_test.rb
@@ -238,17 +238,6 @@ class ApplicationControllerTest < ActionController::TestCase | @@ -238,17 +238,6 @@ class ApplicationControllerTest < ActionController::TestCase | ||
238 | assert_no_tag :tag => 'div', :attributes => { :id => 'theme-test-panel' } | 238 | assert_no_tag :tag => 'div', :attributes => { :id => 'theme-test-panel' } |
239 | end | 239 | end |
240 | 240 | ||
241 | - should 'load terminology from environment' do | ||
242 | - term = Zen3Terminology.instance | ||
243 | - env = Environment.default | ||
244 | - Environment.stubs(:default).returns(env) | ||
245 | - env.stubs(:terminology).returns(term) | ||
246 | - env.stubs(:id).returns(-9999) | ||
247 | - | ||
248 | - get :index | ||
249 | - assert_equal Noosfero.terminology, term | ||
250 | - end | ||
251 | - | ||
252 | should 'not display categories menu if categories feature disabled' do | 241 | should 'not display categories menu if categories feature disabled' do |
253 | Environment.any_instance.stubs(:enabled?).with(anything).returns(true) | 242 | Environment.any_instance.stubs(:enabled?).with(anything).returns(true) |
254 | c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent => nil, :display_in_menu => true ) | 243 | c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent => nil, :display_in_menu => true ) |
test/unit/noosfero_test.rb
@@ -30,15 +30,6 @@ class NoosferoTest < ActiveSupport::TestCase | @@ -30,15 +30,6 @@ class NoosferoTest < ActiveSupport::TestCase | ||
30 | assert_match /^#{Noosfero.identifier_format}$/, 'with.dot' | 30 | assert_match /^#{Noosfero.identifier_format}$/, 'with.dot' |
31 | end | 31 | end |
32 | 32 | ||
33 | - should 'delegate terminology' do | ||
34 | - Noosfero.terminology.expects(:get).with('lalala').returns('lelele') | ||
35 | - assert_equal 'lelele', Noosfero.term('lalala') | ||
36 | - end | ||
37 | - | ||
38 | - should 'use default terminology by default' do | ||
39 | - assert_equal 'lalalalala', Noosfero.term('lalalalala') | ||
40 | - end | ||
41 | - | ||
42 | should 'provide url options to identify development environment' do | 33 | should 'provide url options to identify development environment' do |
43 | ENV.expects(:[]).with('RAILS_ENV').returns('development') | 34 | ENV.expects(:[]).with('RAILS_ENV').returns('development') |
44 | Noosfero.expects(:development_url_options).returns({ :port => 9999 }) | 35 | Noosfero.expects(:development_url_options).returns({ :port => 9999 }) |
@@ -56,19 +47,6 @@ class NoosferoTest < ActiveSupport::TestCase | @@ -56,19 +47,6 @@ class NoosferoTest < ActiveSupport::TestCase | ||
56 | assert_equal 'en', FastGettext.locale | 47 | assert_equal 'en', FastGettext.locale |
57 | end | 48 | end |
58 | 49 | ||
59 | - should 'use terminology with ngettext' do | ||
60 | - Noosfero.stubs(:terminology).returns(UnifreireTerminology.instance) | ||
61 | - | ||
62 | - Noosfero.with_locale('en') do | ||
63 | - assert_equal 'One institution', n__('One enterprise', '%{num} enterprises', 1) | ||
64 | - end | ||
65 | - | ||
66 | - Noosfero.with_locale('pt') do | ||
67 | - stubs(:ngettext).with('One institution', '%{num} institutions', 1).returns('Uma instituição') | ||
68 | - assert_equal 'Uma instituição', n__('One enterprise', '%{num} enterprises', 1) | ||
69 | - end | ||
70 | - end | ||
71 | - | ||
72 | should "use default hostname of default environment as hostname of Noosfero instance" do | 50 | should "use default hostname of default environment as hostname of Noosfero instance" do |
73 | Environment.default.domains << Domain.new(:name => 'thisisdefaulthostname.com', :is_default => true) | 51 | Environment.default.domains << Domain.new(:name => 'thisisdefaulthostname.com', :is_default => true) |
74 | assert_equal 'thisisdefaulthostname.com', Noosfero.default_hostname | 52 | assert_equal 'thisisdefaulthostname.com', Noosfero.default_hostname |