Commit 6b78cf930bede07bf56c8e62dae8275404969fc7

Authored by Rodrigo Souto
1 parent e3a5e91d

profile: add allow_members_to_invite and invite_friends_only configurations

app/models/profile.rb
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 # which by default is the one returned by Environment:default. 3 # which by default is the one returned by Environment:default.
4 class Profile < ActiveRecord::Base 4 class Profile < ActiveRecord::Base
5 5
6 - attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time, :redirection_after_login, :email_suggestions 6 + attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time, :redirection_after_login, :email_suggestions, :allow_members_to_invite, :invite_friends_only
7 7
8 # use for internationalizable human type names in search facets 8 # use for internationalizable human type names in search facets
9 # reimplement on subclasses 9 # reimplement on subclasses
app/views/profile_editor/_moderation.html.erb
1 <h2><%= _('Moderation options') %></h2> 1 <h2><%= _('Moderation options') %></h2>
2 <% if profile.community? %> 2 <% if profile.community? %>
3 <div style='margin-bottom: 1em'> 3 <div style='margin-bottom: 1em'>
  4 + <h4><%= _('Invitation moderation:')%></h4>
  5 + </div>
  6 + <div style='margin-bottom: 0.5em'>
  7 + <%= check_box(:profile_data, :allow_members_to_invite, :style => 'float: left') %>
  8 + <div style='margin-left: 30px'>
  9 + <%= _('Allow all members to send invitation (Default: only administrator)') %>
  10 + </div>
  11 + <br>
  12 + <div class = 'invite_friends_only' >
  13 + <%= check_box(:profile_data, :invite_friends_only, :style => 'float: left') %>
  14 + <div style='margin-left: 30px'>
  15 + <%= _('Allow members to invite only friends (Default: all users)') %>
  16 + </div>
  17 + </div>
  18 + </div>
  19 + <br>
  20 +
  21 + <div style='margin-bottom: 1em'>
4 <%= _('New members must be approved:')%> 22 <%= _('New members must be approved:')%>
5 </div> 23 </div>
6 <div style='margin-bottom: 0.5em'> 24 <div style='margin-bottom: 0.5em'>
@@ -33,3 +51,5 @@ @@ -33,3 +51,5 @@
33 <%= _('<strong>After</strong> being published in this group (a moderator can always remove publicated articles later).') %> 51 <%= _('<strong>After</strong> being published in this group (a moderator can always remove publicated articles later).') %>
34 </div> 52 </div>
35 </div> 53 </div>
  54 +
  55 +<%= javascript_include_tag('invite') %>
db/migrate/20150121173654_add_invitation_moderation_to_profile.rb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +class AddInvitationModerationToProfile < ActiveRecord::Migration
  2 + def up
  3 + add_column :profiles, :allow_members_to_invite, :boolean, :default => true
  4 + end
  5 +
  6 + def down
  7 + remove_column :profiles, :allow_members_to_invite
  8 + end
  9 +end
db/migrate/20150122164937_add_invite_friends_only_to_profile.rb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +class AddInviteFriendsOnlyToProfile < ActiveRecord::Migration
  2 + def up
  3 + add_column :profiles, :invite_friends_only, :boolean, :default => false
  4 + end
  5 +
  6 + def down
  7 + remove_column :profiles, :invite_friends_only
  8 + end
  9 +end
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 # 11 #
12 # It's strongly recommended to check this file into your version control system. 12 # It's strongly recommended to check this file into your version control system.
13 13
14 -ActiveRecord::Schema.define(:version => 20140827191326) do 14 +ActiveRecord::Schema.define(:version => 20150122164937) do
15 15
16 create_table "abuse_reports", :force => true do |t| 16 create_table "abuse_reports", :force => true do |t|
17 t.integer "reporter_id" 17 t.integer "reporter_id"
@@ -518,6 +518,8 @@ ActiveRecord::Schema.define(:version =&gt; 20140827191326) do @@ -518,6 +518,8 @@ ActiveRecord::Schema.define(:version =&gt; 20140827191326) do
518 t.string "personal_website" 518 t.string "personal_website"
519 t.string "jabber_id" 519 t.string "jabber_id"
520 t.integer "welcome_page_id" 520 t.integer "welcome_page_id"
  521 + t.boolean "allow_members_to_invite", :default => true
  522 + t.boolean "invite_friends_only", :default => false
521 end 523 end
522 524
523 add_index "profiles", ["activities_count"], :name => "index_profiles_on_activities_count" 525 add_index "profiles", ["activities_count"], :name => "index_profiles_on_activities_count"