source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
PecanProject/bety
https://github.com/PecanProject/bety
app/helpers/bulk_upload_helper.rb
Ruby
bsd-3-clause
19
develop
4,825
module BulkUploadHelper MAXIMUM_ERRORS_TO_DISPLAY_PER_TYPE = 10 # maps data reference errors to appropriate page for finding or # adding referents ERROR_REMEDY_MAP = { unresolvable_citation_reference: { link_url: :citations, link_text: "Search for or add citation" }, unresolvable_site_reference: { lin...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/helpers/application_helper.rb
Ruby
bsd-3-clause
19
develop
9,570
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper DATA_ACCESS_LEVELS = [ ["1. Restricted", 1], ["2. Internal & Collaborators", 2], ["3. External Researcher", 3], ["4. Public", 4] ] ABBREVIATED_DATA_ACCESS_LEVELS = [ ["1. Restricted", 1], ["2. Internal", ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/helpers/users_helper.rb
Ruby
bsd-3-clause
19
develop
3,825
module UsersHelper # # Use this to wrap view elements that the user can't access. # !! Note: this is an *interface*, not *security* feature !! # You need to do all access control at the controller level. # # Example: # <%= if_authorized?(:index, User) do link_to('List all users', users_path) end %> ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/helpers/formats_helper.rb
Ruby
bsd-3-clause
19
develop
9,207
module FormatsHelper # $mime_types = ["applicaiton/x-bytecode.python", "application/acad", "application/arj", "application/base64", "application/binhex", "application/binhex4", "application/book", "application/cdf", "application/clariscad", "application/commonground", "application/drafting", "application/dsptype", "a...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/lib/api/csv_handler.rb
Ruby
bsd-3-clause
19
develop
8,561
require 'memoist' module Api::CsvHandler extend Memoist class BadHeading < Exception end STAT_HEADING_NAMES = ["SE", "n"] CITATION_HEADING_NAMES = ["citation_doi", "citation_author", "citation_title", "citation_year"] CHILD_ELEMENT_HEADING_NAMES = ["site", "species", "treatme...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/lib/api/trait_creation_support.rb
Ruby
bsd-3-clause
19
develop
17,370
module Api::TraitCreationSupport include JsonHandler, CsvHandler private # Exception to signal document didn't validate against schema or had other # structural problems not captured by the schema constraints. class InvalidDocument < StandardError end # Exception used for various data errors that prev...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/lib/api/json_handler.rb
Ruby
bsd-3-clause
19
develop
1,159
module Api::JsonHandler private ##### JSON HANDLING ##### def json_2_xml(json_string) doc_as_hash = Yajl::Parser.parse(json_string) doc = Nokogiri::XML::Document.new def create_element(doc, hash) if hash.keys.size != 1 raise "Unexpected hash size" end element_name = has...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/lib/utilities/sql_comments.rb
Ruby
bsd-3-clause
19
develop
750
module Utilities::SQLComments def self.get_column_comment(table_name, column_name) query = <<-QUERY SELECT d.description FROM pg_description d JOIN information_schema.columns c ON (c.table_schema = current_schema AND (current_schema || '.' || c.table_name)::regclass = ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/formats_controller.rb
Ruby
bsd-3-clause
19
develop
5,088
class FormatsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction def rem_formats_variables formats_variable = FormatsVariable.find(params[:id]) @format = formats_variable.format formats_variable.destroy respond_to do |format| format...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/workflows_controller.rb
Ruby
bsd-3-clause
19
develop
1,604
class WorkflowsController < ApplicationController before_action :login_required, :except => [ :show ] helper_method :sort_column, :sort_direction require 'csv' # GET /workflows # GET /workflows.xml def index if params[:format].nil? or params[:format] == 'html' @iteration = params[:iteration][/\d...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/inputs_runs_controller.rb
Ruby
bsd-3-clause
19
develop
1,753
class InputsRunsController < ApplicationController before_action :login_required, :except => [ :show ] require 'csv' # GET /inputsruns # GET /inputsruns.xml def index params[:format] = 'xml' if params[:format].nil? # We have a lot of params and they or may not have to be # passed as conditions ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/pfts_species_controller.rb
Ruby
bsd-3-clause
19
develop
1,782
class PftsSpeciesController < ApplicationController before_action :login_required, :except => [ :show ] require 'csv' # GET /pftsspecies # GET /pftsspecies.xml def index params[:format] = 'xml' if params[:format].nil? # We have a lot of params and they or may not have to be # passed as conditio...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/yields_controller.rb
Ruby
bsd-3-clause
19
develop
7,443
class YieldsController < ApplicationController before_action :login_required, :except => [ :show ] helper_method :sort_column, :sort_direction require 'csv' def checked id = params[:id] y = Yield.all_limited(current_user).find(id) if y y.checked = params[:y][:checked] end @element_...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/priors_controller.rb
Ruby
bsd-3-clause
19
develop
6,398
class PriorsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction require 'csv' require 'open3' def search_pfts @prior = Prior.find(params[:id]) # the "sorted_order" call is mainly so "search" has the joins it needs @pfts = Pft.sorted_order...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/models_controller.rb
Ruby
bsd-3-clause
19
develop
5,168
class ModelsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction def edit_models_files @model = Model.find(params[:id]) file = params[:file] if @model and file _file = DBFile.find(file) # If relationship exists we must want to remo...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/cultivars_controller.rb
Ruby
bsd-3-clause
19
develop
4,968
class CultivarsController < ApplicationController before_action :login_required, :except => [ :show ] helper_method :sort_column, :sort_direction require 'csv' # autocompletion for bulk upload wizard def bu_autocomplete search_term = params[:term] species_id = Specie.find_by_scientificname(params[:...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/pfts_controller.rb
Ruby
bsd-3-clause
19
develop
7,085
class PftsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction require 'csv' # restful-authentication override def access_denied flash[:notice] = 'You have insufficient permissions to create new PFTs' redirect_to root_path end def searc...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/traits_controller.rb
Ruby
bsd-3-clause
19
develop
8,536
class TraitsController < ApplicationController before_action :login_required, :except => [ :show ] helper_method :sort_column, :sort_direction require 'csv' require 'timeout' def trait_search @query = params[:symbol] || nil if !params[:symbol].nil? and !params[:cont].nil? and params[:symbol].length ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/application_controller.rb
Ruby
bsd-3-clause
19
develop
7,810
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base rescue_from ActiveRecord::InvalidForeignKey do |e| case e.message # deletion of sites when /fk...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/posteriors_controller.rb
Ruby
bsd-3-clause
19
develop
1,540
class PosteriorsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction # GET /posteriors # GET /posteriors.xml def index if params[:format].nil? or params[:format] == 'html' @iteration = params[:iteration][/\d+/] rescue 1 @posteriors = Po...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/yieldsviews_controller.rb
Ruby
bsd-3-clause
19
develop
1,010
class YieldsviewsController < ApplicationController before_action :login_required require 'csv' # GET /yields/1 # GET /yields/1.xml def show @yield = Yieldsview.all_limited(current_user).find_by_yield_id(params[:id]) if !logged_in? or @yield.nil? @yield = nil if @yield.nil? or !@yield.checked...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/variables_controller.rb
Ruby
bsd-3-clause
19
develop
4,076
class VariablesController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction require 'csv' # general autocompletion def autocomplete variables = search_model(Variable.order(:description), %w( name units ), params[:term]) variables = variables.to_a.map ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/managements_treatments_controller.rb
Ruby
bsd-3-clause
19
develop
2,063
class ManagementsTreatmentsController < ApplicationController before_action :login_required, :except => [ :show ] require 'csv' # GET /managementstreatments # GET /managementstreatments.xml def index params[:format] = 'xml' if params[:format].nil? # We have a lot of params and they or may not have ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/ensembles_controller.rb
Ruby
bsd-3-clause
19
develop
1,290
class EnsemblesController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction # GET /ensembles # GET /ensembles.xml def index if params[:format].nil? or params[:format] == 'html' @iteration = params[:iteration][/\d+/] rescue 1 @ensembles = Ensemb...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/maps_controller.rb
Ruby
bsd-3-clause
19
develop
8,081
if Rails.env == "production" require "#{Rails.root}/lib/mercator" include Mercator end require 'will_paginate/array' class MapsController < ApplicationController layout 'application' def location_yields_lookup location = County.where('state like ? and name like ?',params[:state],params[:county]).first ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/methods_controller.rb
Ruby
bsd-3-clause
19
develop
3,930
# coding: utf-8 class MethodsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction # This action acts as a _source_ for the jQuery UI autocompletion widgets on # the Bulk Upload "Specify Upload Options and Global Values" page. It # responds by sending ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/dbfiles_controller.rb
Ruby
bsd-3-clause
19
develop
4,863
class DbfilesController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction require 'csv' def download file = DBFile.find(params[:id]) rescue nil # Need to make sure someone cannot create a link to other files on forecast # by modifying the file_path...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/sites_controller.rb
Ruby
bsd-3-clause
19
develop
8,543
class SitesController < ApplicationController before_action :login_required, :except => [ :show ] helper_method :sort_column, :sort_direction layout 'application', :except => [ :map ] require 'csv' #AJAX Calls def linked @citation = Citation.find(session["citation"]) @site = Site.find(params[:id]...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/users_controller.rb
Ruby
bsd-3-clause
19
develop
4,324
class UsersController < ApplicationController before_action :login_required, :except => [:create,:new] helper_method :sort_column, :sort_direction def index @iteration = params[:iteration][/\d+/] rescue 1 if current_user.page_access_level == 1 @users = User.sorted_order("#{sort_column('users', 'c...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/citations_sites_controller.rb
Ruby
bsd-3-clause
19
develop
1,827
class CitationsSitesController < ApplicationController before_action :login_required, :except => [ :show ] require 'csv' # GET /sites # GET /sites.xml def index params[:format] = 'xml' if params[:format].nil? # We have a lot of params and they or may not have to be # passed as conditions this i...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/trait_covariate_associations_controller.rb
Ruby
bsd-3-clause
19
develop
202
class TraitCovariateAssociationsController < ApplicationController def index @recognized_traits = TraitCovariateAssociation.all.map { |tca| Variable.find(tca.trait_variable_id) }.uniq end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/feedback_controller.rb
Ruby
bsd-3-clause
19
develop
231
class FeedbackController < ApplicationController def feedback_email ContactMailer::feedback_email(params[:feedback_email]).deliver respond_to do |format| format.js {render :layout =>false} end end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/entities_controller.rb
Ruby
bsd-3-clause
19
develop
3,060
class EntitiesController < ApplicationController require 'will_paginate/array' before_action :login_required # GET /entitys # GET /entitys.xml def index # @entities = Entity.all @entities = Entity.order('created_at DESC').page(params[:page]) respond_to do |format| format.html # index.html...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/sessions_controller.rb
Ruby
bsd-3-clause
19
develop
3,031
# This controller handles the login/logout function of the site. include AuthenticatedSystem class SessionsController < ApplicationController # This should be used on opening the home page ... before a user logs in # On attempting to login from this page ... feed it to the create method in this controller def ne...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/contacts_controller.rb
Ruby
bsd-3-clause
19
develop
342
class ContactsController < ApplicationController def index respond_to do |format| format.html # index.html.erb end end def send_mail ContactMailer::contact_email(params[:email]).deliver flash[:notice] = "Thank you for your email." respond_to do |format| format.html # index.html.e...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/bulk_upload_controller.rb
Ruby
bsd-3-clause
19
develop
18,942
# # Controller for the Bulk Upload wizard. The steps of the wizard are # # 1. {start_upload} # # The user is presented with a form for choosing a file to upload. # # 1. {choose_global_citation} # # The user is presented with a form for choosing a global (dataset-wide) # citation. This page is skipped if...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/species_controller.rb
Ruby
bsd-3-clause
19
develop
7,003
# encoding: utf-8 # RAILS3 added above encoding (actually this is needed with Ruby 1.9.2) class SpeciesController < ApplicationController before_action :login_required, :except => [ :show ] helper_method :sort_column, :sort_direction require 'csv' # autocompletion for bulk upload wizard def bu_autocomplete...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/citations_controller.rb
Ruby
bsd-3-clause
19
develop
6,577
class CitationsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction require 'csv' # General autocompletion # @calls {search_model} def autocomplete citations = search_model(Citation.order('author'), %w( author title ), params[:term]) citati...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/likelihoods_controller.rb
Ruby
bsd-3-clause
19
develop
3,666
class LikelihoodsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction # GET /likelihoods # GET /likelihoods.xml def index if params[:format].nil? or params[:format] == 'html' @iteration = params[:iteration][/\d+/] rescue 1 @likelihoods ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/managements_controller.rb
Ruby
bsd-3-clause
19
develop
6,122
class ManagementsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction require 'csv' def search_treatments @management = Management.find(params[:id]) # the "sorted_order" call is mainly so "search" has the joins it needs @treatments = Treatme...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/mimetypes_controller.rb
Ruby
bsd-3-clause
19
develop
384
class MimetypesController < ApplicationController def autocomplete mimetypes = search_model(Mimetype.order(:type_string), %w( type_string ), params[:term]) mimetypes = mimetypes.to_a.map do |item| { label: item.type_string, value: item.id } end respond_to do |format| ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/runs_controller.rb
Ruby
bsd-3-clause
19
develop
1,402
class RunsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction # GET /runs # GET /runs.xml def index if params[:format].nil? or params[:format] == 'html' @iteration = params[:iteration][/\d+/] rescue 1 @runs = Run.sorted_order("#{sort_c...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/experiments_controller.rb
Ruby
bsd-3-clause
19
develop
3,478
class ExperimentsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction # GET /experiments # GET /experiments.xml def index if params[:format].nil? or params[:format] == 'html' @iteration = params[:iteration][/\d+/] rescue 1 @experiments ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/sitegroups_controller.rb
Ruby
bsd-3-clause
19
develop
5,567
class SitegroupsController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction def edit_sitegroups_sites @sitegroup = Sitegroup.access(current_user).find(params[:id]) site = params[:site] if @sitegroup and site _site = Site.find(site) # If r...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/pfts_priors_controller.rb
Ruby
bsd-3-clause
19
develop
1,753
class PftsPriorsController < ApplicationController before_action :login_required, :except => [ :show ] require 'csv' # GET /pftspriors # GET /pftspriors.xml def index params[:format] = 'xml' if params[:format].nil? # We have a lot of params and they or may not have to be # passed as conditions ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/schemas_controller.rb
Ruby
bsd-3-clause
19
develop
241
class SchemasController < ApplicationController def index @partial='index_table' if params[:partial].present? @partial=params[:partial].strip end respond_to do |format| format.html # index.html.erb end end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/machines_controller.rb
Ruby
bsd-3-clause
19
develop
2,502
class MachinesController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction # GET /machines # GET /machines.xml def index if params[:format].nil? or params[:format] == 'html' @iteration = params[:iteration][/\d+/] rescue 1 @machines = Machine.so...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/inputs_controller.rb
Ruby
bsd-3-clause
19
develop
5,721
class InputsController < ApplicationController before_action :login_required helper_method :sort_direction, :sort_column # general autocompletion def autocomplete inputs = search_model(Input.joins(:site), %w( name sitename), params[:term]) inputs = inputs.to_a.map do |item| { # show inp...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/modeltypes_controller.rb
Ruby
bsd-3-clause
19
develop
4,811
class ModeltypesController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction def remove_modeltypes_format @modeltypes_format = ModeltypesFormat.find(params[:id]) @modeltype = @modeltypes_format.modeltype @modeltypes_format.destroy respond_to do |...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/covariates_controller.rb
Ruby
bsd-3-clause
19
develop
4,595
class CovariatesController < ApplicationController before_action :login_required helper_method :sort_column, :sort_direction # GET /covariates # GET /covariates.xml def index if params[:format].nil? or params[:format] == 'html' @iteration = params[:iteration][/\d+/] rescue 1 @covariates = Cov...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/search_controller.rb
Ruby
bsd-3-clause
19
develop
6,020
# This controller handles searches. include AuthenticatedSystem class SearchController < ApplicationController helper_method :sort_column, :sort_direction CREDITS = ActionController::Base.helpers.strip_tags(CONFIG[:citation_license_copyright_markup]) CONTACT_EMAIL = CONFIG[:admin_email] # Possible paramate...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/citations_treatments_controller.rb
Ruby
bsd-3-clause
19
develop
2,006
class CitationsTreatmentsController < ApplicationController before_action :login_required, :except => [ :show ] require 'csv' # GET /citationstreatments # GET /citationstreatments.xml def index params[:format] = 'xml' if params[:format].nil? # We have a lot of params and they or may not have to be ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/treatments_controller.rb
Ruby
bsd-3-clause
19
develop
9,842
require 'will_paginate/array' class TreatmentsController < ApplicationController before_action :login_required, :except => [ :show ] helper_method :sort_column, :sort_direction require 'csv' # autocompletion for bulk upload wizard def bu_autocomplete search_term = params[:term] # filter treatment...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/api/base_controller.rb
Ruby
bsd-3-clause
19
develop
4,839
class Api::BaseController < ActionController::Base # Not sure why or even if these eight lines are needed. Just copied them from # article at https://labs.kollegorna.se/blog/2015/04/build-an-api-now/ # Presumably we'll change things around here when we decide what sort of # authentication and authorization we...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/api/v1/base_controller.rb
Ruby
bsd-3-clause
19
develop
5,363
require 'utilities/sql_comments.rb' class Api::V1::BaseController < Api::BaseController include ApiAuthenticationSystem before_action :set_content_type # IMPORTANT: Run this filter first! before_action :login_required NO_CONSTRAINT = lambda { |value| true } # Set the response content type based on the "f...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/controllers/api/v1/traits_controller.rb
Ruby
bsd-3-clause
19
develop
2,240
require 'yajl' class Api::V1::TraitsController < Api::V1::BaseController include Api::TraitCreationSupport define_actions(Trait) api! description <<-DESC Create new traits from the data specified in the posted data. Data about traits to be inserted can be supplied in either JSON (the default), CSV...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/managements_treatments.rb
Ruby
bsd-3-clause
19
develop
298
class ManagementsTreatments < ActiveRecord::Base self.primary_key = "id" validates_presence_of :management_id validates_presence_of :treatment_id belongs_to :management belongs_to :treatment comma do treatment_id management_id created_at updated_at end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/posteriors_ensembles.rb
Ruby
bsd-3-clause
19
develop
264
class PosteriorsEnsembles < ActiveRecord::Base belongs_to :ensemble belongs_to :posterior validates_presence_of :posterior_id validates_presence_of :ensemble_id comma do posterior_id ensemble_id created_at updated_at end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/treatment.rb
Ruby
bsd-3-clause
19
develop
2,335
class Treatment < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ } SEARCH_FIELDS = %w{ name definition } has_many :traits has_many :yields has_many :managements_treatments, :class_name => "ManagementsTreatments" has_many :managements, :through => :...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/modeltypes_format.rb
Ruby
bsd-3-clause
19
develop
379
class ModeltypesFormat < ActiveRecord::Base attr_protected [] validates :tag, presence: { message: "tag can't be blank" }, format: { with: /\A[a-z]+\z/, message: 'A tag must be a non-empty sequence of lowercase letters.' } validates_uniqueness_of :tag, scope: :modeltype_id belongs...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/prior.rb
Ruby
bsd-3-clause
19
develop
1,760
class Prior < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ citation variable } SEARCH_FIELDS = %w{ citations.author variables.name priors.phylogeny priors.distn priors.parama priors.paramb priors.n priors.notes } has_many :pfts_priors, :class_name => "P...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/yieldsview.rb
Ruby
bsd-3-clause
19
develop
988
class Yieldsview < ActiveRecord::Base self.table_name = 'yieldsview' scope :all_limited, lambda { |current_user| if !current_user.nil? if current_user.page_access_level == 1 checked = -1 access_level = 1 elsif current_user.page_access_level <= 2 checked = -1 access_l...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/pfts_species.rb
Ruby
bsd-3-clause
19
develop
258
class PftsSpecies < ActiveRecord::Base self.primary_key = "id" belongs_to :pft belongs_to :specie validates_presence_of :pft_id validates_presence_of :specie_id comma do pft_id specie_id created_at updated_at end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/bulk_upload_data_set.rb
Ruby
bsd-3-clause
19
develop
82,522
require 'memoist' module ValidationResult extend Memoist # A symbol representing the result of data validation. attr :result # The message to use as the title attribute of the table cell containing the # data item. attr :message # The message to put in the validation summary. This is also used as the ke...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/specie.rb
Ruby
bsd-3-clause
19
develop
3,126
# -*- coding: utf-8 -*- class Specie < ActiveRecord::Base attr_protected [] require "comma" include Overrides def as_json(options = {}) options[:except] = self.class.column_names.select { |nam| nam =~ /[A-Z]/ && nam != "AcceptedSymbol" } super(options) end def to_xml(options = {}) options[:ex...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/citations_sites.rb
Ruby
bsd-3-clause
19
develop
270
class CitationsSites < ActiveRecord::Base self.primary_key = "id" validates_presence_of :citation_id validates_presence_of :site_id belongs_to :citation belongs_to :site comma do citation_id site_id created_at updated_at end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/db_file.rb
Ruby
bsd-3-clause
19
develop
3,497
class DBFile < ActiveRecord::Base attr_protected [] self.table_name = 'dbfiles' include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ machine } SEARCH_FIELDS = %w{ dbfiles.file_name dbfiles.file_path dbfiles.md5 machines.hostname } validates :file_name, format: /\A[^\/]*\z/, unique...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/pfts_priors.rb
Ruby
bsd-3-clause
19
develop
254
class PftsPriors < ActiveRecord::Base self.primary_key = "id" belongs_to :pft belongs_to :prior validates_presence_of :pft_id validates_presence_of :prior_id comma do pft_id prior_id created_at updated_at end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/input.rb
Ruby
bsd-3-clause
19
develop
1,560
class Input < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ site } SEARCH_FIELDS = %w{ sites.sitename inputs.name inputs.start_date inputs.end_date inputs.notes inputs.created_at inputs.updated_at } has_and_belongs_to_many :runs has_many :likelihoods ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/posterior_samples.rb
Ruby
bsd-3-clause
19
develop
316
class PosteriorSamples < ActiveRecord::Base validates_presence_of :posterior_id validates_presence_of :variable_id validates_presence_of :pft_id validates_presence_of :parent_id comma do posterior_id variable_id pft_id parent_id created_at updated_at end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/trait.rb
Ruby
bsd-3-clause
19
develop
4,841
class Trait < ActiveRecord::Base attr_protected [] # Passed from controller for validation of ability attr_accessor :current_user include Overrides extend DataAccess # provides all_limited extend SimpleSearch SEARCH_INCLUDES = %w{ citation variable specie site treatment } SEARCH_FIELDS = %w{ traits....
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/management.rb
Ruby
bsd-3-clause
19
develop
1,901
class Management < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ citation } SEARCH_FIELDS = %w{ citations.author managements.date managements.mgmttype managements.level managements.units managements.notes } has_many :managements_treatments, :class_name =...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/format.rb
Ruby
bsd-3-clause
19
develop
1,223
class Format < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ mimetype } SEARCH_FIELDS = %w{ formats.name mimetypes.type_string formats.notes formats.skip formats.header } has_many :inputs has_many :formats_variables has_many :variables, :through => :...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/sitegroups_sites.rb
Ruby
bsd-3-clause
19
develop
275
class SitegroupsSites < ActiveRecord::Base self.primary_key = "id" belongs_to :sitegroup belongs_to :site validates_presence_of :sitegroup_id validates_presence_of :site_id comma do sitegroup_id site_id created_at updated_at end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/entity.rb
Ruby
bsd-3-clause
19
develop
547
class Entity < ActiveRecord::Base attr_protected [] include Overrides belongs_to :parent, :class_name => "Entity" has_many :children, :foreign_key => "parent_id", :class_name => "Entity" has_many :traits # Validation callbacks before_validation WhitespaceNormalizer.new([:name]) def to_s name ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/model.rb
Ruby
bsd-3-clause
19
develop
1,310
class Model < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ modeltype } SEARCH_FIELDS = %w{ models.model_name models.revision modeltypes.name } has_many :files, :as => :container, :class_name => 'DBFile' has_many :runs belongs_to :modeltype has_man...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/workflow.rb
Ruby
bsd-3-clause
19
develop
1,026
class Workflow < ActiveRecord::Base include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ } SEARCH_FIELDS = %w{ workflows.folder workflows.started_at workflows.finished_at workflows.created_at workflows.updated_at } has_many :ensembles belongs_to :model belongs_to :site belongs_to :user sco...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/user.rb
Ruby
bsd-3-clause
19
develop
3,318
require 'digest/sha1' class User < ActiveRecord::Base require 'authentication' require 'authentication/by_password' require 'authentication/by_cookie_token' include Authentication include Authentication::ByPassword include Authentication::ByCookieToken extend SimpleSearch SEARCH_INCLUDES = %w{ } SE...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/covariate.rb
Ruby
bsd-3-clause
19
develop
1,358
class Covariate < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ variable } SEARCH_FIELDS = %w{ variables.name covariates.level covariates.n covariates.stat covariates.statname } # Validations ## Validation methods def level_in_range v = Varia...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/variable.rb
Ruby
bsd-3-clause
19
develop
1,666
class Variable < ActiveRecord::Base # Using "attr_protected []" doesn't remove protection for the "type" column, # so we have to whitelist accessible columns instead: attr_accessible :description, :units, :notes, :name, :standard_name, :standard_units, :label, :type # rename inheritance column from "type" so w...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/posterior.rb
Ruby
bsd-3-clause
19
develop
1,055
class Posterior < ActiveRecord::Base include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ pft } SEARCH_FIELDS = %w{ pfts.name } has_many :posteriors_ensembles, :class_name => "PosteriorsEnsembles" has_many :ensembles, :through => :posteriors_ensembles has_many :posterior_samples, :class_name =>...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/citations_treatments.rb
Ruby
bsd-3-clause
19
develop
290
class CitationsTreatments < ActiveRecord::Base self.primary_key = "id" validates_presence_of :citation_id validates_presence_of :treatment_id belongs_to :citation belongs_to :treatment comma do citation_id treatment_id created_at updated_at end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/whitespace_normalizer.rb
Ruby
bsd-3-clause
19
develop
252
class WhitespaceNormalizer def initialize(attrs_to_normalize) @attrs_to_normalize = attrs_to_normalize end def before_validation(model) @attrs_to_normalize.each do |attr| model[attr].nil? || model[attr].squish! end end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/modeltype.rb
Ruby
bsd-3-clause
19
develop
894
class Modeltype < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ } SEARCH_FIELDS = %w{ modeltypes.name } has_many :modeltypes_formats has_many :models has_many :pfts belongs_to :user # Validations validates_uniqueness_of :name validates_form...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/inputs_variables.rb
Ruby
bsd-3-clause
19
develop
202
class InputsVariables < ActiveRecord::Base validates_presence_of :input_id validates_presence_of :variable_id comma do input_id variable_id created_at updated_at end end
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/ensemble.rb
Ruby
bsd-3-clause
19
develop
974
class Ensemble < ActiveRecord::Base include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ } SEARCH_FIELDS = %w{ ensembles.runtype ensembles.notes ensembles.created_at ensembles.updated_at } RUNTYPETYPES = ["ENS","SA"] has_many :runs has_many :posteriors_ensembles, :class_name => "PosteriorsEnsem...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/traits_and_yields_view.rb
Ruby
bsd-3-clause
19
develop
2,751
# This overrides the to_comma method in the "comma" gem, replacing the # iterator_method parameter value passed to the Comma::Generator#run # method so that it uses "find_all" instead of "find_each". # ("find_each" doesn't seem to work correctly with SQL views in rails # 3.0.8.) class ActiveRecord::Relation def to_co...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/yield.rb
Ruby
bsd-3-clause
19
develop
2,267
class Yield < ActiveRecord::Base attr_protected [] include Overrides extend DataAccess # provides all_limited extend SimpleSearch SEARCH_INCLUDES = %w{ citation specie site treatment cultivar } SEARCH_FIELDS = %w{ species.genus cultivars.name yields.mean yields.n yields.stat yields.statname citations.aut...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/sitegroup.rb
Ruby
bsd-3-clause
19
develop
826
class Sitegroup < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ } SEARCH_FIELDS = %w{ sitegroups.name } before_validation WhitespaceNormalizer.new([:name]) validates_presence_of :name scope :sorted_order, lambda { |order| order(order).includes(SEARC...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/experiment.rb
Ruby
bsd-3-clause
19
develop
534
class Experiment < ActiveRecord::Base attr_protected [] extend SimpleSearch SEARCH_INCLUDES = %w{ user } SEARCH_FIELDS = %w{ experiments.name users.name } before_validation WhitespaceNormalizer.new([:name]) validates_presence_of :name has_many :experiments_sites has_many :sites, :through => :experim...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/run.rb
Ruby
bsd-3-clause
19
develop
1,534
class Run < ActiveRecord::Base include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ model site } SEARCH_FIELDS = %w{ models.model_name sites.sitename runs.start_time runs.finish_time runs.started_at runs.finished_at runs.outdir runs.outprefix runs.setting runs.parameter_list } validates_format_of :s...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/machine.rb
Ruby
bsd-3-clause
19
develop
1,117
class Machine < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ } SEARCH_FIELDS = %w{ machines.hostname } validates :hostname, presence: true, uniqueness: true, host: true scope :sorted_order, lambda { |order| order(order).includes(SEA...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/citation.rb
Ruby
bsd-3-clause
19
develop
3,191
require 'whitespace_normalizer' class Citation < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ } SEARCH_FIELDS = %w{ citations.author citations.year citations.title citations.journal citations.vol citations.pg citations.url citations.doi } has_many :ci...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/pft.rb
Ruby
bsd-3-clause
19
develop
1,512
class Pft < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ modeltype } SEARCH_FIELDS = %w{ pfts.name pfts.definition modeltypes.name } has_many :pfts_priors, :class_name => "PftsPriors" has_many :priors, :through => :pfts_priors has_many :pfts_specie...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/cultivar.rb
Ruby
bsd-3-clause
19
develop
1,076
class Cultivar < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ specie } SEARCH_FIELDS = %w{ species.scientificname cultivars.previous_id cultivars.name cultivars.ecotype cultivars.notes } has_many :traits has_many :yields belongs_to :specie valid...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/likelihood.rb
Ruby
bsd-3-clause
19
develop
1,285
class Likelihood < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ input run variable } SEARCH_FIELDS = %w{ variables.name likelihoods.loglikelihood likelihoods.n_eff likelihoods.weight likelihoods.residual } belongs_to :run belongs_to :variable belon...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/site.rb
Ruby
bsd-3-clause
19
develop
9,017
class Site < ActiveRecord::Base attr_protected [] #-- ### Module Usage ### include Overrides extend CoordinateSearch # provides coordinate_search extend SimpleSearch SEARCH_INCLUDES = %w{ } SEARCH_FIELDS = %w{ sites.sitename sites.city sites.state sites.country } #-- ### Associations ### has...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/models/methods.rb
Ruby
bsd-3-clause
19
develop
706
class Methods < ActiveRecord::Base attr_protected [] include Overrides extend SimpleSearch SEARCH_INCLUDES = %w{ citation } SEARCH_FIELDS = %w{ methods.name methods.description citations.author } belongs_to :citation has_many :traits, foreign_key: :method_id has_many :yields, foreign_key: :method_id ...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/assets/stylesheets/windows_js_1.3/helper/prototype_window_class_helper.rb
Ruby
bsd-3-clause
19
develop
2,587
# Prototype Window Class Helper (http://pwc-helper.xurdeonrails.com) # by Jorge Díaz (http://xurde.info) # thanks to Sebastien Gruhier for his Prototype Window Class (http://prototype-window.xilinus.com/) #Quick use: #Reference this helper in your rails applicaction adding -> helper :prototype_window_class in your app...
github
PecanProject/bety
https://github.com/PecanProject/bety
app/services/api_authentication_system.rb
Ruby
bsd-3-clause
19
develop
1,307
# coding: utf-8 module ApiAuthenticationSystem include AuthenticatedSystem # Override default access_denied action. def access_denied if @errors @errors = "authentication failed: " + @errors else @errors = "authentication failed" end render status: 401 end # Override default perm...