This commit is contained in:
BOHUNG 2020-02-06 15:48:50 +08:00
parent d1f87a2370
commit 7441a96bc5
3 changed files with 60 additions and 23 deletions

View File

@ -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"

View File

@ -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

View File

@ -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