40 lines
1.2 KiB
Ruby
40 lines
1.2 KiB
Ruby
# encoding: utf-8
|
|
require 'rubyXL'
|
|
class Admin::CancerpredictsController < OrbitAdminController
|
|
#include Admin::CancerpredictsHelper
|
|
before_action ->(module_app = @app_title) { set_variables module_app }
|
|
before_action :create_first_field
|
|
#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
|
|
def edit
|
|
end
|
|
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
|
|
end |