cancer_predict/app/controllers/admin/cancerpredicts_controller.rb

38 lines
1.2 KiB
Ruby
Raw Normal View History

2019-11-15 00:44:28 +00:00
# encoding: utf-8
require 'rubyXL'
class Admin::CancerpredictsController < OrbitAdminController
2019-11-15 09:02:17 +00:00
#include Admin::CancerpredictsHelper
2019-11-15 00:44:28 +00:00
before_action ->(module_app = @app_title) { set_variables module_app }
2019-11-23 03:15:11 +00:00
before_action :create_first_field
2019-11-15 00:44:28 +00:00
#before_action :load_access_levels
def initialize
super
@app_title = "cancerpredict"
end
def index
@tags = @module_app.tags
@categories = @module_app.categories.enabled
@filter_fields = filter_fields(@categories, @tags)
@table_fields = [:status, :category, :title, :start_date, :end_date, :last_modified]
if request.xhr?
render :partial => "index"
end
end
2019-11-23 03:15:11 +00:00
def create_first_field
if Cancerpredictfields.where("title"=>(@app_title + "_back")).take_while{true}.count == 0
@form_to_show = Cancerpredictfields.new()
@form_to_show.title = @app_title +"_back"
@form_to_show.save
end
@form_to_show
if Cancerpredictfields.where("title"=>@app_title).take_while{true}.count == 0
@form_to_show = Cancerpredictfields.new()
@form_to_show.title=@app_title
@form_to_show.save
@form_to_show = Cancerpredictfields.where("title"=>@app_title).first
else
@form_to_show = Cancerpredictfields.where("title"=>@app_title).first
end
end
2019-11-15 00:44:28 +00:00
end