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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08396c3e31fa52863cd02f3ee048a42ee5c5750e12fa1fbefe0fdcfd01fd886c'
4
- data.tar.gz: 417b0c4686adeafed8e66c503a0a50aa3fe608ea258a910056403126bcce7e7d
3
+ metadata.gz: 7b324808e0004e12334cf196183959b04361b66044b92f5f0ea2a3b8b652073d
4
+ data.tar.gz: 8645eefd185aec204f02dd518a8a609952748d72841a51f906739b10939278cc
5
5
  SHA512:
6
- metadata.gz: aa8cecbe28424e0700b533a43c629b4a2f34df37d409955d306a96a17039757eb9b2fc3dc887f0aaa5c3b03e6cc7ee9846b6e4a0a94594bff77fb9ce04ac8471
7
- data.tar.gz: e76c31a7754b25cbff079168a3fcee1b0cdf26105a5a316e136229bc256fe2603c30fc2b35ed3291b90fa1694a02f27013ac4bb48e79dff931b71a33acfa936c
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, notice: 'Step was successfully created.' }
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 @tutorial_step, notice: 'Step was successfully updated.' }
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 tutorial_steps_url, notice: 'Step was successfully destroyed.' }
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.friendly.find(params[:id])
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"
@@ -1,6 +1,9 @@
1
1
  module PhcdevworksTutorials
2
2
  class Tutorial::Step < ApplicationRecord
3
3
 
4
+ # Image Upload
5
+ has_one_attached :tutorial_step_images
6
+
4
7
  # Relationships
5
8
  belongs_to :post, class_name: "PhcdevworksTutorials::Tutorial::Post"
6
9
 
@@ -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="field">
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', edit_tutorial_step_path(tutorial_step) %></td>
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>
@@ -1,3 +1,3 @@
1
1
  module PhcdevworksTutorials
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  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.1.0
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-29 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails