phcdevworks_tutorials 12.1.1 → 12.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -20
  3. data/README.md +1 -0
  4. data/Rakefile +8 -8
  5. data/app/assets/config/phcdevworks_tutorials_manifest.js +3 -3
  6. data/app/assets/stylesheets/phcdevworks_tutorials/application.scss +0 -0
  7. data/app/assets/stylesheets/phcdevworks_tutorials/blog/commands.scss +3 -3
  8. data/app/assets/stylesheets/phcdevworks_tutorials/blog/tutorials.scss +3 -3
  9. data/app/assets/stylesheets/phcdevworks_tutorials/command/items.scss +3 -3
  10. data/app/assets/stylesheets/phcdevworks_tutorials/command/posts.scss +3 -3
  11. data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/posts.css +4 -4
  12. data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/steps.css +4 -4
  13. data/app/controllers/phcdevworks_tutorials/application_controller.rb +13 -13
  14. data/app/controllers/phcdevworks_tutorials/blog/commands_controller.rb +21 -21
  15. data/app/controllers/phcdevworks_tutorials/blog/tutorials_controller.rb +21 -21
  16. data/app/controllers/phcdevworks_tutorials/command/items_controller.rb +95 -95
  17. data/app/controllers/phcdevworks_tutorials/command/posts_controller.rb +81 -81
  18. data/app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb +81 -81
  19. data/app/controllers/phcdevworks_tutorials/tutorial/steps_controller.rb +89 -89
  20. data/app/helpers/phcdevworks_tutorials/application_helper.rb +4 -4
  21. data/app/helpers/phcdevworks_tutorials/blog/commands_helper.rb +4 -4
  22. data/app/helpers/phcdevworks_tutorials/blog/tutorials_helper.rb +4 -4
  23. data/app/helpers/phcdevworks_tutorials/command/items_helper.rb +4 -4
  24. data/app/helpers/phcdevworks_tutorials/command/posts_helper.rb +4 -4
  25. data/app/helpers/phcdevworks_tutorials/tutorial/posts_helper.rb +4 -4
  26. data/app/helpers/phcdevworks_tutorials/tutorial/steps_helper.rb +4 -4
  27. data/app/jobs/phcdevworks_tutorials/application_job.rb +4 -4
  28. data/app/mailers/phcdevworks_tutorials/application_mailer.rb +6 -6
  29. data/app/models/phcdevworks_tutorials/application_record.rb +5 -5
  30. data/app/models/phcdevworks_tutorials/command/item.rb +17 -17
  31. data/app/models/phcdevworks_tutorials/command/post.rb +34 -34
  32. data/app/models/phcdevworks_tutorials/command.rb +7 -7
  33. data/app/models/phcdevworks_tutorials/command_item_versions.rb +5 -5
  34. data/app/models/phcdevworks_tutorials/command_post_versions.rb +5 -5
  35. data/app/models/phcdevworks_tutorials/tutorial/post.rb +34 -34
  36. data/app/models/phcdevworks_tutorials/tutorial/step.rb +17 -17
  37. data/app/models/phcdevworks_tutorials/tutorial.rb +7 -7
  38. data/app/models/phcdevworks_tutorials/tutorial_post_versions.rb +5 -5
  39. data/app/models/phcdevworks_tutorials/tutorial_step_versions.rb +5 -5
  40. data/app/views/layouts/phcdevworks_tutorials/application.html.erb +131 -131
  41. data/app/views/layouts/phcdevworks_tutorials/components/backend/footer/_footer.html.erb +0 -0
  42. data/app/views/layouts/phcdevworks_tutorials/components/backend/navigation/_top_menu.html.erb +0 -0
  43. data/app/views/layouts/phcdevworks_tutorials/components/backend/sidebars/_side_menu.html.erb +0 -0
  44. data/app/views/layouts/phcdevworks_tutorials/frontend.html.erb +0 -0
  45. data/app/views/phcdevworks_tutorials/blog/commands/index.html.erb +0 -0
  46. data/app/views/phcdevworks_tutorials/blog/commands/show.html.erb +0 -0
  47. data/app/views/phcdevworks_tutorials/blog/tutorials/index.html.erb +0 -0
  48. data/app/views/phcdevworks_tutorials/blog/tutorials/show.html.erb +0 -0
  49. data/app/views/phcdevworks_tutorials/command/items/_form.html.erb +42 -42
  50. data/app/views/phcdevworks_tutorials/command/items/edit.html.erb +47 -47
  51. data/app/views/phcdevworks_tutorials/command/items/index.html.erb +82 -82
  52. data/app/views/phcdevworks_tutorials/command/items/new.html.erb +47 -47
  53. data/app/views/phcdevworks_tutorials/command/items/show.html.erb +19 -19
  54. data/app/views/phcdevworks_tutorials/command/posts/_form.html.erb +56 -56
  55. data/app/views/phcdevworks_tutorials/command/posts/edit.html.erb +47 -47
  56. data/app/views/phcdevworks_tutorials/command/posts/index.html.erb +81 -81
  57. data/app/views/phcdevworks_tutorials/command/posts/new.html.erb +49 -49
  58. data/app/views/phcdevworks_tutorials/command/posts/show.html.erb +74 -74
  59. data/app/views/phcdevworks_tutorials/tutorial/posts/_form.html.erb +56 -56
  60. data/app/views/phcdevworks_tutorials/tutorial/posts/edit.html.erb +47 -47
  61. data/app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb +85 -85
  62. data/app/views/phcdevworks_tutorials/tutorial/posts/new.html.erb +47 -47
  63. data/app/views/phcdevworks_tutorials/tutorial/posts/show.html.erb +76 -76
  64. data/app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb +48 -48
  65. data/app/views/phcdevworks_tutorials/tutorial/steps/edit.html.erb +47 -47
  66. data/app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb +82 -82
  67. data/app/views/phcdevworks_tutorials/tutorial/steps/new.html.erb +47 -47
  68. data/config/routes.rb +35 -35
  69. data/config/spring.rb +1 -1
  70. data/db/migrate/20191017235259_create_phcdevworks_tutorials_tutorial_posts.rb +19 -19
  71. data/db/migrate/20191017235421_create_phcdevworks_tutorials_tutorial_steps.rb +22 -22
  72. data/db/migrate/20191024232406_create_phcdevworks_tutorials_tutorial_categories_posts.rb +10 -10
  73. data/db/migrate/20191102093129_create_phcdevworks_tutorials_tutorial_post_versions.rb +17 -17
  74. data/db/migrate/20191102093146_create_phcdevworks_tutorials_tutorial_step_versions.rb +18 -18
  75. data/db/migrate/20200320110115_create_phcdevworks_tutorials_command_posts.rb +19 -19
  76. data/db/migrate/20200320110553_create_phcdevworks_tutorials_command_items.rb +19 -19
  77. data/db/migrate/20200321122525_create_phcdevworks_tutorials_command_item_versions.rb +18 -18
  78. data/db/migrate/20200321122606_create_phcdevworks_tutorials_command_post_versions.rb +18 -18
  79. data/db/migrate/20200328012248_create_phcdevworks_tutorials_command_categories_posts.rb +10 -10
  80. data/lib/phcdevworks_tutorials/engine.rb +47 -47
  81. data/lib/phcdevworks_tutorials/version.rb +3 -3
  82. data/lib/phcdevworks_tutorials.rb +6 -6
  83. data/lib/tasks/phcdevworks_tutorials_tasks.rake +4 -4
  84. metadata +33 -33
@@ -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
@@ -1,89 +1,89 @@
1
- require_dependency "phcdevworks_tutorials/application_controller"
2
-
3
- module PhcdevworksTutorials
4
- class Tutorial::StepsController < 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_step, only: [:show, :edit, :update, :destroy]
11
-
12
- # GET /tutorial/steps
13
- def index
14
- @tutorial_steps = tutorial_post.steps.order("tutorial_step_number")
15
- end
16
-
17
- # GET /tutorial/steps/1
18
- def show
19
- @tutorial_step = tutorial_post.steps.find(params[:id])
20
- end
21
-
22
- # GET /tutorial/steps/new
23
- def new
24
- @tutorial_step = tutorial_post.steps.build
25
- end
26
-
27
- # GET /tutorial/steps/1/edit
28
- def edit
29
- @tutorial_post = Tutorial::Post.friendly.find(params[:post_id])
30
- end
31
-
32
- # POST /tutorial/steps
33
- def create
34
- @tutorial_step = tutorial_post.steps.create(tutorial_step_params)
35
- @tutorial_step.user_id = current_user.id
36
- @tutorial_step.org_id = current_user.org_id
37
- respond_to do |format|
38
- if @tutorial_step.save
39
- format.html { redirect_to tutorial_post_steps_url, :flash => { :success => 'Tutorial Step has been Added' }}
40
- format.json { render :show, status: :created, location: @tutorial_step }
41
- else
42
- format.html { render :new }
43
- format.json { render json: @tutorial_step.errors, status: :unprocessable_entity }
44
- end
45
- end
46
- end
47
-
48
- # PATCH/PUT /tutorial/steps/1
49
- def update
50
- @tutorial_post = Tutorial::Post.friendly.find(params[:post_id])
51
- respond_to do |format|
52
- if @tutorial_step.update(tutorial_step_params)
53
- format.html { redirect_to tutorial_post_steps_url, :flash => { :notice => 'Tutorial Step has been Updated.' }}
54
- format.json { render :show, status: :ok, location: @tutorial_step }
55
- else
56
- format.html { render :edit }
57
- format.json { render json: @tutorial_step.errors, status: :unprocessable_entity }
58
- end
59
- end
60
- end
61
-
62
- # DELETE /tutorial/steps/1
63
- def destroy
64
- @tutorial_step = tutorial_post.steps.find(params[:id])
65
- @tutorial_step.destroy
66
- respond_to do |format|
67
- format.html { redirect_to tutorial_post_steps_url, :flash => { :error => 'Tutorial Step has been Removed' }}
68
- format.json { head :no_content }
69
- end
70
- end
71
-
72
- private
73
-
74
- # Common Callbacks
75
- def set_tutorial_step
76
- @tutorial_step = Tutorial::Step.find(params[:id])
77
- end
78
-
79
- def tutorial_post
80
- @tutorial_post = Tutorial::Post.friendly.find(params[:post_id])
81
- end
82
-
83
- # Whitelist
84
- def tutorial_step_params
85
- params.require(:tutorial_step).permit(:tutorial_step_number, :tutorial_step_title, :tutorial_step_text, :tutorial_step_copy_instruction, :tutorial_step_image, :optimization_id, :post_id, :slug, :user_id, :org_id)
86
- end
87
-
88
- end
89
- end
1
+ require_dependency "phcdevworks_tutorials/application_controller"
2
+
3
+ module PhcdevworksTutorials
4
+ class Tutorial::StepsController < 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_step, only: [:show, :edit, :update, :destroy]
11
+
12
+ # GET /tutorial/steps
13
+ def index
14
+ @tutorial_steps = tutorial_post.steps.order("tutorial_step_number")
15
+ end
16
+
17
+ # GET /tutorial/steps/1
18
+ def show
19
+ @tutorial_step = tutorial_post.steps.find(params[:id])
20
+ end
21
+
22
+ # GET /tutorial/steps/new
23
+ def new
24
+ @tutorial_step = tutorial_post.steps.build
25
+ end
26
+
27
+ # GET /tutorial/steps/1/edit
28
+ def edit
29
+ @tutorial_post = Tutorial::Post.friendly.find(params[:post_id])
30
+ end
31
+
32
+ # POST /tutorial/steps
33
+ def create
34
+ @tutorial_step = tutorial_post.steps.create(tutorial_step_params)
35
+ @tutorial_step.user_id = current_user.id
36
+ @tutorial_step.org_id = current_user.org_id
37
+ respond_to do |format|
38
+ if @tutorial_step.save
39
+ format.html { redirect_to tutorial_post_steps_url, :flash => { :success => 'Tutorial Step has been Added' }}
40
+ format.json { render :show, status: :created, location: @tutorial_step }
41
+ else
42
+ format.html { render :new }
43
+ format.json { render json: @tutorial_step.errors, status: :unprocessable_entity }
44
+ end
45
+ end
46
+ end
47
+
48
+ # PATCH/PUT /tutorial/steps/1
49
+ def update
50
+ @tutorial_post = Tutorial::Post.friendly.find(params[:post_id])
51
+ respond_to do |format|
52
+ if @tutorial_step.update(tutorial_step_params)
53
+ format.html { redirect_to tutorial_post_steps_url, :flash => { :notice => 'Tutorial Step has been Updated.' }}
54
+ format.json { render :show, status: :ok, location: @tutorial_step }
55
+ else
56
+ format.html { render :edit }
57
+ format.json { render json: @tutorial_step.errors, status: :unprocessable_entity }
58
+ end
59
+ end
60
+ end
61
+
62
+ # DELETE /tutorial/steps/1
63
+ def destroy
64
+ @tutorial_step = tutorial_post.steps.find(params[:id])
65
+ @tutorial_step.destroy
66
+ respond_to do |format|
67
+ format.html { redirect_to tutorial_post_steps_url, :flash => { :error => 'Tutorial Step has been Removed' }}
68
+ format.json { head :no_content }
69
+ end
70
+ end
71
+
72
+ private
73
+
74
+ # Common Callbacks
75
+ def set_tutorial_step
76
+ @tutorial_step = Tutorial::Step.find(params[:id])
77
+ end
78
+
79
+ def tutorial_post
80
+ @tutorial_post = Tutorial::Post.friendly.find(params[:post_id])
81
+ end
82
+
83
+ # Whitelist
84
+ def tutorial_step_params
85
+ params.require(:tutorial_step).permit(:tutorial_step_number, :tutorial_step_title, :tutorial_step_text, :tutorial_step_copy_instruction, :tutorial_step_image, :optimization_id, :post_id, :slug, :user_id, :org_id)
86
+ end
87
+
88
+ end
89
+ end
@@ -1,4 +1,4 @@
1
- module PhcdevworksTutorials
2
- module ApplicationHelper
3
- end
4
- end
1
+ module PhcdevworksTutorials
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -1,4 +1,4 @@
1
- module PhcdevworksTutorials
2
- module Blog::CommandsHelper
3
- end
4
- end
1
+ module PhcdevworksTutorials
2
+ module Blog::CommandsHelper
3
+ end
4
+ end
@@ -1,4 +1,4 @@
1
- module PhcdevworksTutorials
2
- module Blog::TutorialsHelper
3
- end
4
- end
1
+ module PhcdevworksTutorials
2
+ module Blog::TutorialsHelper
3
+ end
4
+ end
@@ -1,4 +1,4 @@
1
- module PhcdevworksTutorials
2
- module Command::ItemsHelper
3
- end
4
- end
1
+ module PhcdevworksTutorials
2
+ module Command::ItemsHelper
3
+ end
4
+ end
@@ -1,4 +1,4 @@
1
- module PhcdevworksTutorials
2
- module Command::PostsHelper
3
- end
4
- end
1
+ module PhcdevworksTutorials
2
+ module Command::PostsHelper
3
+ end
4
+ end
@@ -1,4 +1,4 @@
1
- module PhcdevworksTutorials
2
- module Tutorial::PostsHelper
3
- end
4
- end
1
+ module PhcdevworksTutorials
2
+ module Tutorial::PostsHelper
3
+ end
4
+ end
@@ -1,4 +1,4 @@
1
- module PhcdevworksTutorials
2
- module Tutorial::StepsHelper
3
- end
4
- end
1
+ module PhcdevworksTutorials
2
+ module Tutorial::StepsHelper
3
+ end
4
+ end
@@ -1,4 +1,4 @@
1
- module PhcdevworksTutorials
2
- class ApplicationJob < ActiveJob::Base
3
- end
4
- end
1
+ module PhcdevworksTutorials
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -1,6 +1,6 @@
1
- module PhcdevworksTutorials
2
- class ApplicationMailer < ActionMailer::Base
3
- default from: 'from@example.com'
4
- layout 'mailer'
5
- end
6
- end
1
+ module PhcdevworksTutorials
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
- module PhcdevworksTutorials
2
- class ApplicationRecord < ActiveRecord::Base
3
- self.abstract_class = true
4
- end
5
- end
1
+ module PhcdevworksTutorials
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -1,17 +1,17 @@
1
- module PhcdevworksTutorials
2
- class Command::Item < ApplicationRecord
3
-
4
- # Paper Trail Initialize
5
- has_paper_trail :class_name => 'PhcdevworksTutorials::CommandItemVersions'
6
-
7
- # Image Upload
8
- has_one_attached :command_item_image
9
-
10
- # Relationships
11
- belongs_to :user, class_name: "PhcdevworksAccounts::User"
12
- belongs_to :post, class_name: "Command::Post"
13
- has_many :categories, class_name: "Tutorial::Category", :through => :post
14
- belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
15
-
16
- end
17
- end
1
+ module PhcdevworksTutorials
2
+ class Command::Item < ApplicationRecord
3
+
4
+ # Paper Trail Initialize
5
+ has_paper_trail :class_name => 'PhcdevworksTutorials::CommandItemVersions'
6
+
7
+ # Image Upload
8
+ has_one_attached :command_item_image
9
+
10
+ # Relationships
11
+ belongs_to :user, class_name: "PhcdevworksAccounts::User"
12
+ belongs_to :post, class_name: "Command::Post"
13
+ has_many :categories, class_name: "Tutorial::Category", :through => :post
14
+ belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
15
+
16
+ end
17
+ end
@@ -1,34 +1,34 @@
1
- module PhcdevworksTutorials
2
- class Command::Post < ApplicationRecord
3
-
4
- # Clean URL Initialize
5
- extend FriendlyId
6
-
7
- # Paper Trail Initialize
8
- has_paper_trail :class_name => 'PhcdevworksTutorials::CommandPostVersions'
9
-
10
- # Image Upload
11
- has_one_attached :command_post_image
12
-
13
- # Relationships
14
- belongs_to :user, class_name: "PhcdevworksAccounts::User"
15
- belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
16
- has_and_belongs_to_many :categories, class_name: "PhcdevworksCoreModules::Post::Category", :join_table => "phcdevworks_tutorials_command_categories_posts"
17
- has_many :items, class_name: "Command::Item", :dependent => :destroy
18
-
19
- # Form Fields Validation
20
- validates :command_post_title,
21
- presence: true
22
-
23
- validates :command_post_text,
24
- presence: true
25
-
26
- # Clean URL Define
27
- friendly_id :command_post_nice_urls, use: [:slugged, :finders]
28
-
29
- def command_post_nice_urls
30
- [:command_post_title]
31
- end
32
-
33
- end
34
- end
1
+ module PhcdevworksTutorials
2
+ class Command::Post < ApplicationRecord
3
+
4
+ # Clean URL Initialize
5
+ extend FriendlyId
6
+
7
+ # Paper Trail Initialize
8
+ has_paper_trail :class_name => 'PhcdevworksTutorials::CommandPostVersions'
9
+
10
+ # Image Upload
11
+ has_one_attached :command_post_image
12
+
13
+ # Relationships
14
+ belongs_to :user, class_name: "PhcdevworksAccounts::User"
15
+ belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
16
+ has_and_belongs_to_many :categories, class_name: "PhcdevworksCoreModules::Post::Category", :join_table => "phcdevworks_tutorials_command_categories_posts"
17
+ has_many :items, class_name: "Command::Item", :dependent => :destroy
18
+
19
+ # Form Fields Validation
20
+ validates :command_post_title,
21
+ presence: true
22
+
23
+ validates :command_post_text,
24
+ presence: true
25
+
26
+ # Clean URL Define
27
+ friendly_id :command_post_nice_urls, use: [:slugged, :finders]
28
+
29
+ def command_post_nice_urls
30
+ [:command_post_title]
31
+ end
32
+
33
+ end
34
+ end
@@ -1,7 +1,7 @@
1
- module PhcdevworksTutorials
2
- module Command
3
- def self.table_name_prefix
4
- 'phcdevworks_tutorials_command_'
5
- end
6
- end
7
- end
1
+ module PhcdevworksTutorials
2
+ module Command
3
+ def self.table_name_prefix
4
+ 'phcdevworks_tutorials_command_'
5
+ end
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
- module PhcdevworksTutorials
2
- class CommandItemVersions < PaperTrail::Version
3
- self.table_name = :phcdevworks_tutorials_command_item_versions
4
- end
5
- end
1
+ module PhcdevworksTutorials
2
+ class CommandItemVersions < PaperTrail::Version
3
+ self.table_name = :phcdevworks_tutorials_command_item_versions
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
- module PhcdevworksTutorials
2
- class CommandPostVersions < PaperTrail::Version
3
- self.table_name = :phcdevworks_tutorials_command_post_versions
4
- end
5
- end
1
+ module PhcdevworksTutorials
2
+ class CommandPostVersions < PaperTrail::Version
3
+ self.table_name = :phcdevworks_tutorials_command_post_versions
4
+ end
5
+ end
@@ -1,34 +1,34 @@
1
- module PhcdevworksTutorials
2
- class Tutorial::Post < ApplicationRecord
3
-
4
- # Clean URL Initialize
5
- extend FriendlyId
6
-
7
- # Paper Trail Initialize
8
- has_paper_trail :class_name => 'PhcdevworksTutorials::TutorialPostVersions'
9
-
10
- # Image Upload
11
- has_one_attached :tutorial_post_image
12
-
13
- # Relationships
14
- belongs_to :user, class_name: "PhcdevworksAccounts::User"
15
- belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
16
- has_and_belongs_to_many :categories, class_name: "PhcdevworksCoreModules::Post::Category", :join_table => "phcdevworks_tutorials_tutorial_categories_posts", :dependent => :destroy
17
- has_many :steps, class_name: "Tutorial::Step", :dependent => :destroy
18
-
19
- # Form Fields Validation
20
- validates :tutorial_post_title,
21
- presence: true
22
-
23
- validates :tutorial_post_text,
24
- presence: true
25
-
26
- # Clean URL Define
27
- friendly_id :tutorial_post_nice_urls, use: [:slugged, :finders]
28
-
29
- def tutorial_post_nice_urls
30
- [:tutorial_post_title]
31
- end
32
-
33
- end
34
- end
1
+ module PhcdevworksTutorials
2
+ class Tutorial::Post < ApplicationRecord
3
+
4
+ # Clean URL Initialize
5
+ extend FriendlyId
6
+
7
+ # Paper Trail Initialize
8
+ has_paper_trail :class_name => 'PhcdevworksTutorials::TutorialPostVersions'
9
+
10
+ # Image Upload
11
+ has_one_attached :tutorial_post_image
12
+
13
+ # Relationships
14
+ belongs_to :user, class_name: "PhcdevworksAccounts::User"
15
+ belongs_to :optimization, class_name: "PhcdevworksCoreModules::Marketing::Optimization", optional: true
16
+ has_and_belongs_to_many :categories, class_name: "PhcdevworksCoreModules::Post::Category", :join_table => "phcdevworks_tutorials_tutorial_categories_posts", :dependent => :destroy
17
+ has_many :steps, class_name: "Tutorial::Step", :dependent => :destroy
18
+
19
+ # Form Fields Validation
20
+ validates :tutorial_post_title,
21
+ presence: true
22
+
23
+ validates :tutorial_post_text,
24
+ presence: true
25
+
26
+ # Clean URL Define
27
+ friendly_id :tutorial_post_nice_urls, use: [:slugged, :finders]
28
+
29
+ def tutorial_post_nice_urls
30
+ [:tutorial_post_title]
31
+ end
32
+
33
+ end
34
+ end