phcdevworks_tutorials 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb +1 -1
- data/app/controllers/phcdevworks_tutorials/tutorial/steps_controller.rb +1 -1
- data/app/models/phcdevworks_tutorials/tutorial/category.rb +1 -1
- data/app/models/phcdevworks_tutorials/tutorial/post.rb +6 -2
- data/app/models/phcdevworks_tutorials/tutorial/step.rb +2 -0
- data/app/views/phcdevworks_tutorials/tutorial/posts/_form.html.erb +6 -1
- data/app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb +4 -2
- data/app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb +15 -0
- data/app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb +52 -42
- data/app/views/phcdevworks_tutorials/tutorial/steps/show.html.erb +0 -14
- data/db/migrate/20190911225813_create_phcdevworks_tutorials_tutorial_posts.rb +5 -2
- data/db/migrate/20190923113101_create_phcdevworks_tutorials_tutorial_steps.rb +5 -1
- data/db/migrate/20191003235303_create_join_table_categories_posts.rb +10 -0
- data/lib/phcdevworks_tutorials/version.rb +1 -1
- metadata +3 -5
- data/db/migrate/20190929044403_add_info_to_phcdevworks_tutorials_tutorial_posts.rb +0 -9
- data/db/migrate/20190929044505_add_info_to_phcdevworks_tutorials_tutorial_steps.rb +0 -7
- data/db/migrate/20191002093451_add_image_to_phcdevworks_tutorials_tutorial_posts.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f64d687dc306c83c9812e27c23535b8ad1f6034509d490d94c81a6c243c57d
|
4
|
+
data.tar.gz: e240ea72bb6abbd8d330d49d79fa5847baab7b9da7077e3cd51bbb4f820698c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7e6e240e87ffd74be029311cf49a0d1bb474c99742d3b220ebb2c498fcb6e5f8ffaedef5537ada2d09d2f1981f5a1310014dc7a6bb9595a1335f3c3baf5526c
|
7
|
+
data.tar.gz: 989b0d77e5f5a2beb04c0fb4f3aa45ea1208ec163ed01d21a14b13fd66e38bd3e701f4ad2984ff059aedb6728d24228bd97dbfab6b1be0f99f30ff50ed5f7e89
|
@@ -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,:tutorial_post_description, :tutorial_post_status, :tutorial_post_image, :
|
78
|
+
params.require(:tutorial_post).permit(:tutorial_post_step, :tutorial_post_title, :tutorial_post_text,:tutorial_post_description, :tutorial_post_status, :tutorial_post_image, :slug, :user_id, :org_id, category_ids: [])
|
79
79
|
end
|
80
80
|
|
81
81
|
end
|
@@ -88,7 +88,7 @@ module PhcdevworksTutorials
|
|
88
88
|
|
89
89
|
# Whitelist
|
90
90
|
def tutorial_step_params
|
91
|
-
params.require(:tutorial_step).permit(:
|
91
|
+
params.require(:tutorial_step).permit(:tutorial_step_number, :tutorial_step_body, :tutorial_step_image, :post_id, :slug, :user_id, :org_id)
|
92
92
|
end
|
93
93
|
|
94
94
|
end
|
@@ -5,7 +5,7 @@ module PhcdevworksTutorials
|
|
5
5
|
extend FriendlyId
|
6
6
|
|
7
7
|
#Relationships
|
8
|
-
|
8
|
+
has_and_belongs_to_many :posts, class_name: 'Tutorial::Post', :join_table => 'categories_posts', :dependent => :destroy
|
9
9
|
|
10
10
|
# Form Fields Validation
|
11
11
|
validates :tutorial_category_name,
|
@@ -8,13 +8,17 @@ module PhcdevworksTutorials
|
|
8
8
|
has_one_attached :tutorial_post_image
|
9
9
|
|
10
10
|
# Relationships
|
11
|
-
|
12
|
-
has_many :steps, class_name: "
|
11
|
+
has_and_belongs_to_many :categories, class_name: "Tutorial::Category", :join_table => "categories_posts", :dependent => :destroy
|
12
|
+
has_many :steps, class_name: "Tutorial::Step"
|
13
|
+
belongs_to :user, class_name: "PhcdevworksAccounts::User"
|
13
14
|
|
14
15
|
# Form Fields Validation
|
15
16
|
validates :tutorial_post_title,
|
16
17
|
presence: true
|
17
18
|
|
19
|
+
validates :tutorial_post_description,
|
20
|
+
presence: true
|
21
|
+
|
18
22
|
# Clean URL Define
|
19
23
|
friendly_id :phcdev_tutorials_post_nice_urls, use: [:slugged, :finders]
|
20
24
|
|
@@ -6,6 +6,8 @@ module PhcdevworksTutorials
|
|
6
6
|
|
7
7
|
# Relationships
|
8
8
|
belongs_to :post, class_name: "PhcdevworksTutorials::Tutorial::Post"
|
9
|
+
has_many :categories, class_name: "Tutorial::Category", :through => :post
|
10
|
+
belongs_to :user, class_name: "PhcdevworksAccounts::User"
|
9
11
|
|
10
12
|
end
|
11
13
|
end
|
@@ -32,7 +32,12 @@
|
|
32
32
|
|
33
33
|
<div class="form-group field_with_errors">
|
34
34
|
<label>Select a Category</label>
|
35
|
-
|
35
|
+
<div class="panel-body">
|
36
|
+
<%= form.collection_check_boxes :category_ids, PhcdevworksTutorials::Tutorial::Category.order(:tutorial_category_name), :id, :tutorial_category_name do |post_category| %>
|
37
|
+
<%= post_category.check_box %>
|
38
|
+
<%= post_category.label %><br>
|
39
|
+
<% end %>
|
40
|
+
</div>
|
36
41
|
</div>
|
37
42
|
<!-- Form Input Fields -->
|
38
43
|
|
@@ -37,7 +37,8 @@
|
|
37
37
|
<thead>
|
38
38
|
<tr>
|
39
39
|
<th>Tutorial Title</th>
|
40
|
-
<th>Tutorial
|
40
|
+
<th>Tutorial Description</th>
|
41
|
+
<th>Tutorial Status</th>
|
41
42
|
<th></th>
|
42
43
|
</tr>
|
43
44
|
</thead>
|
@@ -46,7 +47,8 @@
|
|
46
47
|
<% @tutorial_posts.each do |tutorial_post| %>
|
47
48
|
<tr>
|
48
49
|
<td><%= tutorial_post.tutorial_post_title %></td>
|
49
|
-
<td><%= tutorial_post.
|
50
|
+
<td><%= tutorial_post.tutorial_post_description %></td>
|
51
|
+
<td><%= tutorial_post.tutorial_post_status %></td>
|
50
52
|
<td>
|
51
53
|
<div class="btn-group d-flex" role="group">
|
52
54
|
<%= link_to "Details", tutorial_post, class: "btn btn-purple btn-xs" %>
|
@@ -10,11 +10,26 @@
|
|
10
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
11
|
</div>
|
12
12
|
|
13
|
+
<div class="form-group field_with_errors">
|
14
|
+
<%= form.label :tutorial_step_title, "Step Title" %>
|
15
|
+
<%= form.text_area :tutorial_step_title, class: "form-control", rows: "10" %>
|
16
|
+
</div>
|
17
|
+
|
13
18
|
<div class="form-group field_with_errors">
|
14
19
|
<%= form.label :tutorial_step_body, "Step Text" %>
|
15
20
|
<%= form.text_area :tutorial_step_body, class: "form-control", rows: "10" %>
|
16
21
|
</div>
|
17
22
|
|
23
|
+
<div class="form-group field_with_errors">
|
24
|
+
<div class="form-group field_with_errors">
|
25
|
+
<%= form.label :tutorial_step_image, "Step Image" %>
|
26
|
+
<%= form.file_field :tutorial_step_image, class: "form-control" %>
|
27
|
+
</div>
|
28
|
+
<% if form.object.tutorial_step_image.attached? %>
|
29
|
+
<%= image_tag main_app.url_for(form.object.tutorial_step_image), class: "img-responsive img-thumbnail" %>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
|
18
33
|
<div class="form-group field_with_errors">
|
19
34
|
<div class="form-group field_with_errors">
|
20
35
|
<%= form.label :tutorial_step_image, "Step Image" %>
|
@@ -7,8 +7,8 @@
|
|
7
7
|
|
8
8
|
<!-- Page Bradcrumbs -->
|
9
9
|
<ol class="breadcrumb pull-right">
|
10
|
-
|
11
|
-
|
10
|
+
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
+
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
12
|
</ol>
|
13
13
|
<!-- Page Bradcrumbs -->
|
14
14
|
|
@@ -18,50 +18,60 @@
|
|
18
18
|
|
19
19
|
<!-- Page & Panel Content -->
|
20
20
|
<div class="panel panel-inverse">
|
21
|
-
|
22
|
-
|
23
|
-
<div class="panel-heading
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
|
22
|
+
<!-- Panel Heading -->
|
23
|
+
<div class="panel-heading">
|
24
|
+
<div class="panel-heading-btn">
|
25
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
|
26
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-redo"></i></a>
|
27
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
|
28
|
+
</div>
|
29
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
27
30
|
</div>
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
<!-- Panel Heading -->
|
32
|
+
|
33
|
+
<!-- Panel Body -->
|
34
|
+
<div class="panel-body">
|
35
|
+
|
36
|
+
<!-- Table - Snippet Index -->
|
37
|
+
<div class="table-responsive">
|
38
|
+
<table class="table table-striped table-bordered">
|
36
39
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
<thead>
|
41
|
+
<tr>
|
42
|
+
<th>Tutorial Step Number</th>
|
43
|
+
<th>Tutorial Step Title</th>
|
44
|
+
<th></th>
|
45
|
+
</tr>
|
46
|
+
</thead>
|
44
47
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
48
|
+
<tbody>
|
49
|
+
<% @tutorial_steps.each do |tutorial_step| %>
|
50
|
+
<tr>
|
51
|
+
<td><%= tutorial_step.tutorial_step_number %></td>
|
52
|
+
<td><%= tutorial_step.tutorial_step_title %></td>
|
53
|
+
<td>
|
54
|
+
<div class="btn-group d-flex" role="group">
|
55
|
+
<%= link_to 'Show', tutorial_post_step_path(tutorial_step.post, tutorial_step), class: "btn btn-purple btn-xs" %>
|
56
|
+
<%= link_to 'Update', edit_tutorial_post_step_path(tutorial_step.post, tutorial_step), class: "btn btn-primary btn-xs" %>
|
57
|
+
<%= link_to "Update", edit_tutorial_post_path(tutorial_post) %>
|
58
|
+
<%= link_to 'Destroy', tutorial_post_step_path(tutorial_step.post, tutorial_step), method: :delete, data: { confirm: 'Are you sure? This Action Cannot be Reversed.' }, class: "btn btn-danger btn-xs" %>
|
59
|
+
</div>
|
60
|
+
</td>
|
61
|
+
</tr>
|
62
|
+
<% end %>
|
63
|
+
</tbody>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
<%= link_to phcdevworks_tutorials.new_tutorial_post_step_path, class: "btn btn-primary btn-sm" do %>
|
67
|
+
<i class="fas fa-plus-circle"></i>
|
68
|
+
Add a New Step for Tutorial
|
69
|
+
<% end %>
|
70
|
+
</div>
|
71
|
+
<!-- Table - Snippet Index -->
|
56
72
|
|
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
73
|
</div>
|
63
|
-
<!--
|
64
|
-
|
65
|
-
<!-- Panel Body -->
|
74
|
+
<!-- Panel Body -->
|
75
|
+
|
66
76
|
</div>
|
67
77
|
<!-- Page & Panel Content -->
|
@@ -1,14 +0,0 @@
|
|
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 %>
|
@@ -3,8 +3,11 @@ class CreatePhcdevworksTutorialsTutorialPosts < ActiveRecord::Migration[6.0]
|
|
3
3
|
create_table :phcdevworks_tutorials_tutorial_posts do |t|
|
4
4
|
|
5
5
|
t.string :tutorial_post_title
|
6
|
-
|
7
|
-
t.
|
6
|
+
t.text :tutorial_post_description
|
7
|
+
t.string :tutorial_post_status
|
8
|
+
|
9
|
+
t.string :tutorial_post_image
|
10
|
+
t.string :tutorial_post_images
|
8
11
|
|
9
12
|
t.string :slug
|
10
13
|
t.string :user_id
|
@@ -3,7 +3,11 @@ class CreatePhcdevworksTutorialsTutorialSteps < ActiveRecord::Migration[6.0]
|
|
3
3
|
create_table :phcdevworks_tutorials_tutorial_steps do |t|
|
4
4
|
|
5
5
|
t.integer :tutorial_step_number
|
6
|
-
t.
|
6
|
+
t.string :tutorial_step_title
|
7
|
+
t.text :tutorial_step_description
|
8
|
+
|
9
|
+
t.string :tutorial_step_image
|
10
|
+
t.string :tutorial_step_images
|
7
11
|
|
8
12
|
t.string :slug
|
9
13
|
t.string :user_id
|
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:
|
4
|
+
version: 2.0.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-10-
|
11
|
+
date: 2019-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -286,9 +286,7 @@ files:
|
|
286
286
|
- db/migrate/20190911225813_create_phcdevworks_tutorials_tutorial_posts.rb
|
287
287
|
- db/migrate/20190911225925_create_phcdevworks_tutorials_tutorial_categories.rb
|
288
288
|
- db/migrate/20190923113101_create_phcdevworks_tutorials_tutorial_steps.rb
|
289
|
-
- db/migrate/
|
290
|
-
- db/migrate/20190929044505_add_info_to_phcdevworks_tutorials_tutorial_steps.rb
|
291
|
-
- db/migrate/20191002093451_add_image_to_phcdevworks_tutorials_tutorial_posts.rb
|
289
|
+
- db/migrate/20191003235303_create_join_table_categories_posts.rb
|
292
290
|
- lib/phcdevworks_tutorials.rb
|
293
291
|
- lib/phcdevworks_tutorials/engine.rb
|
294
292
|
- lib/phcdevworks_tutorials/version.rb
|
@@ -1,9 +0,0 @@
|
|
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
|
@@ -1,8 +0,0 @@
|
|
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
|