Merge pull request #416 from foodcoop1040/invite_config
Add config option to disable the invites
This commit is contained in:
commit
d358278333
12 changed files with 25 additions and 11 deletions
|
|
@ -132,7 +132,13 @@ class ApplicationController < ActionController::Base
|
|||
#
|
||||
def require_plugin_enabled(plugin)
|
||||
unless plugin.enabled?
|
||||
redirect_to root_path, alert: I18n.t('application.controller.error_plugin_disabled')
|
||||
redirect_to root_path, alert: I18n.t('application.controller.error_feature_disabled')
|
||||
end
|
||||
end
|
||||
|
||||
def require_config_disabled(config)
|
||||
if FoodsoftConfig[config]
|
||||
redirect_to root_path, alert: I18n.t('application.controller.error_feature_disabled')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
class InvitesController < ApplicationController
|
||||
|
||||
before_filter :authenticate_membership_or_admin_for_invites
|
||||
before_filter -> { require_config_disabled :disable_invite }
|
||||
|
||||
def new
|
||||
@invite = Invite.new(:user => @current_user, :group => @group)
|
||||
|
|
|
|||
|
|
@ -2,5 +2,6 @@
|
|||
= config_input form, :use_wiki, as: :boolean
|
||||
= config_input form, :use_nick, as: :boolean
|
||||
= config_input form, :tolerance_is_costly, as: :boolean
|
||||
= config_input form, :disable_invite, as: :boolean
|
||||
= config_input form, :help_url, as: :url, input_html: {class: 'input-xlarge'}
|
||||
= config_input form, :webstats_tracking_code, as: :text, input_html: {class: 'input-xxlarge', rows: 3}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
- unless @ordergroup.new_record?
|
||||
- unless @ordergroup.new_record? || FoodsoftConfig[:disable_invite]
|
||||
%p= t('.first_paragraph', url: link_to(t('.here'), new_invite_path(id: @ordergroup.id), remote: true)).html_safe
|
||||
= simple_form_for [:admin, @ordergroup] do |f|
|
||||
- captured = capture do
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
%p= t('.first_paragraph', url: link_to(t('.here'), new_invite_path(id: @workgroup.id), remote: true)).html_safe
|
||||
- unless FoodsoftConfig[:disable_invite]
|
||||
%p= t('.first_paragraph', url: link_to(t('.here'), new_invite_path(id: @workgroup.id), remote: true)).html_safe
|
||||
= simple_form_for [:admin, @workgroup] do |f|
|
||||
- captured = capture do
|
||||
%h4= t 'admin.access_to'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
- title t('.title')
|
||||
|
||||
%p= t('.invite_new', invite_link: link_to(t('.invite_link'), new_invite_path(id: @workgroup.id))).html_safe
|
||||
- unless FoodsoftConfig[:disable_invite]
|
||||
%p= t('.invite_new', invite_link: link_to(t('.invite_link'), new_invite_path(id: @workgroup.id))).html_safe
|
||||
= simple_form_for [:foodcoop, @workgroup] do |f|
|
||||
= render 'shared/group_form_fields', f: f
|
||||
.form-actions
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
%p
|
||||
%b= heading_helper(Ordergroup, :user_tokens) + ':'
|
||||
= @ordergroup.memberships.map{|m| show_user m.user}.join(', ')
|
||||
= link_to t('.invite'), new_invite_path(:id => @ordergroup), :remote => true, class: 'btn btn-primary'
|
||||
- unless FoodsoftConfig[:disable_invite]
|
||||
= link_to t('.invite'), new_invite_path(:id => @ordergroup), :remote => true, class: 'btn btn-primary'
|
||||
.span8
|
||||
%h2= t('.account_summary')
|
||||
.well.well-small
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@
|
|||
- else
|
||||
= @current_user.ordergroup.name
|
||||
%td.right
|
||||
= link_to t('.groups.invite'), new_invite_path(id: @current_user.ordergroup),
|
||||
remote: true, class: 'btn btn-success btn-small'
|
||||
- unless FoodsoftConfig[:disable_invite]
|
||||
= link_to t('.groups.invite'), new_invite_path(id: @current_user.ordergroup),
|
||||
remote: true, class: 'btn btn-success btn-small'
|
||||
- if @current_user.workgroups.any?
|
||||
%h3= User.human_attribute_name(:workgroup, count: 2)
|
||||
%table.table.table-striped
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue