phcdevworks_tutorials 1.1.1 → 1.2.4
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 +7 -3
- data/app/models/phcdevworks_tutorials/tutorial/step.rb +3 -1
- data/app/views/phcdevworks_tutorials/tutorial/posts/_form.html.erb +13 -8
- data/app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb +4 -2
- data/app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb +7 -7
- data/db/migrate/20190911225813_create_phcdevworks_tutorials_tutorial_posts.rb +0 -2
- data/db/migrate/20191002093451_add_image_to_phcdevworks_tutorials_tutorial_posts.rb +8 -0
- data/db/migrate/20191003235303_create_join_table_categories_posts.rb +10 -0
- data/lib/phcdevworks_tutorials/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ff71cf7890e9431a3c6aeb70737f58e3949ce986a891ea908ec663a7dd9d0a8
|
4
|
+
data.tar.gz: d078f7ef2afdcb5ee40b42903b0b020083ff7b3bf6f2a0260cbc001d39ad87d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d56273632043b9429e4ec8c696e12942aaff4696b8d11c3cee50dc05e25d77b4dfe73e798018ca4b46b3e3a7afd6ac830247e94275c018b04b6dd47a0c90024b
|
7
|
+
data.tar.gz: 9004b26ba26941eb7363a5837d306b54c7fc451ce47f3d900222c52f59a39f2513a4628748f18a7b259f9a6320a08e324fb17e6fe2e74d8b890aa970c036e682
|
@@ -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, :
|
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,
|
@@ -5,16 +5,20 @@ module PhcdevworksTutorials
|
|
5
5
|
extend FriendlyId
|
6
6
|
|
7
7
|
# Image Upload
|
8
|
-
has_one_attached :
|
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
|
|
@@ -2,10 +2,12 @@ module PhcdevworksTutorials
|
|
2
2
|
class Tutorial::Step < ApplicationRecord
|
3
3
|
|
4
4
|
# Image Upload
|
5
|
-
has_one_attached :
|
5
|
+
has_one_attached :tutorial_step_image
|
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
|
@@ -21,18 +21,23 @@
|
|
21
21
|
</div>
|
22
22
|
|
23
23
|
<div class="form-group field_with_errors">
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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 %>
|
31
31
|
</div>
|
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" %>
|
@@ -16,13 +16,13 @@
|
|
16
16
|
</div>
|
17
17
|
|
18
18
|
<div class="form-group field_with_errors">
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
26
|
</div>
|
27
27
|
<!-- Form Input Fields -->
|
28
28
|
|
@@ -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.4
|
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-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -288,6 +288,8 @@ files:
|
|
288
288
|
- db/migrate/20190923113101_create_phcdevworks_tutorials_tutorial_steps.rb
|
289
289
|
- db/migrate/20190929044403_add_info_to_phcdevworks_tutorials_tutorial_posts.rb
|
290
290
|
- db/migrate/20190929044505_add_info_to_phcdevworks_tutorials_tutorial_steps.rb
|
291
|
+
- db/migrate/20191002093451_add_image_to_phcdevworks_tutorials_tutorial_posts.rb
|
292
|
+
- db/migrate/20191003235303_create_join_table_categories_posts.rb
|
291
293
|
- lib/phcdevworks_tutorials.rb
|
292
294
|
- lib/phcdevworks_tutorials/engine.rb
|
293
295
|
- lib/phcdevworks_tutorials/version.rb
|