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.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -20
- data/README.md +1 -0
- data/Rakefile +8 -8
- data/app/assets/config/phcdevworks_tutorials_manifest.js +3 -3
- data/app/assets/stylesheets/phcdevworks_tutorials/application.scss +0 -0
- data/app/assets/stylesheets/phcdevworks_tutorials/blog/commands.scss +3 -3
- data/app/assets/stylesheets/phcdevworks_tutorials/blog/tutorials.scss +3 -3
- data/app/assets/stylesheets/phcdevworks_tutorials/command/items.scss +3 -3
- data/app/assets/stylesheets/phcdevworks_tutorials/command/posts.scss +3 -3
- data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/posts.css +4 -4
- data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/steps.css +4 -4
- data/app/controllers/phcdevworks_tutorials/application_controller.rb +13 -13
- data/app/controllers/phcdevworks_tutorials/blog/commands_controller.rb +21 -21
- data/app/controllers/phcdevworks_tutorials/blog/tutorials_controller.rb +21 -21
- data/app/controllers/phcdevworks_tutorials/command/items_controller.rb +95 -95
- data/app/controllers/phcdevworks_tutorials/command/posts_controller.rb +81 -81
- data/app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb +81 -81
- data/app/controllers/phcdevworks_tutorials/tutorial/steps_controller.rb +89 -89
- data/app/helpers/phcdevworks_tutorials/application_helper.rb +4 -4
- data/app/helpers/phcdevworks_tutorials/blog/commands_helper.rb +4 -4
- data/app/helpers/phcdevworks_tutorials/blog/tutorials_helper.rb +4 -4
- data/app/helpers/phcdevworks_tutorials/command/items_helper.rb +4 -4
- data/app/helpers/phcdevworks_tutorials/command/posts_helper.rb +4 -4
- data/app/helpers/phcdevworks_tutorials/tutorial/posts_helper.rb +4 -4
- data/app/helpers/phcdevworks_tutorials/tutorial/steps_helper.rb +4 -4
- data/app/jobs/phcdevworks_tutorials/application_job.rb +4 -4
- data/app/mailers/phcdevworks_tutorials/application_mailer.rb +6 -6
- data/app/models/phcdevworks_tutorials/application_record.rb +5 -5
- data/app/models/phcdevworks_tutorials/command/item.rb +17 -17
- data/app/models/phcdevworks_tutorials/command/post.rb +34 -34
- data/app/models/phcdevworks_tutorials/command.rb +7 -7
- data/app/models/phcdevworks_tutorials/command_item_versions.rb +5 -5
- data/app/models/phcdevworks_tutorials/command_post_versions.rb +5 -5
- data/app/models/phcdevworks_tutorials/tutorial/post.rb +34 -34
- data/app/models/phcdevworks_tutorials/tutorial/step.rb +17 -17
- data/app/models/phcdevworks_tutorials/tutorial.rb +7 -7
- data/app/models/phcdevworks_tutorials/tutorial_post_versions.rb +5 -5
- data/app/models/phcdevworks_tutorials/tutorial_step_versions.rb +5 -5
- data/app/views/layouts/phcdevworks_tutorials/application.html.erb +131 -131
- data/app/views/layouts/phcdevworks_tutorials/components/backend/footer/_footer.html.erb +0 -0
- data/app/views/layouts/phcdevworks_tutorials/components/backend/navigation/_top_menu.html.erb +0 -0
- data/app/views/layouts/phcdevworks_tutorials/components/backend/sidebars/_side_menu.html.erb +0 -0
- data/app/views/layouts/phcdevworks_tutorials/frontend.html.erb +0 -0
- data/app/views/phcdevworks_tutorials/blog/commands/index.html.erb +0 -0
- data/app/views/phcdevworks_tutorials/blog/commands/show.html.erb +0 -0
- data/app/views/phcdevworks_tutorials/blog/tutorials/index.html.erb +0 -0
- data/app/views/phcdevworks_tutorials/blog/tutorials/show.html.erb +0 -0
- data/app/views/phcdevworks_tutorials/command/items/_form.html.erb +42 -42
- data/app/views/phcdevworks_tutorials/command/items/edit.html.erb +47 -47
- data/app/views/phcdevworks_tutorials/command/items/index.html.erb +82 -82
- data/app/views/phcdevworks_tutorials/command/items/new.html.erb +47 -47
- data/app/views/phcdevworks_tutorials/command/items/show.html.erb +19 -19
- data/app/views/phcdevworks_tutorials/command/posts/_form.html.erb +56 -56
- data/app/views/phcdevworks_tutorials/command/posts/edit.html.erb +47 -47
- data/app/views/phcdevworks_tutorials/command/posts/index.html.erb +81 -81
- data/app/views/phcdevworks_tutorials/command/posts/new.html.erb +49 -49
- data/app/views/phcdevworks_tutorials/command/posts/show.html.erb +74 -74
- data/app/views/phcdevworks_tutorials/tutorial/posts/_form.html.erb +56 -56
- data/app/views/phcdevworks_tutorials/tutorial/posts/edit.html.erb +47 -47
- data/app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb +85 -85
- data/app/views/phcdevworks_tutorials/tutorial/posts/new.html.erb +47 -47
- data/app/views/phcdevworks_tutorials/tutorial/posts/show.html.erb +76 -76
- data/app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb +48 -48
- data/app/views/phcdevworks_tutorials/tutorial/steps/edit.html.erb +47 -47
- data/app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb +82 -82
- data/app/views/phcdevworks_tutorials/tutorial/steps/new.html.erb +47 -47
- data/config/routes.rb +35 -35
- data/config/spring.rb +1 -1
- data/db/migrate/20191017235259_create_phcdevworks_tutorials_tutorial_posts.rb +19 -19
- data/db/migrate/20191017235421_create_phcdevworks_tutorials_tutorial_steps.rb +22 -22
- data/db/migrate/20191024232406_create_phcdevworks_tutorials_tutorial_categories_posts.rb +10 -10
- data/db/migrate/20191102093129_create_phcdevworks_tutorials_tutorial_post_versions.rb +17 -17
- data/db/migrate/20191102093146_create_phcdevworks_tutorials_tutorial_step_versions.rb +18 -18
- data/db/migrate/20200320110115_create_phcdevworks_tutorials_command_posts.rb +19 -19
- data/db/migrate/20200320110553_create_phcdevworks_tutorials_command_items.rb +19 -19
- data/db/migrate/20200321122525_create_phcdevworks_tutorials_command_item_versions.rb +18 -18
- data/db/migrate/20200321122606_create_phcdevworks_tutorials_command_post_versions.rb +18 -18
- data/db/migrate/20200328012248_create_phcdevworks_tutorials_command_categories_posts.rb +10 -10
- data/lib/phcdevworks_tutorials/engine.rb +47 -47
- data/lib/phcdevworks_tutorials/version.rb +3 -3
- data/lib/phcdevworks_tutorials.rb +6 -6
- data/lib/tasks/phcdevworks_tutorials_tasks.rake +4 -4
- metadata +33 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0708394071c5e7a10a3eb67d9da0da3fc6bf52a534f80d2d70ee316e1dcd6d7
|
4
|
+
data.tar.gz: a3bddf33299c18f30da4999141ba4005b55a569b93b0de210c7dd6fe128716f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d7e5d53ab0893f27c72d5305e128a30e69df10d2cc6dcbc47685b4f561c26ec01ad70dcda732fa0bf38f088563b3c32f493ce4d5a1bdaf37d5b40913ca24198
|
7
|
+
data.tar.gz: 353898662e7ff66238c5b1c5ff319bb9eefd5323e317ab4d1d4742b52a4d39b283441b369d5cfec899c2db1df5112e1d3db3cbab82b7aa738663fd5bf98832af
|
data/MIT-LICENSE
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright 2020 BradPotts
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright 2020 BradPotts
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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)
|
data/Rakefile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require "bundler/setup"
|
2
|
-
|
3
|
-
APP_RAKEFILE = File.expand_path("spec/test_app/Rakefile", __dir__)
|
4
|
-
load "rails/tasks/engine.rake"
|
5
|
-
|
6
|
-
load "rails/tasks/statistics.rake"
|
7
|
-
|
8
|
-
require "bundler/gem_tasks"
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
APP_RAKEFILE = File.expand_path("spec/test_app/Rakefile", __dir__)
|
4
|
+
load "rails/tasks/engine.rake"
|
5
|
+
|
6
|
+
load "rails/tasks/statistics.rake"
|
7
|
+
|
8
|
+
require "bundler/gem_tasks"
|
@@ -1,3 +1,3 @@
|
|
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_directory ../stylesheets/phcdevworks_tutorials .scss
|
2
|
+
//= link phcthemes_admin_panel_pack_coloradmin.css
|
3
|
+
//= link phcthemes_admin_panel_pack_coloradmin.js
|
File without changes
|
@@ -1,3 +1,3 @@
|
|
1
|
-
// Place all the styles related to the blog/commands controller here.
|
2
|
-
// They will automatically be included in application.css.
|
3
|
-
// You can use Sass (SCSS) here: https://sass-lang.com/
|
1
|
+
// Place all the styles related to the blog/commands controller here.
|
2
|
+
// They will automatically be included in application.css.
|
3
|
+
// You can use Sass (SCSS) here: https://sass-lang.com/
|
@@ -1,3 +1,3 @@
|
|
1
|
-
// Place all the styles related to the blog/tutorials controller here.
|
2
|
-
// They will automatically be included in application.css.
|
3
|
-
// You can use Sass (SCSS) here: https://sass-lang.com/
|
1
|
+
// Place all the styles related to the blog/tutorials controller here.
|
2
|
+
// They will automatically be included in application.css.
|
3
|
+
// You can use Sass (SCSS) here: https://sass-lang.com/
|
@@ -1,3 +1,3 @@
|
|
1
|
-
// Place all the styles related to the command::items controller here.
|
2
|
-
// They will automatically be included in application.css.
|
3
|
-
// You can use Sass (SCSS) here: https://sass-lang.com/
|
1
|
+
// Place all the styles related to the command::items controller here.
|
2
|
+
// They will automatically be included in application.css.
|
3
|
+
// You can use Sass (SCSS) here: https://sass-lang.com/
|
@@ -1,3 +1,3 @@
|
|
1
|
-
// Place all the styles related to the command::posts controller here.
|
2
|
-
// They will automatically be included in application.css.
|
3
|
-
// You can use Sass (SCSS) here: https://sass-lang.com/
|
1
|
+
// Place all the styles related to the command::posts controller here.
|
2
|
+
// They will automatically be included in application.css.
|
3
|
+
// You can use Sass (SCSS) here: https://sass-lang.com/
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*
|
2
|
-
Place all the styles related to the matching controller here.
|
3
|
-
They will automatically be included in application.css.
|
4
|
-
*/
|
1
|
+
/*
|
2
|
+
Place all the styles related to the matching controller here.
|
3
|
+
They will automatically be included in application.css.
|
4
|
+
*/
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*
|
2
|
-
Place all the styles related to the matching controller here.
|
3
|
-
They will automatically be included in application.css.
|
4
|
-
*/
|
1
|
+
/*
|
2
|
+
Place all the styles related to the matching controller here.
|
3
|
+
They will automatically be included in application.css.
|
4
|
+
*/
|
@@ -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
|