jinda 0.6.1 → 0.6.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 +4 -4
- data/README.md +1 -1
- data/lib/generators/jinda/templates/app/controllers/jinda_org/articles_controller.rb +5 -3
- data/lib/generators/jinda/templates/app/controllers/jinda_org/comments_controller.rb +19 -7
- data/lib/generators/jinda/templates/app/jinda/index.mm +22 -19
- data/lib/generators/jinda/templates/app/models/comment.rb +5 -3
- data/lib/generators/jinda/templates/app/views/articles/show.html.haml +2 -1
- data/lib/jinda/helpers.rb +4 -1
- data/lib/jinda/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14a8e0de198f0e7a005ef69aee6d54e675168afea12c2e4f35d01c1dbcab457d
|
4
|
+
data.tar.gz: f3324931dea17255d9f9150476ec12d4789ce9ba9da7c17149452c076d3dde96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df655fea57ffaca3d5ebb317114b7b8058c80acdc208fac62dd5cadffb4222deecce991f3371a2581e34f17778b7d25b3924e1705dbf8958192daf75d8694879
|
7
|
+
data.tar.gz: 5e70fdb8fad32c2c0d859e8e6f77d6a662597594e30c2189804ca5edf46d325efc711a0929911b20248fe9ab7f0d19fca703001be3240f074973716daef2ce08
|
data/README.md
CHANGED
@@ -12,8 +12,10 @@ class ArticlesController < ApplicationController
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def show
|
15
|
-
@article = Article.find(
|
16
|
-
@
|
15
|
+
@article = Article.find(article_params)
|
16
|
+
@commentable = @article
|
17
|
+
@comments = @commentable.comments.desc(:created_at).page(params[:page]).per(10)
|
18
|
+
|
17
19
|
prepare_meta_tags(title: @article.title,
|
18
20
|
description: @article.text,
|
19
21
|
keywords: @article.keywords)
|
@@ -92,7 +94,7 @@ class ArticlesController < ApplicationController
|
|
92
94
|
end
|
93
95
|
|
94
96
|
def article_params
|
95
|
-
params[:article_id]
|
97
|
+
[params[:article_id], params[:id]].detect { |p| !p.nil? }
|
96
98
|
end
|
97
99
|
|
98
100
|
def load_edit_article
|
@@ -1,19 +1,31 @@
|
|
1
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
|
2
8
|
|
3
9
|
def create
|
4
|
-
@
|
5
|
-
@comment = @article.comments.new(comment_params)
|
10
|
+
@comment = @commentable.comments.new comment_params
|
6
11
|
@comment.save!
|
7
|
-
redirect_to
|
12
|
+
redirect_to [@commentable], notice: "Comment created"
|
8
13
|
end
|
9
14
|
|
10
15
|
private
|
11
16
|
|
12
|
-
def article_params
|
13
|
-
|
14
|
-
end
|
17
|
+
# def article_params
|
18
|
+
# params.require(:comment).permit(:article_id)
|
19
|
+
# end
|
15
20
|
|
16
21
|
def comment_params
|
17
|
-
|
22
|
+
resource = request.path.split('/')[1]
|
23
|
+
commentable_id = "#{resource.singularize.to_sym}_id" #:article_id
|
24
|
+
params.require(:comment).permit(:body, :user_id, commentable_id.to_sym)
|
18
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
|
19
31
|
end
|
@@ -25,7 +25,7 @@
|
|
25
25
|
</node>
|
26
26
|
</node>
|
27
27
|
</node>
|
28
|
-
<node CREATED="1275752678377" ID="ID_1348489452" MODIFIED="
|
28
|
+
<node CREATED="1275752678377" FOLDED="true" ID="ID_1348489452" MODIFIED="1602251558474" TEXT="admins:Admin">
|
29
29
|
<node CREATED="1275752688167" ID="ID_229996461" MODIFIED="1275752690948" TEXT="role:a"/>
|
30
30
|
<node CREATED="1282722836614" ID="ID_1213363124" MODIFIED="1330477902602" TEXT="edit_role:edit user role">
|
31
31
|
<node CREATED="1282722862918" ID="ID_1190117882" MODIFIED="1330477922159" TEXT="select_user:select user">
|
@@ -44,7 +44,7 @@
|
|
44
44
|
<node CREATED="1275790679363" ID="ID_829325467" MODIFIED="1511159696044" TEXT="link: logs: /jinda/logs"/>
|
45
45
|
<node CREATED="1507573166973" ID="ID_351025910" MODIFIED="1511159700908" TEXT="link: docs: /jinda/doc"/>
|
46
46
|
</node>
|
47
|
-
<node CREATED="1273706796854" ID="ID_1003882979" MODIFIED="
|
47
|
+
<node CREATED="1273706796854" FOLDED="true" ID="ID_1003882979" MODIFIED="1602251560242" TEXT="devs: Developer">
|
48
48
|
<node CREATED="1275373154914" ID="ID_340725299" MODIFIED="1275373158632" TEXT="role:d"/>
|
49
49
|
<node CREATED="1275788317299" ID="ID_716276608" MODIFIED="1511159716471" TEXT="link: error_logs: /jinda/error_logs"/>
|
50
50
|
<node CREATED="1275788317299" ID="ID_1570419198" MODIFIED="1587858894833" TEXT="link: notice_logs: /jinda/notice_logs"/>
|
@@ -87,7 +87,7 @@
|
|
87
87
|
</node>
|
88
88
|
</node>
|
89
89
|
</node>
|
90
|
-
<node CREATED="1493393619430" ID="ID_554831343" MODIFIED="
|
90
|
+
<node CREATED="1493393619430" FOLDED="true" ID="ID_554831343" MODIFIED="1602251562724" TEXT="notes: Notes">
|
91
91
|
<node CREATED="1493489768542" ID="ID_737469676" MODIFIED="1589772615102" TEXT="link:My Notes: /notes/my">
|
92
92
|
<node CREATED="1493490295677" ID="ID_514416082" MODIFIED="1493490302239" TEXT="role:m"/>
|
93
93
|
</node>
|
@@ -151,7 +151,7 @@
|
|
151
151
|
</node>
|
152
152
|
</node>
|
153
153
|
</node>
|
154
|
-
<node CREATED="1493393619430" ID="ID_328863650" MODIFIED="
|
154
|
+
<node CREATED="1493393619430" FOLDED="true" ID="ID_328863650" MODIFIED="1602251538059" TEXT="articles: Article">
|
155
155
|
<node CREATED="1493419096527" ID="ID_1521905276" MODIFIED="1493478060121" TEXT="link: All Articles: /articles"/>
|
156
156
|
<node CREATED="1493489768542" FOLDED="true" ID="ID_1376361427" MODIFIED="1589757167952" TEXT="link: My article: /articles/my">
|
157
157
|
<node CREATED="1493490295677" ID="ID_628476988" MODIFIED="1493490302239" TEXT="role:m"/>
|
@@ -199,7 +199,7 @@
|
|
199
199
|
</node>
|
200
200
|
</node>
|
201
201
|
</node>
|
202
|
-
<node CREATED="1493664700564" ID="ID_704959130" MODIFIED="
|
202
|
+
<node CREATED="1493664700564" FOLDED="true" ID="ID_704959130" MODIFIED="1602251564023" TEXT="comments: Comment">
|
203
203
|
<icon BUILTIN="button_cancel"/>
|
204
204
|
<node CREATED="1493665155709" ID="ID_1973520751" MODIFIED="1591392666652" TEXT="new_comment: New Comment">
|
205
205
|
<icon BUILTIN="button_cancel"/>
|
@@ -281,7 +281,7 @@
|
|
281
281
|
<node CREATED="1273819855875" ID="ID_1429503284" MODIFIED="1330477311102" TEXT="a: admin"/>
|
282
282
|
<node CREATED="1273819859775" ID="ID_568365839" MODIFIED="1330477315009" TEXT="d: developer"/>
|
283
283
|
</node>
|
284
|
-
<node CREATED="1273819456867"
|
284
|
+
<node CREATED="1273819456867" ID="ID_1677010054" MODIFIED="1602123498759" POSITION="left" TEXT="models">
|
285
285
|
<node CREATED="1292122118499" FOLDED="true" ID="ID_1957754752" MODIFIED="1493705885123" TEXT="person">
|
286
286
|
<node CREATED="1292122135809" ID="ID_1617970069" MODIFIED="1332878659106" TEXT="fname"/>
|
287
287
|
<node CREATED="1292122150362" ID="ID_1200135538" MODIFIED="1332878662388" TEXT="lname"/>
|
@@ -305,7 +305,7 @@
|
|
305
305
|
<node CREATED="1292243471343" ID="ID_1859608350" MODIFIED="1310195256623" TEXT="lat: float"/>
|
306
306
|
<node CREATED="1292243477436" ID="ID_48497260" MODIFIED="1310195262534" TEXT="lng: float"/>
|
307
307
|
</node>
|
308
|
-
<node CREATED="1493418879485"
|
308
|
+
<node CREATED="1493418879485" ID="ID_1995497233" MODIFIED="1602529325998" TEXT="article">
|
309
309
|
<node CREATED="1493418891110" ID="ID_364756011" MODIFIED="1493418905253" TEXT="title"/>
|
310
310
|
<node CREATED="1493418906868" ID="ID_1676483995" MODIFIED="1493418911919" TEXT="text"/>
|
311
311
|
<node CREATED="1493487131376" ID="ID_1334057464" MODIFIED="1538328284823" TEXT="belongs_to :user, :class_name => "User"">
|
@@ -320,18 +320,6 @@
|
|
320
320
|
<node CREATED="1494181636998" ID="ID_229502630" MODIFIED="1494181660419" TEXT="body"/>
|
321
321
|
<node CREATED="1497913676275" ID="ID_404103076" MODIFIED="1497913685065" TEXT="keywords"/>
|
322
322
|
</node>
|
323
|
-
<node CREATED="1493418915637" FOLDED="true" ID="ID_429078131" MODIFIED="1583097162517" TEXT="comment">
|
324
|
-
<node CREATED="1493418939760" ID="ID_1251093062" MODIFIED="1493418943423" TEXT="body"/>
|
325
|
-
<node CREATED="1493418945686" ID="ID_911071644" MODIFIED="1493418986711" TEXT="belongs_to :article">
|
326
|
-
<icon BUILTIN="edit"/>
|
327
|
-
</node>
|
328
|
-
<node CREATED="1493643129947" ID="ID_588013696" MODIFIED="1493643146424" TEXT="belongs_to :user">
|
329
|
-
<icon BUILTIN="edit"/>
|
330
|
-
</node>
|
331
|
-
<node CREATED="1493718512191" ID="ID_173203253" MODIFIED="1493718583874" TEXT="validates :body, :user_id, :article_id, presence: true">
|
332
|
-
<icon BUILTIN="edit"/>
|
333
|
-
</node>
|
334
|
-
</node>
|
335
323
|
<node CREATED="1494040082403" FOLDED="true" ID="ID_864577403" MODIFIED="1583097161145" TEXT="picture">
|
336
324
|
<node CREATED="1494040091583" ID="ID_679208099" MODIFIED="1494040119098" TEXT="picture"/>
|
337
325
|
<node CREATED="1494040120208" ID="ID_1266154874" MODIFIED="1494040125130" TEXT="description"/>
|
@@ -361,6 +349,21 @@
|
|
361
349
|
<icon BUILTIN="edit"/>
|
362
350
|
</node>
|
363
351
|
</node>
|
352
|
+
<node CREATED="1493418915637" ID="ID_429078131" MODIFIED="1602591443455" TEXT="comment">
|
353
|
+
<node CREATED="1493418939760" ID="ID_1251093062" MODIFIED="1493418943423" TEXT="body"/>
|
354
|
+
<node CREATED="1493418945686" ID="ID_911071644" MODIFIED="1602529513657" TEXT="belongs_to :article, :class_name => "Article" ">
|
355
|
+
<icon BUILTIN="edit"/>
|
356
|
+
</node>
|
357
|
+
<node CREATED="1493643129947" ID="ID_588013696" MODIFIED="1602110865206" TEXT="belongs_to :user, :class_name => "User" ">
|
358
|
+
<icon BUILTIN="edit"/>
|
359
|
+
</node>
|
360
|
+
<node CREATED="1601847760278" ID="ID_1288333428" MODIFIED="1602591549062" TEXT="belongs_to :commentable, polymorphic: true ">
|
361
|
+
<icon BUILTIN="edit"/>
|
362
|
+
</node>
|
363
|
+
<node CREATED="1602591560333" ID="ID_598892151" MODIFIED="1602592677709" TEXT="index({ commentable_id: 1, commentable_type: 1}) ">
|
364
|
+
<icon BUILTIN="edit"/>
|
365
|
+
</node>
|
366
|
+
</node>
|
364
367
|
</node>
|
365
368
|
</node>
|
366
369
|
</map>
|
@@ -4,8 +4,10 @@ class Comment
|
|
4
4
|
# jinda begin
|
5
5
|
include Mongoid::Timestamps
|
6
6
|
field :body, :type => String
|
7
|
-
belongs_to :article
|
8
|
-
belongs_to :user, :class_name => "User"
|
9
|
-
|
7
|
+
belongs_to :article, :class_name => "Article"
|
8
|
+
belongs_to :user, :class_name => "User"
|
9
|
+
belongs_to :job, :class_name => "Job"
|
10
|
+
belongs_to :commentable, polymorphic: true
|
11
|
+
index({ commentable_id: 1, commentable_type: 1})
|
10
12
|
# jinda end
|
11
13
|
end
|
@@ -17,7 +17,8 @@
|
|
17
17
|
-#
|
18
18
|
- if login?
|
19
19
|
%h3 Add a comment:
|
20
|
-
|
20
|
+
=# form_for([@comment, @article.comments.build]) do |f|
|
21
|
+
= form_with(model: [@article, Comment.new], local: true) do |f|
|
21
22
|
= f.hidden_field :article_id, :value => @article.id
|
22
23
|
= f.label :body, "Comment"
|
23
24
|
= f.text_area :body
|
data/lib/jinda/helpers.rb
CHANGED
@@ -645,7 +645,10 @@ module Jinda
|
|
645
645
|
if a[:edit]
|
646
646
|
doc += " #{a[:text]}\n"
|
647
647
|
else
|
648
|
-
|
648
|
+
# Fixed: Capitalize only first char
|
649
|
+
# doc += " field :#{a[:code]}, :type => #{a[:type].capitalize}\n"
|
650
|
+
a[:type][0] = a[:type][0].capitalize
|
651
|
+
doc += " field :#{a[:code]}, :type => #{a[:type]}\n"
|
649
652
|
end
|
650
653
|
end
|
651
654
|
doc += " #{@etext}\n"
|
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.6.
|
4
|
+
version: 0.6.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: 2020-10-
|
12
|
+
date: 2020-10-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -43,40 +43,40 @@ dependencies:
|
|
43
43
|
name: activesupport
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 4.1.11
|
49
|
-
- - "
|
49
|
+
- - "~>"
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: 4.1.11
|
52
52
|
type: :development
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- - "
|
56
|
+
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: 4.1.11
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 4.1.11
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: mongoid
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 4.1.11
|
69
|
-
- - "
|
69
|
+
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: 4.1.11
|
72
72
|
type: :development
|
73
73
|
prerelease: false
|
74
74
|
version_requirements: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- - "
|
76
|
+
- - ">="
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: 4.1.11
|
79
|
-
- - "
|
79
|
+
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: 4.1.11
|
82
82
|
description: 'Generate Rails workflow from mind map: Freemind'
|
@@ -406,7 +406,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
406
406
|
- !ruby/object:Gem::Version
|
407
407
|
version: '0'
|
408
408
|
requirements: []
|
409
|
-
rubygems_version: 3.
|
409
|
+
rubygems_version: 3.0.8
|
410
410
|
signing_key:
|
411
411
|
specification_version: 4
|
412
412
|
summary: 'Rails workflow from mind map: Freemind'
|