Commit b7a6c7e4c2eec0b4e5ec6941d11cc6677d408107
1 parent
8233605b
Exists in
master
and in
28 other branches
ActionItem835: bringing features from zen3 branch
Everything that was in the zen3-specific branch was brought to the master branch either directly as a enhancement or as a configuration that will be available and turned on on zen3 itself.
Showing
9 changed files
with
48 additions
and
8 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
@@ -102,7 +102,9 @@ class CmsController < MyProfileController | @@ -102,7 +102,9 @@ class CmsController < MyProfileController | ||
102 | 102 | ||
103 | raise "Invalid article type #{@type}" unless valid_article_type?(@type) | 103 | raise "Invalid article type #{@type}" unless valid_article_type?(@type) |
104 | klass = @type.constantize | 104 | klass = @type.constantize |
105 | - @article = klass.new(params[:article]) | 105 | + article_data = environment.enabled?('articles_dont_accept_comments_by_default') ? { :accept_comments => false } : {} |
106 | + article_data.merge!(params[:article]) if params[:article] | ||
107 | + @article = klass.new(article_data) | ||
106 | 108 | ||
107 | parent = check_parent(params[:parent_id]) | 109 | parent = check_parent(params[:parent_id]) |
108 | if parent | 110 | if parent |
app/controllers/my_profile/memberships_controller.rb
@@ -20,7 +20,9 @@ class MembershipsController < MyProfileController | @@ -20,7 +20,9 @@ class MembershipsController < MyProfileController | ||
20 | end | 20 | end |
21 | 21 | ||
22 | def new_community | 22 | def new_community |
23 | - @community = Community.new(params[:community]) | 23 | + community_data = environment.enabled?('organizations_are_moderated_by_default') ? { :moderated_articles => true } : {} |
24 | + community_data.merge!(params[:community]) if params[:community] | ||
25 | + @community = Community.new(community_data) | ||
24 | @wizard = params[:wizard].blank? ? false : params[:wizard] | 26 | @wizard = params[:wizard].blank? ? false : params[:wizard] |
25 | if request.post? | 27 | if request.post? |
26 | @community.environment = environment | 28 | @community.environment = environment |
app/models/environment.rb
@@ -50,6 +50,11 @@ class Environment < ActiveRecord::Base | @@ -50,6 +50,11 @@ class Environment < ActiveRecord::Base | ||
50 | 'use_portal_community' => _('Use the portal as news source for front page'), | 50 | 'use_portal_community' => _('Use the portal as news source for front page'), |
51 | 'user_themes' => N_('Allow users to create their own themes'), | 51 | 'user_themes' => N_('Allow users to create their own themes'), |
52 | 'search_in_home' => N_("Display search form in home page"), | 52 | 'search_in_home' => N_("Display search form in home page"), |
53 | + | ||
54 | + 'cant_change_homepage' => N_("Don't allow users to change which article to use as homepage"), | ||
55 | + 'display_header_footer_explanation' => N_("Display explanation about header and footer"), | ||
56 | + 'articles_dont_accept_comments_by_default' => N_("Articles don't accept comments by default"), | ||
57 | + 'organizations_are_moderated_by_default' => N_("Organizations have moderated publication by default"), | ||
53 | } | 58 | } |
54 | end | 59 | end |
55 | 60 |
app/views/box_organizer/_link_list_block.rhtml
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <% for link in @block.links do %> | 5 | <% for link in @block.links do %> |
6 | <tr> | 6 | <tr> |
7 | <td><%= select_tag 'block[links][][icon]', @block.icons_options(link['icon']) %></td> | 7 | <td><%= select_tag 'block[links][][icon]', @block.icons_options(link['icon']) %></td> |
8 | - <td><%= text_field_tag 'block[links][][name]', link[:name] %></td> | 8 | + <td><%= text_field_tag 'block[links][][name]', link[:name], :maxlength => 20 %></td> |
9 | <td class='cel-address'><%= text_field_tag 'block[links][][address]', link[:address] %></td> | 9 | <td class='cel-address'><%= text_field_tag 'block[links][][address]', link[:address] %></td> |
10 | </tr> | 10 | </tr> |
11 | <% end %> | 11 | <% end %> |
@@ -13,6 +13,6 @@ | @@ -13,6 +13,6 @@ | ||
13 | </div> | 13 | </div> |
14 | 14 | ||
15 | <%= link_to_function(_('New link'), nil, :class => 'button icon-add with-text') do |page| | 15 | <%= link_to_function(_('New link'), nil, :class => 'button icon-add with-text') do |page| |
16 | - 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'))) + | ||
17 | - javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight") | 16 | + 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'))) + |
17 | + javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight") | ||
18 | end %> | 18 | end %> |
app/views/box_organizer/edit.rhtml
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | 2 | ||
3 | <% form_tag(:action => 'save', :id => @block.id) do %> | 3 | <% form_tag(:action => 'save', :id => @block.id) do %> |
4 | 4 | ||
5 | - <%= labelled_form_field(_('Custom title for this block: '), text_field(:block, :title)) %> | 5 | + <%= labelled_form_field(_('Custom title for this block: '), text_field(:block, :title, :maxlength => 20)) %> |
6 | 6 | ||
7 | <%= render :partial => partial_for_class(@block.class) %> | 7 | <%= render :partial => partial_for_class(@block.class) %> |
8 | 8 |
app/views/cms/view.rhtml
@@ -58,7 +58,9 @@ | @@ -58,7 +58,9 @@ | ||
58 | <td class="article-controls"> | 58 | <td class="article-controls"> |
59 | <%= button_without_text :edit, _('Properties'), :action => 'edit', :id => folder.id %> | 59 | <%= button_without_text :edit, _('Properties'), :action => 'edit', :id => folder.id %> |
60 | <%= button_without_text :eyes, _('Public view'), folder.url %> | 60 | <%= button_without_text :eyes, _('Public view'), folder.url %> |
61 | - <%= button_without_text :home, _('Use as homepage'), { :action => 'set_home_page', :id => folder.id }, :method => :post %> | 61 | + <% if !environment.enabled?('cant_change_homepage') %> |
62 | + <%= button_without_text :home, _('Use as homepage'), { :action => 'set_home_page', :id => folder.id }, :method => :post %> | ||
63 | + <% end %> | ||
62 | <%= 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!') %> | 64 | <%= 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!') %> |
63 | </td> | 65 | </td> |
64 | </tr> | 66 | </tr> |
@@ -80,7 +82,9 @@ | @@ -80,7 +82,9 @@ | ||
80 | <% if profile.person? %> | 82 | <% if profile.person? %> |
81 | <%= button_without_text :spread, _('Spread this'), :action => 'publish', :id => item.id %> | 83 | <%= button_without_text :spread, _('Spread this'), :action => 'publish', :id => item.id %> |
82 | <% end %> | 84 | <% end %> |
83 | - <%= button_without_text :home, _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %> | 85 | + <% if !environment.enabled?('cant_change_homepage') %> |
86 | + <%= button_without_text :home, _('Use as homepage'), { :action => 'set_home_page', :id => item.id }, :method => :post %> | ||
87 | + <% end %> | ||
84 | <%= button_without_text :delete, _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %> | 88 | <%= button_without_text :delete, _('Delete'), { :action => 'destroy', :id => item.id }, :method => :post, :confirm => _('Are you sure that you want to remove this item?') %> |
85 | </td> | 89 | </td> |
86 | </tr> | 90 | </tr> |
app/views/profile_editor/header_footer.rhtml
@@ -4,6 +4,22 @@ | @@ -4,6 +4,22 @@ | ||
4 | 4 | ||
5 | <% form_tag do %> | 5 | <% form_tag do %> |
6 | <div style='width: 90%; margin: auto;'> | 6 | <div style='width: 90%; margin: auto;'> |
7 | + <% if environment.enabled?('display_header_footer_explanation') %> | ||
8 | + <div class='explanation'> | ||
9 | + <%= _('Using the fields below you can customize the header and footer for your website:') %> | ||
10 | + <ul> | ||
11 | + <li><%= _('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.') %></li> | ||
12 | + <li><%= _('On footer, you can include a slogan and your contact information etc.') %></li> | ||
13 | + </ul> | ||
14 | + <p> | ||
15 | + <%= _('See existing examples:') %> | ||
16 | + </p> | ||
17 | + <ul> | ||
18 | + <li><a href='http://www.zen3.net/coalition-ecopc'>ecoPC Coalition</a></li> | ||
19 | + <li><a href="http://www.zen3.net/ynternet.org">Ynternet.org Foundation</a></li> | ||
20 | + </ul> | ||
21 | + </div> | ||
22 | + <% end %> | ||
7 | <h2><%= _('Content for header ') %></h2> | 23 | <h2><%= _('Content for header ') %></h2> |
8 | <%= text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;') %> | 24 | <%= text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;') %> |
9 | <h2><%= _('Content for footer') %></h2> | 25 | <h2><%= _('Content for footer') %></h2> |
config/environment.rb
@@ -115,6 +115,7 @@ Noosfero.locales = { | @@ -115,6 +115,7 @@ Noosfero.locales = { | ||
115 | 'en' => 'English', | 115 | 'en' => 'English', |
116 | 'pt_BR' => 'Português', | 116 | 'pt_BR' => 'Português', |
117 | 'fr' => 'Français', | 117 | 'fr' => 'Français', |
118 | + 'hy' => 'հայերեն լեզու', | ||
118 | } | 119 | } |
119 | # if you want to override this, do it in config/local.rb ! | 120 | # if you want to override this, do it in config/local.rb ! |
120 | Noosfero.default_locale = 'en' | 121 | Noosfero.default_locale = 'en' |
test/functional/cms_controller_test.rb
@@ -97,6 +97,16 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -97,6 +97,16 @@ class CmsControllerTest < Test::Unit::TestCase | ||
97 | assert_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{a.id}" } | 97 | assert_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{a.id}" } |
98 | end | 98 | end |
99 | 99 | ||
100 | + should 'not display set as home page if disabled in environment' do | ||
101 | + article = profile.articles.create!(:name => 'my new home page') | ||
102 | + folder = Folder.new(:name => 'article folder'); profile.articles << folder; folder.save! | ||
103 | + Article.stubs(:short_description).returns('bli') | ||
104 | + env = Environment.default; env.enable('cant_change_homepage'); env.save! | ||
105 | + get :index, :profile => profile.identifier | ||
106 | + assert_no_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{article.id}" } | ||
107 | + assert_no_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{folder.id}" } | ||
108 | + end | ||
109 | + | ||
100 | should 'be able to set home page' do | 110 | should 'be able to set home page' do |
101 | a = profile.articles.build(:name => 'my new home page') | 111 | a = profile.articles.build(:name => 'my new home page') |
102 | a.save! | 112 | a.save! |