jinda 0.7.2 → 0.7.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ed59d0a776091a540cfb3dc8529d9ddb11c0ca4f94cdf40b277957432d300a1
|
4
|
+
data.tar.gz: 7e5d9f3308145ee6241c0aca617325e62068571111c22de905119043acaf61ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7265365e8f612ee25707ae76c080b61790b458023d9953179ae43e91e5e779d67baedaa91c37694c34da4d74b159e5f25849ede86d3ec9e2fa4f54961cd97762
|
7
|
+
data.tar.gz: 6bb86d8ef01fd4346214acab6de8395293d1c8d18771495db4378ba97cbdecd22ba36e4dbe0de9c9ca05adf497ed56fb3a55a23c1ccefec1d647fe45e214e1fa
|
@@ -4,43 +4,44 @@
|
|
4
4
|
.container
|
5
5
|
%div.row::before
|
6
6
|
%div.col-md-12
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
%
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
%
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
7
|
+
.row-description
|
8
|
+
%h2.display-3.mt-5.pt-5
|
9
|
+
= @article.title
|
10
|
+
= link_to image_tag('pencil.png', style:'border:none; float:right;', id: 'article_pen'), {controller: "articles", action: "edit", article_id: @article.id}, data: { confirm: "Please Confirm" }
|
11
|
+
%hr
|
12
|
+
= @article.text
|
13
|
+
%h4.row-body
|
14
|
+
= @article.body.html_safe
|
15
|
+
%hr
|
16
|
+
- @comments.each do |comment|
|
17
|
+
%div#article-comment.ui-corner-all
|
18
|
+
.col-md-12
|
19
|
+
%div.small-box.bg-white.text-info
|
20
|
+
%div.inner
|
21
|
+
%div.font-weight-light
|
22
|
+
Author:
|
23
|
+
%b= comment.name if comment.name
|
24
|
+
%div.right-date
|
25
|
+
12/12/2021
|
26
|
+
%div#comment-body
|
27
|
+
%i= comment.body
|
28
28
|
|
29
29
|
- if login?
|
30
|
-
%
|
31
|
-
|
32
|
-
|
33
|
-
.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
30
|
+
%hr
|
31
|
+
%h4.col-md-12
|
32
|
+
Add a comment:
|
33
|
+
= form_with(model: [@article, Comment.new], local: true) do |f|
|
34
|
+
.form-group
|
35
|
+
= f.hidden_field :article_id, :value => @article.id
|
36
|
+
.form-group
|
37
|
+
= f.label :body, "Comment"
|
38
|
+
.form-group
|
39
|
+
= f.text_area :body, rows: 5, class: "form-control"
|
40
|
+
.form-group
|
41
|
+
= f.hidden_field :user_id, :value => current_ma_user.id
|
42
|
+
.form-group
|
43
|
+
= f.hidden_field :name, :value => current_ma_user.code
|
44
|
+
.form-group
|
45
|
+
= f.hidden_field :image, :value => current_ma_user.image
|
46
|
+
.form-group
|
47
|
+
= f.submit "Submit", class: "btn btn-default btn-success"
|
data/lib/jinda/themes.rb
CHANGED
@@ -1,163 +1,168 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
2
|
+
# ############################### Themes ###################################
|
3
|
+
#
|
4
|
+
# Check login user information from User model: name(code), image for Themes
|
5
|
+
#
|
6
|
+
# ##########################################################################
|
7
|
+
def get_login_user_info
|
8
|
+
if current_ma_user.present?
|
9
|
+
$user_image = current_ma_user.image
|
10
|
+
$user_name = current_ma_user.code
|
11
|
+
$user_email = current_ma_user.email
|
12
|
+
$user_id = current_ma_user.try(:id)
|
13
|
+
else
|
14
|
+
$user_image = asset_url("user.png", :width => "48")
|
15
|
+
$user_name = 'Guest User'
|
16
|
+
$user_email = 'guest@sample.com'
|
17
|
+
$user_id = ''
|
18
|
+
end
|
19
|
+
return $user_image, $user_name, $user_email,$user_id
|
20
|
+
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
22
|
+
def name2code(s)
|
23
|
+
# rather not ignore # symbol cause it could be comment
|
24
|
+
code, name = s.split(':')
|
25
|
+
code.downcase.strip.gsub(' ','_').gsub(/[^#_\/a-zA-Z0-9]/,'')
|
26
|
+
end
|
27
|
+
def name2camel(s)
|
28
|
+
s.gsub(' ','_').camelcase
|
29
|
+
end
|
30
|
+
def true_action?(s)
|
31
|
+
%w(call ws redirect invoke email).include? s
|
32
|
+
end
|
33
|
+
def set_global
|
34
|
+
$xmain= @xmain ; $runseq = @runseq ; $user = current_ma_user ; $xvars= @xmain.xvars; $ip = request.env["REMOTE_ADDR"]
|
35
|
+
end
|
36
|
+
def authorize? # use in pending tasks
|
37
|
+
@runseq= @xmain.runseqs.find @xmain.current_runseq
|
38
|
+
return false unless @runseq
|
39
|
+
@user = current_ma_user
|
40
|
+
set_global
|
41
|
+
return false unless eval(@runseq.rule) if @runseq.rule
|
42
|
+
return true if true_action?(@runseq.action)
|
43
|
+
# return false if check_wait
|
44
|
+
return true if @runseq.role.blank?
|
45
|
+
unless @runseq.role.empty?
|
46
|
+
return false unless @user.role
|
47
|
+
return @user.role.upcase.split(',').include?(@runseq.role.upcase)
|
48
|
+
end
|
49
|
+
return true
|
50
|
+
end
|
51
|
+
def authorize_init? # use when initialize new transaction
|
52
|
+
# check module role
|
53
|
+
mrole = @service.module.role
|
54
|
+
return false if mrole && !current_ma_user
|
55
|
+
return false if mrole && !current_ma_user.has_role(mrole)
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
57
|
+
# check step 1 role
|
58
|
+
xml= @service.xml
|
59
|
+
step1 = REXML::Document.new(xml).root.elements['node']
|
60
|
+
role= get_option_xml("role", step1) || ""
|
61
|
+
# rule= get_option_xml("rule", step1) || true
|
62
|
+
rule= get_option_xml("rule", step1) || true
|
63
|
+
return true if role==""
|
64
|
+
unless current_ma_user
|
65
|
+
return role.blank?
|
66
|
+
else
|
67
|
+
return false unless current_ma_user.role
|
68
|
+
return current_ma_user.has_role(role)
|
69
|
+
end
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
71
|
+
end
|
72
|
+
def ma_log(message)
|
73
|
+
# Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
|
74
|
+
# :unread=> true, :ip=> ($ip || request.env["REMOTE_ADDR"])
|
75
|
+
if session[:user_id]
|
76
|
+
Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
|
77
|
+
:user_id => $user.id, :unread=> true, :ip=>request.env["REMOTE_ADDR"]
|
78
|
+
else
|
79
|
+
Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
|
80
|
+
:unread=> true, :ip=>request.env["REMOTE_ADDR"]
|
81
|
+
end
|
82
|
+
end
|
83
83
|
|
84
|
-
|
84
|
+
alias :ma_notice :ma_log
|
85
85
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
86
|
+
# methods from application_helper
|
87
|
+
def markdown(text)
|
88
|
+
begin
|
89
|
+
erbified = ERB.new(text.html_safe).result(binding)
|
90
|
+
rescue => error
|
91
|
+
flash[:notice] = "This ruby version not support #{error}"
|
92
|
+
return
|
93
|
+
end
|
94
|
+
red = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)
|
95
|
+
red.render(erbified).html_safe
|
96
|
+
end
|
97
|
+
def align_text(s, pixel=3)
|
98
|
+
"<span style='position:relative; top:-#{pixel}px;'>#{s}</span>".html_safe
|
99
|
+
end
|
100
|
+
def status_icon(status)
|
101
|
+
case status
|
102
|
+
when 'R'
|
103
|
+
image_tag 'user.png'
|
104
|
+
when 'F'
|
105
|
+
image_tag 'tick.png'
|
106
|
+
when 'I'
|
107
|
+
image_tag 'control_play.png'
|
108
|
+
when 'E'
|
109
|
+
image_tag 'logout.png'
|
110
|
+
when 'X'
|
111
|
+
image_tag 'cross.png'
|
112
|
+
else
|
113
|
+
image_tag 'cancel.png'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
def role_name(code)
|
117
|
+
role= Jinda::Role.where(code:code).first
|
118
|
+
return role ? role.name : ""
|
119
|
+
end
|
120
|
+
def uncomment(s)
|
121
|
+
s.sub(/^#\s/,'')
|
122
|
+
end
|
123
|
+
def code_div(s)
|
124
|
+
"<pre style='background-color: #efffef;'><code class='ruby' lang='ruby'> #{s}</code></pre>".html_safe
|
125
|
+
end
|
126
|
+
def ajax?(s)
|
127
|
+
return s.match('file_field') ? false : true
|
128
|
+
end
|
129
|
+
def step(s, total) # square text
|
130
|
+
s = (s==0)? 1: s.to_i
|
131
|
+
total = total.to_i
|
132
|
+
out ="<div class='step'>"
|
133
|
+
(s-1).times {|ss| out += "<span class='steps_done'>#{(ss+1)}</span>" }
|
134
|
+
out += %Q@<span class='step_now' >@
|
135
|
+
out += s.to_s
|
136
|
+
out += "</span>"
|
137
|
+
out += %Q@@
|
138
|
+
for i in s+1..total
|
139
|
+
out += "<span class='steps_more'>#{i}</span>"
|
140
|
+
end
|
141
|
+
out += "</div>"
|
142
|
+
out.html_safe
|
143
|
+
end
|
139
144
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
145
|
+
def current_ma_user
|
146
|
+
# if session[:user_id]
|
147
|
+
# return @user ||= User.find(session[:user_id]['$oid'])
|
148
|
+
# else
|
149
|
+
# return nil
|
150
|
+
# end
|
151
|
+
#@user ||= User.find_by_auth_token!(cookies[:auth_token]) if cookies[:auth_token]
|
152
|
+
@user ||= User.where(:auth_token => cookies[:auth_token]).first if cookies[:auth_token]
|
153
|
+
return @user
|
154
|
+
end
|
150
155
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
156
|
+
def ui_action?(s)
|
157
|
+
%w(form output mail pdf).include? s
|
158
|
+
end
|
159
|
+
# def handle_ma_notice
|
160
|
+
# if Jinda::Notice.recent.count>0
|
161
|
+
# notice= Jinda::Notice.recent.last
|
162
|
+
# notice.update_attribute :unread, false
|
163
|
+
# "<script>notice('#{notice.message}');</script>"
|
164
|
+
# else
|
165
|
+
# ""
|
166
|
+
# end
|
167
|
+
# end
|
163
168
|
|
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.3
|
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-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|