phcdevworks_tutorials 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/phcdevworks_tutorials/tutorial/steps.coffee +3 -0
- data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/steps.scss +3 -0
- data/app/assets/stylesheets/scaffolds.scss +65 -0
- data/app/controllers/phcdevworks_tutorials/blog/tutorials_controller.rb +14 -0
- data/app/controllers/phcdevworks_tutorials/tutorial/categories_controller.rb +1 -1
- data/app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb +1 -1
- data/app/controllers/phcdevworks_tutorials/tutorial/steps_controller.rb +95 -0
- data/app/helpers/phcdevworks_tutorials/tutorial/steps_helper.rb +4 -0
- data/app/models/phcdevworks_tutorials/tutorial/post.rb +4 -3
- data/app/models/phcdevworks_tutorials/tutorial/step.rb +11 -0
- data/app/views/layouts/phcdevworks_tutorials/frontend.html.erb +5 -0
- data/app/views/phcdevworks_tutorials/tutorial/categories/_form.html.erb +6 -2
- data/app/views/phcdevworks_tutorials/tutorial/posts/_form.html.erb +22 -9
- data/app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb +3 -7
- data/app/views/phcdevworks_tutorials/tutorial/posts/show.html.erb +0 -15
- data/app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb +35 -0
- data/app/views/phcdevworks_tutorials/tutorial/steps/edit.html.erb +39 -0
- data/app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb +67 -0
- data/app/views/phcdevworks_tutorials/tutorial/steps/new.html.erb +39 -0
- data/app/views/phcdevworks_tutorials/tutorial/steps/show.html.erb +14 -0
- data/config/routes.rb +7 -5
- data/db/migrate/20190911225813_create_phcdevworks_tutorials_tutorial_posts.rb +0 -2
- data/db/migrate/20190923113101_create_phcdevworks_tutorials_tutorial_steps.rb +18 -0
- data/db/migrate/20190929044403_add_info_to_phcdevworks_tutorials_tutorial_posts.rb +9 -0
- data/db/migrate/20190929044505_add_info_to_phcdevworks_tutorials_tutorial_steps.rb +7 -0
- data/db/migrate/20191002093451_add_image_to_phcdevworks_tutorials_tutorial_posts.rb +8 -0
- data/lib/phcdevworks_tutorials/version.rb +1 -1
- metadata +34 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fb02f5f552818db1a3870f7fe9ca6b51b667d24d44a7ef920024e757c04593f
|
4
|
+
data.tar.gz: 35fdd2b2e952c22ec951db3ef331a3ec64378eee415ac476640c6de85931cd7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1abce4457ca8938d0746020cbc7090288baf7d0d281103b9958dbddd0f4c10c7cf98fc53adf90c35365a89ac338ca4aaa5ab5c5a6b3fbe16dd6e79860ab8c6f1
|
7
|
+
data.tar.gz: a0601147138c7b06999164810be638ee90f1a952da1602c27443881cf33e85f6f367039b956ab6697ac6b89428d305b253d600e7caf8a07b8df9a1a09cf91c85
|
@@ -0,0 +1,65 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
margin: 33px; }
|
5
|
+
|
6
|
+
body, p, ol, ul, td {
|
7
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
8
|
+
font-size: 13px;
|
9
|
+
line-height: 18px; }
|
10
|
+
|
11
|
+
pre {
|
12
|
+
background-color: #eee;
|
13
|
+
padding: 10px;
|
14
|
+
font-size: 11px; }
|
15
|
+
|
16
|
+
a {
|
17
|
+
color: #000; }
|
18
|
+
|
19
|
+
a:visited {
|
20
|
+
color: #666; }
|
21
|
+
|
22
|
+
a:hover {
|
23
|
+
color: #fff;
|
24
|
+
background-color: #000; }
|
25
|
+
|
26
|
+
th {
|
27
|
+
padding-bottom: 5px; }
|
28
|
+
|
29
|
+
td {
|
30
|
+
padding: 0 5px 7px; }
|
31
|
+
|
32
|
+
div.field,
|
33
|
+
div.actions {
|
34
|
+
margin-bottom: 10px; }
|
35
|
+
|
36
|
+
#notice {
|
37
|
+
color: green; }
|
38
|
+
|
39
|
+
.field_with_errors {
|
40
|
+
padding: 2px;
|
41
|
+
background-color: red;
|
42
|
+
display: table; }
|
43
|
+
|
44
|
+
#error_explanation {
|
45
|
+
width: 450px;
|
46
|
+
border: 2px solid red;
|
47
|
+
padding: 7px 7px 0;
|
48
|
+
margin-bottom: 20px;
|
49
|
+
background-color: #f0f0f0; }
|
50
|
+
|
51
|
+
#error_explanation h2 {
|
52
|
+
text-align: left;
|
53
|
+
font-weight: bold;
|
54
|
+
padding: 5px 5px 5px 15px;
|
55
|
+
font-size: 12px;
|
56
|
+
margin: -7px -7px 0;
|
57
|
+
background-color: #c00;
|
58
|
+
color: #fff; }
|
59
|
+
|
60
|
+
#error_explanation ul li {
|
61
|
+
font-size: 12px;
|
62
|
+
list-style: square; }
|
63
|
+
|
64
|
+
label {
|
65
|
+
display: block; }
|
@@ -2,5 +2,19 @@ require_dependency "phcdevworks_tutorials/application_controller"
|
|
2
2
|
|
3
3
|
module PhcdevworksTutorials
|
4
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")
|
12
|
+
end
|
13
|
+
|
14
|
+
# SHOW
|
15
|
+
def show
|
16
|
+
@phcdevworks_tutorials_single = Tutorial::Post.friendly.find(params[:id])
|
17
|
+
end
|
18
|
+
|
5
19
|
end
|
6
20
|
end
|
@@ -75,7 +75,7 @@ module PhcdevworksTutorials
|
|
75
75
|
|
76
76
|
# Whitelist
|
77
77
|
def tutorial_category_params
|
78
|
-
params.require(:tutorial_category).permit(:tutorial_category_name)
|
78
|
+
params.require(:tutorial_category).permit(:tutorial_category_name, :slug, :user_id, :org_id)
|
79
79
|
end
|
80
80
|
|
81
81
|
end
|
@@ -75,7 +75,7 @@ module PhcdevworksTutorials
|
|
75
75
|
|
76
76
|
# Whitelist
|
77
77
|
def tutorial_post_params
|
78
|
-
params.require(:tutorial_post).permit(:tutorial_post_step, :tutorial_post_title, :tutorial_post_text, :category_id)
|
78
|
+
params.require(:tutorial_post).permit(:tutorial_post_step, :tutorial_post_title, :tutorial_post_text,:tutorial_post_description, :tutorial_post_status, :tutorial_post_image, :category_id, :slug, :user_id, :org_id)
|
79
79
|
end
|
80
80
|
|
81
81
|
end
|
@@ -0,0 +1,95 @@
|
|
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
|
+
# GET /tutorial/steps.json
|
14
|
+
def index
|
15
|
+
@tutorial_steps = tutorial_post.steps.all
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /tutorial/steps/1
|
19
|
+
# GET /tutorial/steps/1.json
|
20
|
+
def show
|
21
|
+
@tutorial_step = tutorial_post.steps.find(params[:id])
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /tutorial/steps/new
|
25
|
+
def new
|
26
|
+
@tutorial_step = tutorial_post.steps.build
|
27
|
+
end
|
28
|
+
|
29
|
+
# GET /tutorial/steps/1/edit
|
30
|
+
def edit
|
31
|
+
@tutorial_step = Tutorial::Post.friendly.find(params[:post_id])
|
32
|
+
end
|
33
|
+
|
34
|
+
# POST /tutorial/steps
|
35
|
+
# POST /tutorial/steps.json
|
36
|
+
def create
|
37
|
+
@tutorial_step = tutorial_post.steps.create(tutorial_step_params)
|
38
|
+
@tutorial_step.user_id = current_user.id
|
39
|
+
@tutorial_step.org_id = current_user.org_id
|
40
|
+
respond_to do |format|
|
41
|
+
if @tutorial_step.save
|
42
|
+
format.html { redirect_to tutorial_post_steps_path, :flash => { :success => 'Tutorial Step has been Added' }}
|
43
|
+
format.json { render :show, status: :created, location: @tutorial_step }
|
44
|
+
else
|
45
|
+
format.html { render :new }
|
46
|
+
format.json { render json: @tutorial_step.errors, status: :unprocessable_entity }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# PATCH/PUT /tutorial/steps/1
|
52
|
+
# PATCH/PUT /tutorial/steps/1.json
|
53
|
+
def update
|
54
|
+
@tutorial_post = Tutorial::Post.friendly.find(params[:post_id])
|
55
|
+
respond_to do |format|
|
56
|
+
if @tutorial_step.update(tutorial_step_params)
|
57
|
+
format.html { redirect_to tutorial_post_steps_path, :flash => { :notice => 'Tutorial Step has been Updated.' }}
|
58
|
+
format.json { render :show, status: :ok, location: @tutorial_step }
|
59
|
+
else
|
60
|
+
format.html { render :edit }
|
61
|
+
format.json { render json: @tutorial_step.errors, status: :unprocessable_entity }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# DELETE /tutorial/steps/1
|
67
|
+
# DELETE /tutorial/steps/1.json
|
68
|
+
def destroy
|
69
|
+
@tutorial_step = tutorial_post.steps.find(params[:id])
|
70
|
+
@tutorial_step.destroy
|
71
|
+
respond_to do |format|
|
72
|
+
format.html { redirect_to tutorial_post_steps_path, :flash => { :error => 'Tutorial Step has been Removed' }}
|
73
|
+
format.json { head :no_content }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
# Common Callbacks
|
80
|
+
|
81
|
+
def set_tutorial_step
|
82
|
+
@tutorial_step = Tutorial::Step.find(params[:id])
|
83
|
+
end
|
84
|
+
|
85
|
+
def tutorial_post
|
86
|
+
@tutorial_post = Tutorial::Post.friendly.find(params[:post_id])
|
87
|
+
end
|
88
|
+
|
89
|
+
# Whitelist
|
90
|
+
def tutorial_step_params
|
91
|
+
params.require(:tutorial_step).permit(:steps_number, :steps_body, :tutorial_step_image, :post_id, :slug, :user_id, :org_id)
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
@@ -4,16 +4,17 @@ module PhcdevworksTutorials
|
|
4
4
|
# Clean URL Initialize
|
5
5
|
extend FriendlyId
|
6
6
|
|
7
|
+
# Image Upload
|
8
|
+
has_one_attached :tutorial_post_images
|
9
|
+
|
7
10
|
# Relationships
|
8
11
|
belongs_to :category, class_name: 'PhcdevworksTutorials::Tutorial::Category'
|
12
|
+
has_many :steps, class_name: "PhcdevworksTutorials::Tutorial::Step"
|
9
13
|
|
10
14
|
# Form Fields Validation
|
11
15
|
validates :tutorial_post_title,
|
12
16
|
presence: true
|
13
17
|
|
14
|
-
validates :tutorial_post_text,
|
15
|
-
presence: true
|
16
|
-
|
17
18
|
# Clean URL Define
|
18
19
|
friendly_id :phcdev_tutorials_post_nice_urls, use: [:slugged, :finders]
|
19
20
|
|
@@ -1,9 +1,13 @@
|
|
1
1
|
<%= form_with(model: tutorial_category, local: true) do |form| %>
|
2
2
|
|
3
|
+
<!-- PHCNotifi Render Validation -->
|
4
|
+
<%= render "phcdevworks_notifications/bootstrap/validations", :object => @tutorial_category %>
|
5
|
+
<!-- PHCNotifi Render Validation -->
|
6
|
+
|
3
7
|
<!-- Form Input Fields -->
|
4
8
|
<div class="form-group field_with_errors">
|
5
|
-
<%= form.label :tutorial_category_name,
|
6
|
-
<%= form.text_field :tutorial_category_name, placeholder:
|
9
|
+
<%= form.label :tutorial_category_name, "Tutorial Category" %>
|
10
|
+
<%= form.text_field :tutorial_category_name, placeholder: "Category Name", class: "form-control" %>
|
7
11
|
</div>
|
8
12
|
<!-- Form Input Fields -->
|
9
13
|
|
@@ -1,20 +1,33 @@
|
|
1
1
|
<%= form_with(model: tutorial_post, local: true) do |form| %>
|
2
2
|
|
3
|
+
<!-- PHCNotifi Render Validation -->
|
4
|
+
<%= render "phcdevworks_notifications/bootstrap/validations", :object => @tutorial_post %>
|
5
|
+
<!-- PHCNotifi Render Validation -->
|
6
|
+
|
3
7
|
<!-- Form Input Fields -->
|
4
|
-
<div class="form-group field_with_errors">
|
5
|
-
<%= form.label :tutorial_post_step, "Tutorial Step" %>
|
6
|
-
<%= form.select( :tutorial_post_step, [["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"]], {}, {class: "form-control"}) %>
|
7
|
-
</div>
|
8
|
-
|
9
8
|
<div class="form-group field_with_errors">
|
10
9
|
<%= form.label :tutorial_post_title, "Tutorial Title" %>
|
11
10
|
<%= form.text_field :tutorial_post_title, placeholder: "Tutorial Title", class: "form-control" %>
|
12
11
|
</div>
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
<div class="form-group field_with_errors">
|
14
|
+
<%= form.label :tutorial_post_description, "Tutorial Description" %>
|
15
|
+
<%= form.text_area :tutorial_post_description, class: "form-control", rows: "10" %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="form-group field_with_errors">
|
19
|
+
<%= form.label :tutorial_post_status, "Tutorial Status" %>
|
20
|
+
<%= form.select( :tutorial_post_status, [['Draft','draft'],['Published','published'],['Review','review']], {}, {class: "form-control form-control"}) %>
|
21
|
+
</div>
|
22
|
+
|
15
23
|
<div class="form-group field_with_errors">
|
16
|
-
|
17
|
-
|
24
|
+
<div class="form-group field_with_errors">
|
25
|
+
<%= form.label :tutorial_post_image, "Featured Image" %>
|
26
|
+
<%= form.file_field :tutorial_post_image, class: "form-control" %>
|
27
|
+
</div>
|
28
|
+
<% if form.object.tutorial_post_image.attached? %>
|
29
|
+
<%= image_tag main_app.url_for(form.object.tutorial_post_image), class: "img-responsive img-thumbnail" %>
|
30
|
+
<% end %>
|
18
31
|
</div>
|
19
32
|
|
20
33
|
<div class="form-group field_with_errors">
|
@@ -36,9 +36,7 @@
|
|
36
36
|
|
37
37
|
<thead>
|
38
38
|
<tr>
|
39
|
-
<th>Tutorial Step</th>
|
40
39
|
<th>Tutorial Title</th>
|
41
|
-
<th>Tutorial Text</th>
|
42
40
|
<th>Tutorial Category</th>
|
43
41
|
<th></th>
|
44
42
|
</tr>
|
@@ -47,15 +45,13 @@
|
|
47
45
|
<tbody>
|
48
46
|
<% @tutorial_posts.each do |tutorial_post| %>
|
49
47
|
<tr>
|
50
|
-
<td><%= tutorial_post.tutorial_post_step %></td>
|
51
48
|
<td><%= tutorial_post.tutorial_post_title %></td>
|
52
|
-
<td><%= tutorial_post.tutorial_post_text %></td>
|
53
49
|
<td><%= tutorial_post.category.tutorial_category_name %></td>
|
54
50
|
<td>
|
55
51
|
<div class="btn-group d-flex" role="group">
|
56
|
-
<%= link_to
|
57
|
-
<%= link_to
|
58
|
-
<%= link_to
|
52
|
+
<%= link_to "Details", tutorial_post, class: "btn btn-purple btn-xs" %>
|
53
|
+
<%= link_to "Update", edit_tutorial_post_path(tutorial_post), class: "btn btn-primary btn-xs" %>
|
54
|
+
<%= link_to "Remove", tutorial_post, method: :delete, data: { confirm: "Are you sure? This action cannot be reversed." }, class: "btn btn-danger btn-xs" %>
|
59
55
|
</div>
|
60
56
|
</td>
|
61
57
|
</tr>
|
@@ -1,19 +1,4 @@
|
|
1
1
|
<p id="notice"><%= notice %></p>
|
2
2
|
|
3
|
-
<p>
|
4
|
-
<strong>Tutorial post step:</strong>
|
5
|
-
<%= @tutorial_post.tutorial_post_step %>
|
6
|
-
</p>
|
7
|
-
|
8
|
-
<p>
|
9
|
-
<strong>Tutorial post text:</strong>
|
10
|
-
<%= @tutorial_post.tutorial_post_text %>
|
11
|
-
</p>
|
12
|
-
|
13
|
-
<p>
|
14
|
-
<strong>Category:</strong>
|
15
|
-
<%= @tutorial_post.category_id %>
|
16
|
-
</p>
|
17
|
-
|
18
3
|
<%= link_to 'Edit', edit_tutorial_post_path(@tutorial_post) %> |
|
19
4
|
<%= link_to 'Back', tutorial_posts_path %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<%= form_with(model: [ @tutorial_post, @tutorial_step], url: form_url, local: true) do |form| %>
|
2
|
+
|
3
|
+
<!-- PHCNotifi Render Validation -->
|
4
|
+
<%= render "phcdevworks_notifications/bootstrap/validations", :object => @tutorial_step %>
|
5
|
+
<!-- PHCNotifi Render Validation -->
|
6
|
+
|
7
|
+
<!-- Form Input Fields -->
|
8
|
+
<div class="form-group field_with_errors">
|
9
|
+
<%= form.label :tutorial_step_number, "Tutorial Step" %>
|
10
|
+
<%= form.select( :tutorial_step_number, [["1","1"],["2","2"],["3","3"],["4","4"],["5","5"],["6","6"],["7","7"],["8","8"],["9","9"],["10","10"],["11","11"],["12","12"],["13","13"],["14","14"]], {}, {class: "form-control"}) %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="form-group field_with_errors">
|
14
|
+
<%= form.label :tutorial_step_body, "Step Text" %>
|
15
|
+
<%= form.text_area :tutorial_step_body, class: "form-control", rows: "10" %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="form-group field_with_errors">
|
19
|
+
<div class="form-group field_with_errors">
|
20
|
+
<%= form.label :tutorial_step_image, "Step Image" %>
|
21
|
+
<%= form.file_field :tutorial_step_image, class: "form-control" %>
|
22
|
+
</div>
|
23
|
+
<% if form.object.tutorial_step_image.attached? %>
|
24
|
+
<%= image_tag main_app.url_for(form.object.tutorial_step_image), class: "img-responsive img-thumbnail" %>
|
25
|
+
<% end %>
|
26
|
+
</div>
|
27
|
+
<!-- Form Input Fields -->
|
28
|
+
|
29
|
+
<!-- Form Submition Button -->
|
30
|
+
<div class="actions">
|
31
|
+
<%= form.submit class: "btn btn-primary" %>
|
32
|
+
</div>
|
33
|
+
<!-- For Submition Button -->
|
34
|
+
|
35
|
+
<% end %>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Tutorial Post Manager" %>
|
3
|
+
<% phc_title_tagline "Update Tutorial Step" %>
|
4
|
+
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
|
+
<% phc_breadcrumb_two link_to "Step Index", phcdevworks_tutorials.tutorial_categories_path %>
|
6
|
+
<!-- Title System -->
|
7
|
+
|
8
|
+
<!-- Page Bradcrumbs -->
|
9
|
+
<ol class="breadcrumb pull-right">
|
10
|
+
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
+
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
|
+
</ol>
|
13
|
+
<!-- Page Bradcrumbs -->
|
14
|
+
|
15
|
+
<!-- Page Header -->
|
16
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<div class="panel-heading">
|
23
|
+
<div class="panel-heading-btn">
|
24
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
|
25
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-redo"></i></a>
|
26
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
|
27
|
+
</div>
|
28
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Form to Edit Member Address -->
|
34
|
+
<%= render "form", { form_url: tutorial_post_steps_path } %>
|
35
|
+
<!-- Form to Edit Member Address -->
|
36
|
+
</div>
|
37
|
+
<!-- Panel Body -->
|
38
|
+
</div>
|
39
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Tutorial Post Manager" %>
|
3
|
+
<% phc_title_tagline "Tutorial Index" %>
|
4
|
+
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
|
+
<% phc_breadcrumb_two link_to "Tutorial Index", phcdevworks_tutorials.tutorial_post_steps_path %>
|
6
|
+
<!-- Title System -->
|
7
|
+
|
8
|
+
<!-- Page Bradcrumbs -->
|
9
|
+
<ol class="breadcrumb pull-right">
|
10
|
+
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
+
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
|
+
</ol>
|
13
|
+
<!-- Page Bradcrumbs -->
|
14
|
+
|
15
|
+
<!-- Page Header -->
|
16
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<div class="panel-heading">
|
23
|
+
<div class="panel-heading-btn">
|
24
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
|
25
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-redo"></i></a>
|
26
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
|
27
|
+
</div>
|
28
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Table - Snippet Index -->
|
34
|
+
<div class="table-responsive">
|
35
|
+
<table class="table table-striped table-bordered">
|
36
|
+
|
37
|
+
<thead>
|
38
|
+
<tr>
|
39
|
+
<th>Tutorial Step Number</th>
|
40
|
+
<th>Tutorial Step Body</th>
|
41
|
+
<th></th>
|
42
|
+
</tr>
|
43
|
+
</thead>
|
44
|
+
|
45
|
+
<tbody>
|
46
|
+
<% @tutorial_steps.each do |tutorial_step| %>
|
47
|
+
<tr>
|
48
|
+
<td><%= tutorial_step.tutorial_step_number %></td>
|
49
|
+
<td><%= tutorial_step.tutorial_step_body %></td>
|
50
|
+
<td><%= link_to 'Show', tutorial_post_step_path(tutorial_step.post, tutorial_step) %></td>
|
51
|
+
<td><%= link_to 'Edit', edit_tutorial_post_step_path(tutorial_step.post, tutorial_step) %></td>
|
52
|
+
<td><%= link_to 'Destroy', tutorial_post_step_path(tutorial_step.post, tutorial_step), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
53
|
+
</tr>
|
54
|
+
<% end %>
|
55
|
+
</tbody>
|
56
|
+
|
57
|
+
</table>
|
58
|
+
<%= link_to phcdevworks_tutorials.new_tutorial_post_step_path, class: "btn btn-primary btn-sm" do %>
|
59
|
+
<i class="fas fa-plus-circle"></i>
|
60
|
+
Add a New Step for Tutorial
|
61
|
+
<% end %>
|
62
|
+
</div>
|
63
|
+
<!-- Table - Snippet Index -->
|
64
|
+
</div>
|
65
|
+
<!-- Panel Body -->
|
66
|
+
</div>
|
67
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Tutorial Post Manager" %>
|
3
|
+
<% phc_title_tagline "Add a New Step" %>
|
4
|
+
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
|
+
<% phc_breadcrumb_two link_to "Tutorial Step Index", phcdevworks_tutorials.tutorial_post_steps_path %>
|
6
|
+
<!-- Title System -->
|
7
|
+
|
8
|
+
<!-- Page Bradcrumbs -->
|
9
|
+
<ol class="breadcrumb pull-right">
|
10
|
+
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
+
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
|
+
</ol>
|
13
|
+
<!-- Page Bradcrumbs -->
|
14
|
+
|
15
|
+
<!-- Page Header -->
|
16
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<div class="panel-heading">
|
23
|
+
<div class="panel-heading-btn">
|
24
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
|
25
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-redo"></i></a>
|
26
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
|
27
|
+
</div>
|
28
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Form to Edit Member Address -->
|
34
|
+
<%= render "form", { form_url: tutorial_post_steps_path } %>
|
35
|
+
<!-- Form to Edit Member Address -->
|
36
|
+
</div>
|
37
|
+
<!-- Panel Body -->
|
38
|
+
</div>
|
39
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Tutorial step number:</strong>
|
5
|
+
<%= @tutorial_step.tutorial_step_number %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Tutorial step body:</strong>
|
10
|
+
<%= @tutorial_step.tutorial_step_body %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<%= link_to 'Edit', edit_tutorial_step_path(@tutorial_step) %> |
|
14
|
+
<%= link_to 'Back', tutorial_steps_path %>
|
data/config/routes.rb
CHANGED
@@ -2,8 +2,10 @@ PhcdevworksTutorials::Engine.routes.draw do
|
|
2
2
|
|
3
3
|
# Tutorial Routs
|
4
4
|
namespace :tutorial do
|
5
|
-
resources :posts, class_name:
|
6
|
-
|
5
|
+
resources :posts, class_name: "PhcdevworksTutorials::Tutorial::Post" do
|
6
|
+
resources :steps, class_name: "PhcdevworksTutorials::Tutorial::Step"
|
7
|
+
end
|
8
|
+
resources :categories, class_name: "PhcdevworksTutorials::Tutorial::Category"
|
7
9
|
end
|
8
10
|
|
9
11
|
# Frontend Routes
|
@@ -14,12 +16,12 @@ PhcdevworksTutorials::Engine.routes.draw do
|
|
14
16
|
# API Routes
|
15
17
|
namespace :api, :path => "", :constraints => {:subdomain => "tutorial_api"} do
|
16
18
|
namespace :v1 do
|
17
|
-
resources :posts, defaults: {format:
|
18
|
-
resources :categories, defaults: {format:
|
19
|
+
resources :posts, defaults: {format: "json"}
|
20
|
+
resources :categories, defaults: {format: "json"}
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
24
|
# Mount Routes
|
23
|
-
mount PhcdevworksAccounts::Engine, :at =>
|
25
|
+
mount PhcdevworksAccounts::Engine, :at => "/"
|
24
26
|
|
25
27
|
end
|
@@ -2,9 +2,7 @@ class CreatePhcdevworksTutorialsTutorialPosts < ActiveRecord::Migration[6.0]
|
|
2
2
|
def change
|
3
3
|
create_table :phcdevworks_tutorials_tutorial_posts do |t|
|
4
4
|
|
5
|
-
t.string :tutorial_post_step
|
6
5
|
t.string :tutorial_post_title
|
7
|
-
t.text :tutorial_post_text
|
8
6
|
|
9
7
|
t.references :category
|
10
8
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreatePhcdevworksTutorialsTutorialSteps < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table :phcdevworks_tutorials_tutorial_steps do |t|
|
4
|
+
|
5
|
+
t.integer :tutorial_step_number
|
6
|
+
t.text :tutorial_step_body
|
7
|
+
|
8
|
+
t.string :slug
|
9
|
+
t.string :user_id
|
10
|
+
t.string :org_id
|
11
|
+
|
12
|
+
t.references :post
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddInfoToPhcdevworksTutorialsTutorialPosts < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
|
4
|
+
add_column :phcdevworks_tutorials_tutorial_posts, :tutorial_post_images, :string
|
5
|
+
add_column :phcdevworks_tutorials_tutorial_posts, :tutorial_post_description, :text
|
6
|
+
add_column :phcdevworks_tutorials_tutorial_posts, :tutorial_post_status, :string
|
7
|
+
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddImageToPhcdevworksTutorialsTutorialPosts < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
|
4
|
+
add_column :phcdevworks_tutorials_tutorial_steps, :tutorial_step_image, :string
|
5
|
+
add_column :phcdevworks_tutorials_tutorial_posts, :tutorial_post_image, :string
|
6
|
+
|
7
|
+
end
|
8
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phcdevworks_tutorials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PHCDevworks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -58,84 +58,84 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.2.3
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.2.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: phcthemes_web_theme_pack
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 1.1.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 1.1.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: phcdevworks_active_menus
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 1.0.1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.0.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: phcdevworks_notifications
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 1.0.1
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 1.0.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: phcdevworks_titleseo
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 1.0.1
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 1.0.1
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: friendly_id
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '5.
|
131
|
+
version: '5.3'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '5.
|
138
|
+
version: '5.3'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: gravtastic
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '1.
|
159
|
+
version: '1.48'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '1.
|
166
|
+
version: '1.48'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: google-cloud-storage
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +198,14 @@ dependencies:
|
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version: 1.
|
201
|
+
version: 1.2.0
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version: 1.
|
208
|
+
version: 1.2.0
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: sqlite3
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -213,9 +213,6 @@ dependencies:
|
|
213
213
|
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '1.4'
|
216
|
-
- - ">="
|
217
|
-
- !ruby/object:Gem::Version
|
218
|
-
version: 1.4.1
|
219
216
|
type: :development
|
220
217
|
prerelease: false
|
221
218
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -223,9 +220,6 @@ dependencies:
|
|
223
220
|
- - "~>"
|
224
221
|
- !ruby/object:Gem::Version
|
225
222
|
version: '1.4'
|
226
|
-
- - ">="
|
227
|
-
- !ruby/object:Gem::Version
|
228
|
-
version: 1.4.1
|
229
223
|
description: Ruby on Rails 6 Tutorial engine to manage and post tutorials.
|
230
224
|
email:
|
231
225
|
- developers@phcdevworks.com
|
@@ -241,28 +235,35 @@ files:
|
|
241
235
|
- app/assets/javascripts/phcdevworks_tutorials/blog/tutorials.coffee
|
242
236
|
- app/assets/javascripts/phcdevworks_tutorials/tutorial/categories.coffee
|
243
237
|
- app/assets/javascripts/phcdevworks_tutorials/tutorial/posts.coffee
|
238
|
+
- app/assets/javascripts/phcdevworks_tutorials/tutorial/steps.coffee
|
244
239
|
- app/assets/stylesheets/phcdevworks_tutorials/application.scss
|
245
240
|
- app/assets/stylesheets/phcdevworks_tutorials/blog/tutorials.scss
|
246
241
|
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/categories.scss
|
247
242
|
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/posts.scss
|
243
|
+
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/steps.scss
|
244
|
+
- app/assets/stylesheets/scaffolds.scss
|
248
245
|
- app/controllers/phcdevworks_tutorials/application_controller.rb
|
249
246
|
- app/controllers/phcdevworks_tutorials/blog/tutorials_controller.rb
|
250
247
|
- app/controllers/phcdevworks_tutorials/tutorial/categories_controller.rb
|
251
248
|
- app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb
|
249
|
+
- app/controllers/phcdevworks_tutorials/tutorial/steps_controller.rb
|
252
250
|
- app/helpers/phcdevworks_tutorials/application_helper.rb
|
253
251
|
- app/helpers/phcdevworks_tutorials/blog/tutorials_helper.rb
|
254
252
|
- app/helpers/phcdevworks_tutorials/tutorial/categories_helper.rb
|
255
253
|
- app/helpers/phcdevworks_tutorials/tutorial/posts_helper.rb
|
254
|
+
- app/helpers/phcdevworks_tutorials/tutorial/steps_helper.rb
|
256
255
|
- app/jobs/phcdevworks_tutorials/application_job.rb
|
257
256
|
- app/mailers/phcdevworks_tutorials/application_mailer.rb
|
258
257
|
- app/models/phcdevworks_tutorials/application_record.rb
|
259
258
|
- app/models/phcdevworks_tutorials/tutorial.rb
|
260
259
|
- app/models/phcdevworks_tutorials/tutorial/category.rb
|
261
260
|
- app/models/phcdevworks_tutorials/tutorial/post.rb
|
261
|
+
- app/models/phcdevworks_tutorials/tutorial/step.rb
|
262
262
|
- app/views/layouts/phcdevworks_tutorials/application.html.erb
|
263
263
|
- app/views/layouts/phcdevworks_tutorials/components/backend/footer/_footer.html.erb
|
264
264
|
- app/views/layouts/phcdevworks_tutorials/components/backend/navigation/_top_menu.html.erb
|
265
265
|
- app/views/layouts/phcdevworks_tutorials/components/backend/sidebars/_side_menu.html.erb
|
266
|
+
- app/views/layouts/phcdevworks_tutorials/frontend.html.erb
|
266
267
|
- app/views/phcdevworks_tutorials/blog/tutorials/index.html.erb
|
267
268
|
- app/views/phcdevworks_tutorials/blog/tutorials/show.html.erb
|
268
269
|
- app/views/phcdevworks_tutorials/tutorial/categories/_form.html.erb
|
@@ -275,10 +276,19 @@ files:
|
|
275
276
|
- app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb
|
276
277
|
- app/views/phcdevworks_tutorials/tutorial/posts/new.html.erb
|
277
278
|
- app/views/phcdevworks_tutorials/tutorial/posts/show.html.erb
|
279
|
+
- app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb
|
280
|
+
- app/views/phcdevworks_tutorials/tutorial/steps/edit.html.erb
|
281
|
+
- app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb
|
282
|
+
- app/views/phcdevworks_tutorials/tutorial/steps/new.html.erb
|
283
|
+
- app/views/phcdevworks_tutorials/tutorial/steps/show.html.erb
|
278
284
|
- config/initializers/friendly_id.rb
|
279
285
|
- config/routes.rb
|
280
286
|
- db/migrate/20190911225813_create_phcdevworks_tutorials_tutorial_posts.rb
|
281
287
|
- db/migrate/20190911225925_create_phcdevworks_tutorials_tutorial_categories.rb
|
288
|
+
- db/migrate/20190923113101_create_phcdevworks_tutorials_tutorial_steps.rb
|
289
|
+
- db/migrate/20190929044403_add_info_to_phcdevworks_tutorials_tutorial_posts.rb
|
290
|
+
- db/migrate/20190929044505_add_info_to_phcdevworks_tutorials_tutorial_steps.rb
|
291
|
+
- db/migrate/20191002093451_add_image_to_phcdevworks_tutorials_tutorial_posts.rb
|
282
292
|
- lib/phcdevworks_tutorials.rb
|
283
293
|
- lib/phcdevworks_tutorials/engine.rb
|
284
294
|
- lib/phcdevworks_tutorials/version.rb
|