diff --git a/app/models/profile.rb b/app/models/profile.rb
index f646e71..2f94881 100644
--- a/app/models/profile.rb
+++ b/app/models/profile.rb
@@ -3,7 +3,7 @@
# which by default is the one returned by Environment:default.
class Profile < ActiveRecord::Base
- 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
+ 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
# use for internationalizable human type names in search facets
# reimplement on subclasses
diff --git a/app/views/profile_editor/_moderation.html.erb b/app/views/profile_editor/_moderation.html.erb
index 45539a8..749c653 100644
--- a/app/views/profile_editor/_moderation.html.erb
+++ b/app/views/profile_editor/_moderation.html.erb
@@ -1,6 +1,24 @@
<%= _('Moderation options') %>
<% if profile.community? %>
+
<%= _('Invitation moderation:')%>
+
+
+ <%= check_box(:profile_data, :allow_members_to_invite, :style => 'float: left') %>
+
+ <%= _('Allow all members to send invitation (Default: only administrator)') %>
+
+
+
+ <%= check_box(:profile_data, :invite_friends_only, :style => 'float: left') %>
+
+ <%= _('Allow members to invite only friends (Default: all users)') %>
+
+
+
+
+
+
<%= _('New members must be approved:')%>
@@ -33,3 +51,5 @@
<%= _('After being published in this group (a moderator can always remove publicated articles later).') %>
+
+<%= javascript_include_tag('invite') %>
diff --git a/db/migrate/20150121173654_add_invitation_moderation_to_profile.rb b/db/migrate/20150121173654_add_invitation_moderation_to_profile.rb
new file mode 100644
index 0000000..091fbad
--- /dev/null
+++ b/db/migrate/20150121173654_add_invitation_moderation_to_profile.rb
@@ -0,0 +1,9 @@
+class AddInvitationModerationToProfile < ActiveRecord::Migration
+ def up
+ add_column :profiles, :allow_members_to_invite, :boolean, :default => true
+ end
+
+ def down
+ remove_column :profiles, :allow_members_to_invite
+ end
+end
diff --git a/db/migrate/20150122164937_add_invite_friends_only_to_profile.rb b/db/migrate/20150122164937_add_invite_friends_only_to_profile.rb
new file mode 100644
index 0000000..a072abd
--- /dev/null
+++ b/db/migrate/20150122164937_add_invite_friends_only_to_profile.rb
@@ -0,0 +1,9 @@
+class AddInviteFriendsOnlyToProfile < ActiveRecord::Migration
+ def up
+ add_column :profiles, :invite_friends_only, :boolean, :default => false
+ end
+
+ def down
+ remove_column :profiles, :invite_friends_only
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8374631..96a582e 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140827191326) do
+ActiveRecord::Schema.define(:version => 20150122164937) do
create_table "abuse_reports", :force => true do |t|
t.integer "reporter_id"
@@ -518,6 +518,8 @@ ActiveRecord::Schema.define(:version => 20140827191326) do
t.string "personal_website"
t.string "jabber_id"
t.integer "welcome_page_id"
+ t.boolean "allow_members_to_invite", :default => true
+ t.boolean "invite_friends_only", :default => false
end
add_index "profiles", ["activities_count"], :name => "index_profiles_on_activities_count"
--
libgit2 0.21.2