diff --git a/app/controllers/admin/admin_panel_controller.rb b/app/controllers/admin/admin_panel_controller.rb
index 1670512..4780917 100644
--- a/app/controllers/admin/admin_panel_controller.rb
+++ b/app/controllers/admin/admin_panel_controller.rb
@@ -16,25 +16,6 @@ class AdminPanelController < AdminController
end
end
- def manage_templates
- @person_templates = environment.templates('person')
- @community_templates = environment.templates('community')
- @enterprise_templates = environment.templates('enterprise')
- @templates = @person_templates + @community_templates + @enterprise_templates
- end
-
- def set_template
- environment.person_template = Person.find(params[:environment][:person_template]) if params[:environment][:person_template]
- environment.enterprise_template = Enterprise.find(params[:environment][:enterprise_template]) if params[:environment][:enterprise_template]
- environment.community_template = Community.find(params[:environment][:community_template]) if params[:environment][:community_template]
- if environment.save!
- flash[:notice] = _('Template updated successfully')
- else
- flash[:error] = _('Could not update template')
- end
- redirect_to :action => 'manage_templates'
- end
-
def set_portal_community
env = environment
@portal_community = env.portal_community || Community.new
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 422c50a..0230ae8 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -594,25 +594,6 @@ class Environment < ActiveRecord::Base
settings[:inactive_enterprise_template_id] = value.id
end
- def templates(profile = 'profile')
- klass = profile.classify.constantize
- templates = []
- if settings[:templates_ids]
- settings[:templates_ids].each do |template_id|
- templates << klass.find_by_id(template_id)
- end
- end
- templates.compact
- end
-
- def add_templates=(values)
- if settings[:templates_ids]
- settings[:templates_ids].concat(values.map(&:id))
- else
- settings[:templates_ids] = values.map(&:id)
- end
- end
-
def replace_enterprise_template_when_enable
settings[:replace_enterprise_template_when_enable] || false
end
diff --git a/app/views/admin_panel/index.rhtml b/app/views/admin_panel/index.rhtml
index c245f2d..476f668 100644
--- a/app/views/admin_panel/index.rhtml
+++ b/app/views/admin_panel/index.rhtml
@@ -10,7 +10,6 @@
<%= link_to _('Manage Categories'), :controller => 'categories'%> |
<%= link_to _('Manage User roles'), :controller => 'role' %> |
<%= link_to _('Manage Validators by region'), :controller => 'region_validators' %> |
- <%= link_to _('Manage Templates'), :action => 'manage_templates' %> |
<%= link_to _('Edit Templates'), :action => 'edit_templates' %> |
<%= link_to _('Manage Fields'), :controller => 'features', :action => 'manage_fields' %> |
<%= link_to _('Set Portal'), :action => 'set_portal_community' %> |
diff --git a/app/views/admin_panel/manage_templates.rhtml b/app/views/admin_panel/manage_templates.rhtml
deleted file mode 100644
index d941c67..0000000
--- a/app/views/admin_panel/manage_templates.rhtml
+++ /dev/null
@@ -1,24 +0,0 @@
-<%= _('Set Templates') %>
-
-<% labelled_form_for(:environment, @environment, :url => {:action => 'set_template'}) do |f| %>
-
-
- <%= f.select :person_template, @person_templates.map {|item| [ item.identifier, item.id]}, :selected => (environment.person_template.nil? ? nil : environment.person_template.id) %>
-
-
-
-
- <%= f.select :community_template, @community_templates.map {|item| [ item.identifier, item.id]}, :selected => (environment.community_template.nil? ? nil : environment.community_template.id) %>
-
-
-
-
- <%= f.select :enterprise_template, @enterprise_templates.map {|item| [ item.identifier, item.id]}, :selected => (environment.enterprise_template.nil? ? nil : environment.enterprise_template.id) %>
-
-
- <% button_bar do %>
- <%= submit_button(:save, _('Save')) %>
- <%= button(:cancel, _('Cancel'), :action => 'index') %>
- <% end %>
-
-<% end %>
diff --git a/test/functional/admin_panel_controller_test.rb b/test/functional/admin_panel_controller_test.rb
index 58c3ce5..5272182 100644
--- a/test/functional/admin_panel_controller_test.rb
+++ b/test/functional/admin_panel_controller_test.rb
@@ -99,42 +99,6 @@ class AdminPanelControllerTest < Test::Unit::TestCase
assert_equal "This is my new environment", Environment.default.message_for_disabled_enterprise
end
- should 'list templates' do
- get :manage_templates
-
- assert_kind_of Array, assigns(:person_templates)
- assert_kind_of Array, assigns(:community_templates)
- assert_kind_of Array, assigns(:enterprise_templates)
- end
-
- should 'display environment template options' do
- e = Environment.default
- @controller.stubs(:environment).returns(e)
- profile_template = Profile.create!(:name =>'template_test', :identifier => 'template_test', :environment => e)
- e.settings[:templates_ids] = [profile_template.id]
- e.save!
- e.stubs(:templates).with('person').returns([profile_template])
- e.stubs(:templates).with('community').returns([profile_template])
- e.stubs(:templates).with('enterprise').returns([profile_template])
-
- assert_equal [profile_template], e.templates('person')
-
- get :manage_templates
- ['person_template', 'community_template', 'enterprise_template'].each do |template|
- assert_tag :tag => 'select', :attributes => { :id => "environment_#{template}"}, :descendant => { :tag => 'option', :content => 'template_test'}
- end
- end
-
- should 'set template' do
- e = Environment.default
- @controller.stubs(:environment).returns(e)
- profile_template = Enterprise.create!(:name =>'template_test', :identifier => 'template_test')
-
- post :set_template, :environment => {:enterprise_template => profile_template.id}
-
- assert_equal profile_template, e.enterprise_template
- end
-
should 'not use WYSWYIG if disabled' do
e = Environment.default; e.disable('wysiwyg_editor_for_environment_home'); e.save!
get :site_info
diff --git a/test/unit/environment_test.rb b/test/unit/environment_test.rb
index 8543b4a..8d50f0d 100644
--- a/test/unit/environment_test.rb
+++ b/test/unit/environment_test.rb
@@ -487,34 +487,6 @@ class EnvironmentTest < Test::Unit::TestCase
assert_equal template, e.enterprise_template
end
- should 'add templates when it is empty' do
- e = Environment.create!(:name => 'test_env')
- ent_template_a = Enterprise.create!(:name => 'Enterprise template A', :identifier => e.name.to_slug + 'enterprise_template_a', :environment => e, :public_profile => false)
- ent_template_b = Enterprise.create!(:name => 'Enterprise template B', :identifier => e.name.to_slug + 'enterprise_template_b', :environment => e, :public_profile => false)
-
- e.add_templates = [ent_template_a, ent_template_b]
- assert_equal [ent_template_a, ent_template_b], e.templates
- end
-
- should 'add templates when it is not empty' do
- e = Environment.create!(:name => 'test_env')
-
- ent_template_example = Enterprise.create!(:name => 'Enterprise template example', :identifier => e.name.to_slug + 'enterprise_template_example', :environment => e, :public_profile => false)
-
- e.settings[:templates_ids] = [ent_template_example.id]
- e.save
-
- ent_template_a = Enterprise.create!(:name => 'Enterprise template A', :identifier => e.name.to_slug + 'enterprise_template_a', :environment => e, :public_profile => false)
-
- e.add_templates = [ent_template_a]
-
- assert_equal [ent_template_example, ent_template_a], e.templates
- end
-
- should 'have an empty array of templates by default' do
- assert_equal [], Environment.new.templates
- end
-
should 'not disable ssl by default' do
e = Environment.new
assert !e.disable_ssl
--
libgit2 0.21.2