Move github source to private server

This commit is contained in:
Zin Bo Thit
2026-01-29 12:00:13 +06:30
parent 417600b23e
commit 87cc77e0fb
27 changed files with 916 additions and 381 deletions

View File

@@ -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

View 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

View File

@@ -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