Permette di correggere la timeline e ripristina la ricerca in alto.
Le voci si possono modificare o eliminare se registrate per errore, e la ricerca non va più in errore SQL sul campo email. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
class ActivitiesController < ApplicationController
|
||||
before_action :set_organization, only: %i[create]
|
||||
before_action :require_current_project!
|
||||
before_action :set_organization
|
||||
before_action :set_activity, only: %i[edit update destroy]
|
||||
|
||||
def create
|
||||
@activity = @organization.activities.build(activity_params)
|
||||
@@ -14,10 +16,36 @@ class ActivitiesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@page_title = "Modifica attività"
|
||||
end
|
||||
|
||||
def update
|
||||
if @activity.update(activity_params)
|
||||
redirect_to @organization, notice: "Attività aggiornata."
|
||||
else
|
||||
@page_title = "Modifica attività"
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@activity.destroy!
|
||||
redirect_to @organization, notice: "Attività eliminata."
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_organization
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
return if current_user.admin?
|
||||
return if @organization.projects.merge(available_projects).exists?
|
||||
|
||||
redirect_to organizations_path, alert: "Organizzazione non disponibile per i tuoi progetti." and return
|
||||
end
|
||||
|
||||
def set_activity
|
||||
@activity = @organization.activities.find(params[:id])
|
||||
end
|
||||
|
||||
def activity_params
|
||||
|
||||
Reference in New Issue
Block a user