diff --git a/cancerpredict.gemspec b/cancerpredict.gemspec index 4a1a180..6e59fc2 100644 --- a/cancerpredict.gemspec +++ b/cancerpredict.gemspec @@ -1,6 +1,40 @@ # -*- encoding: utf-8 -*- # stub: cancerpredict 0.0.1 ruby lib - +insert_flag = 0 +app_path = File.expand_path(__dir__) +template_path = ENV['PWD'] + '/app/templates' +all_template = Dir.glob(template_path+'/*/') +puts 'copying module' +check_texts = '<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js"%>' +edit_texts = '<%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"%>' +all_template.each do |folder| + if !folder.include?('mobile') + begin + if folder.split('/')[-1] != 'mobile' + begin + system ('cp -r '+ app_path + '/modules/. ' + folder+'/modules/.') + puts "finish copy module cancerpredict to #{folder}" + rescue + puts 'error copy' + end + end + texts = File.read(folder+'partial/_head.html.erb') + insert_flag = 0 + if texts.include?(check_texts) + texts = texts.gsub(check_texts,edit_texts) + insert_flag = 1 + end + if insert_flag == 1 + puts 'editing _head.html.erb' + f = File.open(folder+'partial/_head.html.erb','w') + f.write(texts) + f.close + end + rescue + puts "not found _head.html.erb in #{folder}" + end + end +end Gem::Specification.new do |s| s.name = "cancerpredict" s.version = "0.0.1" diff --git a/config/routes.rb b/config/routes.rb index 6d9efd1..cd15307 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,5 +12,7 @@ Rails.application.routes.draw do get 'cancerpredicts/export_cancer_tool_record' , to: 'cancerpredicts#export_cancer_tool_record' resources :cancerpredicts end + get "cancerpredictResult", to: "cancerpredicts#calculate" + post "cancerpredictResult", to: "cancerpredicts#calculate" end end diff --git a/lib/cancerpredict/engine.rb b/lib/cancerpredict/engine.rb index ca678fc..8428a15 100644 --- a/lib/cancerpredict/engine.rb +++ b/lib/cancerpredict/engine.rb @@ -9,29 +9,30 @@ module Cancerpredict authorizable widget_methods ["widget"] widget_settings [{"data_count"=>1}] - frontend_enabled - side_bar do - head_label_i18n 'cancerpredict.cancerpredict', icon_class: "icons-megaphone" - available_for "users" - active_for_controllers (['admin/cancerpredicts']) - head_link_path "admin_cancerpredicts_path" + set_keyword_contstraints ['cancerpredictResult'] + frontend_enabled + side_bar do + head_label_i18n 'cancerpredict.cancerpredict', icon_class: "icons-megaphone" + available_for "users" + active_for_controllers (['admin/cancerpredicts']) + head_link_path "admin_cancerpredicts_path" - context_link 'cancerpredict.cancerpredict', - :link_path=>"admin_cancerpredicts_path" , - :priority=>1, - :active_for_action=>{'admin/cancerpredicts'=>'index'}, - :available_for => 'users' - context_link 'cancerpredict.submitResult', - :link_path=>"admin_cancerpredicts_showSubmit_path" , - :priority=>1, - :active_for_action=>{'admin/cancerpredicts'=>'show_submit'}, - :available_for => 'users' - context_link 'cancerpredict.export_cancer_predict_tool_records', - :link_path=>"admin_cancerpredicts_export_cancer_tool_record_path" , - :priority=>1, - :active_for_action=>{'admin/cancerpredicts'=>'export_cancer_tool_record'}, - :available_for => 'users' - end + context_link 'cancerpredict.cancerpredict', + :link_path=>"admin_cancerpredicts_path" , + :priority=>1, + :active_for_action=>{'admin/cancerpredicts'=>'index'}, + :available_for => 'users' + context_link 'cancerpredict.submitResult', + :link_path=>"admin_cancerpredicts_showSubmit_path" , + :priority=>1, + :active_for_action=>{'admin/cancerpredicts'=>'show_submit'}, + :available_for => 'users' + context_link 'cancerpredict.export_cancer_predict_tool_records', + :link_path=>"admin_cancerpredicts_export_cancer_tool_record_path" , + :priority=>1, + :active_for_action=>{'admin/cancerpredicts'=>'export_cancer_tool_record'}, + :available_for => 'users' + end end end end