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 | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/checkbox_field.rb | Ruby | mit | 84 | main | 3,114 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Bootstrap checkbox field component with checkbox wrapper and slots
class CheckboxField < Superform::Rails::Components::Checkbox
include Phlex::Slotable
include FieldWithHelp
slot :between
slot :append
sl... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/select_field.rb | Ruby | mit | 84 | main | 2,810 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Bootstrap select field component with form-group wrapper and slots
class SelectField < Superform::Rails::Components::Select
include Phlex::Slotable
include FieldWithHelp
include FieldLabelRow
slot :between
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/textarea_field.rb | Ruby | mit | 84 | main | 2,016 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Bootstrap textarea field component with form-group wrapper and slots
class TextareaField < Superform::Rails::Components::Textarea
include Phlex::Slotable
include FieldWithHelp
include FieldLabelRow
slot :bet... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/read_only_field.rb | Ruby | mit | 84 | main | 1,767 | # frozen_string_literal: true
# Read-only field component for Superform.
# Renders a label + static text display + hidden input field.
#
# This is used when you want to show the user what value is being submitted
# but prevent them from editing it.
#
# @example Basic usage
# field(:user_id).read_only(
# wrapper_... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/field_label_row.rb | Ruby | mit | 84 | main | 1,911 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Shared label row rendering for form field components
module FieldLabelRow
include Components::TrustedHtml
def render_label_row(label_text, inline)
if simple_label?
label(for: field.dom.id, class: "mr-3... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/static_text_field.rb | Ruby | mit | 84 | main | 1,535 | # frozen_string_literal: true
# Static text field component for Superform.
# Renders a label + read-only text display (no input field).
#
# Used for displaying non-editable information in a form layout.
#
# @example Basic usage
# field(:name).static(
# wrapper_options: { label: "Name:", value: "John Doe" }
# )... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/checklist/contents.rb | Ruby | mit | 84 | main | 4,023 | # frozen_string_literal: true
module Components
module Checklist
# Summary + panels for the checklist page. Wraps everything in
# #checklist_contents so the target-names turbo-stream can replace
# the whole block when a target is added or removed.
class Contents < Components::Base
register_outp... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/checklist/context.rb | Ruby | mit | 84 | main | 646 | # frozen_string_literal: true
module Components
module Checklist
# Bundles the rendering context for a checklist page: the viewer, plus
# the scope indicators (project / user / location / species_list) that
# determine link targets. Keeps component/view constructors narrow.
Context = Struct.new(
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/checklist/panel.rb | Ruby | mit | 84 | main | 1,269 | # frozen_string_literal: true
module Components
module Checklist
# Renders a single checklist panel: a <ul> of name links wrapped in the
# shared Panel component. Used by the Contents component for each
# section (unobserved / species-level / higher-level / default).
class Panel < Components::Base
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/field_slip_job_trackers_controller.rb | Ruby | mit | 84 | main | 672 | # frozen_string_literal: true
class FieldSlipJobTrackersController < ApplicationController
before_action :login_required
# This is only a Turbo endpoint updating the row of a particular tracker.
def show
return unless (@tracker = FieldSlipJobTracker.find(params[:id]))
respond_to do |format|
forma... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/lookups_controller.rb | Ruby | mit | 84 | main | 6,985 | # frozen_string_literal: true
class LookupsController < ApplicationController
before_action :login_required, except: [
:lookup_observation
]
def lookup_comment
lookup_general(Comment)
end
def lookup_image
lookup_general(Image)
end
def lookup_glossary_term
lookup_general(GlossaryTerm)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/javascript_controller.rb | Ruby | mit | 84 | main | 1,220 | # frozen_string_literal: true
######### Browser JS utility methods
class JavascriptController < ApplicationController
before_action :login_required, except: [
:turn_javascript_nil,
:turn_javascript_off,
:turn_javascript_on
]
# Force javascript on.
def turn_javascript_on
session[:js_override] =... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/translations_controller.rb | Ruby | mit | 84 | main | 8,960 | # frozen_string_literal: true
# rubocop:disable Metrics/ClassLength
class TranslationsController < ApplicationController
before_action :login_required
def index
@lang = set_language_and_authorize_user
@for_page = params[:for_page]
@strings = @lang.localization_strings
@edit_tags = tags_to_edit(@ta... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/account_controller.rb | Ruby | mit | 84 | main | 6,817 | # frozen_string_literal: true
#
# Account Controller
#
# == Actions
# L = login required
# R = root required
# V = has view
# P = prefetching allowed
#
# ==== Sign-up
# signup:: <tt>(. V P)</tt> Create new account.
# verify:: <tt>(. V .)</tt> Verify new account.
# reverify:: ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/comments_controller.rb | Ruby | mit | 84 | main | 10,208 | # frozen_string_literal: true
# ==== Show, CRUD actions
# index::
# show::
# new::
# create::
# edit::
# update::
# destroy::
#
class CommentsController < ApplicationController
before_action :login_required
before_action :store_location, only: [:show]
# Bullet doesn't seem to be able to figure out that ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/field_slips_controller.rb | Ruby | mit | 84 | main | 6,651 | # frozen_string_literal: true
class FieldSlipsController < ApplicationController
include Show
include Index
include ObservationHandling
before_action :login_required
# Disable cop: all these methods are defined in files included above.
# rubocop:disable Rails/LexicallyScopedActionFilter
before_action :s... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/visual_groups_controller.rb | Ruby | mit | 84 | main | 4,437 | # frozen_string_literal: true
class VisualGroupsController < ApplicationController
before_action :login_required
# GET /visual_groups or /visual_groups.json
def index
@visual_model = VisualModel.find(params[:visual_model_id])
end
# GET /visual_groups/1 or /visual_groups/1.json
def show
@filter = ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/support_controller.rb | Ruby | mit | 84 | main | 1,501 | # frozen_string_literal: true
# Controller for community support including donations and summary letters
class SupportController < ApplicationController
before_action :store_location, except: :confirm
def donate
@donation = Donation.new
@donation.user = @user
@donation.amount = 100
return unless @... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/application_controller.rb | Ruby | mit | 84 | main | 13,219 | # frozen_string_literal: true
#
# = Application Controller Base Class
#
# This is the base class for all the application's controllers. It contains
# all the important application-wide filters and lots of helper methods.
# Anything that appears here is available to every controller and view.
#
# == Methods
# *N... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/projects_controller.rb | Ruby | mit | 84 | main | 10,045 | # frozen_string_literal: true
class ProjectsController < ApplicationController
include Validators
before_action :login_required
before_action :store_location, only: [:show]
##############################################################################
# INDEX
#
def index
build_index_with_query
en... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/search_controller.rb | Ruby | mit | 84 | main | 7,869 | # frozen_string_literal: true
# searches defined by the url query string
class SearchController < ApplicationController
# These are plural symbols because the search bar sends them this way.
PATTERN_SEARCHABLE_MODELS = [
:comments, :glossary_terms, :herbaria, :herbarium_records, :images,
:locations, :names... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/admin_controller.rb | Ruby | mit | 84 | main | 488 | # frozen_string_literal: true
class AdminController < ApplicationController
# This changes the params of :login_required to restrict access to admins.
# To work, admin namespaced controllers must inherit from AdminController
def authorize?(_user)
in_admin_mode?
end
def access_denied
flash_error(:per... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/visual_models_controller.rb | Ruby | mit | 84 | main | 1,672 | # frozen_string_literal: true
class VisualModelsController < ApplicationController
before_action :login_required
# GET /visual_models
def index
@visual_models = VisualModel.order(:name)
end
# GET /visual_models/1
def show
@visual_model = VisualModel.find(params[:id])
respond_to do |format|
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/locations_controller.rb | Ruby | mit | 84 | main | 16,876 | # frozen_string_literal: true
# :index
# params:
# advanced_search:
# pattern:
# country:
# project:
# by_user:
# by_editor:
# :show,
# :new,
# :create,
# :edit,
# :update,
# :destroy
# Locations controller.
# rubocop:disable Metrics/ClassLength
class LocationsController < ApplicationController
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/sequences_controller.rb | Ruby | mit | 84 | main | 9,124 | # frozen_string_literal: true
# Controller for nucleotide Sequences
#
# Actions:
#
# create:: Create new sequence and add to Observation
# destroy:: Destroy sequence
# edit:: Show form to edit a Sequence
# new:: Show form to create new Sequence for an Observation
# index:: List selected... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/rss_logs_controller.rb | Ruby | mit | 84 | main | 4,518 | # frozen_string_literal: true
class RssLogsController < ApplicationController
before_action :login_required
before_action :store_location, only: [:show]
# Default page. Just displays latest happenings. The actual action is
# buried way down toward the end of this file.
# Displays matrix of selected RssLog... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/autocompleters_controller.rb | Ruby | mit | 84 | main | 2,221 | # frozen_string_literal: true
class AutocompletersController < ApplicationController
# Requiring login here would mean "advanced search" must also require login.
around_action :catch_ajax_errors
# Reduce overhead for these requests.
disable_filters
layout false
# The Autocomplete class returns "primers":... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/publications_controller.rb | Ruby | mit | 84 | main | 3,663 | # frozen_string_literal: true
# Control information about publications that benefit from or cite MO
class PublicationsController < ApplicationController
before_action :login_required, except: [:index, :show]
before_action :require_successful_user, only: [:create]
before_action :store_location, only: [:index, :sh... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/users_controller.rb | Ruby | mit | 84 | main | 4,249 | # frozen_string_literal: true
# display information about, and edit, users
class UsersController < ApplicationController
before_action :login_required
before_action :store_location, only: [:show]
##############################################################################
# INDEX
#
def index
build_i... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names_controller.rb | Ruby | mit | 84 | main | 23,288 | # frozen_string_literal: true
# rubocop:disable Metrics/ClassLength
class NamesController < ApplicationController
class RankWarning < RuntimeError; end
before_action :store_location, except: [:index]
before_action :login_required
##############################################################################
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/export_controller.rb | Ruby | mit | 84 | main | 1,772 | # frozen_string_literal: true
######### Exports
class ExportController < ApplicationController
EXPORTABLE_MODELS = [Image, Location, LocationDescription, NameDescription,
Name].freeze
before_action :login_required
# Callback (no view) to let reviewers change the export status of an
# I... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/contributors_controller.rb | Ruby | mit | 84 | main | 962 | # frozen_string_literal: true
# display information about user contributions to the site
class ContributorsController < ApplicationController
before_action :login_required
##############################################################################
# INDEX
#
def index
build_index_with_query
end
d... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/info_controller.rb | Ruby | mit | 84 | main | 1,838 | # frozen_string_literal: true
# Display canned informations about site
class InfoController < ApplicationController
before_action :login_required, except: [
:how_to_help,
:how_to_use,
:intro
]
before_action :store_location, except: [:textile_sandbox, :translators_note]
# Intro to site.
def intro... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/checklists_controller.rb | Ruby | mit | 84 | main | 1,982 | # frozen_string_literal: true
class ChecklistsController < ApplicationController
# filters
before_action :login_required
before_action :store_location
# Old MO Action (method) New "Normalized" Action (method)
# ---------------------------- --------------------------------
# observer_checklist (get... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/glossary_terms_controller.rb | Ruby | mit | 84 | main | 6,358 | # frozen_string_literal: true
# create and edit Glossary terms
class GlossaryTermsController < ApplicationController
before_action :login_required, except: [:index, :show]
before_action :store_location, except: [:create, :update, :destroy]
########################################################################... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/theme_controller.rb | Ruby | mit | 84 | main | 732 | # frozen_string_literal: true
# Theme controller
# Shows information about available user color themes.
#
# ==== Public Actions =====
# color_themes:: Show general information about color themes
# Agaricus, etc.:: Show sample page, explaining color derivation.
#
class ThemeController < ApplicationControll... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/articles_controller.rb | Ruby | mit | 84 | main | 3,365 | # frozen_string_literal: true
# News Articles
#
# Actions
#
# create: Create article from data in "new" form
# destroy:: Destroy article
# edit:: Display form for editing article
# index:: List articles, filtered by current query
# new:: Display form ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/occurrences_controller.rb | Ruby | mit | 84 | main | 4,940 | # frozen_string_literal: true
# Controls creating and viewing Occurrences (groups of Observations
# of the same specimen).
class OccurrencesController < ApplicationController
include Show
include Edit
include ResolveProjects
before_action :login_required
def new
@source_obs = find_source_observation!
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/observation_views_controller.rb | Ruby | mit | 84 | main | 1,154 | # frozen_string_literal: true
class ObservationViewsController < ApplicationController
before_action :login_required
# endpoint to mark an observation as 'reviewed' by the current user
# Note that it doesn't take an ov.id param - it looks up or creates an ov
# from an observation_id param (confusingly, :id!) ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/observations_controller.rb | Ruby | mit | 84 | main | 845 | # frozen_string_literal: true
class ObservationsController < ApplicationController
include Index
include Show
include New
include Create
include EditAndUpdate
include Destroy
# Disable cop: all these methods are defined in files included above.
# rubocop:disable Rails/LexicallyScopedActionFilter
bef... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/species_lists_controller.rb | Ruby | mit | 84 | main | 11,156 | # frozen_string_literal: true
# *NOTE*: There is some ambiguity between observations and names that makes
# this slightly confusing. The end result of a species_list is actually a
# list of Observation's, not Name's. However, creation and editing is
# generally accomplished via Name's alone (although see manage_... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/inat_imports_controller.rb | Ruby | mit | 84 | main | 10,566 | # frozen_string_literal: true
# import iNaturalist Observations as MO Observations
# Actions
# -------
# new (get)
# create (post)
# authorization_response (get)
# cancel (post):: cancels the InatImportJob
#
# Work flow:
# 1. User calls `new`, fills out form
# Adds a InatImport instance if user lacks one
# 2. creat... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/collection_numbers_controller.rb | Ruby | mit | 84 | main | 12,002 | # frozen_string_literal: true
# Controls viewing and modifying collection numbers.
# rubocop:disable Metrics/ClassLength
class CollectionNumbersController < ApplicationController
before_action :login_required
before_action :store_location, except: [:destroy]
#####################################################... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/licenses_controller.rb | Ruby | mit | 84 | main | 2,863 | # frozen_string_literal: true
# Licenses that are available for Images and Descriptions
# NOTE: inherits from AdminController in order to limit actions to admins
# NOTE: for badges see, e.g., app/views/controllers/shared/_form_ccbysa30.erb
class LicensesController < AdminController
before_action :store_location, exc... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/interests_controller.rb | Ruby | mit | 84 | main | 7,326 | # frozen_string_literal: true
#
# = Interests Controller
#
# == Actions
# L = login required
# R = root required
# V = has view
# P = prefetching allowed
#
# index::
# set_interest::
# create::
# update::
# destroy::
#
################################################################################
cla... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/herbaria_controller.rb | Ruby | mit | 84 | main | 14,291 | # frozen_string_literal: true
# Actions
# -------
# create (post)
# destroy (delete)
# edit (get)
# index (get) (default) list query results
# index (get, pattern: present) list Herbaria matching a string pattern
# index (get, nonpersonal: true) list institutional Herbaria registered in IH
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/api2_controller.rb | Ruby | mit | 84 | main | 4,090 | # frozen_string_literal: true
#
# = API2 Controller
#
# This controller handles the JSON and XML interfaces
#
# == Actions
#
# observations, etc.:: Entry point for REST requests.
#
################################################################################
#
class API2Controller < ApplicationController
re... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/images_controller.rb | Ruby | mit | 84 | main | 7,607 | # frozen_string_literal: true
#
# = Images Controller
#
# == Actions
#
# index::
# show:: can use params[:flow] :next, :prev
# new:: Upload images for observation.
# edit:: Edit notes, etc. for image.
# create:: New form commits here
# update::... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/add_dispatch_controller.rb | Ruby | mit | 84 | main | 1,820 | # frozen_string_literal: true
# Enables "Add" button on ProjectsController#show and
# SpeciesListsController#show. Dispatches to either the
# ObservationsController#new, or FieldSlipsController#new,
# depending on whether field slip code is provided and
# whether it already exists.
class AddDispatchController < Applic... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/herbarium_records_controller.rb | Ruby | mit | 84 | main | 13,929 | # frozen_string_literal: true
# Controls viewing and modifying herbarium records.
# rubocop:disable Metrics/ClassLength
class HerbariumRecordsController < ApplicationController
before_action :login_required
before_action :store_location, except: [:destroy]
#######################################################... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/inat_imports/job_trackers_controller.rb | Ruby | mit | 84 | main | 678 | # frozen_string_literal: true
module InatImports
class JobTrackersController < ApplicationController
before_action :login_required
# This is only a Turbo endpoint updating the display of the status of a job.
def show
@tracker = InatImportJobTracker.find(params[:id])
return unless @tracker
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/inat_imports_controller/estimators.rb | Ruby | mit | 84 | main | 2,458 | # frozen_string_literal: true
module InatImportsController::Estimators
include Inat::Constants
private
def fetch_import_estimate
response = RestClient.get(
"#{API_BASE}/observations?#{import_estimate_query_args.to_query}",
{ accept: :json, open_timeout: 5, timeout: 10 }
)
JSON.parse(res... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/inat_imports_controller/validators.rb | Ruby | mit | 84 | main | 3,130 | # frozen_string_literal: true
module InatImportsController::Validators
SITE = "https://www.inaturalist.org"
# Maximum size of id list param, based on
# Puma max query string size (1024 * 10)
# MAX_COOKIE_SIZE
# - ~256 to allow for other stuff
MAX_ID_LIST_SIZE =
[1024 * 10, ActionDispatch::Cookies::... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/clustered_observation_map.rb | Ruby | mit | 84 | main | 5,935 | # frozen_string_literal: true
# Shared loader + JSON refetch payload for controllers that map a
# query of observations with the dynamic-clustering pipeline (#4159).
# Caller sets `@query` (an `::Query::Observations`-shaped query) before
# invoking `find_locations_matching_observations`. The concern then
# populates `... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/emailable.rb | Ruby | mit | 84 | main | 1,504 | # frozen_string_literal: true
#
# = Emailable Concern
#
# This is a module that is included by some controllers that deal with
# emails. (Just Observations::EmailsController right now.)
#
#
# == Helpers
# can_email_user_question?:: Check if the user or object owner
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/searchable.rb | Ruby | mit | 84 | main | 8,688 | # frozen_string_literal: true
#
# = Searchable Concern
#
# This is a module of reusable methods included by controllers that handle
# "faceted" query searches per model, with separate inputs for each keyword.
# It also handles rendering help for the pattern search bar, via `:show` action
#
########################... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/descriptions.rb | Ruby | mit | 84 | main | 12,944 | # frozen_string_literal: true
#
# = Descriptions Concern
#
# This is a module that is included by all controllers that deal with
# descriptions. (Just LocationsController and NamesController right now.)
#
# == Actions
# L = login required
# R = root required
# V = has view
# P = prefetching allowed
#
#
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/locationable.rb | Ruby | mit | 84 | main | 5,028 | # frozen_string_literal: true
#
# = Locationable Concern
#
# This is a module of reusable methods that can be included by controllers that
# deal with associated locations, where the location may be created on the fly
# in the create form. (Why not "locatable"? It could be otherwise locatable.)
# - Observations... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/descriptions/moves.rb | Ruby | mit | 84 | main | 5,083 | # frozen_string_literal: true
# new::
# create::
# move_description:: Move current description to another name
module Descriptions::Moves
extend ActiveSupport::Concern
included do
# Form to move a description to another name. User must be both an admin for
# the old description (whic... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/descriptions/merges.rb | Ruby | mit | 84 | main | 5,745 | # frozen_string_literal: true
# merge_descriptions::
# perform_merge:: Merge 1 description into another if it
# can.
# merge_description_notes:: Merge the notes fields of 2 descriptions
module Descriptions::Merges
extend ActiveSupport::Concern... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/descriptions/permissions.rb | Ruby | mit | 84 | main | 10,178 | # frozen_string_literal: true
# adjust_permissions::
# flash_description_changes:: Show changes made to permissions.
# group_name:: Return human-readable name of UserGroup.
# modify_description_permissions:: Update blah_groups based on changed to
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/descriptions/defaults.rb | Ruby | mit | 84 | main | 789 | # frozen_string_literal: true
# make_description_default::
module Descriptions::Defaults
extend ActiveSupport::Concern
included do
# PUT callback to make a description the default one.
# Description must be publically readable and writable.
def update
return unless (desc = find_description!)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/descriptions/publish.rb | Ruby | mit | 84 | main | 1,890 | # frozen_string_literal: true
# publish_description::
module Descriptions::Publish
extend ActiveSupport::Concern
included do
# Publish a draft description. If the name has no description, just turn
# the draft into a public description and make it the default. If the name
# has a default descriptio... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/concerns/projects/location_grouping.rb | Ruby | mit | 84 | main | 1,968 | # frozen_string_literal: true
module Projects
# Shared logic for grouping project locations under target
# locations by name suffix.
module LocationGrouping
private
def build_grouped_locations(project)
obs_locs = project.locations.distinct.to_a
targets = sorted_targets(project)
sorted_... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/glossary_terms/versions_controller.rb | Ruby | mit | 84 | main | 791 | # frozen_string_literal: true
# show_past_glossary_term
module GlossaryTerms
class VersionsController < ApplicationController
before_action :login_required
before_action :store_location
# Show past versions of GlossaryTerm.
# Accessible only from show_glossary_term page.
def show
return un... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/glossary_terms/images_controller.rb | Ruby | mit | 84 | main | 3,572 | # frozen_string_literal: true
# Clicking on an image currently fires a GET to these actions... because it
# comes from a link made by Components::InteractiveImage(link: url_args)
# with CRUD refactor, change component link to fire a POST somehow?
module GlossaryTerms
class ImagesController < ApplicationController
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/users/emails_controller.rb | Ruby | mit | 84 | main | 2,159 | # frozen_string_literal: true
# Send emails directly to another user via the application
module Users
class EmailsController < ApplicationController
include ::Emailable
before_action :login_required
def new
@target = find_or_goto_index(User, params[:id].to_s)
return unless @target && can_em... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/account/preferences_controller.rb | Ruby | mit | 84 | main | 5,187 | # frozen_string_literal: true
module Account
class PreferencesController < ApplicationController
before_action :login_required
def edit
load_user_licenses
end
def update
load_user_licenses
update_password
update_prefs_from_form
if prefs_changed_successfully
r... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/account/profile_controller.rb | Ruby | mit | 84 | main | 2,607 | # frozen_string_literal: true
module Account
class ProfileController < ApplicationController
before_action :login_required
def edit
@licenses = License.available_names_and_ids(@user.license)
@user.place_name ||= @user.location&.display_name
if @user.image
@copyright_holder = @user... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/account/verifications_controller.rb | Ruby | mit | 84 | main | 3,816 | # frozen_string_literal: true
module Account
class VerificationsController < ApplicationController
before_action :login_required, except: [
:new,
:create,
:reverify,
:resend_email
]
# Regular signup verifications hit this page only (via GET).
def new
id = params[... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/account/login_controller.rb | Ruby | mit | 84 | main | 3,657 | # frozen_string_literal: true
module Account
class LoginController < ApplicationController
before_action :login_required, except: [
:new,
:create,
:logout,
:email_new_password,
:new_password_request
]
# the login form
def new
if @user
redirect_to(observati... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/account/api_keys_controller.rb | Ruby | mit | 84 | main | 2,569 | # frozen_string_literal: true
module Account
class APIKeysController < ApplicationController
before_action :login_required
# NOTE: The index has several forms:
# a form to edit existing_keys
# a form to create a new_key
# a destroy button for each key
# an activate button if the key is not v... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/account/profile/images_controller.rb | Ruby | mit | 84 | main | 1,786 | # frozen_string_literal: true
# Clicking on an image currently fires a GET to these actions... because it
# comes from a link made by Components::InteractiveImage(link: url_args)
# with CRUD refactor, change component link to fire a POST somehow?
# No need to remove_images from Account profile: reuse_image removes im... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/classification_controller.rb | Ruby | mit | 84 | main | 766 | # frozen_string_literal: true
# edit_classification::
module Names
class ClassificationController < ApplicationController
before_action :login_required
before_action :store_location
# Form
def edit
nil unless find_name!
end
# PUT callback
def update
return unless find_name!... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/search_controller.rb | Ruby | mit | 84 | main | 2,345 | # frozen_string_literal: true
# Names search form and help.
#
# Route: `names_search_path`, `new_names_search_path`
#
# Call namespaced controller actions with a hash like
# `{ controller: "/names/search", action: :create }`
module Names
class SearchController < ApplicationController
include ::Searchable
be... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/versions_controller.rb | Ruby | mit | 84 | main | 992 | # frozen_string_literal: true
# show_past_name
module Names
class VersionsController < ApplicationController
before_action :login_required
before_action :store_location
# Show past version of Name. Accessible only from show_name page.
def show
return unless find_name!
@name.revert_to(p... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/maps_controller.rb | Ruby | mit | 84 | main | 1,886 | # frozen_string_literal: true
# map:: Show distribution map.
module Names
class MapsController < ApplicationController
include(ClusteredObservationMap)
before_action :login_required
def controller_model_name
"Name"
end
# Draw a map of all the locations where this... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/synonyms_controller.rb | Ruby | mit | 84 | main | 5,933 | # frozen_string_literal: true
# change_synonyms:: Change list of synonyms for a name.
module Names
class SynonymsController < ApplicationController
include Names::Synonyms::SharedPrivateMethods
before_action :login_required
##################################################################... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/trackers_controller.rb | Ruby | mit | 84 | main | 4,703 | # frozen_string_literal: true
# == NAME TRACKERS
# email_tracking::
# approve_tracker::
module Names
class TrackersController < ApplicationController
before_action :login_required
# Form accessible from show_name that lets a user setup a tracker
# with notifications for a name.
def new
retu... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/descriptions_controller.rb | Ruby | mit | 84 | main | 7,790 | # frozen_string_literal: true
# == DESCRIPTIONS
# index_name_description:: List of results of index/search.
# list_name_descriptions:: Alphabetical list of all name_descriptions,
# used or otherwise.
# name_descriptions_by_author::Alphabetical list of name_descriptions aut... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/lifeforms_controller.rb | Ruby | mit | 84 | main | 583 | # frozen_string_literal: true
# edit_lifeform:: Edit lifeform tags.
module Names
class LifeformsController < ApplicationController
before_action :login_required
def edit
find_name!
end
def update
return unless find_name!
words = Name.all_lifeforms.select do |word|
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/eol_data_controller.rb | Ruby | mit | 84 | main | 527 | # frozen_string_literal: true
# eol::
module Names
class EolDataController < ApplicationController
before_action :login_required
##########################################################################
#
# :section: EOL Feed
#
#############################################################... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/lifeforms/propagate_controller.rb | Ruby | mit | 84 | main | 668 | # frozen_string_literal: true
# propagate_lifeform
module Names::Lifeforms
class PropagateController < ApplicationController
before_action :login_required
def edit
@name = find_or_goto_index(Name, params[:id])
end
def update
@name = find_or_goto_index(Name, params[:id])
Name.all_... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/eol_data/expanded_review_controller.rb | Ruby | mit | 84 | main | 625 | # frozen_string_literal: true
# eol_expanded_review::
module Names::EolData
class ExpandedReviewController < ApplicationController
before_action :login_required
def show
@timer_start = Time.current
@data = ::EolData.new
end
# TODO: Add ability to preview synonyms?
# TODO: List stuff... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/eol_data/preview_controller.rb | Ruby | mit | 84 | main | 2,672 | # frozen_string_literal: true
# eol_preview::
module Names::EolData
class PreviewController < ApplicationController
before_action :login_required
# Show the data getting sent to EOL
def show
@timer_start = Time.current
eol_data
@timer_end = Time.current
end
private
# Gat... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/classification/propagate_controller.rb | Ruby | mit | 84 | main | 444 | # frozen_string_literal: true
# propagate_classification
module Names::Classification
class PropagateController < ApplicationController
before_action :login_required
# PUT callback
def update
return unless find_name!
return unless make_sure_name_is_genus!(@name)
@name.propagate_classi... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/classification/refresh_controller.rb | Ruby | mit | 84 | main | 663 | # frozen_string_literal: true
# refresh_classification
module Names::Classification
class RefreshController < ApplicationController
before_action :login_required
# PUT callback. Description-mirror write went away with the column
# itself (discussion #4163) — only the Name needs updating now.
def upd... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/classification/shared_private_methods.rb | Ruby | mit | 84 | main | 3,185 | # frozen_string_literal: true
module Names::Classification
module SharedPrivateMethods
private
def find_name!
@name = find_or_goto_index(Name, params[:id])
end
def make_sure_parent_higher_rank!(parent)
parent_index = Name.rank_index(parent.rank)
our_index = Name.rank_index(@name.r... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/classification/inherit_controller.rb | Ruby | mit | 84 | main | 1,144 | # frozen_string_literal: true
# inherit_classification
module Names::Classification
class InheritController < ApplicationController
before_action :login_required
before_action :store_location
# form
def new
return unless find_name!
nil unless make_sure_name_is_at_or_above_genus!(@name)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/descriptions/defaults_controller.rb | Ruby | mit | 84 | main | 316 | # frozen_string_literal: true
# make_description_default:: Make a description the default one.
module Names::Descriptions
class DefaultsController < ApplicationController
before_action :login_required
include ::Descriptions::Defaults
include ::Names::Descriptions::SharedPrivateMethods
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/descriptions/review_status_controller.rb | Ruby | mit | 84 | main | 466 | # frozen_string_literal: true
# set_review_status
module Names::Descriptions
class ReviewStatusController < ApplicationController
before_action :login_required
# PUT Callback to let reviewers change review_status of a NameDescription
# from the show_name page.
def update
desc = NameDescription... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/descriptions/merges_controller.rb | Ruby | mit | 84 | main | 310 | # frozen_string_literal: true
# merge_descriptions:: Merge a description with another.
module Names::Descriptions
class MergesController < ApplicationController
before_action :login_required
include ::Descriptions::Merges
include ::Names::Descriptions::SharedPrivateMethods
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/descriptions/permissions_controller.rb | Ruby | mit | 84 | main | 323 | # frozen_string_literal: true
# adjust_permissions:: Adjust permissions on a description.
module Names::Descriptions
class PermissionsController < ApplicationController
before_action :login_required
include ::Descriptions::Permissions
include ::Names::Descriptions::SharedPrivateMethods
end
e... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/descriptions/publish_controller.rb | Ruby | mit | 84 | main | 305 | # frozen_string_literal: true
# publish_description:: Publish a draft description.
module Names::Descriptions
class PublishController < ApplicationController
before_action :login_required
include ::Descriptions::Publish
include ::Names::Descriptions::SharedPrivateMethods
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/descriptions/shared_private_methods.rb | Ruby | mit | 84 | main | 414 | # frozen_string_literal: true
module Names::Descriptions
module SharedPrivateMethods
private
# This either finds a description by id, or sets the ivar from the param.
def find_description!(id = nil)
desc_id = id || params[:id]
@description = NameDescription.show_includes.safe_find(desc_id) |... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/descriptions/moves_controller.rb | Ruby | mit | 84 | main | 311 | # frozen_string_literal: true
# move_descriptions:: Move a description to another parent.
module Names::Descriptions
class MovesController < ApplicationController
before_action :login_required
include ::Descriptions::Moves
include ::Names::Descriptions::SharedPrivateMethods
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/descriptions/versions_controller.rb | Ruby | mit | 84 | main | 559 | # frozen_string_literal: true
# show_past_name_description
module Names::Descriptions
class VersionsController < ApplicationController
include ::Names::Descriptions::SharedPrivateMethods
before_action :login_required
before_action :store_location
# Show past versions of NameDescription. Accessible... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/synonyms/shared_private_methods.rb | Ruby | mit | 84 | main | 663 | # frozen_string_literal: true
module Names::Synonyms
module SharedPrivateMethods
private
def find_name!
@name = find_or_goto_index(Name, params[:id].to_s)
end
def abort_if_name_locked!(name)
return false if !name.locked || in_admin_mode?
flash_error(:permission_denied.t)
re... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/synonyms/deprecate_controller.rb | Ruby | mit | 84 | main | 3,592 | # frozen_string_literal: true
# deprecate_name
module Names::Synonyms
class DeprecateController < ApplicationController
before_action :login_required
# Form accessible from show_name that lets the user deprecate a name
# in favor of another name.
def new
return unless find_name!
return i... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/controllers/names/synonyms/approve_controller.rb | Ruby | mit | 84 | main | 1,617 | # frozen_string_literal: true
# approve_name
module Names::Synonyms
class ApproveController < ApplicationController
before_action :login_required
# Form accessible from show_name that lets a user make call this an accepted
# name, possibly deprecating its synonyms at the same time.
def new
ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.