class GuidanceGroupsController

Public Instance Methods

admin_create() click to toggle source

POST /guidance_groups POST /guidance_groups.json

# File app/controllers/guidance_groups_controller.rb, line 34
def admin_create
  if user_signed_in? && current_user.can_org_admin? then
          @guidance_group = GuidanceGroup.new(params[:guidance_group])
          @guidance_group.organisation_id = current_user.organisation_id
      
          respond_to do |format|
            if @guidance_group.save
              format.html { redirect_to admin_index_guidance_path, notice: I18n.t('org_admin.guidance_group.created_message') }
              format.json { render json: @guidance_group, status: :created, location: @guidance_group }
            else
              format.html { render action: "new" }
              format.json { render json: @guidance_group.errors, status: :unprocessable_entity }
            end
          end
  else
                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
              end 
end
admin_destroy() click to toggle source

DELETE /guidance_groups/1 DELETE /guidance_groups/1.json

# File app/controllers/guidance_groups_controller.rb, line 87
def admin_destroy
      if user_signed_in? && current_user.can_org_admin? then
             @guidance_group = GuidanceGroup.find(params[:id])
          @guidance_group.destroy
      
          respond_to do |format|
            format.html { redirect_to admin_index_guidance_path, notice: I18n.t('org_admin.guidance_group.destroyed_message') }
            format.json { head :no_content }
          end
             else
                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
              end 
      
      end
admin_edit() click to toggle source

GET /guidance_groups/1/edit

# File app/controllers/guidance_groups_controller.rb, line 55
def admin_edit
      if user_signed_in? && current_user.can_org_admin? then
    @guidance_group = GuidanceGroup.find(params[:id])
  else
                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
              end 
end
admin_new() click to toggle source

GET add new guidance groups

# File app/controllers/guidance_groups_controller.rb, line 21
    def admin_new
if user_signed_in? && current_user.can_org_admin? then
        @guidance_group = GuidanceGroup.new
           
        respond_to do |format|
          format.html # new.html.erb

          format.json { render json: @guidance }
        end
    end
    end
admin_show() click to toggle source

GET /guidance_groups/1 GET /guidance_groups/1.json

# File app/controllers/guidance_groups_controller.rb, line 6
def admin_show
  if user_signed_in? && current_user.can_org_admin? then
          @guidance_group = GuidanceGroup.find(params[:id])
      
          respond_to do |format|
            format.html 
            format.json { render json: @guidance_group }
          end
  else
                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
              end 
end
admin_update() click to toggle source

PUT /guidance_groups/1 PUT /guidance_groups/1.json

# File app/controllers/guidance_groups_controller.rb, line 65
def admin_update
              if user_signed_in? && current_user.can_org_admin? then
              @guidance_group = GuidanceGroup.find(params[:id])
          @guidance_group.organisation_id = current_user.organisation_id

          respond_to do |format|
            if @guidance_group.update_attributes(params[:guidance_group])
              format.html { redirect_to admin_index_guidance_path(params[:guidance_group]), notice: I18n.t('org_admin.guidance_group.updated_message') }
              format.json { head :no_content }
            else
              format.html { render action: "edit" }
              format.json { render json: @guidance_group.errors, status: :unprocessable_entity }
            end
          end
  else
                      render(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)
              end 
end