jinda 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faef5ea06cc850bbbf7ebb2b1f8d3ac4e59688d0b5197c124bc4ca525b2ce466
|
4
|
+
data.tar.gz: f84ac716bb2ae580fcfeda5178544f7809440ae998c1f0cd263bbdfd5f58e1ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ab17b915d572b178f1d709037c9b1af2ed64db23b14d8cb36d68c1c010bb0e75dabcc8c1e1172acc628826f591ee4ef4278137191a53bfe1c0454b42858f274
|
7
|
+
data.tar.gz: 1404b46acb45165bccd3087926380ee9bf986edee9f8726691a5037ef25504b7b3b56d6ab3e467e752d9e2ac506a0d7e5d6198b1db07c795a2fc13210e1e4e13
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class CommentsController < ApplicationController
|
2
|
+
before_action :comment_params, only: [:create]
|
3
|
+
before_action :load_commmentable
|
4
|
+
|
5
|
+
def index
|
6
|
+
@comments = @commentable.comments
|
7
|
+
end
|
8
|
+
|
9
|
+
def create
|
10
|
+
@comment = @commentable.comments.new comment_params
|
11
|
+
@comment.save!
|
12
|
+
redirect_to [@commentable], notice: "Comment created"
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
# def article_params
|
18
|
+
# params.require(:comment).permit(:article_id)
|
19
|
+
# end
|
20
|
+
|
21
|
+
def comment_params
|
22
|
+
resource = request.path.split('/')[1]
|
23
|
+
commentable_id = "#{resource.singularize.to_sym}_id" #:article_id
|
24
|
+
params.require(:comment).permit(:body, :user_id,:name, :image, commentable_id.to_sym)
|
25
|
+
end
|
26
|
+
|
27
|
+
def load_commmentable
|
28
|
+
resource, id = request.path.split('/')[1,2]
|
29
|
+
@commentable = resource.singularize.classify.constantize.find(id)
|
30
|
+
end
|
31
|
+
end
|
@@ -4,9 +4,10 @@ class Comment
|
|
4
4
|
# jinda begin
|
5
5
|
include Mongoid::Timestamps
|
6
6
|
field :body, :type => String
|
7
|
+
field :name, :type => String
|
8
|
+
field :image, :type => String
|
7
9
|
belongs_to :article, :class_name => "Article"
|
8
10
|
belongs_to :user, :class_name => "User"
|
9
|
-
belongs_to :job, :class_name => "Job"
|
10
11
|
belongs_to :commentable, polymorphic: true
|
11
12
|
index({ commentable_id: 1, commentable_type: 1})
|
12
13
|
# jinda end
|
@@ -18,7 +18,7 @@
|
|
18
18
|
%div.inner
|
19
19
|
%div.font-weight-light
|
20
20
|
Author:
|
21
|
-
%b= comment.
|
21
|
+
%b= comment.name if comment.name
|
22
22
|
%div#comment-body
|
23
23
|
%i= comment.body
|
24
24
|
%hr
|
@@ -37,6 +37,10 @@
|
|
37
37
|
.form-group
|
38
38
|
= f.text_area :body, rows: 5, class: "form-control"
|
39
39
|
.form-group
|
40
|
-
= f.hidden_field :user_id, :value => current_ma_user
|
40
|
+
= f.hidden_field :user_id, :value => current_ma_user.id
|
41
|
+
.form-group
|
42
|
+
= f.hidden_field :name, :value => current_ma_user.code
|
43
|
+
.form-group
|
44
|
+
= f.hidden_field :image, :value => current_ma_user.image
|
41
45
|
.form-group
|
42
46
|
= f.submit "Submit", class: "btn btn-default btn-success"
|
data/lib/jinda/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jinda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Prateep Kul
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-01-
|
12
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- lib/generators/jinda/templates/app/channels/application_cable/channel.rb
|
223
223
|
- lib/generators/jinda/templates/app/channels/application_cable/connection.rb
|
224
224
|
- lib/generators/jinda/templates/app/controllers/api/v1/notes_controller.rb
|
225
|
+
- lib/generators/jinda/templates/app/controllers/comments_controller.rb
|
225
226
|
- lib/generators/jinda/templates/app/controllers/jinda_org/admins_controller.rb
|
226
227
|
- lib/generators/jinda/templates/app/controllers/jinda_org/application_controller.rb
|
227
228
|
- lib/generators/jinda/templates/app/controllers/jinda_org/articles_controller.rb
|
@@ -465,7 +466,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
465
466
|
- !ruby/object:Gem::Version
|
466
467
|
version: '0'
|
467
468
|
requirements: []
|
468
|
-
rubygems_version: 3.2
|
469
|
+
rubygems_version: 3.1.2
|
469
470
|
signing_key:
|
470
471
|
specification_version: 4
|
471
472
|
summary: 'Rails workflow from mind map: Freemind'
|