Class: JindaController

Inherits:
ApplicationController show all
Includes:
JindaGeneralConcern, JindaRunConcern
Defined in:
app/controllers/jinda_controller.rb

Instance Method Summary collapse

Methods included from JindaGeneralConcern

#cancel, #doc, #doc_print, #document, #err404, #err500, #error_logs, #get_image, #get_image1, #help, #index, #logs, #notice_logs, #pending, #search, #status

Methods included from JindaRunConcern

#end_action, #end_form, #end_output, #run_direct_to, #run_do, #run_folder, #run_form, #run_if, #run_list, #run_mail, #run_output, #run_redirect

Methods inherited from ApplicationController

#prepare_meta_tags

Instance Method Details

#initObject

view menu by user selected what service (module and code) to run (not all services like menu did Its only one service



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/jinda_controller.rb', line 9

def init
  module_code, code = params[:s].split(":")
  @service= Jinda::Service.where(:module_code=> module_code, :code=> code).first
  if @service && authorize_init?
    xmain = create_xmain(@service)
    result = create_runseq(xmain)
    unless result
      message = "Node missing action icon: cannot find action for xmain #{xmain.id}, the node required action(icon) in freemind eg: form, list, method"
      ma_log(message)
      flash[:notice]= message
      redirect_to "pending" and return
    end
    xmain.update_attribute(:xvars, @xvars)
    xmain.runseqs.last.update_attribute(:end,true)
    #Above line cause error update_attribute in heroku shown in logs and it was proposed to fixed in github:'kul1/g241502'
    # Main action run with :id
    redirect_to :action=>'run', :id=>xmain.id
    
  else
    refresh_to "/", :alert => "Error: cannot process"
    error_run_xmain = "Error_run_xmain"
    ma_log(error_run_xmain)
  end
end

#runObject

] run if, form, mail, output etc depend on icon in freemind action from @r.action == do, form, if, output Then will call def run_do, run_form, run_if, run_output ]

run

init_vars 
To get all var from global and runseq, action
  (@runseq.action)

run_do, run_form, run_if, run_output
  run_do => controller => action eg: update, create, document
  run_form => 
    run_form.haml => - next step => def end_form
    - next_step = end_form
  run_if =>
  run_output =>

end_action
=> save local var to database :current_runseq
:current_runseq => next_runseq


57
58
59
60
61
62
63
64
65
# File 'app/controllers/jinda_controller.rb', line 57

def run
  init_vars(params[:id])
  if authorize?
    # session[:full_layout]= false
    redirect_to(:action=>"run_#{@runseq.action}", :id=>@xmain.id)
  else
    redirect_to_root
  end
end