diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb
index 8ffac82..96e5fac 100644
--- a/app/controllers/my_profile/cms_controller.rb
+++ b/app/controllers/my_profile/cms_controller.rb
@@ -102,7 +102,9 @@ class CmsController < MyProfileController
raise "Invalid article type #{@type}" unless valid_article_type?(@type)
klass = @type.constantize
- @article = klass.new(params[:article])
+ article_data = environment.enabled?('articles_dont_accept_comments_by_default') ? { :accept_comments => false } : {}
+ article_data.merge!(params[:article]) if params[:article]
+ @article = klass.new(article_data)
parent = check_parent(params[:parent_id])
if parent
diff --git a/app/controllers/my_profile/memberships_controller.rb b/app/controllers/my_profile/memberships_controller.rb
index b8a1334..d3b96ee 100644
--- a/app/controllers/my_profile/memberships_controller.rb
+++ b/app/controllers/my_profile/memberships_controller.rb
@@ -20,7 +20,9 @@ class MembershipsController < MyProfileController
end
def new_community
- @community = Community.new(params[:community])
+ community_data = environment.enabled?('organizations_are_moderated_by_default') ? { :moderated_articles => true } : {}
+ community_data.merge!(params[:community]) if params[:community]
+ @community = Community.new(community_data)
@wizard = params[:wizard].blank? ? false : params[:wizard]
if request.post?
@community.environment = environment
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 303ab70..22c5af4 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -50,6 +50,11 @@ class Environment < ActiveRecord::Base
'use_portal_community' => _('Use the portal as news source for front page'),
'user_themes' => N_('Allow users to create their own themes'),
'search_in_home' => N_("Display search form in home page"),
+
+ 'cant_change_homepage' => N_("Don't allow users to change which article to use as homepage"),
+ 'display_header_footer_explanation' => N_("Display explanation about header and footer"),
+ 'articles_dont_accept_comments_by_default' => N_("Articles don't accept comments by default"),
+ 'organizations_are_moderated_by_default' => N_("Organizations have moderated publication by default"),
}
end
diff --git a/app/views/box_organizer/_link_list_block.rhtml b/app/views/box_organizer/_link_list_block.rhtml
index e4aa51e..7a5686d 100644
--- a/app/views/box_organizer/_link_list_block.rhtml
+++ b/app/views/box_organizer/_link_list_block.rhtml
@@ -5,7 +5,7 @@
<% for link in @block.links do %>
<%= select_tag 'block[links][][icon]', @block.icons_options(link['icon']) %> |
- <%= text_field_tag 'block[links][][name]', link[:name] %> |
+ <%= text_field_tag 'block[links][][name]', link[:name], :maxlength => 20 %> |
<%= text_field_tag 'block[links][][address]', link[:address] %> |
<% end %>
@@ -13,6 +13,6 @@
<%= link_to_function(_('New link'), nil, :class => 'button icon-add with-text') do |page|
- page.insert_html :bottom, 'links', content_tag('tr', content_tag('td', select_tag('block[links][][icon]', @block.icons_options)) + content_tag('td',text_field_tag('block[links][][name]')) + content_tag('td',text_field_tag('block[links][][address]', nil, :class => 'cel-address'))) +
- javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight")
+ page.insert_html :bottom, 'links', content_tag('tr', content_tag('td', select_tag('block[links][][icon]', @block.icons_options)) + content_tag('td',text_field_tag('block[links][][name]', '', :maxlength => 20)) + content_tag('td',text_field_tag('block[links][][address]', nil, :class => 'cel-address'))) +
+ javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight")
end %>
diff --git a/app/views/box_organizer/edit.rhtml b/app/views/box_organizer/edit.rhtml
index c7500f3..62ce36c 100644
--- a/app/views/box_organizer/edit.rhtml
+++ b/app/views/box_organizer/edit.rhtml
@@ -2,7 +2,7 @@
<% form_tag(:action => 'save', :id => @block.id) do %>
- <%= labelled_form_field(_('Custom title for this block: '), text_field(:block, :title)) %>
+ <%= labelled_form_field(_('Custom title for this block: '), text_field(:block, :title, :maxlength => 20)) %>
<%= render :partial => partial_for_class(@block.class) %>
diff --git a/app/views/cms/view.rhtml b/app/views/cms/view.rhtml
index 43ae572..7a1ec9a 100644
--- a/app/views/cms/view.rhtml
+++ b/app/views/cms/view.rhtml
@@ -58,7 +58,9 @@
<%= button_without_text :edit, _('Properties'), :action => 'edit', :id => folder.id %>
<%= button_without_text :eyes, _('Public view'), folder.url %>
- <%= button_without_text :home, _('Use as homepage'), { :action => 'set_home_page', :id => folder.id }, :method => :post %>
+ <% if !environment.enabled?('cant_change_homepage') %>
+ <%= button_without_text :home, _('Use as homepage'), { :action => 'set_home_page', :id => folder.id }, :method => :post %>
+ <% end %>
<%= button_without_text :delete, _('Delete'), { :action => 'destroy', :id => folder.id }, :method => :post, :confirm => _('Are you sure that you want to remove this folder? Note that all the items inside it will also be removed!') %>
|
@@ -80,7 +82,9 @@
<% if profile.person? %>
<%= button_without_text :spread, _('Spread this'), :action => 'publish', :id => item.id %>
<% end %>
- <%= button_without_text :home, _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %>
+ <% if !environment.enabled?('cant_change_homepage') %>
+ <%= button_without_text :home, _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %>
+ <% end %>
<%= button_without_text :delete, _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %>
diff --git a/app/views/profile_editor/header_footer.rhtml b/app/views/profile_editor/header_footer.rhtml
index de9867f..54dc6a7 100644
--- a/app/views/profile_editor/header_footer.rhtml
+++ b/app/views/profile_editor/header_footer.rhtml
@@ -4,6 +4,22 @@
<% form_tag do %>
+ <% if environment.enabled?('display_header_footer_explanation') %>
+
+ <%= _('Using the fields below you can customize the header and footer for your website:') %>
+
+ - <%= _('On header, you can include a personalized banner by first adding in "Manage content", and then referencing it here. A good format is 468 X 60 pixels, PNG format.') %>
+ - <%= _('On footer, you can include a slogan and your contact information etc.') %>
+
+
+ <%= _('See existing examples:') %>
+
+
+
+ <% end %>
<%= _('Content for header ') %>
<%= text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;') %>
<%= _('Content for footer') %>
diff --git a/config/environment.rb b/config/environment.rb
index 70e1c7f..3e16d86 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -115,6 +115,7 @@ Noosfero.locales = {
'en' => 'English',
'pt_BR' => 'Português',
'fr' => 'Français',
+ 'hy' => 'հայերեն լեզու',
}
# if you want to override this, do it in config/local.rb !
Noosfero.default_locale = 'en'
diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb
index be9ebb6..8a3e07a 100644
--- a/test/functional/cms_controller_test.rb
+++ b/test/functional/cms_controller_test.rb
@@ -97,6 +97,16 @@ class CmsControllerTest < Test::Unit::TestCase
assert_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{a.id}" }
end
+ should 'not display set as home page if disabled in environment' do
+ article = profile.articles.create!(:name => 'my new home page')
+ folder = Folder.new(:name => 'article folder'); profile.articles << folder; folder.save!
+ Article.stubs(:short_description).returns('bli')
+ env = Environment.default; env.enable('cant_change_homepage'); env.save!
+ get :index, :profile => profile.identifier
+ assert_no_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{article.id}" }
+ assert_no_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{folder.id}" }
+ end
+
should 'be able to set home page' do
a = profile.articles.build(:name => 'my new home page')
a.save!
--
libgit2 0.21.2