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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6412f7c9df60f94abda676a7ebfe87dcdc0249a3c90947a3917c5a6c79c987c0
4
- data.tar.gz: fee6c6c8aadf5d23b8baf804fc5c7424d0d1e0c443c2bade395b2d67320c39d5
3
+ metadata.gz: 34a83590140593e5245b54ea6edbfadc73dd4adaea05877d9743b64f06cd36e5
4
+ data.tar.gz: 644da69d744877a19d598a49ef21bb14bc8895cd17cd80122f5f2b9d03691519
5
5
  SHA512:
6
- metadata.gz: c43442994c7a7567b0ace50547feed51e77a83238df4653d203a45ef825c19ff66cc4b9d1bdb0d9b1ff3f4e4a7cf864ee2ac736ac459029b1d437c2a57c4e908
7
- data.tar.gz: efce113507fff946c4d924c857b2dde89fee4a1e79b9515881842f19360b92642c10db5be702950ae4ad7bb0f2007d9c1e6b40c399e908a360382236d5763174
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.1
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.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
- gem 'omniauth-google-oauth2'
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
- gem 'database_cleaner'
44
+ gem 'database_cleaner'
44
45
  gem 'guard'
45
46
  gem 'guard-rspec'
46
47
  gem 'guard-minitest'
47
48
  gem 'capybara'
48
- gem 'selenium-webdriver'
49
+ gem 'selenium-webdriver'
49
50
  gem 'rb-fsevent'
50
- gem 'valid_attribute'
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
- route "get '/articles/my/destroy' => 'articles#destroy'"
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
- end
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 = {
@@ -20,6 +20,5 @@
20
20
  //= require jqm/jinda
21
21
  // require turbolinks
22
22
  //= require jqm/disable_enter_key.js
23
- //= require ckeditor/init
24
23
 
25
24
 
@@ -1,6 +1,6 @@
1
1
  class AdminsController < ApplicationController
2
2
  def update_role
3
- user = User.find_by :code=> $xvars["select_user"]["code"]
3
+ user = Jinda::User.find_by :code=> $xvars["select_user"]["code"]
4
4
  user.update_attribute :role, $xvars["edit_role"]["role"]
5
5
  end
6
6
  end
@@ -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
- if @service && authorize_init?
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
- # action from @runseq.action == do, form, if, output
65
- # Then will call def run_do, run_form, run_if, run_output
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
- # Run View Form f created template by jinda rake follow freemind mm file
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
- @ui= File.read(f)
92
- else
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
- :xmain=>@xmain, :runseq=>@runseq, :user=>current_ma_user,
173
- :ip=> get_ip, :service=>service, :ma_display=>ma_display,
174
- :ma_secured => @xmain.service.ma_secured
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
- :content_type=>"output", :data_text=> render_to_string(:inline=>@ui, :layout=>"utf8"),
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
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 &gt;"
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
- :content_type=>"mail", :data_text=> render_to_string(:inline=>@ui, :layout=>false),
202
- :xmain=>@xmain, :runseq=>@runseq, :user=>current_ma_user,
203
- :ip=> get_ip, :service=>service, :ma_display=>false,
204
- :ma_secured => @xmain.service.ma_secured
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
- # Search for uploaded file name if exist
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
- # check if params of array in form eg: edit_article
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
- # eval "@xvars[@runseq.code][k1] = params.require(k1).permit(k1)"
258
- eval "@xvars[@runseq.code][k1] = v1"
259
- next unless v1.respond_to?(:original_filename)
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
- # bug in to_unsalfe_h rails 5.1.6 https://github.com/getsentry/raven-ruby/issues/799
264
- # Solution:
265
- # https://stackoverflow.com/questions/34949505/rails-5-unable-to-retrieve-hash-values-from-parameter
266
- # v = v.to_unsafe_h unless v.class == String
267
- # v = params.require[k] unless v.class == String
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
- :name=> key.to_s,
308
- :xmain=> @xmain.id,
309
- :runseq=> @runseq.id,
310
- :filename=> params.original_filename,
311
- :content_type => params.content_type || 'application/zip',
312
- :data_text=> '',
313
- :ma_display=>true,
314
- :ma_secured => @xmain.service.ma_secured )
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
- :name=> "#{key}_#{key1}",
331
- :xmain=> @xmain.id,
332
- :runseq=> @runseq.id,
333
- :filename=> params.original_filename,
334
- :content_type => params.content_type || 'application/zip',
335
- :data_text=> '',
336
- :ma_display=>true, :ma_secured => @xmain.service.ma_secured )
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
- format.pdf {
369
- latex= Maruku.new(doc).to_latex
370
- File.open('tmp/doc.md','w') {|f| f.puts doc}
371
- File.open('tmp/doc.tex','w') {|f| f.puts latex}
372
- # system('pdflatex tmp/doc.tex ')
373
- # send_file( 'tmp/doc.pdf', :type => ‘application/pdf’,
374
- # :disposition => ‘inline’, :filename => 'doc.pdf')
375
- render :plain=>'done'
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
- # flash.now[:notice]= "transaction #{@xmain.id} was cancelled" if @xmain.status=='X'
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
- :start=>Time.now,
438
- :name=>service.name,
439
- :ip=> get_ip,
440
- :status=>'I', # init
441
- :user=>current_ma_user,
442
- :xvars=> {
443
- :service_id=>service.id,
444
- :p=>params.to_unsafe_h,
445
- :id=>params[:id],
446
- :user_id=>current_ma_user.try(:id),
447
- :custom_controller=>custom_controller,
448
- :host=>request.host,
449
- :referer=>request.env['HTTP_REFERER']
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
- :name=> name, :action=> action,
488
- :code=> code, :role=>role.upcase, :rule=> rule,
489
- :rstep=> i, :form_step=> j, :status=>'I',
490
- :xml=>activity.to_s
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
- :filename=> (params[:file_name]||''),
527
- :content_type => (params[:content_type] || 'application/zip'),
528
- :data_text=> '',
529
- :ma_display=>true
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 &crarr;
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
@@ -5,7 +5,7 @@ class Jinda::Notice
5
5
  field :message, :type => String
6
6
  field :unread, :type => Boolean
7
7
  field :ip, :type => String
8
- belongs_to :user
8
+ belongs_to :user, :class_name => "Jinda::User"
9
9
 
10
10
  def self.recent(user_id, ip)
11
11
  where(unread: true, ip: ip).last
@@ -4,5 +4,5 @@ class Jinda::Role
4
4
  include Mongoid::Timestamps
5
5
  field :code, :type => String
6
6
  field :name, :type => String
7
- belongs_to :user
7
+ belongs_to :user, :class_name => "Jinda::User"
8
8
  end
@@ -2,7 +2,7 @@
2
2
  class Jinda::Runseq
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
- belongs_to :user
5
+ belongs_to :user, :class_name => "Jinda::User"
6
6
  belongs_to :xmain, :class_name => "Jinda::Xmain"
7
7
 
8
8
  field :action, :type => String
@@ -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.1
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.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
- Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
163
- :unread=> true, :ip=> ($ip || request.env["REMOTE_ADDR"])
164
- # if session[:user_id]
165
- # Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
166
- # :user_id => $user.id, :unread=> true, :ip=>request.env["REMOTE_ADDR"]
167
- # else
168
- # Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
169
- # :unread=> true, :ip=>request.env["REMOTE_ADDR"]
170
- # end
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
@@ -1,3 +1,3 @@
1
1
  module Jinda
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
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.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-03-21 00:00:00.000000000 Z
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