# File app/controllers/admin/projects_controller.rb, line 29 def create @admin_project = Project.new(params[:project]) @admin_project.owner = current_user if @admin_project.save redirect_to [:admin, @admin_project], notice: 'Project was successfully created.' else render action: "new" end end
# File app/controllers/admin/projects_controller.rb, line 54 def destroy @admin_project.destroy redirect_to admin_projects_url, notice: 'Project was successfully deleted.' end
# File app/controllers/admin/projects_controller.rb, line 20 def edit end
# File app/controllers/admin/projects_controller.rb, line 4 def index @admin_projects = Project.scoped @admin_projects = @admin_projects.search(params[:name]) if params[:name].present? @admin_projects = @admin_projects.page(params[:page]).per(20) end
# File app/controllers/admin/projects_controller.rb, line 16 def new @admin_project = Project.new end
# File app/controllers/admin/projects_controller.rb, line 10 def show @users = User.scoped @users = @users.not_in_project(@admin_project) if @admin_project.users.present? @users = @users.all end
# File app/controllers/admin/projects_controller.rb, line 23 def team_update @admin_project.add_users_ids_to_team(params[:user_ids], params[:project_access]) redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.' end
# File app/controllers/admin/projects_controller.rb, line 40 def update owner_id = params[:project].delete(:owner_id) if owner_id @admin_project.owner = User.find(owner_id) end if @admin_project.update_attributes(params[:project]) redirect_to [:admin, @admin_project], notice: 'Project was successfully updated.' else render action: "edit" end end