Class: EgovUtils::GroupsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- EgovUtils::GroupsController
- Defined in:
- app/controllers/egov_utils/groups_controller.rb
Instance Method Summary collapse
Instance Method Details
#add_users ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/egov_utils/groups_controller.rb', line 35 def add_users render_404 and return unless @group.allow_member_assign? @users = User.active.assignable_to_group(@group).where(:id => (params[:user_id] || params[:user_ids])).to_a @group.users << @users respond_to do |format| format.html { redirect_to group_path(@group) } format.json { head :ok } end end |
#create ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/egov_utils/groups_controller.rb', line 15 def create respond_to do |format| if @group.save format.html{ redirect_to egov_utils.users_path, notice: t('success_created') } format.json{ render json: @group, status: :created } else format.html{ render 'new' } format.json{ render json: @group.errors., status: :unprocessable_entity } end end end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/egov_utils/groups_controller.rb', line 8 def index @groups = EgovUtils::Group.accessible_by(current_ability) end |
#new_users ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/controllers/egov_utils/groups_controller.rb', line 27 def new_users @principals = EgovUtils::User.active.assignable_to_group(@group) respond_to do |format| format.html format.js { render_modal_js } end end |
#show ⇒ Object
12 13 |
# File 'app/controllers/egov_utils/groups_controller.rb', line 12 def show end |