phcdevworks_tutorials 12.1.0 → 13.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +1 -0
  4. data/app/assets/config/phcdevworks_tutorials_manifest.js +2 -3
  5. data/app/controllers/phcdevworks_tutorials/application_controller.rb +13 -13
  6. data/app/controllers/phcdevworks_tutorials/blog/commands_controller.rb +21 -21
  7. data/app/controllers/phcdevworks_tutorials/blog/tutorials_controller.rb +21 -21
  8. data/app/controllers/phcdevworks_tutorials/command/items_controller.rb +95 -95
  9. data/app/controllers/phcdevworks_tutorials/command/posts_controller.rb +81 -81
  10. data/app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb +81 -81
  11. data/app/controllers/phcdevworks_tutorials/tutorial/steps_controller.rb +89 -89
  12. data/app/helpers/phcdevworks_tutorials/application_helper.rb +4 -4
  13. data/app/helpers/phcdevworks_tutorials/blog/commands_helper.rb +4 -4
  14. data/app/helpers/phcdevworks_tutorials/blog/tutorials_helper.rb +4 -4
  15. data/app/helpers/phcdevworks_tutorials/command/items_helper.rb +4 -4
  16. data/app/helpers/phcdevworks_tutorials/command/posts_helper.rb +4 -4
  17. data/app/helpers/phcdevworks_tutorials/tutorial/posts_helper.rb +4 -4
  18. data/app/helpers/phcdevworks_tutorials/tutorial/steps_helper.rb +4 -4
  19. data/app/jobs/phcdevworks_tutorials/application_job.rb +4 -4
  20. data/app/mailers/phcdevworks_tutorials/application_mailer.rb +6 -6
  21. data/app/models/phcdevworks_tutorials/application_record.rb +5 -5
  22. data/app/models/phcdevworks_tutorials/command/item.rb +17 -17
  23. data/app/models/phcdevworks_tutorials/command/post.rb +34 -34
  24. data/app/models/phcdevworks_tutorials/command.rb +7 -7
  25. data/app/models/phcdevworks_tutorials/command_item_versions.rb +5 -5
  26. data/app/models/phcdevworks_tutorials/command_post_versions.rb +5 -5
  27. data/app/models/phcdevworks_tutorials/tutorial/post.rb +34 -34
  28. data/app/models/phcdevworks_tutorials/tutorial/step.rb +17 -17
  29. data/app/models/phcdevworks_tutorials/tutorial.rb +7 -7
  30. data/app/models/phcdevworks_tutorials/tutorial_post_versions.rb +5 -5
  31. data/app/models/phcdevworks_tutorials/tutorial_step_versions.rb +5 -5
  32. data/app/views/layouts/phcdevworks_tutorials/application.html.erb +34 -92
  33. data/app/views/layouts/phcdevworks_tutorials/components/backend/footer/_footer.html.erb +10 -9
  34. data/app/views/layouts/phcdevworks_tutorials/components/backend/navigation/_top_menu.html.erb +26 -25
  35. data/app/views/layouts/phcdevworks_tutorials/components/backend/sidebars/_side_menu.html.erb +491 -287
  36. data/app/views/phcdevworks_tutorials/command/items/_form.html.erb +42 -42
  37. data/app/views/phcdevworks_tutorials/command/items/edit.html.erb +39 -47
  38. data/app/views/phcdevworks_tutorials/command/items/index.html.erb +74 -82
  39. data/app/views/phcdevworks_tutorials/command/items/new.html.erb +39 -47
  40. data/app/views/phcdevworks_tutorials/command/items/show.html.erb +19 -19
  41. data/app/views/phcdevworks_tutorials/command/posts/_form.html.erb +56 -56
  42. data/app/views/phcdevworks_tutorials/command/posts/edit.html.erb +39 -47
  43. data/app/views/phcdevworks_tutorials/command/posts/index.html.erb +73 -81
  44. data/app/views/phcdevworks_tutorials/command/posts/new.html.erb +41 -49
  45. data/app/views/phcdevworks_tutorials/command/posts/show.html.erb +66 -74
  46. data/app/views/phcdevworks_tutorials/tutorial/posts/_form.html.erb +56 -56
  47. data/app/views/phcdevworks_tutorials/tutorial/posts/edit.html.erb +39 -47
  48. data/app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb +76 -85
  49. data/app/views/phcdevworks_tutorials/tutorial/posts/new.html.erb +39 -47
  50. data/app/views/phcdevworks_tutorials/tutorial/posts/show.html.erb +68 -76
  51. data/app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb +48 -48
  52. data/app/views/phcdevworks_tutorials/tutorial/steps/edit.html.erb +39 -47
  53. data/app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb +74 -82
  54. data/app/views/phcdevworks_tutorials/tutorial/steps/new.html.erb +39 -47
  55. data/config/routes.rb +31 -36
  56. data/config/spring.rb +1 -1
  57. data/db/migrate/20191017235259_create_phcdevworks_tutorials_tutorial_posts.rb +19 -19
  58. data/db/migrate/20191017235421_create_phcdevworks_tutorials_tutorial_steps.rb +22 -22
  59. data/db/migrate/20191024232406_create_phcdevworks_tutorials_tutorial_categories_posts.rb +10 -10
  60. data/db/migrate/20191102093129_create_phcdevworks_tutorials_tutorial_post_versions.rb +17 -17
  61. data/db/migrate/20191102093146_create_phcdevworks_tutorials_tutorial_step_versions.rb +18 -18
  62. data/db/migrate/20200320110115_create_phcdevworks_tutorials_command_posts.rb +19 -19
  63. data/db/migrate/20200320110553_create_phcdevworks_tutorials_command_items.rb +19 -19
  64. data/db/migrate/20200321122525_create_phcdevworks_tutorials_command_item_versions.rb +18 -18
  65. data/db/migrate/20200321122606_create_phcdevworks_tutorials_command_post_versions.rb +18 -18
  66. data/db/migrate/20200328012248_create_phcdevworks_tutorials_command_categories_posts.rb +10 -10
  67. data/lib/phcdevworks_tutorials/engine.rb +45 -46
  68. data/lib/phcdevworks_tutorials/version.rb +3 -3
  69. metadata +36 -87
  70. data/app/assets/stylesheets/phcdevworks_tutorials/application.scss +0 -0
  71. data/app/assets/stylesheets/phcdevworks_tutorials/blog/commands.scss +0 -3
  72. data/app/assets/stylesheets/phcdevworks_tutorials/blog/tutorials.scss +0 -3
  73. data/app/assets/stylesheets/phcdevworks_tutorials/command/items.scss +0 -3
  74. data/app/assets/stylesheets/phcdevworks_tutorials/command/posts.scss +0 -3
  75. data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/posts.css +0 -4
  76. data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/steps.css +0 -4
  77. data/app/views/layouts/phcdevworks_tutorials/frontend.html.erb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0694ed8c9aedf0f315deb54c9c585e38680635fb7d8c1f00ea10499cac52cbe5'
4
- data.tar.gz: f559130354d543a0131ca8e3d3e9ce39cb064d2841f2e89e712f20aea8ce0e9a
3
+ metadata.gz: e55b9c969594170d5abd5bcd714d0cf130cff27822e1d3b93b7f04ab07748c96
4
+ data.tar.gz: bcc838b3ccabc38f409b4be694a94c0df49285a849b77df266cca03d6f38c7a4
5
5
  SHA512:
6
- metadata.gz: '08412dd657cbc3f39118e9362165e4abf07bff0f681e08f577e7575f69af4536b9e88d5db21eebc06348b258ff6aa2d5d3419117c37982721f61ef851b12f09e'
7
- data.tar.gz: b49677b7762bedc1ddfc180ecff1fd5631b300659918281ce963d8b1c038faa5c6f9754de2e50c7226a947ac4b7311b36063ed2c94e89c5962f5dfb0bdce2d9e
6
+ metadata.gz: 4d434ea13efe786fb7d452e80eddf0ea18ab4927e907c6d6020a24a0145d1e0cc2bc4e270dd7111bfdd3883e27035e43db2c0396a405dc62b12df6b76e1b558a
7
+ data.tar.gz: 626670940711e1a967cdc3697f16121ef94acbbf870d2654bbac092868b2e39d73073a122bc3059dafea376fdfd1c5b477cd267c2a1626dd2397ce202a09c537
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2020 BradPotts
1
+ Copyright 2022 PHCDevworks
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -0,0 +1 @@
1
+ [![Gem Version](https://badge.fury.io/rb/phcdevworks_tutorials.svg)](https://badge.fury.io/rb/phcdevworks_tutorials)
@@ -1,3 +1,2 @@
1
- //= link_directory ../stylesheets/phcdevworks_tutorials .scss
2
- //= link phcthemes_admin_panel_pack_coloradmin.css
3
- //= link phcthemes_admin_panel_pack_coloradmin.js
1
+ //= link coloradmin/default/phcthemes_admin_panel_pack_coloradmin.css
2
+ //= link coloradmin/phcthemes_admin_panel_pack_coloradmin.js
@@ -1,13 +1,13 @@
1
- module PhcdevworksTutorials
2
- class ApplicationController < ActionController::Base
3
-
4
- # Security Filters
5
- protect_from_forgery with: :exception
6
-
7
- # Load Requried Helper Files
8
- helper PhcdevworksActiveMenus::Engine.helpers
9
- helper PhcdevworksNotifications::Engine.helpers
10
- helper PhcdevworksTitleseo::Engine.helpers
11
-
12
- end
13
- end
1
+ module PhcdevworksTutorials
2
+ class ApplicationController < ActionController::Base
3
+
4
+ # Security Filters
5
+ protect_from_forgery with: :exception
6
+
7
+ # Load Requried Helper Files
8
+ helper PhcdevworksActiveMenus::Engine.helpers
9
+ helper PhcdevworksNotifications::Engine.helpers
10
+ helper PhcdevworksTitleseo::Engine.helpers
11
+
12
+ end
13
+ end
@@ -1,21 +1,21 @@
1
- require_dependency "phcdevworks_tutorials/application_controller"
2
-
3
- module PhcdevworksTutorials
4
- class Blog::CommandsController < ApplicationController
5
-
6
- # Layout
7
- layout 'phcdevworks_tutorials/frontend'
8
-
9
- # INDEX
10
- def index
11
- @phcdevworks_commands_index = Command::Post.where(command_post_status: "published").order("created_at DESC")
12
- @phcdevworks_commands_photo_randomizer = Command::Post.order('RANDOM()').limit(1)
13
- end
14
-
15
- # SHOW
16
- def show
17
- @phcdevworks_commands_single = Command::Post.friendly.find(params[:id])
18
- end
19
-
20
- end
21
- end
1
+ require_dependency "phcdevworks_tutorials/application_controller"
2
+
3
+ module PhcdevworksTutorials
4
+ class Blog::CommandsController < ApplicationController
5
+
6
+ # Layout
7
+ layout 'phcdevworks_tutorials/frontend'
8
+
9
+ # INDEX
10
+ def index
11
+ @phcdevworks_commands_index = Command::Post.where(command_post_status: "published").order("created_at DESC")
12
+ @phcdevworks_commands_photo_randomizer = Command::Post.order('RANDOM()').limit(1)
13
+ end
14
+
15
+ # SHOW
16
+ def show
17
+ @phcdevworks_commands_single = Command::Post.friendly.find(params[:id])
18
+ end
19
+
20
+ end
21
+ end
@@ -1,21 +1,21 @@
1
- require_dependency "phcdevworks_tutorials/application_controller"
2
-
3
- module PhcdevworksTutorials
4
- class Blog::TutorialsController < ApplicationController
5
-
6
- # Layout
7
- layout 'phcdevworks_tutorials/frontend'
8
-
9
- # INDEX
10
- def index
11
- @phcdevworks_tutorials_index = Tutorial::Post.where(tutorial_post_status: "published").order("created_at DESC")
12
- @phcdevworks_tutorials_photo_randomizer = Tutorial::Post.order('RANDOM()').limit(1)
13
- end
14
-
15
- # SHOW
16
- def show
17
- @phcdevworks_tutorials_single = Tutorial::Post.friendly.find(params[:id])
18
- end
19
-
20
- end
21
- end
1
+ require_dependency "phcdevworks_tutorials/application_controller"
2
+
3
+ module PhcdevworksTutorials
4
+ class Blog::TutorialsController < ApplicationController
5
+
6
+ # Layout
7
+ layout 'phcdevworks_tutorials/frontend'
8
+
9
+ # INDEX
10
+ def index
11
+ @phcdevworks_tutorials_index = Tutorial::Post.where(tutorial_post_status: "published").order("created_at DESC")
12
+ @phcdevworks_tutorials_photo_randomizer = Tutorial::Post.order('RANDOM()').limit(1)
13
+ end
14
+
15
+ # SHOW
16
+ def show
17
+ @phcdevworks_tutorials_single = Tutorial::Post.friendly.find(params[:id])
18
+ end
19
+
20
+ end
21
+ end
@@ -1,95 +1,95 @@
1
- require_dependency "phcdevworks_tutorials/application_controller"
2
-
3
- module PhcdevworksTutorials
4
- class Command::ItemsController < ApplicationController
5
-
6
- # Filters & Security
7
- #include PhcdevworksCore::PhcpluginsHelper
8
- before_action :authenticate_user!
9
- before_action :set_paper_trail_whodunnit
10
- before_action :set_command_item, only: [:show, :edit, :update, :destroy]
11
-
12
- # GET /post/items
13
- # GET /post/items.json
14
- def index
15
- @command_items = command_post.items.order('command_item_title ASC')
16
- end
17
-
18
- # GET /post/items/1
19
- # GET /post/items/1.json
20
- def show
21
- @command_item = command_post.items.find(params[:id])
22
- @member_address_versions = PhcdevworksTutorials::CommandItemVersions.where(item_id: @command_item, item_type: 'PhcdevworksTutorials::Command::Item')
23
- end
24
-
25
- # GET /post/items/new
26
- def new
27
- @command_item = command_post.items.build
28
- end
29
-
30
- # GET /post/items/1/edit
31
- def edit
32
- @command_post = Command::Post.friendly.find(params[:post_id])
33
- end
34
-
35
- # POST /post/items
36
- # POST /post/items.json
37
- def create
38
- @command_item = command_post.items.create(command_item_params)
39
- @command_item.user_id = current_user.id
40
- @command_item.org_id = current_user.org_id
41
- respond_to do |format|
42
- if @command_item.save
43
- format.html { redirect_to command_post_items_url, :flash => { :success => 'Command Item has been Added' }}
44
- format.json { render :show, status: :created, location: @command_item }
45
- else
46
- format.html { render :new }
47
- format.json { render json: @command_item.errors, status: :unprocessable_entity }
48
- end
49
- end
50
- end
51
-
52
- # PATCH/PUT /post/items/1
53
- # PATCH/PUT /post/items/1.json
54
- def update
55
- @command_post = Command::Post.friendly.find(params[:post_id])
56
- respond_to do |format|
57
- if @command_item.update(command_item_params)
58
- format.html { redirect_to command_post_items_url, :flash => { :notice => 'Command Item has been Updated.' }}
59
- format.json { render :show, status: :ok, location: @command_item }
60
- else
61
- format.html { render :edit }
62
- format.json { render json: @command_item.errors, status: :unprocessable_entity }
63
- end
64
- end
65
- end
66
-
67
- # DELETE /post/items/1
68
- # DELETE /post/items/1.json
69
- def destroy
70
- @command_item = command_post.items.find(params[:id])
71
- @command_item.destroy
72
- respond_to do |format|
73
- format.html { redirect_to command_post_items_url, :flash => { :error => 'Command Item has been Removed' }}
74
- format.json { head :no_content }
75
- end
76
- end
77
-
78
- private
79
-
80
- # Common Callbacks
81
- def set_command_item
82
- @command_item = Command::Item.find(params[:id])
83
- end
84
-
85
- def command_post
86
- @command_post = Command::Post.friendly.find(params[:post_id])
87
- end
88
-
89
- # Whitelist
90
- def command_item_params
91
- params.require(:command_item).permit(:command_item_title, :command_item_text, :command_item_copy_command, :command_item_image, :slug, :optimization_id, :user_id, :org_id)
92
- end
93
-
94
- end
95
- end
1
+ require_dependency "phcdevworks_tutorials/application_controller"
2
+
3
+ module PhcdevworksTutorials
4
+ class Command::ItemsController < ApplicationController
5
+
6
+ # Filters & Security
7
+ #include PhcdevworksCore::PhcpluginsHelper
8
+ before_action :authenticate_user!
9
+ before_action :set_paper_trail_whodunnit
10
+ before_action :set_command_item, only: [:show, :edit, :update, :destroy]
11
+
12
+ # GET /post/items
13
+ # GET /post/items.json
14
+ def index
15
+ @command_items = command_post.items.order('command_item_title ASC')
16
+ end
17
+
18
+ # GET /post/items/1
19
+ # GET /post/items/1.json
20
+ def show
21
+ @command_item = command_post.items.find(params[:id])
22
+ @member_address_versions = PhcdevworksTutorials::CommandItemVersions.where(item_id: @command_item, item_type: 'PhcdevworksTutorials::Command::Item')
23
+ end
24
+
25
+ # GET /post/items/new
26
+ def new
27
+ @command_item = command_post.items.build
28
+ end
29
+
30
+ # GET /post/items/1/edit
31
+ def edit
32
+ @command_post = Command::Post.friendly.find(params[:post_id])
33
+ end
34
+
35
+ # POST /post/items
36
+ # POST /post/items.json
37
+ def create
38
+ @command_item = command_post.items.create(command_item_params)
39
+ @command_item.user_id = current_user.id
40
+ @command_item.org_id = current_user.org_id
41
+ respond_to do |format|
42
+ if @command_item.save
43
+ format.html { redirect_to command_post_items_url, :flash => { :success => 'Command Item has been Added' }}
44
+ format.json { render :show, status: :created, location: @command_item }
45
+ else
46
+ format.html { render :new }
47
+ format.json { render json: @command_item.errors, status: :unprocessable_entity }
48
+ end
49
+ end
50
+ end
51
+
52
+ # PATCH/PUT /post/items/1
53
+ # PATCH/PUT /post/items/1.json
54
+ def update
55
+ @command_post = Command::Post.friendly.find(params[:post_id])
56
+ respond_to do |format|
57
+ if @command_item.update(command_item_params)
58
+ format.html { redirect_to command_post_items_url, :flash => { :notice => 'Command Item has been Updated.' }}
59
+ format.json { render :show, status: :ok, location: @command_item }
60
+ else
61
+ format.html { render :edit }
62
+ format.json { render json: @command_item.errors, status: :unprocessable_entity }
63
+ end
64
+ end
65
+ end
66
+
67
+ # DELETE /post/items/1
68
+ # DELETE /post/items/1.json
69
+ def destroy
70
+ @command_item = command_post.items.find(params[:id])
71
+ @command_item.destroy
72
+ respond_to do |format|
73
+ format.html { redirect_to command_post_items_url, :flash => { :error => 'Command Item has been Removed' }}
74
+ format.json { head :no_content }
75
+ end
76
+ end
77
+
78
+ private
79
+
80
+ # Common Callbacks
81
+ def set_command_item
82
+ @command_item = Command::Item.find(params[:id])
83
+ end
84
+
85
+ def command_post
86
+ @command_post = Command::Post.friendly.find(params[:post_id])
87
+ end
88
+
89
+ # Whitelist
90
+ def command_item_params
91
+ params.require(:command_item).permit(:command_item_title, :command_item_text, :command_item_copy_command, :command_item_image, :slug, :optimization_id, :user_id, :org_id)
92
+ end
93
+
94
+ end
95
+ end
@@ -1,81 +1,81 @@
1
- require_dependency "phcdevworks_tutorials/application_controller"
2
-
3
- module PhcdevworksTutorials
4
- class Command::PostsController < ApplicationController
5
-
6
- # Filters & Security
7
- #include PhcdevworksCore::PhcpluginsHelper
8
- before_action :authenticate_user!
9
- before_action :set_paper_trail_whodunnit
10
- before_action :set_command_post, only: [:show, :edit, :update, :destroy]
11
-
12
- # GET /command/posts
13
- def index
14
- @command_posts = Command::Post.all
15
- end
16
-
17
- # GET /command/posts/1
18
- def show
19
- end
20
-
21
- # GET /command/posts/new
22
- def new
23
- @command_post = Command::Post.new
24
- end
25
-
26
- # GET /command/posts/1/edit
27
- def edit
28
- end
29
-
30
- # POST /command/posts
31
- def create
32
- @command_post = Command::Post.new(command_post_params)
33
- @command_post.user_id = current_user.id
34
- @command_post.org_id = current_user.org_id
35
- respond_to do |format|
36
- if @command_post.save
37
- format.html { redirect_to command_posts_path, :flash => { :success => 'Command Post has been Added.' }}
38
- format.json { render :show, status: :created, location: @command_post }
39
- else
40
- format.html { render :new }
41
- format.json { render json: @command_post.errors, status: :unprocessable_entity }
42
- end
43
- end
44
- end
45
-
46
- # PATCH/PUT /command/posts/1
47
- def update
48
- respond_to do |format|
49
- if @command_post.update(command_post_params)
50
- format.html { redirect_to command_posts_path, :flash => { :notice => 'Command Post has been Updated.' }}
51
- format.json { render :show, status: :ok, location: @command_post }
52
- else
53
- format.html { render :edit }
54
- format.json { render json: @command_post.errors, status: :unprocessable_entity }
55
- end
56
- end
57
- end
58
-
59
- # DELETE /command/posts/1
60
- def destroy
61
- @command_post.destroy
62
- respond_to do |format|
63
- format.html { redirect_to command_posts_path, :flash => { :error => 'Command Post has been Removed.' }}
64
- format.json { head :no_content }
65
- end
66
- end
67
-
68
- private
69
-
70
- # Common Callbacks
71
- def set_command_post
72
- @command_post = Command::Post.find(params[:id])
73
- end
74
-
75
- # Whitelist
76
- def command_post_params
77
- params.require(:command_post).permit(:command_post_title, :command_post_text, :command_post_status, :command_post_image, :slug, :optimization_id, :user_id, :org_id, category_ids: [])
78
- end
79
-
80
- end
81
- end
1
+ require_dependency "phcdevworks_tutorials/application_controller"
2
+
3
+ module PhcdevworksTutorials
4
+ class Command::PostsController < ApplicationController
5
+
6
+ # Filters & Security
7
+ #include PhcdevworksCore::PhcpluginsHelper
8
+ before_action :authenticate_user!
9
+ before_action :set_paper_trail_whodunnit
10
+ before_action :set_command_post, only: [:show, :edit, :update, :destroy]
11
+
12
+ # GET /command/posts
13
+ def index
14
+ @command_posts = Command::Post.all
15
+ end
16
+
17
+ # GET /command/posts/1
18
+ def show
19
+ end
20
+
21
+ # GET /command/posts/new
22
+ def new
23
+ @command_post = Command::Post.new
24
+ end
25
+
26
+ # GET /command/posts/1/edit
27
+ def edit
28
+ end
29
+
30
+ # POST /command/posts
31
+ def create
32
+ @command_post = Command::Post.new(command_post_params)
33
+ @command_post.user_id = current_user.id
34
+ @command_post.org_id = current_user.org_id
35
+ respond_to do |format|
36
+ if @command_post.save
37
+ format.html { redirect_to command_posts_path, :flash => { :success => 'Command Post has been Added.' }}
38
+ format.json { render :show, status: :created, location: @command_post }
39
+ else
40
+ format.html { render :new }
41
+ format.json { render json: @command_post.errors, status: :unprocessable_entity }
42
+ end
43
+ end
44
+ end
45
+
46
+ # PATCH/PUT /command/posts/1
47
+ def update
48
+ respond_to do |format|
49
+ if @command_post.update(command_post_params)
50
+ format.html { redirect_to command_posts_path, :flash => { :notice => 'Command Post has been Updated.' }}
51
+ format.json { render :show, status: :ok, location: @command_post }
52
+ else
53
+ format.html { render :edit }
54
+ format.json { render json: @command_post.errors, status: :unprocessable_entity }
55
+ end
56
+ end
57
+ end
58
+
59
+ # DELETE /command/posts/1
60
+ def destroy
61
+ @command_post.destroy
62
+ respond_to do |format|
63
+ format.html { redirect_to command_posts_path, :flash => { :error => 'Command Post has been Removed.' }}
64
+ format.json { head :no_content }
65
+ end
66
+ end
67
+
68
+ private
69
+
70
+ # Common Callbacks
71
+ def set_command_post
72
+ @command_post = Command::Post.find(params[:id])
73
+ end
74
+
75
+ # Whitelist
76
+ def command_post_params
77
+ params.require(:command_post).permit(:command_post_title, :command_post_text, :command_post_status, :command_post_image, :slug, :optimization_id, :user_id, :org_id, category_ids: [])
78
+ end
79
+
80
+ end
81
+ end
@@ -1,81 +1,81 @@
1
- require_dependency "phcdevworks_tutorials/application_controller"
2
-
3
- module PhcdevworksTutorials
4
- class Tutorial::PostsController < ApplicationController
5
-
6
- # Filters & Security
7
- #include PhcdevworksCore::PhcpluginsHelper
8
- before_action :authenticate_user!
9
- before_action :set_paper_trail_whodunnit
10
- before_action :set_tutorial_post, only: [:show, :edit, :update, :destroy]
11
-
12
- # GET /tutorial/posts
13
- def index
14
- @tutorial_posts = Tutorial::Post.all
15
- end
16
-
17
- # GET /tutorial/posts/1
18
- def show
19
- end
20
-
21
- # GET /tutorial/posts/new
22
- def new
23
- @tutorial_post = Tutorial::Post.new
24
- end
25
-
26
- # GET /tutorial/posts/1/edit
27
- def edit
28
- end
29
-
30
- # POST /tutorial/posts
31
- def create
32
- @tutorial_post = Tutorial::Post.new(tutorial_post_params)
33
- @tutorial_post.user_id = current_user.id
34
- @tutorial_post.org_id = current_user.org_id
35
- respond_to do |format|
36
- if @tutorial_post.save
37
- format.html { redirect_to tutorial_posts_path, :flash => { :success => 'Tutorial has been Added.' }}
38
- format.json { render :show, status: :created, location: @tutorial_post }
39
- else
40
- format.html { render :new }
41
- format.json { render json: @tutorial_post.errors, status: :unprocessable_entity }
42
- end
43
- end
44
- end
45
-
46
- # PATCH/PUT /tutorial/posts/1
47
- def update
48
- respond_to do |format|
49
- if @tutorial_post.update(tutorial_post_params)
50
- format.html { redirect_to tutorial_posts_path, :flash => { :notice => 'Tutorial has been Updated.' }}
51
- format.json { render :show, status: :ok, location: @tutorial_post }
52
- else
53
- format.html { render :edit }
54
- format.json { render json: @tutorial_post.errors, status: :unprocessable_entity }
55
- end
56
- end
57
- end
58
-
59
- # DELETE /tutorial/posts/1
60
- def destroy
61
- @tutorial_post.destroy
62
- respond_to do |format|
63
- format.html { redirect_to tutorial_posts_path, :flash => { :error => 'Tutorial has been Removed.' }}
64
- format.json { head :no_content }
65
- end
66
- end
67
-
68
- private
69
-
70
- # Common Callbacks
71
- def set_tutorial_post
72
- @tutorial_post = Tutorial::Post.find(params[:id])
73
- end
74
-
75
- # Whitelist
76
- def tutorial_post_params
77
- params.require(:tutorial_post).permit(:tutorial_post_title, :tutorial_post_text, :tutorial_post_status, :tutorial_post_image, :slug, :optimization_id, :user_id, :org_id, category_ids: [])
78
- end
79
-
80
- end
81
- end
1
+ require_dependency "phcdevworks_tutorials/application_controller"
2
+
3
+ module PhcdevworksTutorials
4
+ class Tutorial::PostsController < ApplicationController
5
+
6
+ # Filters & Security
7
+ #include PhcdevworksCore::PhcpluginsHelper
8
+ before_action :authenticate_user!
9
+ before_action :set_paper_trail_whodunnit
10
+ before_action :set_tutorial_post, only: [:show, :edit, :update, :destroy]
11
+
12
+ # GET /tutorial/posts
13
+ def index
14
+ @tutorial_posts = Tutorial::Post.all
15
+ end
16
+
17
+ # GET /tutorial/posts/1
18
+ def show
19
+ end
20
+
21
+ # GET /tutorial/posts/new
22
+ def new
23
+ @tutorial_post = Tutorial::Post.new
24
+ end
25
+
26
+ # GET /tutorial/posts/1/edit
27
+ def edit
28
+ end
29
+
30
+ # POST /tutorial/posts
31
+ def create
32
+ @tutorial_post = Tutorial::Post.new(tutorial_post_params)
33
+ @tutorial_post.user_id = current_user.id
34
+ @tutorial_post.org_id = current_user.org_id
35
+ respond_to do |format|
36
+ if @tutorial_post.save
37
+ format.html { redirect_to tutorial_posts_path, :flash => { :success => 'Tutorial has been Added.' }}
38
+ format.json { render :show, status: :created, location: @tutorial_post }
39
+ else
40
+ format.html { render :new }
41
+ format.json { render json: @tutorial_post.errors, status: :unprocessable_entity }
42
+ end
43
+ end
44
+ end
45
+
46
+ # PATCH/PUT /tutorial/posts/1
47
+ def update
48
+ respond_to do |format|
49
+ if @tutorial_post.update(tutorial_post_params)
50
+ format.html { redirect_to tutorial_posts_path, :flash => { :notice => 'Tutorial has been Updated.' }}
51
+ format.json { render :show, status: :ok, location: @tutorial_post }
52
+ else
53
+ format.html { render :edit }
54
+ format.json { render json: @tutorial_post.errors, status: :unprocessable_entity }
55
+ end
56
+ end
57
+ end
58
+
59
+ # DELETE /tutorial/posts/1
60
+ def destroy
61
+ @tutorial_post.destroy
62
+ respond_to do |format|
63
+ format.html { redirect_to tutorial_posts_path, :flash => { :error => 'Tutorial has been Removed.' }}
64
+ format.json { head :no_content }
65
+ end
66
+ end
67
+
68
+ private
69
+
70
+ # Common Callbacks
71
+ def set_tutorial_post
72
+ @tutorial_post = Tutorial::Post.find(params[:id])
73
+ end
74
+
75
+ # Whitelist
76
+ def tutorial_post_params
77
+ params.require(:tutorial_post).permit(:tutorial_post_title, :tutorial_post_text, :tutorial_post_status, :tutorial_post_image, :slug, :optimization_id, :user_id, :org_id, category_ids: [])
78
+ end
79
+
80
+ end
81
+ end