Class: RailsImagePostSolution::Admin::FrozenPostsController
Instance Method Summary
collapse
#default_url_options, #require_admin, #require_login
Instance Method Details
66
67
68
69
70
|
# File 'app/controllers/rails_image_post_solution/admin/frozen_posts_controller.rb', line 66
def
= MultiplayRecruitmentComment.find(params[:id])
.destroy
redirect_to admin_frozen_posts_path, notice: I18n.t("admin.flash.comment_deleted")
end
|
#destroy_stage ⇒ Object
60
61
62
63
64
|
# File 'app/controllers/rails_image_post_solution/admin/frozen_posts_controller.rb', line 60
def destroy_stage
stage = Stage.find(params[:id])
stage.destroy
redirect_to admin_frozen_posts_path, notice: I18n.t("admin.flash.stage_deleted")
end
|
#index ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/rails_image_post_solution/admin/frozen_posts_controller.rb', line 9
def index
@filter = params[:filter] || "all"
stages = Stage.frozen.includes(:user).recent
= MultiplayRecruitmentComment.frozen.includes(:user, :multiplay_recruitment).recent
case @filter
when "temporary"
stages = stages.temporarily_frozen
= .temporarily_frozen
when "permanent"
stages = stages.permanently_frozen
= .permanently_frozen
end
@frozen_posts = (stages.to_a + .to_a).sort_by(&:frozen_at).reverse
@stats = {
total: Stage.frozen.count + MultiplayRecruitmentComment.frozen.count,
temporary: Stage.temporarily_frozen.count + MultiplayRecruitmentComment.temporarily_frozen.count,
permanent: Stage.permanently_frozen.count + MultiplayRecruitmentComment.permanently_frozen.count
}
end
|
54
55
56
57
58
|
# File 'app/controllers/rails_image_post_solution/admin/frozen_posts_controller.rb', line 54
def
= MultiplayRecruitmentComment.find(params[:id])
.freeze_post!(type: :permanent, reason: params[:reason] || I18n.t("admin.flash.permanent_freeze_by_admin"))
redirect_to admin_frozen_posts_path, notice: I18n.t("admin.flash.comment_permanently_frozen")
end
|
#permanent_freeze_stage ⇒ Object
48
49
50
51
52
|
# File 'app/controllers/rails_image_post_solution/admin/frozen_posts_controller.rb', line 48
def permanent_freeze_stage
stage = Stage.find(params[:id])
stage.freeze_post!(type: :permanent, reason: params[:reason] || I18n.t("admin.flash.permanent_freeze_by_admin"))
redirect_to admin_frozen_posts_path, notice: I18n.t("admin.flash.stage_permanently_frozen")
end
|
42
43
44
45
46
|
# File 'app/controllers/rails_image_post_solution/admin/frozen_posts_controller.rb', line 42
def
= MultiplayRecruitmentComment.find(params[:id])
.unfreeze!
redirect_to admin_frozen_posts_path, notice: I18n.t("admin.flash.comment_unfrozen")
end
|
#unfreeze_stage ⇒ Object
36
37
38
39
40
|
# File 'app/controllers/rails_image_post_solution/admin/frozen_posts_controller.rb', line 36
def unfreeze_stage
stage = Stage.find(params[:id])
stage.unfreeze!
redirect_to admin_frozen_posts_path, notice: I18n.t("admin.flash.stage_unfrozen")
end
|