jinda 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/generators/jinda/config_generator.rb +0 -1
- data/lib/generators/jinda/install_generator.rb +14 -8
- data/lib/generators/jinda/templates/app/assets/javascripts/application.js +0 -1
- data/lib/generators/jinda/templates/app/controllers/admins_controller.rb +1 -1
- data/lib/generators/jinda/templates/app/controllers/jinda_controller.rb +83 -77
- data/lib/generators/jinda/templates/app/controllers/password_resets.rb +3 -3
- data/lib/generators/jinda/templates/app/controllers/password_resets_controller.rb +3 -3
- data/lib/generators/jinda/templates/app/models/jinda/doc.rb +1 -1
- data/lib/generators/jinda/templates/app/models/jinda/notice.rb +1 -1
- data/lib/generators/jinda/templates/app/models/jinda/role.rb +1 -1
- data/lib/generators/jinda/templates/app/models/jinda/runseq.rb +1 -1
- data/lib/generators/jinda/templates/app/views/jinda/index.html.haml +2 -2
- data/lib/generators/jinda/templates/app/views/jinda/notice_logs.haml +18 -0
- data/lib/jinda/helpers.rb +12 -10
- data/lib/jinda/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34a83590140593e5245b54ea6edbfadc73dd4adaea05877d9743b64f06cd36e5
|
4
|
+
data.tar.gz: 644da69d744877a19d598a49ef21bb14bc8895cd17cd80122f5f2b9d03691519
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae032fad6e397859dc90b213ddb8dd9a26facfc4d9dd547370b7ed69ed53f393c4a79a21d6e562b014e842f680dcea0c7188271caee124dbcb0aa4f27fba2b02
|
7
|
+
data.tar.gz: 155e54f906475400106f8761596a7b8a7c63c7b27d46f9697fd4474306b2d5c1e5fdf5365040127d990114f20ce9166dc9d7c8644cc9d53b299ea21bd042da0e
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ Rails Application Generator using Freemind
|
|
16
16
|
These versions works for sure but others may do.
|
17
17
|
|
18
18
|
* Ruby 2.5.0
|
19
|
-
* Rails 5.2.
|
19
|
+
* Rails 5.2.3
|
20
20
|
* MongoDB 6
|
21
21
|
* Freemind 1.0.1
|
22
22
|
|
@@ -36,7 +36,7 @@ app without ActiveRecord
|
|
36
36
|
|
37
37
|
## Add jinda to your Gemfile:
|
38
38
|
|
39
|
-
gem 'jinda', '~> 0.3.
|
39
|
+
gem 'jinda', '~> 0.3.4'
|
40
40
|
|
41
41
|
For Development (most updated)
|
42
42
|
|
@@ -9,7 +9,6 @@ module Jinda
|
|
9
9
|
st=" "
|
10
10
|
inside("config/initializers") {(File.file? "omniauth.rb") ? (run "mv omniauth.rb omniauth.rb.bak") : (puts "new omniauth.rb created")}
|
11
11
|
inside("config/initializers") {(File.file? "mongoid.rb") ? (run "mv mongoid.rb omniauth.rb.bak") : (puts "new mongoid.rb created")}
|
12
|
-
inside("config/initializers") {(File.file? "ckeditor.rb") ? (run "mv ckeditor.rb ckeditor.rb.bak") : (puts "new ckeditor.rb created")}
|
13
12
|
(File.file? ".env") ? (run "cp .env .env-bak") : (puts "backup .env")
|
14
13
|
end
|
15
14
|
|
@@ -12,6 +12,7 @@ module Jinda
|
|
12
12
|
gem 'normalize-rails'
|
13
13
|
gem 'font-awesome-sass', '~> 4.7.0'
|
14
14
|
gem 'ckeditor', github: 'galetahub/ckeditor'
|
15
|
+
|
15
16
|
gem 'mongoid-paperclip', require: 'mongoid_paperclip'
|
16
17
|
gem 'meta-tags'
|
17
18
|
gem 'jquery-turbolinks'
|
@@ -27,7 +28,7 @@ module Jinda
|
|
27
28
|
gem 'bcrypt'
|
28
29
|
gem 'omniauth-identity'
|
29
30
|
gem 'omniauth-facebook'
|
30
|
-
|
31
|
+
gem 'omniauth-google-oauth2'
|
31
32
|
gem 'dotenv-rails'
|
32
33
|
gem 'cloudinary'
|
33
34
|
gem 'kaminari'
|
@@ -40,14 +41,15 @@ module Jinda
|
|
40
41
|
gem 'binding_of_caller'
|
41
42
|
gem 'pry-byebug'
|
42
43
|
gem 'factory_bot_rails'
|
43
|
-
|
44
|
+
gem 'database_cleaner'
|
44
45
|
gem 'guard'
|
45
46
|
gem 'guard-rspec'
|
46
47
|
gem 'guard-minitest'
|
47
48
|
gem 'capybara'
|
48
|
-
|
49
|
+
gem 'selenium-webdriver'
|
49
50
|
gem 'rb-fsevent'
|
50
|
-
|
51
|
+
gem 'valid_attribute'
|
52
|
+
gem 'faker', :git => 'https://github.com/stympy/faker.git', :branch => 'master'
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
@@ -73,21 +75,21 @@ module Jinda
|
|
73
75
|
route "resources :identities"
|
74
76
|
route "resources :users"
|
75
77
|
route "resources :articles"
|
76
|
-
|
78
|
+
route "get '/articles/my/destroy' => 'articles#destroy'"
|
77
79
|
route "get '/articles/my' => 'articles/my'"
|
78
80
|
route "get '/logout' => 'sessions#destroy', :as => 'logout'"
|
79
81
|
route "get '/auth/:provider/callback' => 'sessions#create'"
|
80
82
|
route "post '/auth/:provider/callback' => 'sessions#create'"
|
83
|
+
route "\# end jinda method routes"
|
81
84
|
route "mount Ckeditor::Engine => '/ckeditor'"
|
82
|
-
route "\# end jinda method routes"
|
83
85
|
route "post '/jinda/end_form' => 'jinda#end_form'"
|
84
86
|
route "post '/jinda/pending' => 'jinda#index'"
|
85
87
|
route "post '/jinda/init' => 'jinda#init'"
|
86
88
|
route "jinda_methods.each do \|aktion\| get \"/jinda/\#\{aktion\}\" => \"jinda#\#\{aktion\}\" end"
|
87
|
-
route "jinda_methods += ['init','run','run_do','run_form','end_form','error_logs']"
|
89
|
+
route "jinda_methods += ['init','run','run_do','run_form','end_form','error_logs', 'notice_logs', 'cancel']"
|
88
90
|
route "jinda_methods = ['pending','status','search','doc','logs','ajax_notice']"
|
89
91
|
route "\# start jiinda method routes"
|
90
|
-
|
92
|
+
end
|
91
93
|
|
92
94
|
def setup_env
|
93
95
|
run "mv README.md README.md.bak"
|
@@ -105,6 +107,10 @@ module Jinda
|
|
105
107
|
g.test_framework :rspec
|
106
108
|
g.integration_tool :rspec
|
107
109
|
end
|
110
|
+
|
111
|
+
# config time zone
|
112
|
+
config.time_zone = "Central Time (US & Canada)"
|
113
|
+
|
108
114
|
# gmail config
|
109
115
|
config.action_mailer.delivery_method = :smtp
|
110
116
|
config.action_mailer.smtp_settings = {
|
@@ -8,6 +8,9 @@ class JindaController < ApplicationController
|
|
8
8
|
def error_logs
|
9
9
|
@xmains = Jinda::Xmain.in(status:['E']).desc(:created_at).page(params[:page]).per(10)
|
10
10
|
end
|
11
|
+
def notice_logs
|
12
|
+
@notices= Jinda::Notice.desc(:created_at).page(params[:page]).per(10)
|
13
|
+
end
|
11
14
|
def pending
|
12
15
|
@title= "Pending Tasks"
|
13
16
|
@xmains = Jinda::Xmain.in(status:['R','I']).asc(:created_at)
|
@@ -42,7 +45,7 @@ class JindaController < ApplicationController
|
|
42
45
|
module_code, code = params[:s].split(":")
|
43
46
|
@service= Jinda::Service.where(:module_code=> module_code, :code=> code).first
|
44
47
|
# @service= Jinda::Service.where(:module_code=> params[:module], :code=> params[:service]).first
|
45
|
-
|
48
|
+
if @service && authorize_init?
|
46
49
|
xmain = create_xmain(@service)
|
47
50
|
result = create_runseq(xmain)
|
48
51
|
unless result
|
@@ -61,8 +64,8 @@ class JindaController < ApplicationController
|
|
61
64
|
end
|
62
65
|
####################################################################################################]
|
63
66
|
# run if, form, mail, output etc depend on icon in freemind
|
64
|
-
|
65
|
-
|
67
|
+
# action from @runseq.action == do, form, if, output
|
68
|
+
# Then will call def run_do, run_form, run_if, run_output
|
66
69
|
####################################################################################################]
|
67
70
|
def run
|
68
71
|
init_vars(params[:id])
|
@@ -80,19 +83,22 @@ class JindaController < ApplicationController
|
|
80
83
|
redirect_to_root
|
81
84
|
else
|
82
85
|
service= @xmain.service
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
+
###############################################################################################
|
87
|
+
# Run View Form f created template by jinda rake follow freemind mm file
|
88
|
+
###############################################################################################
|
86
89
|
if service
|
87
90
|
@title= "Transaction ID #{@xmain.xid}: #{@xmain.name} / #{@runseq.name}"
|
88
91
|
fhelp= "app/views/#{service.module.code}/#{service.code}/#{@runseq.code}.md"
|
89
92
|
@help = File.read(fhelp) if File.exists?(fhelp)
|
90
93
|
f= "app/views/#{service.module.code}/#{service.code}/#{@runseq.code}.html.erb"
|
91
|
-
|
92
|
-
|
94
|
+
if File.file?(f)
|
95
|
+
@ui= File.read(f)
|
96
|
+
else
|
93
97
|
# flash[:notice]= "Error: Can not find the view file for this controller"
|
94
98
|
ma_log "Error: Can not find the view file for this controller"
|
95
99
|
redirect_to_root
|
100
|
+
end
|
101
|
+
|
96
102
|
end
|
97
103
|
end
|
98
104
|
else
|
@@ -169,15 +175,15 @@ class JindaController < ApplicationController
|
|
169
175
|
if Jinda::Doc.where(:runseq_id=>@runseq.id).exists?
|
170
176
|
@doc= Jinda::Doc.where(:runseq_id=>@runseq.id).first
|
171
177
|
@doc.update_attributes :data_text=> render_to_string(:inline=>@ui, :layout=>"utf8"),
|
172
|
-
|
173
|
-
|
174
|
-
|
178
|
+
:xmain=>@xmain, :runseq=>@runseq, :user=>current_ma_user,
|
179
|
+
:ip=> get_ip, :service=>service, :ma_display=>ma_display,
|
180
|
+
:ma_secured => @xmain.service.ma_secured
|
175
181
|
else
|
176
182
|
@doc= Jinda::Doc.create :name=> @runseq.name,
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
183
|
+
:content_type=>"output", :data_text=> render_to_string(:inline=>@ui, :layout=>"utf8"),
|
184
|
+
:xmain=>@xmain, :runseq=>@runseq, :user=>current_ma_user,
|
185
|
+
:ip=> get_ip, :service=>service, :ma_display=>ma_display,
|
186
|
+
:ma_secured => @xmain.service.ma_secured
|
181
187
|
end
|
182
188
|
@message = defined?(MSG_NEXT) ? MSG_NEXT : "Next >"
|
183
189
|
@message = "Finish" if @runseq.end
|
@@ -198,10 +204,10 @@ class JindaController < ApplicationController
|
|
198
204
|
f= "app/views/#{service.module.code}/#{service.code}/#{@runseq.code}.html.erb"
|
199
205
|
@ui= File.read(f).html_safe
|
200
206
|
@doc= Jinda::Doc.create :name=> @runseq.name,
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
207
|
+
:content_type=>"mail", :data_text=> render_to_string(:inline=>@ui, :layout=>false),
|
208
|
+
:xmain=>@xmain, :runseq=>@runseq, :user=>current_ma_user,
|
209
|
+
:ip=> get_ip, :service=>service, :ma_display=>false,
|
210
|
+
:ma_secured => @xmain.service.ma_secured
|
205
211
|
eval "@xvars[:#{@runseq.code}] = url_for(:controller=>'jinda', :action=>'document', :id=>@doc.id)"
|
206
212
|
mail_from = get_option('from')
|
207
213
|
# sender= render_to_string(:inline=>mail_from) if mail_from
|
@@ -247,24 +253,24 @@ class JindaController < ApplicationController
|
|
247
253
|
def end_form
|
248
254
|
init_vars(params[:xmain_id])
|
249
255
|
eval "@xvars[@runseq.code] = {} unless @xvars[@runseq.code]"
|
250
|
-
|
256
|
+
# Search for uploaded file name if exist
|
251
257
|
params.each { |k,v|
|
252
258
|
if params[k].respond_to? :original_filename
|
253
259
|
get_image(k, params[k])
|
254
|
-
|
260
|
+
# check if params of array in form eg: edit_article
|
255
261
|
elsif params[k].is_a?(ActionController::Parameters)
|
256
262
|
params[k].each { |k1,v1|
|
257
|
-
|
258
|
-
|
259
|
-
|
263
|
+
# eval "@xvars[@runseq.code][k1] = params.require(k1).permit(k1)"
|
264
|
+
eval "@xvars[@runseq.code][k1] = v1"
|
265
|
+
next unless v1.respond_to?(:original_filename)
|
260
266
|
get_image1(k, k1, params[k][k1])
|
261
267
|
}
|
262
268
|
else
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
269
|
+
# bug in to_unsalfe_h rails 5.1.6 https://github.com/getsentry/raven-ruby/issues/799
|
270
|
+
# Solution:
|
271
|
+
# https://stackoverflow.com/questions/34949505/rails-5-unable-to-retrieve-hash-values-from-parameter
|
272
|
+
# v = v.to_unsafe_h unless v.class == String
|
273
|
+
# v = params.require[k] unless v.class == String
|
268
274
|
v = v.to_s unless v.class == String
|
269
275
|
eval "@xvars[@runseq.code][k] = v"
|
270
276
|
end
|
@@ -304,14 +310,14 @@ class JindaController < ApplicationController
|
|
304
310
|
# process images from first level
|
305
311
|
def get_image(key, params)
|
306
312
|
doc = Jinda::Doc.create(
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
313
|
+
:name=> key.to_s,
|
314
|
+
:xmain=> @xmain.id,
|
315
|
+
:runseq=> @runseq.id,
|
316
|
+
:filename=> params.original_filename,
|
317
|
+
:content_type => params.content_type || 'application/zip',
|
318
|
+
:data_text=> '',
|
319
|
+
:ma_display=>true,
|
320
|
+
:ma_secured => @xmain.service.ma_secured )
|
315
321
|
if defined?(IMAGE_LOCATION)
|
316
322
|
filename = "#{IMAGE_LOCATION}/f#{Param.gen(:asset_id)}"
|
317
323
|
File.open(filename,"wb") { |f| f.write(params.read) }
|
@@ -327,13 +333,13 @@ class JindaController < ApplicationController
|
|
327
333
|
# process images from second level, e.g,, fields_for
|
328
334
|
def get_image1(key, key1, params)
|
329
335
|
doc = Jinda::Doc.create(
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
336
|
+
:name=> "#{key}_#{key1}",
|
337
|
+
:xmain=> @xmain.id,
|
338
|
+
:runseq=> @runseq.id,
|
339
|
+
:filename=> params.original_filename,
|
340
|
+
:content_type => params.content_type || 'application/zip',
|
341
|
+
:data_text=> '',
|
342
|
+
:ma_display=>true, :ma_secured => @xmain.service.ma_secured )
|
337
343
|
if defined?(IMAGE_LOCATION)
|
338
344
|
filename = "#{IMAGE_LOCATION}/f#{Param.gen(:asset_id)}"
|
339
345
|
File.open(filename,"wb") { |f| f.write(params.read) }
|
@@ -365,15 +371,15 @@ class JindaController < ApplicationController
|
|
365
371
|
# h = RDoc::Markup::ToHtml.new
|
366
372
|
# render :text=> h.convert(doc), :layout => 'layouts/_page'
|
367
373
|
}
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
374
|
+
format.pdf {
|
375
|
+
latex= Maruku.new(doc).to_latex
|
376
|
+
File.open('tmp/doc.md','w') {|f| f.puts doc}
|
377
|
+
File.open('tmp/doc.tex','w') {|f| f.puts latex}
|
378
|
+
# system('pdflatex tmp/doc.tex ')
|
379
|
+
# send_file( 'tmp/doc.pdf', :type => ‘application/pdf’,
|
380
|
+
# :disposition => ‘inline’, :filename => 'doc.pdf')
|
381
|
+
render :plain=>'done'
|
382
|
+
}
|
377
383
|
end
|
378
384
|
end
|
379
385
|
# handle uploaded image
|
@@ -397,7 +403,7 @@ class JindaController < ApplicationController
|
|
397
403
|
@xvars= @xmain.xvars
|
398
404
|
# flash.now[:notice]= "รายการ #{@xmain.id} ได้ถูกยกเลิกแล้ว" if @xmain.status=='X'
|
399
405
|
ma_log "Task #{@xmain.id} is cancelled" if @xmain.status=='X'
|
400
|
-
|
406
|
+
# flash.now[:notice]= "transaction #{@xmain.id} was cancelled" if @xmain.status=='X'
|
401
407
|
rescue
|
402
408
|
refresh_to "/", :alert => "Could not find task number <b> #{params[:xid]} </b>"
|
403
409
|
end
|
@@ -434,20 +440,20 @@ class JindaController < ApplicationController
|
|
434
440
|
custom_controller= "#{c}Controller"
|
435
441
|
params["return"] = request.env['HTTP_REFERER']
|
436
442
|
Jinda::Xmain.create :service=>service,
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
443
|
+
:start=>Time.now,
|
444
|
+
:name=>service.name,
|
445
|
+
:ip=> get_ip,
|
446
|
+
:status=>'I', # init
|
447
|
+
:user=>current_ma_user,
|
448
|
+
:xvars=> {
|
449
|
+
:service_id=>service.id,
|
450
|
+
:p=>params.to_unsafe_h,
|
451
|
+
:id=>params[:id],
|
452
|
+
:user_id=>current_ma_user.try(:id),
|
453
|
+
:custom_controller=>custom_controller,
|
454
|
+
:host=>request.host,
|
455
|
+
:referer=>request.env['HTTP_REFERER']
|
456
|
+
}
|
451
457
|
end
|
452
458
|
def create_runseq(xmain)
|
453
459
|
@xvars= xmain.xvars
|
@@ -484,10 +490,10 @@ class JindaController < ApplicationController
|
|
484
490
|
role= get_option_xml("role", activity) || default_role
|
485
491
|
rule= get_option_xml("rule", activity) || "true"
|
486
492
|
runseq= Jinda::Runseq.create :xmain=>xmain.id,
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
493
|
+
:name=> name, :action=> action,
|
494
|
+
:code=> code, :role=>role.upcase, :rule=> rule,
|
495
|
+
:rstep=> i, :form_step=> j, :status=>'I',
|
496
|
+
:xml=>activity.to_s
|
491
497
|
xmain.current_runseq= runseq.id if i==1
|
492
498
|
end
|
493
499
|
@xvars['total_steps']= i
|
@@ -497,7 +503,7 @@ class JindaController < ApplicationController
|
|
497
503
|
@xmain= Jinda::Xmain.find xmain
|
498
504
|
@xvars= @xmain.xvars
|
499
505
|
@runseq= @xmain.runseqs.find @xmain.current_runseq
|
500
|
-
# authorize?
|
506
|
+
# authorize?
|
501
507
|
@xvars['current_step']= @runseq.rstep
|
502
508
|
@xvars['referrer']= request.referrer
|
503
509
|
session[:xmain_id]= @xmain.id
|
@@ -523,10 +529,10 @@ class JindaController < ApplicationController
|
|
523
529
|
def store_asset
|
524
530
|
if params[:content]
|
525
531
|
doc = GmaDoc.create! :name=> 'asset',
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
532
|
+
:filename=> (params[:file_name]||''),
|
533
|
+
:content_type => (params[:content_type] || 'application/zip'),
|
534
|
+
:data_text=> '',
|
535
|
+
:ma_display=>true
|
530
536
|
path = (IMAGE_LOCATION || "tmp")
|
531
537
|
File.open("#{path}/f#{doc.id}","wb") { |f|
|
532
538
|
f.puts(params[:content])
|
@@ -2,7 +2,7 @@ class PasswordResetsController < ApplicationController
|
|
2
2
|
|
3
3
|
def create
|
4
4
|
##user = User.find_by_email(params[:email])
|
5
|
-
user = User.where(:email => params[:email]).first
|
5
|
+
user = Jinda::User.where(:email => params[:email]).first
|
6
6
|
|
7
7
|
user.send_password_reset if user
|
8
8
|
redirect_to root_url, :notice => "Email sent with password reset instructions."
|
@@ -10,12 +10,12 @@ class PasswordResetsController < ApplicationController
|
|
10
10
|
|
11
11
|
def edit
|
12
12
|
##@user = User.find_by_password_reset_token!(params[:id])
|
13
|
-
@user = User.where(:password_reset_token => params[:id]).first
|
13
|
+
@user = Jinda::User.where(:password_reset_token => params[:id]).first
|
14
14
|
end
|
15
15
|
|
16
16
|
def update
|
17
17
|
##@user = User.find_by_password_reset_token!(params[:id])
|
18
|
-
@user = User.where(:password_reset_token => params[:id]).first
|
18
|
+
@user = Jinda::User.where(:password_reset_token => params[:id]).first
|
19
19
|
if @user.password_reset_sent_at < 2.hours.ago
|
20
20
|
redirect_to new_password_reset_path, :alert => "Password reset has expired."
|
21
21
|
elsif @user.update_attributes(params[:user])
|
@@ -5,7 +5,7 @@ class PasswordResetsController < ApplicationController
|
|
5
5
|
|
6
6
|
def create
|
7
7
|
#user = User.find_by_email(params[:email])
|
8
|
-
user = User.where(:email => params[:email]).first
|
8
|
+
user = Jinda::User.where(:email => params[:email]).first
|
9
9
|
|
10
10
|
user.send_password_reset if user
|
11
11
|
redirect_to root_url, :ma_notice => "Email sent with password reset instructions."
|
@@ -14,12 +14,12 @@ class PasswordResetsController < ApplicationController
|
|
14
14
|
def edit
|
15
15
|
## Deprecated syntax in rail 5
|
16
16
|
##@user = User.find_by_password_reset_token!(params[:id])
|
17
|
-
@user = User.where(:password_reset_token => params[:id]).first
|
17
|
+
@user = Jinda::User.where(:password_reset_token => params[:id]).first
|
18
18
|
end
|
19
19
|
|
20
20
|
def update
|
21
21
|
##@user = User.find_by_password_reset_token!(params[:id])
|
22
|
-
@user = User.where(:password_reset_token => params[:id]).first
|
22
|
+
@user = Jinda::User.where(:password_reset_token => params[:id]).first
|
23
23
|
if @user.password_reset_sent_at < 2.hours.ago
|
24
24
|
redirect_to new_password_reset_path, :alert => "Password ↵
|
25
25
|
reset has expired."
|
@@ -11,7 +11,7 @@ class Jinda::Doc
|
|
11
11
|
field :cloudinary, :type => Boolean
|
12
12
|
belongs_to :xmain, :class_name => "Jinda::Xmain"
|
13
13
|
belongs_to :runseq, :class_name => "Jinda::Runseq"
|
14
|
-
belongs_to :user
|
14
|
+
belongs_to :user, :class_name => "Jinda::User"
|
15
15
|
belongs_to :service, :class_name => "Jinda::Service"
|
16
16
|
field :ip, :type => String
|
17
17
|
field :ma_display, :type => Boolean
|
@@ -14,14 +14,14 @@
|
|
14
14
|
%h2 Recently tested with:
|
15
15
|
%ul
|
16
16
|
%li Rubygems 2.5.0
|
17
|
-
%li Rails 5.2.
|
17
|
+
%li Rails 5.2.3
|
18
18
|
%li rails new YOURAPP --skip-test-unit --skip-bundle --skip-active-record
|
19
19
|
%li (rails new YOURAPP -BOT)
|
20
20
|
|
21
21
|
|
22
22
|
%h2 Installation
|
23
23
|
%ul
|
24
|
-
%li add gem 'jinda', '0.3.
|
24
|
+
%li add gem 'jinda', '0.3.4'
|
25
25
|
%li bundle
|
26
26
|
%li rails generate jinda:install
|
27
27
|
%li bundle
|
@@ -0,0 +1,18 @@
|
|
1
|
+
- @title= "Notice Error Logs"
|
2
|
+
= paginate @notices
|
3
|
+
%table{:id=>"pending-table", :width=>"100%"}
|
4
|
+
%tr{:style=>"color:white; background-color:#97BF60;"}
|
5
|
+
%th created
|
6
|
+
%th user
|
7
|
+
%th message
|
8
|
+
- @notices.each do |notice|
|
9
|
+
- @notice= notice
|
10
|
+
- current_notice = @notice.id
|
11
|
+
- #current_notice_user = @notice.user
|
12
|
+
- notice_user = (Jinda::User.find @notice.user ? notice.user : 0)
|
13
|
+
- (notice_user_name = notice_user.code) if notice_user
|
14
|
+
|
15
|
+
%tr
|
16
|
+
%td(style='vertical-align:top;')= notice.created_at
|
17
|
+
%td(style='vertical-align:top;')= notice_user_name
|
18
|
+
%td(style='vertical-align:top;')= notice.message
|
data/lib/jinda/helpers.rb
CHANGED
@@ -102,12 +102,14 @@ module Jinda
|
|
102
102
|
$user_image = current_ma_user.image
|
103
103
|
$user_name = current_ma_user.code
|
104
104
|
$user_email = current_ma_user.email
|
105
|
+
$user_id = current_ma_user.try(:id)
|
105
106
|
else
|
106
107
|
$user_image = asset_url("user.png", :width => "48")
|
107
108
|
$user_name = 'Guest User'
|
108
109
|
$user_email = 'guest@sample.com'
|
110
|
+
$user_id = ''
|
109
111
|
end
|
110
|
-
return $user_image, $user_name, $user_email
|
112
|
+
return $user_image, $user_name, $user_email,$user_id
|
111
113
|
end
|
112
114
|
|
113
115
|
def name2code(s)
|
@@ -159,15 +161,15 @@ module Jinda
|
|
159
161
|
end
|
160
162
|
end
|
161
163
|
def ma_log(message)
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
164
|
+
# Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
|
165
|
+
# :unread=> true, :ip=> ($ip || request.env["REMOTE_ADDR"])
|
166
|
+
if session[:user_id]
|
167
|
+
Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
|
168
|
+
:user_id => $user.id, :unread=> true, :ip=>request.env["REMOTE_ADDR"]
|
169
|
+
else
|
170
|
+
Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
|
171
|
+
:unread=> true, :ip=>request.env["REMOTE_ADDR"]
|
172
|
+
end
|
171
173
|
end
|
172
174
|
|
173
175
|
alias :ma_notice :ma_log
|
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.3.
|
4
|
+
version: 0.3.4
|
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: 2019-
|
12
|
+
date: 2019-04-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -378,6 +378,7 @@ files:
|
|
378
378
|
- lib/generators/jinda/templates/app/views/jinda/help.haml
|
379
379
|
- lib/generators/jinda/templates/app/views/jinda/index.html.haml
|
380
380
|
- lib/generators/jinda/templates/app/views/jinda/logs.haml
|
381
|
+
- lib/generators/jinda/templates/app/views/jinda/notice_logs.haml
|
381
382
|
- lib/generators/jinda/templates/app/views/jinda/pending.haml
|
382
383
|
- lib/generators/jinda/templates/app/views/jinda/run_form.haml
|
383
384
|
- lib/generators/jinda/templates/app/views/jinda/run_output.haml
|