phcdevworks_tutorials 1.1.0 → 1.1.1
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 +5 -5
- data/app/models/phcdevworks_tutorials/tutorial/post.rb +3 -0
- data/app/models/phcdevworks_tutorials/tutorial/step.rb +3 -0
- data/app/views/phcdevworks_tutorials/tutorial/posts/_form.html.erb +20 -0
- data/app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb +14 -4
- data/app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb +3 -3
- data/lib/phcdevworks_tutorials/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b324808e0004e12334cf196183959b04361b66044b92f5f0ea2a3b8b652073d
|
4
|
+
data.tar.gz: 8645eefd185aec204f02dd518a8a609952748d72841a51f906739b10939278cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c5f2b33ab00ac78a83401986a1e79e77dec89af3b5def70046e48a11a8f2597a34c852459e01e8e5e879c4e26f455b76b0a59171eda5003923a409fd9fdaabc
|
7
|
+
data.tar.gz: 0e4d7326c1dec8efc96c70b279e2500246cdbcdf5b4345b011d17294d58ae393d1417c5afc075de75b76d8d3c9ced7cb8c22ad61b35317e6b9404b9f47189112
|
@@ -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, :slug, :user_id, :org_id)
|
78
|
+
params.require(:tutorial_post).permit(:tutorial_post_step, :tutorial_post_title, :tutorial_post_text,:tutorial_post_description, :tutorial_post_status, :tutorial_post_images, :category_id, :slug, :user_id, :org_id)
|
79
79
|
end
|
80
80
|
|
81
81
|
end
|
@@ -39,7 +39,7 @@ module PhcdevworksTutorials
|
|
39
39
|
@tutorial_step.org_id = current_user.org_id
|
40
40
|
respond_to do |format|
|
41
41
|
if @tutorial_step.save
|
42
|
-
format.html { redirect_to tutorial_post_steps_path,
|
42
|
+
format.html { redirect_to tutorial_post_steps_path, :flash => { :success => 'Tutorial Step has been Added' }}
|
43
43
|
format.json { render :show, status: :created, location: @tutorial_step }
|
44
44
|
else
|
45
45
|
format.html { render :new }
|
@@ -54,7 +54,7 @@ module PhcdevworksTutorials
|
|
54
54
|
@tutorial_post = Tutorial::Post.friendly.find(params[:post_id])
|
55
55
|
respond_to do |format|
|
56
56
|
if @tutorial_step.update(tutorial_step_params)
|
57
|
-
format.html { redirect_to
|
57
|
+
format.html { redirect_to tutorial_post_steps_path, :flash => { :notice => 'Tutorial Step has been Updated.' }}
|
58
58
|
format.json { render :show, status: :ok, location: @tutorial_step }
|
59
59
|
else
|
60
60
|
format.html { render :edit }
|
@@ -69,7 +69,7 @@ module PhcdevworksTutorials
|
|
69
69
|
@tutorial_step = tutorial_post.steps.find(params[:id])
|
70
70
|
@tutorial_step.destroy
|
71
71
|
respond_to do |format|
|
72
|
-
format.html { redirect_to
|
72
|
+
format.html { redirect_to tutorial_post_steps_path, :flash => { :error => 'Tutorial Step has been Removed' }}
|
73
73
|
format.json { head :no_content }
|
74
74
|
end
|
75
75
|
end
|
@@ -79,7 +79,7 @@ module PhcdevworksTutorials
|
|
79
79
|
# Common Callbacks
|
80
80
|
|
81
81
|
def set_tutorial_step
|
82
|
-
@tutorial_step = Tutorial::Step.
|
82
|
+
@tutorial_step = Tutorial::Step.find(params[:id])
|
83
83
|
end
|
84
84
|
|
85
85
|
def tutorial_post
|
@@ -88,7 +88,7 @@ module PhcdevworksTutorials
|
|
88
88
|
|
89
89
|
# Whitelist
|
90
90
|
def tutorial_step_params
|
91
|
-
params.require(:tutorial_step).permit(:steps_number, :steps_body, :post_id, :slug, :user_id, :org_id)
|
91
|
+
params.require(:tutorial_step).permit(:steps_number, :steps_body, :tutorial_step_images, :post_id, :slug, :user_id, :org_id)
|
92
92
|
end
|
93
93
|
|
94
94
|
end
|
@@ -4,6 +4,9 @@ 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'
|
9
12
|
has_many :steps, class_name: "PhcdevworksTutorials::Tutorial::Step"
|
@@ -10,6 +10,26 @@
|
|
10
10
|
<%= form.text_field :tutorial_post_title, placeholder: "Tutorial Title", class: "form-control" %>
|
11
11
|
</div>
|
12
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
|
+
|
23
|
+
<div class="form-group field_with_errors">
|
24
|
+
<%= form.label :remove_tutorial_post_images, "Step Image" %>
|
25
|
+
<%= form.file_field :remove_tutorial_post_images, class: "form-control" %>
|
26
|
+
<% if form.object.tutorial_post_images? %>
|
27
|
+
<%= image_tag form.object.tutorial_post_images_url, class: "img-responsive img-thumbnail" %>
|
28
|
+
<%= form.label :remove_tutorial_post_images %>
|
29
|
+
<%= form.check_box :remove_tutorial_post_images %>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
|
13
33
|
<div class="form-group field_with_errors">
|
14
34
|
<label>Select a Category</label>
|
15
35
|
<%= form.collection_select :category_id, PhcdevworksTutorials::Tutorial::Category.order(:tutorial_category_name),:id, :tutorial_category_name, {}, {class: "form-control"} %>
|
@@ -10,12 +10,22 @@
|
|
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="
|
14
|
-
<%= form.label :tutorial_step_body %>
|
15
|
-
<%= form.text_area :tutorial_step_body %>
|
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
|
+
<%= form.label :remove_tutorial_step_images, "Step Image" %>
|
20
|
+
<%= form.file_field :remove_tutorial_step_images, class: "form-control" %>
|
21
|
+
<% if form.object.tutorial_step_images? %>
|
22
|
+
<%= image_tag form.object.tutorial_step_images_url, class: "img-responsive img-thumbnail" %>
|
23
|
+
<%= form.label :remove_tutorial_step_images %>
|
24
|
+
<%= form.check_box :remove_tutorial_step_images %>
|
25
|
+
<% end %>
|
16
26
|
</div>
|
17
27
|
<!-- Form Input Fields -->
|
18
|
-
|
28
|
+
|
19
29
|
<!-- Form Submition Button -->
|
20
30
|
<div class="actions">
|
21
31
|
<%= form.submit class: "btn btn-primary" %>
|
@@ -47,9 +47,9 @@
|
|
47
47
|
<tr>
|
48
48
|
<td><%= tutorial_step.tutorial_step_number %></td>
|
49
49
|
<td><%= tutorial_step.tutorial_step_body %></td>
|
50
|
-
<td><%= link_to 'Show', tutorial_step %></td>
|
51
|
-
<td><%= link_to 'Edit',
|
52
|
-
<td><%= link_to 'Destroy', tutorial_step, method: :delete, data: { confirm: 'Are you sure?' } %></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
53
|
</tr>
|
54
54
|
<% end %>
|
55
55
|
</tbody>
|
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.1.
|
4
|
+
version: 1.1.1
|
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-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|