phcdevworks_tutorials 0.2.0 → 1.0.2
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 +5 -2
- data/app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb +5 -2
- 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/category.rb +19 -0
- data/app/models/phcdevworks_tutorials/tutorial/post.rb +19 -1
- data/app/models/phcdevworks_tutorials/tutorial/step.rb +8 -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 +4 -11
- 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 +25 -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/initializers/friendly_id.rb +107 -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/lib/phcdevworks_tutorials/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a45e1901641ed89f76059cfe021ce3f8b02b585bf7956aaa424ad3e0e31e3fd
|
4
|
+
data.tar.gz: 3e9929250fcb7c624194d78673f720c1b8dd50f1fcd6ba9f57e1e6187b450a11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d069541f5e14f712aa693d7a33d06b45fab873f2a0c57a3a2ded462ff8eb6e6ffe4e1d302c465da1b7b4f8a6d279bc82ef9244a9b07a675b0a2d63f0bdc93ff
|
7
|
+
data.tar.gz: 62778941f02f41342af967d6eaf46f8045848c693be3ad442ab74af5ca2eaf57430f4a3f4c2d2654f7087b8f83568709053e1bb3ebfcf9769bfeeed61ad31beb
|
@@ -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(org_id: current_user.org_id)
|
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
|
@@ -16,6 +16,7 @@ module PhcdevworksTutorials
|
|
16
16
|
|
17
17
|
# GET /tutorial/categories/1
|
18
18
|
def show
|
19
|
+
@tutorial_category = Tutorial::Category.friendly.find(params[:id])
|
19
20
|
end
|
20
21
|
|
21
22
|
# GET /tutorial/categories/new
|
@@ -30,6 +31,8 @@ module PhcdevworksTutorials
|
|
30
31
|
# POST /tutorial/categories
|
31
32
|
def create
|
32
33
|
@tutorial_category = Tutorial::Category.new(tutorial_category_params)
|
34
|
+
@tutorial_category.user_id = current_user.id
|
35
|
+
@tutorial_category.org_id = current_user.org_id
|
33
36
|
respond_to do |format|
|
34
37
|
if @tutorial_category.save
|
35
38
|
format.html { redirect_to tutorial_categories_path, :flash => { :success => 'Tutorial has been Added.' }}
|
@@ -67,12 +70,12 @@ module PhcdevworksTutorials
|
|
67
70
|
|
68
71
|
# Common Callbacks
|
69
72
|
def set_tutorial_category
|
70
|
-
@tutorial_category = Tutorial::Category.find(params[:id])
|
73
|
+
@tutorial_category = Tutorial::Category.friendly.find(params[:id])
|
71
74
|
end
|
72
75
|
|
73
76
|
# Whitelist
|
74
77
|
def tutorial_category_params
|
75
|
-
params.require(:tutorial_category).permit(:tutorial_category_name)
|
78
|
+
params.require(:tutorial_category).permit(:tutorial_category_name, :slug, :user_id, :org_id)
|
76
79
|
end
|
77
80
|
|
78
81
|
end
|
@@ -16,6 +16,7 @@ module PhcdevworksTutorials
|
|
16
16
|
|
17
17
|
# GET /tutorial/posts/1
|
18
18
|
def show
|
19
|
+
@tutorial_post = Tutorial::Post.friendly.find(params[:id])
|
19
20
|
end
|
20
21
|
|
21
22
|
# GET /tutorial/posts/new
|
@@ -30,6 +31,8 @@ module PhcdevworksTutorials
|
|
30
31
|
# POST /tutorial/posts
|
31
32
|
def create
|
32
33
|
@tutorial_post = Tutorial::Post.new(tutorial_post_params)
|
34
|
+
@tutorial_post.user_id = current_user.id
|
35
|
+
@tutorial_post.org_id = current_user.org_id
|
33
36
|
respond_to do |format|
|
34
37
|
if @tutorial_post.save
|
35
38
|
format.html { redirect_to tutorial_posts_path, :flash => { :success => 'Tutorial has been Added.' }}
|
@@ -67,12 +70,12 @@ module PhcdevworksTutorials
|
|
67
70
|
|
68
71
|
# Common Callbacks
|
69
72
|
def set_tutorial_post
|
70
|
-
@tutorial_post = Tutorial::Post.find(params[:id])
|
73
|
+
@tutorial_post = Tutorial::Post.friendly.find(params[:id])
|
71
74
|
end
|
72
75
|
|
73
76
|
# Whitelist
|
74
77
|
def tutorial_post_params
|
75
|
-
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, :category_id, :slug, :user_id, :org_id)
|
76
79
|
end
|
77
80
|
|
78
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, notice: 'Step was successfully created.' }
|
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_step, notice: 'Step was successfully 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_steps_url, notice: 'Step was successfully destroyed.' }
|
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.friendly.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, :post_id, :slug, :user_id, :org_id)
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
@@ -1,4 +1,23 @@
|
|
1
1
|
module PhcdevworksTutorials
|
2
2
|
class Tutorial::Category < ApplicationRecord
|
3
|
+
|
4
|
+
# Clean URL Initialize
|
5
|
+
extend FriendlyId
|
6
|
+
|
7
|
+
#Relationships
|
8
|
+
has_many :posts, class_name: 'PhcdevworksTutorials::Tutorial::Post'
|
9
|
+
|
10
|
+
# Form Fields Validation
|
11
|
+
validates :tutorial_category_name,
|
12
|
+
presence: true,
|
13
|
+
uniqueness: true
|
14
|
+
|
15
|
+
# Clean URL Define
|
16
|
+
friendly_id :phcdev_tutorials_category_nice_urls, use: [:slugged, :finders]
|
17
|
+
|
18
|
+
def phcdev_tutorials_category_nice_urls
|
19
|
+
[:tutorial_category_name]
|
20
|
+
end
|
21
|
+
|
3
22
|
end
|
4
23
|
end
|
@@ -1,5 +1,23 @@
|
|
1
1
|
module PhcdevworksTutorials
|
2
2
|
class Tutorial::Post < ApplicationRecord
|
3
|
-
|
3
|
+
|
4
|
+
# Clean URL Initialize
|
5
|
+
extend FriendlyId
|
6
|
+
|
7
|
+
# Relationships
|
8
|
+
belongs_to :category, class_name: 'PhcdevworksTutorials::Tutorial::Category'
|
9
|
+
has_many :steps, class_name: "PhcdevworksTutorials::Tutorial::Step"
|
10
|
+
|
11
|
+
# Form Fields Validation
|
12
|
+
validates :tutorial_post_title,
|
13
|
+
presence: true
|
14
|
+
|
15
|
+
# Clean URL Define
|
16
|
+
friendly_id :phcdev_tutorials_post_nice_urls, use: [:slugged, :finders]
|
17
|
+
|
18
|
+
def phcdev_tutorials_post_nice_urls
|
19
|
+
[:tutorial_post_title]
|
20
|
+
end
|
21
|
+
|
4
22
|
end
|
5
23
|
end
|
@@ -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,21 +1,14 @@
|
|
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
|
-
<!-- Form Input Fields -->
|
15
|
-
<div class="form-group field_with_errors">
|
16
|
-
<%= form.label :tutorial_post_text, "Tutorial Text" %>
|
17
|
-
<%= form.text_area :tutorial_post_text, placeholder: "Tutorial Text", class: "form-control" %>
|
18
|
-
</div>
|
19
12
|
|
20
13
|
<div class="form-group field_with_errors">
|
21
14
|
<label>Select a Category</label>
|
@@ -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,25 @@
|
|
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="field">
|
14
|
+
<%= form.label :tutorial_step_body %>
|
15
|
+
<%= form.text_area :tutorial_step_body %>
|
16
|
+
</div>
|
17
|
+
<!-- Form Input Fields -->
|
18
|
+
|
19
|
+
<!-- Form Submition Button -->
|
20
|
+
<div class="actions">
|
21
|
+
<%= form.submit class: "btn btn-primary" %>
|
22
|
+
</div>
|
23
|
+
<!-- For Submition Button -->
|
24
|
+
|
25
|
+
<% 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_step %></td>
|
51
|
+
<td><%= link_to 'Edit', edit_tutorial_step_path(tutorial_step) %></td>
|
52
|
+
<td><%= link_to 'Destroy', 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 %>
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# FriendlyId Global Configuration
|
2
|
+
#
|
3
|
+
# Use this to set up shared configuration options for your entire application.
|
4
|
+
# Any of the configuration options shown here can also be applied to single
|
5
|
+
# models by passing arguments to the `friendly_id` class method or defining
|
6
|
+
# methods in your model.
|
7
|
+
#
|
8
|
+
# To learn more, check out the guide:
|
9
|
+
#
|
10
|
+
# http://norman.github.io/friendly_id/file.Guide.html
|
11
|
+
|
12
|
+
FriendlyId.defaults do |config|
|
13
|
+
# ## Reserved Words
|
14
|
+
#
|
15
|
+
# Some words could conflict with Rails's routes when used as slugs, or are
|
16
|
+
# undesirable to allow as slugs. Edit this list as needed for your app.
|
17
|
+
config.use :reserved
|
18
|
+
|
19
|
+
config.reserved_words = %w(new edit index session login logout users admin
|
20
|
+
stylesheets assets javascripts images)
|
21
|
+
|
22
|
+
# This adds an option to treat reserved words as conflicts rather than exceptions.
|
23
|
+
# When there is no good candidate, a UUID will be appended, matching the existing
|
24
|
+
# conflict behavior.
|
25
|
+
|
26
|
+
# config.treat_reserved_as_conflict = true
|
27
|
+
|
28
|
+
# ## Friendly Finders
|
29
|
+
#
|
30
|
+
# Uncomment this to use friendly finders in all models. By default, if
|
31
|
+
# you wish to find a record by its friendly id, you must do:
|
32
|
+
#
|
33
|
+
# MyModel.friendly.find('foo')
|
34
|
+
#
|
35
|
+
# If you uncomment this, you can do:
|
36
|
+
#
|
37
|
+
# MyModel.find('foo')
|
38
|
+
#
|
39
|
+
# This is significantly more convenient but may not be appropriate for
|
40
|
+
# all applications, so you must explicity opt-in to this behavior. You can
|
41
|
+
# always also configure it on a per-model basis if you prefer.
|
42
|
+
#
|
43
|
+
# Something else to consider is that using the :finders addon boosts
|
44
|
+
# performance because it will avoid Rails-internal code that makes runtime
|
45
|
+
# calls to `Module.extend`.
|
46
|
+
#
|
47
|
+
# config.use :finders
|
48
|
+
#
|
49
|
+
# ## Slugs
|
50
|
+
#
|
51
|
+
# Most applications will use the :slugged module everywhere. If you wish
|
52
|
+
# to do so, uncomment the following line.
|
53
|
+
#
|
54
|
+
# config.use :slugged
|
55
|
+
#
|
56
|
+
# By default, FriendlyId's :slugged addon expects the slug column to be named
|
57
|
+
# 'slug', but you can change it if you wish.
|
58
|
+
#
|
59
|
+
# config.slug_column = 'slug'
|
60
|
+
#
|
61
|
+
# By default, slug has no size limit, but you can change it if you wish.
|
62
|
+
#
|
63
|
+
# config.slug_limit = 255
|
64
|
+
#
|
65
|
+
# When FriendlyId can not generate a unique ID from your base method, it appends
|
66
|
+
# a UUID, separated by a single dash. You can configure the character used as the
|
67
|
+
# separator. If you're upgrading from FriendlyId 4, you may wish to replace this
|
68
|
+
# with two dashes.
|
69
|
+
#
|
70
|
+
# config.sequence_separator = '-'
|
71
|
+
#
|
72
|
+
# Note that you must use the :slugged addon **prior** to the line which
|
73
|
+
# configures the sequence separator, or else FriendlyId will raise an undefined
|
74
|
+
# method error.
|
75
|
+
#
|
76
|
+
# ## Tips and Tricks
|
77
|
+
#
|
78
|
+
# ### Controlling when slugs are generated
|
79
|
+
#
|
80
|
+
# As of FriendlyId 5.0, new slugs are generated only when the slug field is
|
81
|
+
# nil, but if you're using a column as your base method can change this
|
82
|
+
# behavior by overriding the `should_generate_new_friendly_id?` method that
|
83
|
+
# FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
|
84
|
+
# more like 4.0.
|
85
|
+
# Note: Use(include) Slugged module in the config if using the anonymous module.
|
86
|
+
# If you have `friendly_id :name, use: slugged` in the model, Slugged module
|
87
|
+
# is included after the anonymous module defined in the initializer, so it
|
88
|
+
# overrides the `should_generate_new_friendly_id?` method from the anonymous module.
|
89
|
+
#
|
90
|
+
# config.use :slugged
|
91
|
+
# config.use Module.new {
|
92
|
+
# def should_generate_new_friendly_id?
|
93
|
+
# slug.blank? || <your_column_name_here>_changed?
|
94
|
+
# end
|
95
|
+
# }
|
96
|
+
#
|
97
|
+
# FriendlyId uses Rails's `parameterize` method to generate slugs, but for
|
98
|
+
# languages that don't use the Roman alphabet, that's not usually sufficient.
|
99
|
+
# Here we use the Babosa library to transliterate Russian Cyrillic slugs to
|
100
|
+
# ASCII. If you use this, don't forget to add "babosa" to your Gemfile.
|
101
|
+
#
|
102
|
+
# config.use Module.new {
|
103
|
+
# def normalize_friendly_id(text)
|
104
|
+
# text.to_slug.normalize! :transliterations => [:russian, :latin]
|
105
|
+
# end
|
106
|
+
# }
|
107
|
+
end
|
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
|
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: 0.2
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PHCDevworks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -198,14 +198,14 @@ dependencies:
|
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version: 1.0
|
201
|
+
version: 1.1.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.0
|
208
|
+
version: 1.1.0
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: sqlite3
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,28 +241,35 @@ files:
|
|
241
241
|
- app/assets/javascripts/phcdevworks_tutorials/blog/tutorials.coffee
|
242
242
|
- app/assets/javascripts/phcdevworks_tutorials/tutorial/categories.coffee
|
243
243
|
- app/assets/javascripts/phcdevworks_tutorials/tutorial/posts.coffee
|
244
|
+
- app/assets/javascripts/phcdevworks_tutorials/tutorial/steps.coffee
|
244
245
|
- app/assets/stylesheets/phcdevworks_tutorials/application.scss
|
245
246
|
- app/assets/stylesheets/phcdevworks_tutorials/blog/tutorials.scss
|
246
247
|
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/categories.scss
|
247
248
|
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/posts.scss
|
249
|
+
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/steps.scss
|
250
|
+
- app/assets/stylesheets/scaffolds.scss
|
248
251
|
- app/controllers/phcdevworks_tutorials/application_controller.rb
|
249
252
|
- app/controllers/phcdevworks_tutorials/blog/tutorials_controller.rb
|
250
253
|
- app/controllers/phcdevworks_tutorials/tutorial/categories_controller.rb
|
251
254
|
- app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb
|
255
|
+
- app/controllers/phcdevworks_tutorials/tutorial/steps_controller.rb
|
252
256
|
- app/helpers/phcdevworks_tutorials/application_helper.rb
|
253
257
|
- app/helpers/phcdevworks_tutorials/blog/tutorials_helper.rb
|
254
258
|
- app/helpers/phcdevworks_tutorials/tutorial/categories_helper.rb
|
255
259
|
- app/helpers/phcdevworks_tutorials/tutorial/posts_helper.rb
|
260
|
+
- app/helpers/phcdevworks_tutorials/tutorial/steps_helper.rb
|
256
261
|
- app/jobs/phcdevworks_tutorials/application_job.rb
|
257
262
|
- app/mailers/phcdevworks_tutorials/application_mailer.rb
|
258
263
|
- app/models/phcdevworks_tutorials/application_record.rb
|
259
264
|
- app/models/phcdevworks_tutorials/tutorial.rb
|
260
265
|
- app/models/phcdevworks_tutorials/tutorial/category.rb
|
261
266
|
- app/models/phcdevworks_tutorials/tutorial/post.rb
|
267
|
+
- app/models/phcdevworks_tutorials/tutorial/step.rb
|
262
268
|
- app/views/layouts/phcdevworks_tutorials/application.html.erb
|
263
269
|
- app/views/layouts/phcdevworks_tutorials/components/backend/footer/_footer.html.erb
|
264
270
|
- app/views/layouts/phcdevworks_tutorials/components/backend/navigation/_top_menu.html.erb
|
265
271
|
- app/views/layouts/phcdevworks_tutorials/components/backend/sidebars/_side_menu.html.erb
|
272
|
+
- app/views/layouts/phcdevworks_tutorials/frontend.html.erb
|
266
273
|
- app/views/phcdevworks_tutorials/blog/tutorials/index.html.erb
|
267
274
|
- app/views/phcdevworks_tutorials/blog/tutorials/show.html.erb
|
268
275
|
- app/views/phcdevworks_tutorials/tutorial/categories/_form.html.erb
|
@@ -275,9 +282,16 @@ files:
|
|
275
282
|
- app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb
|
276
283
|
- app/views/phcdevworks_tutorials/tutorial/posts/new.html.erb
|
277
284
|
- app/views/phcdevworks_tutorials/tutorial/posts/show.html.erb
|
285
|
+
- app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb
|
286
|
+
- app/views/phcdevworks_tutorials/tutorial/steps/edit.html.erb
|
287
|
+
- app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb
|
288
|
+
- app/views/phcdevworks_tutorials/tutorial/steps/new.html.erb
|
289
|
+
- app/views/phcdevworks_tutorials/tutorial/steps/show.html.erb
|
290
|
+
- config/initializers/friendly_id.rb
|
278
291
|
- config/routes.rb
|
279
292
|
- db/migrate/20190911225813_create_phcdevworks_tutorials_tutorial_posts.rb
|
280
293
|
- db/migrate/20190911225925_create_phcdevworks_tutorials_tutorial_categories.rb
|
294
|
+
- db/migrate/20190923113101_create_phcdevworks_tutorials_tutorial_steps.rb
|
281
295
|
- lib/phcdevworks_tutorials.rb
|
282
296
|
- lib/phcdevworks_tutorials/engine.rb
|
283
297
|
- lib/phcdevworks_tutorials/version.rb
|