Move github source to private server
This commit is contained in:
@@ -3,6 +3,7 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
include AuthorizationConcern
|
||||
|
||||
before_action :authenticate_user!
|
||||
before_action :configure_permitted_parameters, if: :devise_controller?
|
||||
before_action :set_current_user_department
|
||||
|
||||
|
||||
31
app/controllers/comments_controller.rb
Normal file
31
app/controllers/comments_controller.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
class CommentsController < ApplicationController
|
||||
before_action :set_task
|
||||
|
||||
def create
|
||||
authorize_task!
|
||||
@comment = @task.comments.build(comment_params)
|
||||
@comment.user = current_user
|
||||
|
||||
if @comment.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to @task, notice: 'Comment added.' }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { redirect_to @task, alert: 'Comment cannot be blank.' }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_task
|
||||
@task = Task.find(params[:task_id])
|
||||
end
|
||||
|
||||
def comment_params
|
||||
params.require(:comment).permit(:content)
|
||||
end
|
||||
end
|
||||
@@ -53,7 +53,6 @@ class TasksController < ApplicationController
|
||||
end
|
||||
|
||||
def edit
|
||||
authorize_task_update!(@task)
|
||||
@departments = accessible_departments.ordered
|
||||
end
|
||||
|
||||
@@ -72,7 +71,14 @@ class TasksController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
if @task.update(task_params)
|
||||
updated_params = task_params.to_h
|
||||
if updated_params[:status] == "1"
|
||||
updated_params[:status] = "completed"
|
||||
elsif updated_params[:status] == "0"
|
||||
updated_params[:status] = "open"
|
||||
end
|
||||
|
||||
if @task.update(updated_params)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to @task, notice: 'Task was successfully updated.' }
|
||||
format.js
|
||||
|
||||
Reference in New Issue
Block a user