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/helpers/header/type_filter_helper.rb | Ruby | mit | 84 | main | 414 | # frozen_string_literal: true
# add_type_filters # add content_for(:type_filters)
#
module Header
module TypeFilterHelper
# Different from sorting links: type_filters
# currently only used in RssLogsController#index
def add_type_filters(query, types)
content_for(:type_filters) do
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/header/filters_helper.rb | Ruby | mit | 84 | main | 8,973 | # frozen_string_literal: true
# --------- Index Filters -----------------------------
#
# add_query_filters(query) # content_for(:filters)
# builds filter caption explaining
# index results, if filtered
# add_filter_help(filters_applied)... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/header/sorter_helper.rb | Ruby | mit | 84 | main | 5,106 | # frozen_string_literal: true
# add_sorter # helper to render the sorter partial
#
module Header
module SorterHelper
# Conditionally adds a group of sorting links, for indexes, if relevant
# These link back to the same index action, changing only the `by` param.
# Called in the view, d... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/header/index_pagination_helper.rb | Ruby | mit | 84 | main | 1,906 | # frozen_string_literal: true
module Header
module IndexPaginationHelper
def add_pagination(pagination_data, args = {})
content_for(:index_pagination_top) do
render_index_pagination(pagination_data, args, position: :top)
end
return unless pagination_data && pagination_data.num_pages > 1... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/header/show_prev_next_helper.rb | Ruby | mit | 84 | main | 1,156 | # frozen_string_literal: true
# Prev/Index/Next object links for show templates
#
# add_pager_for(object) # add a prev/next pager for an object (show)
#
module Header
module ShowPrevNextHelper
# NOTE: Prev/Next only makes sense in the context of a query, so this UI
# only displays if the current que... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/header/title_helper.rb | Ruby | mit | 84 | main | 5,276 | # frozen_string_literal: true
# --------- Contextual Page Title -----------------------------
#
# add_page_title(title) # add content_for(:title)
# and content_for(:document_title)
# add_owner_naming(naming) # add content_for(:owner_naming), on show obs
# title_tag_content... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/header/rubric_helper.rb | Ruby | mit | 84 | main | 3,048 | # frozen_string_literal: true
# nav_rubric # The top nav title, which may link to an index
# nav_create # Top nav create_link
# nav_scan_qr_code # Top nav qr code link, for Obs and FieldSlips
#
module Header
module RubricHelper
# The idea here is to make the rubric link to an unfiltere... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/header/toggles_helper.rb | Ruby | mit | 84 | main | 1,188 | # frozen_string_literal: true
# search_nav_toggle # toggle the collapsible search_nav
# left_nav_toggle # toggle the left nav on mobile
#
module Header
module TogglesHelper
def search_nav_toggle
tag.div(class: "navbar-form px-2 px-sm-3") do
tag.button(
link_icon(... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/herbaria_helper.rb | Ruby | mit | 84 | main | 2,552 | # frozen_string_literal: true
# Custom Tabset Helpers for Herbaria views
# NOTE: this uses ids not classes for identifiers, change this
module Tabs
module HerbariaHelper
def herbaria_index_tabs(query: nil)
links ||= []
links << if query&.params&.dig(:nonpersonal)
herbaria_index_tab
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/descriptions_helper.rb | Ruby | mit | 84 | main | 5,446 | # frozen_string_literal: true
# html used in tabsets
module Tabs
module DescriptionsHelper
# Links for the tabset
def description_change_links(user, desc)
type = desc.parent.type_tag
admin = user_is_admin?(user, desc)
[
user_writer?(user, desc) ? edit_button(target: desc, icon: :edi... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/inat_imports_helper.rb | Ruby | mit | 84 | main | 350 | # frozen_string_literal: true
# html used in tabsets
module Tabs
module InatImportsHelper
def inat_import_form_new_tabs
[cancel_to_observation_create_tab]
end
def cancel_to_observation_create_tab
InternalLink.new(:cancel_and_create.t(type: :OBSERVATION),
new_observatio... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/field_slips_helper.rb | Ruby | mit | 84 | main | 1,106 | # frozen_string_literal: true
module Tabs
module FieldSlipsHelper
def field_slip_edit_tabs(field_slip)
[field_slips_index_tab, show_field_slip_tab(field_slip)]
end
def field_slips_index_tabs
[new_field_slip_tab]
end
def field_slips_index_tab
InternalLink::Model.new(
:I... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/namings_helper.rb | Ruby | mit | 84 | main | 691 | # frozen_string_literal: true
# html used in tabsets
module Tabs
module NamingsHelper
def new_naming_tab(obs_id, text:, context:, btn_class:)
InternalLink::Model.new(
text, Naming,
new_observation_naming_path(observation_id: obs_id, context: context),
html_options: {
class... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/collection_numbers_helper.rb | Ruby | mit | 84 | main | 2,535 | # frozen_string_literal: true
module Tabs
module CollectionNumbersHelper
def collection_numbers_index_tabs(obs:)
return [] if obs.blank?
[
object_return_tab(obs),
new_collection_number_tab(obs)
]
end
def collection_numbers_index_sorts
[
["name", :so... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/herbarium_records_helper.rb | Ruby | mit | 84 | main | 2,846 | # frozen_string_literal: true
# Custom View Helpers for Herbarium Records views
#
module Tabs
module HerbariumRecordsHelper
include HerbariaHelper
def herbarium_records_index_tabs(obs:)
links = []
if obs.present?
links = [
object_return_tab(obs)
]
end
links ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/themes_helper.rb | Ruby | mit | 84 | main | 266 | # frozen_string_literal: true
module Tabs
module ThemesHelper
def theme_show_tabs
[theme_list_tab,
account_edit_preferences_tab]
end
def theme_list_tab
InternalLink.new(:theme_list.t, theme_color_themes_path).tab
end
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/sequences_helper.rb | Ruby | mit | 84 | main | 2,315 | # frozen_string_literal: true
module Tabs
module SequencesHelper
def sequence_show_tabs(seq:)
[object_return_tab(seq.observation)]
end
def sequence_form_tabs(obj:)
[object_return_tab(obj)]
end
def sequence_tab(seq, obs)
# This is passed in to show_sequence, allowing users to d... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/account_helper.rb | Ruby | mit | 84 | main | 1,795 | # frozen_string_literal: true
module Tabs
module AccountHelper
def account_welcome_title(user = nil)
if user
:email_welcome.t(user: user.legal_name)
else
:welcome_no_user_title.t
end
end
def account_profile_edit_tabs
[
account_bulk_license_updater_tab,
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/images_helper.rb | Ruby | mit | 84 | main | 2,650 | # frozen_string_literal: true
# html used in tabsets
module Tabs
module ImagesHelper
# link attribute arrays
def images_index_tabs(query:)
[related_observations_tab(:Image, query)]
end
# assemble links for show_image
def show_image_tabs(image:)
[
*show_image_obs_tabs(image),
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/comments_helper.rb | Ruby | mit | 84 | main | 1,775 | # frozen_string_literal: true
module Tabs
module CommentsHelper
def comment_show_tabs(comment:, target:)
links = [
object_return_tab(
target,
:comment_show_show.t(type: comment.target_type_localized)
)
]
return unless permission?(comment)
links += comm... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/glossary_terms_helper.rb | Ruby | mit | 84 | main | 1,504 | # frozen_string_literal: true
module Tabs
module GlossaryTermsHelper
def glossary_term_form_new_tabs
[
# Replace this link with a "Cancel" link (back to glossary)
# See https://www.pivotaltracker.com/story/show/174614188
glossary_terms_index_tab
]
end
def glossary_ter... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/rss_logs_helper.rb | Ruby | mit | 84 | main | 567 | # frozen_string_literal: true
# Custom View Helpers for Rss_log View (Activity Feed)
#
module Tabs
module RssLogsHelper
def rss_logs_index_tabs(user:, types:)
[
activity_log_default_types_for_user_tab(user, types)
]
end
def activity_log_default_types_for_user_tab(user, types)
r... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/names_helper.rb | Ruby | mit | 84 | main | 10,297 | # frozen_string_literal: true
# html used in tabsets
module Tabs
module NamesHelper
def edit_name_tab(name)
InternalLink::Model.new(
:show_name_edit_name.l, name,
edit_name_path(name.id),
html_options: { icon: :edit }
).tab
end
def new_name_tab
InternalLink::Mod... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/locations_helper.rb | Ruby | mit | 84 | main | 4,694 | # frozen_string_literal: true
# html used in tabsets
module Tabs
module LocationsHelper
# link attribute arrays (each tab returns array)
def locations_index_tabs(query:)
[
new_location_tab,
map_locations_tab(query),
location_countries_tab,
related_observations_tab(:Locat... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/external_links_helper.rb | Ruby | mit | 84 | main | 524 | # frozen_string_literal: true
# Custom View Helpers for External Links views
#
module Tabs
module ExternalLinksHelper
def new_external_link_tab(obs:)
InternalLink.new(
:show_observation_add_link.l,
new_external_link_path(id: obs.id),
html_options: { icon: :add }
).tab
end
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/articles_helper.rb | Ruby | mit | 84 | main | 1,146 | # frozen_string_literal: true
# Custom View Helpers for Article views
#
# xx_tabs:: List of links to display in xx tabset; include links which
# write Articles only if user has write permission
# xx_title:: Title of x page; includes any markup
#
module Tabs
module ArticlesHelper
def... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/publications_helper.rb | Ruby | mit | 84 | main | 590 | # frozen_string_literal: true
module Tabs
module PublicationsHelper
def publications_index_tabs
[new_publication_tab]
end
def publication_form_new_tabs
[publications_index_tab]
end
def publication_form_edit_tabs(pub:)
[
object_return_tab(pub),
publications_inde... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/licenses_helper.rb | Ruby | mit | 84 | main | 1,794 | # frozen_string_literal: true
# Title and Tab Helpers for License views
# xx_tabs:: List of links to display in xx tabset
# xx_title:: Title of x page; includes any markup
#
module Tabs
module LicensesHelper
def license_index_tabs
[new_license_tab]
end
def license_show_title(license)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/support_helper.rb | Ruby | mit | 84 | main | 1,066 | # frozen_string_literal: true
module Tabs
module SupportHelper
def support_donate_tabs
links = [support_donors_tab]
return links unless in_admin_mode?
links += support_admin_tabs
links
end
def support_donors_tabs
links = [support_donate_tab]
return links unless in_ad... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/checklists_helper.rb | Ruby | mit | 84 | main | 1,193 | # frozen_string_literal: true
module Tabs
module ChecklistsHelper
def checklist_show_title(user:, list:)
if user
:checklist_for_user_title.t(user: user.legal_name)
elsif list
:checklist_for_species_list_title.t(list: list.title)
else
:checklist_for_site_title.t
end... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/general_helper.rb | Ruby | mit | 84 | main | 1,707 | # frozen_string_literal: true
module Tabs
module GeneralHelper
def search_tab_for(site_symbol, search_string)
return unless (url = external_search_urls[site_symbol])
InternalLink.new(
site_symbol.to_s.titlecase, "#{url}#{search_string}",
html_options: { id: "search_link_to_#{site_sym... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/emails_helper.rb | Ruby | mit | 84 | main | 248 | # frozen_string_literal: true
module Tabs
module EmailsHelper
def email_name_change_request_tabs(name:)
[object_return_tab(name)]
end
def email_merge_request_tabs(old_obj:)
[object_return_tab(old_obj)]
end
end
end |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/user_nav_helper.rb | Ruby | mit | 84 | main | 1,178 | # frozen_string_literal: true
module Tabs
module UserNavHelper
def user_logged_in_tabs(user)
[
user_observations_tab(user, :app_your_observations.t),
comments_for_user_tab(user, :app_comments_for_you.t),
projects_for_user_tab(user),
species_lists_for_user_tab(user),
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/observations_helper.rb | Ruby | mit | 84 | main | 9,428 | # frozen_string_literal: true
# html used in tabsets
module Tabs
module ObservationsHelper
########################################################################
# LINKS FOR PANELS
#
# Used in the observation panel
def send_observer_question_tab(obs)
InternalLink::Model.new(
:sho... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/users_helper.rb | Ruby | mit | 84 | main | 3,653 | # frozen_string_literal: true
module Tabs
module UsersHelper
def user_show_tabs
[site_contributors_tab]
end
def user_profile_tabs(show_user:, user:)
links = []
links += if show_user == user
links_for_this_user(show_user)
else
links_for_t... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/projects_helper.rb | Ruby | mit | 84 | main | 5,126 | # frozen_string_literal: true
module Tabs
module ProjectsHelper
def project_form_new_tabs
[projects_index_tab]
end
def project_form_edit_tabs(project:)
links = [
projects_index_tab,
object_return_tab(project)
]
links << destroy_project_tab(project) if permission?(... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/admin_helper.rb | Ruby | mit | 84 | main | 868 | # frozen_string_literal: true
module Tabs
module AdminHelper
def admin_donations_form_edit_tabs
links = support_governance_tabs
links << admin_create_donation_tab
links
end
def admin_donations_form_new_tabs
links = support_governance_tabs
links << admin_review_donations_tab... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/species_lists_helper.rb | Ruby | mit | 84 | main | 5,540 | # frozen_string_literal: true
module Tabs
module SpeciesListsHelper
# Moved download link into species_list_logged_in_show_tabs and
# nixed user: kwarg
# Can't access this page unless logged in as of 2023
def species_list_show_tabs(list:, query: nil)
tabs = species_list_logged_in_show_tabs(list... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/related_objects_helper.rb | Ruby | mit | 84 | main | 1,348 | # frozen_string_literal: true
module Tabs
module RelatedObjectsHelper
# These build links for indexes of a related object, filtered by the
# current query (or indexes of the same object, from a map). This new
# joined filtered query is passed as a new, provisional `q` - it is not
# saved as a QueryRe... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/contributors_helper.rb | Ruby | mit | 84 | main | 392 | # frozen_string_literal: true
module Tabs
module ContributorsHelper
def contributors_index_tabs
[info_site_stats_tab]
end
def info_site_stats_tab
InternalLink.new(
:app_site_stats.t, info_site_stats_path
).tab
end
def site_contributors_tab
InternalLink.new(
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/names/descriptions_helper.rb | Ruby | mit | 84 | main | 1,180 | # frozen_string_literal: true
# html used in tabsets
module Tabs
module Names
module DescriptionsHelper
def name_description_index_tabs(query:)
[related_names_tab(:NameDescription, query)]
end
def name_description_form_new_tabs(description:)
[object_return_tab(description.name)... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/locations/descriptions_helper.rb | Ruby | mit | 84 | main | 1,141 | # frozen_string_literal: true
# html used in tabsets
module Tabs
module Locations
module DescriptionsHelper
def location_description_index_tabs(query:)
[
map_locations_tab(query),
locations_index_tab,
related_locations_tab(:LocationDescription, query)
]
e... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/sidebar/login_helper.rb | Ruby | mit | 84 | main | 546 | # frozen_string_literal: true
module Tabs
module Sidebar
module LoginHelper
def sidebar_login_tabs
[
login_tab,
signup_tab
]
end
def login_tab
InternalLink.new(
:app_login.t, new_account_login_path,
html_options: { id: "nav_login_... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/sidebar/latest_helper.rb | Ruby | mit | 84 | main | 1,118 | # frozen_string_literal: true
module Tabs
module Sidebar
module LatestHelper
def sidebar_latest_tabs(user)
[
nav_latest_news_tab,
nav_latest_changes_tab(user),
nav_latest_images_tab(user),
nav_latest_comments_tab(user)
]
end
def nav_lates... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/sidebar/species_lists_helper.rb | Ruby | mit | 84 | main | 931 | # frozen_string_literal: true
module Tabs
module Sidebar
module SpeciesListsHelper
def sidebar_species_lists_tabs(user)
[
nav_your_lists_tab(user),
nav_all_lists_tab,
nav_new_list_tab(user)
]
end
def nav_your_lists_tab(user)
return unless u... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/sidebar/observations_helper.rb | Ruby | mit | 84 | main | 1,494 | # frozen_string_literal: true
module Tabs
module Sidebar
module ObservationsHelper
def sidebar_observations_tabs(user)
[
nav_latest_observations_tab,
nav_new_observation_tab(user),
nav_your_observations_tab(user),
nav_identify_observations_tab(user)
]... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/sidebar/indexes_helper.rb | Ruby | mit | 84 | main | 1,150 | # frozen_string_literal: true
module Tabs
module Sidebar
module IndexesHelper
def sidebar_indexes_tabs
[
nav_glossary_tab,
nav_herbaria_tab,
nav_locations_tab,
nav_names_tab,
nav_projects_tab
]
end
def nav_glossary_tab
I... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/sidebar/info_helper.rb | Ruby | mit | 84 | main | 2,802 | # frozen_string_literal: true
module Tabs
module Sidebar
module InfoHelper
def sidebar_info_tabs
[
nav_mobile_app_tab,
nav_intro_tab,
nav_how_to_use_tab,
nav_donate_tab,
nav_how_to_help_tab,
nav_report_a_bug_tab,
nav_send_a_comme... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/sidebar/user_helper.rb | Ruby | mit | 84 | main | 628 | # frozen_string_literal: true
module Tabs
module Sidebar
module UserHelper
def sidebar_user_tabs(user)
[
comments_for_user_tab(user, :app_comments_for_you.t),
account_show_interests_tab,
user_summary_tab(user),
account_edit_preferences_tab,
join_mai... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/tabs/sidebar/admin_helper.rb | Ruby | mit | 84 | main | 1,457 | # frozen_string_literal: true
module Tabs
module Sidebar
module AdminHelper
def sidebar_admin_tabs
[
admin_jobs_tab,
admin_blocked_ips_tab,
admin_switch_users_tab,
admin_users_tab,
admin_banners_tab,
admin_licenses_tab
]
end
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/helpers/observations/sibling_records_helper.rb | Ruby | mit | 84 | main | 2,990 | # frozen_string_literal: true
# Renders read-only records from sibling observations in an occurrence.
# Used on the observation show page to display aggregated data.
module Observations::SiblingRecordsHelper
def sibling_collection_numbers(siblings)
sibling_record_list(siblings, :collection_numbers) do |cn, sib|
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/form_carousel_item.rb | Ruby | mit | 84 | main | 5,147 | # frozen_string_literal: true
# Form carousel item component for a single image in the observation form.
#
# This component displays an image alongside form fields for editing metadata.
# It inherits from BaseImage to handle image presentation logic.
#
# Layout:
# - Left column: Image display
# - Right column: Form fi... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/form_camera_info.rb | Ruby | mit | 84 | main | 4,051 | # frozen_string_literal: true
# Displays EXIF camera metadata for an image in the observation form.
#
# Shows:
# - GPS coordinates (lat, lng, alt)
# - Date taken
# - File name and size
# - Button to transfer EXIF data to observation form
#
# @example
# render Components::FormCameraInfo.new(
# img_id: 123,
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/login_form.rb | Ruby | mit | 84 | main | 1,169 | # frozen_string_literal: true
# Form for user login
class Components::LoginForm < Components::ApplicationForm
def view_template
render_login_field
render_password_field
render_remember_me_field
submit(:login_login.l, center: true)
render_forgot_login_text
render_help_text
end
private
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/observation_form_upload.rb | Ruby | mit | 84 | main | 1,505 | # frozen_string_literal: true
# Upload section of the observation form.
# Renders image select button and hidden fields for image management.
#
# @param form [Components::ApplicationForm] the parent form
# @param good_images [Array<Image>] already uploaded images
class Components::ObservationFormUpload < Components::B... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/alert.rb | Ruby | mit | 84 | main | 1,206 | # frozen_string_literal: true
module Components
# Bootstrap alert component
#
# @example Basic usage
# render(Components::Alert.new(message: "Success!", level: :success))
#
# @example With block
# render(Components::Alert.new(level: :warning)) do
# plain "Warning: "
# strong "Be careful!"... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/name_edit_synonym_form.rb | Ruby | mit | 84 | main | 4,120 | # frozen_string_literal: true
# Form for editing name synonyms.
# Creates its own FormObject internally from the provided kwargs.
#
# @example
# render(Components::NameEditSynonymForm.new(
# name: @name,
# synonym_members: @list_members,
# deprecate_all: @deprecate_all,
# current_synonyms: @name.syno... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/observation_form_details.rb | Ruby | mit | 84 | main | 6,007 | # frozen_string_literal: true
# Details section of the observation form.
# Renders date, location autocomplete, lat/lng/alt, and related checkboxes.
#
# @param form [Components::ApplicationForm] the parent form
# @param observation [Observation] the observation model
# @param mode [Symbol] :create or :update
# @param ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/external_link_form.rb | Ruby | mit | 84 | main | 2,648 | # frozen_string_literal: true
# Form for creating or editing external links for observations
class Components::ExternalLinkForm < Components::ApplicationForm
def initialize(model, **kwargs)
@observation = kwargs.delete(:observation)
@sites = kwargs.delete(:sites)
@site = kwargs.delete(:site) || @sites&.f... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/add_obs_modal.rb | Ruby | mit | 84 | main | 2,381 | # frozen_string_literal: true
# Turbo modal shown when a project member clicks "Add My Observations".
# Displays how many of the member's observations match the project's
# constraints and are not already in the project, with a button that
# submits a PUT to add the next batch (capped at `batch_limit`).
# See issue #4... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_field_slip_form.rb | Ruby | mit | 84 | main | 748 | # frozen_string_literal: true
# Phlex form for creating project field slips.
# Replaces the form_with in projects/field_slips/new.html.erb.
class Components::ProjectFieldSlipForm < Components::ApplicationForm
register_value_helper :project_field_slips_path
def initialize(model, project:, **)
@project = projec... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/matrix_table.rb | Ruby | mit | 84 | main | 2,692 | # frozen_string_literal: true
# Matrix table component for displaying grids of matrix boxes.
#
# Renders a responsive grid layout with Stimulus controller for dynamic
# resizing. Can render a collection of objects or accept a block for
# custom content.
#
# @example With block
# render(MatrixTable.new) do |table|
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/inat_import_confirm_form.rb | Ruby | mit | 84 | main | 3,011 | # frozen_string_literal: true
# Confirmation form for iNat import.
# Shows estimated import count and Proceed/Go Back buttons.
# Hidden fields carry form data through the confirmation step.
class Components::InatImportConfirmForm < Components::ApplicationForm
def initialize(model, estimate: nil, unlicensed_obs: nil,... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/location_form.rb | Ruby | mit | 84 | main | 5,624 | # frozen_string_literal: true
# Form for creating or editing locations.
# Includes an interactive map, compass inputs for coordinates, and
# elevation inputs. Handles locked locations for non-admin users.
#
# @example Usage
# render(Components::LocationForm.new(
# @location,
# display_name: @display_name,
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/matrix_box_title.rb | Ruby | mit | 84 | main | 900 | # frozen_string_literal: true
# Matrix box title component.
#
# Renders the title span for a matrix box item. The title styling varies
# based on the object type - observations and names get regular weight,
# while other types get bold weight.
#
# @example With observation
# render MatrixBoxTitle.new(
# id: obs.... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/description_form.rb | Ruby | mit | 84 | main | 6,488 | # frozen_string_literal: true
# Polymorphic form for creating/editing Name and Location descriptions.
# Handles source type, permissions, license, and model-specific note fields.
class Components::DescriptionForm < Components::ApplicationForm
def initialize(description, licenses:, user:, merge_opts: {}, **)
@des... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/form_name_feedback.rb | Ruby | mit | 84 | main | 3,988 | # frozen_string_literal: true
# Displays feedback for name fields when the entered name is:
# - Not recognized
# - Deprecated (with valid synonyms)
# - Ambiguous (multiple matches)
# - Has a deprecated parent
#
# @param given_name [String] the name typed by user
# @param button_name [String] the button text (e.g., "Cr... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/observer_question_form.rb | Ruby | mit | 84 | main | 1,131 | # frozen_string_literal: true
# Form for asking the observer a question about their observation.
# Creates its own FormObject internally from the provided kwargs.
class Components::ObserverQuestionForm < Components::ApplicationForm
# Accept optional model arg for ModalForm compatibility (ignored - we create
# our ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/print_labels_form.rb | Ruby | mit | 84 | main | 691 | # frozen_string_literal: true
# Phlex form component for printing labels for species list observations.
#
# @example
# render(Components::PrintLabelsForm.new(query_param: q_param(@query)))
#
class Components::PrintLabelsForm < Components::ApplicationForm
def initialize(query_param:, **)
@query_param = query_pa... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/modal_form.rb | Ruby | mit | 84 | main | 4,045 | # frozen_string_literal: true
# Bootstrap modal wrapper for forms.
# Used in turbo_stream responses from `new` and `edit` form actions.
#
# The modal listens for section-update:updated events to auto-close when
# the page section is successfully updated. The user_id comparison ensures
# broadcasts don't unintentionall... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/glossary_term_form.rb | Ruby | mit | 84 | main | 2,101 | # frozen_string_literal: true
# Form for creating/editing glossary terms
class Components::GlossaryTermForm < Components::ApplicationForm
# Override initialize to accept upload field props (only for new form)
def initialize(model, action: nil, upload_params: nil, **)
@upload_params = upload_params
super(mo... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/observation_form.rb | Ruby | mit | 84 | main | 7,979 | # frozen_string_literal: true
# Form for creating or editing observations.
# Includes image upload, location autocomplete, naming (on create),
# specimen fields, notes, projects, and species lists.
#
# @example Usage
# render(Components::ObservationForm.new(
# @observation,
# action: :create,
# user: @us... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/collapse_info_trigger.rb | Ruby | mit | 84 | main | 681 | # frozen_string_literal: true
# Collapse info trigger component - clickable icon that toggles collapse
#
# @example
# CollapseInfoTrigger(id: "help_text_1")
# CollapseInfoTrigger(id: "help_text_2", class: "custom-trigger")
class Components::CollapseInfoTrigger < Components::Base
prop :target_id, String
prop :e... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/naming_fields.rb | Ruby | mit | 84 | main | 3,334 | # frozen_string_literal: true
# Renders naming fields (name autocompleter, vote, reasons) for embedding
# in Superform-based forms. For ERB forms, use the _fields.erb partial.
#
# @param form [Components::ApplicationForm] the parent form
# @param vote [Vote] the vote object
# @param given_name [String] the name typed ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/name_propagate_lifeform_form.rb | Ruby | mit | 84 | main | 1,599 | # frozen_string_literal: true
# Form for propagating lifeform tags to child names
#
# @example
# render(Components::NamePropagateLifeformForm.new(
# FormObject::PropagateLifeform.new,
# name: @name
# ))
#
class Components::NamePropagateLifeformForm < Components::ApplicationForm
def initialize(model, name... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/carousel.rb | Ruby | mit | 84 | main | 3,239 | # frozen_string_literal: true
# Bootstrap carousel component for displaying image galleries.
#
# Renders a complete carousel with:
# - Optional heading with title and links
# - Carousel slides (CarouselItem components)
# - Previous/Next controls (if multiple images)
# - Thumbnail navigation (optional)
#
# @example
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/mark_as_reviewed_toggle.rb | Ruby | mit | 84 | main | 2,093 | # frozen_string_literal: true
module Components
# Component for rendering a toggle to mark observations as reviewed.
#
# https://stackoverflow.com/questions/68624668/how-can-i-submit-a-form-on-input-change-with-turbo-streams
#
# @example Default usage (lightbox caption)
# obs_view = observation_view_for(... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/name_form.rb | Ruby | mit | 84 | main | 5,898 | # frozen_string_literal: true
# Form for creating and editing Name records
class Components::NameForm < Components::ApplicationForm
def initialize(model, **options)
@user = options.delete(:user)
@name_string = options.delete(:name_string) || ""
@misspelling = options.delete(:misspelling)
@correct_spe... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/herbarium_record_form.rb | Ruby | mit | 84 | main | 2,189 | # frozen_string_literal: true
# Form for creating or editing herbarium records attached to observations
class Components::HerbariumRecordForm < Components::ApplicationForm
def initialize(model, observation: nil, back: nil, **)
@observation = observation || model.observations.first
@back = back
super(mode... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/form_elevation_fields.rb | Ruby | mit | 84 | main | 1,235 | # frozen_string_literal: true
# Elevation input group for location forms.
# Renders high and low elevation inputs with a button to fetch elevations
# from the map. Interacts with the Stimulus map controller.
#
# @example Usage in a form
# FormElevationFields(form: f, location: @location)
#
class Components::FormElev... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/occurrence_edit_form.rb | Ruby | mit | 84 | main | 5,343 | # frozen_string_literal: true
# Form for editing an Occurrence: change primary observation and
# remove observations. Renders a grid of observation boxes with
# Primary radio buttons and Remove checkboxes.
class Components::OccurrenceEditForm < Components::ApplicationForm
def initialize(occurrence:, observations:, c... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_groups.rb | Ruby | mit | 84 | main | 1,115 | # frozen_string_literal: true
# Renders member and admin group lists for a project.
# Replaces _groups.html.erb partial.
class Components::ProjectGroups < Components::Base
def initialize(project:, user:)
super()
@project = project
@user = user
end
def view_template
render_group(:change_member_st... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/form_compass_fields.rb | Ruby | mit | 84 | main | 1,489 | # frozen_string_literal: true
# Compass rose input group for location forms.
# Renders north, south, east, west coordinate inputs that interact with
# the Stimulus map controller.
#
# @example Usage in a form
# FormCompassFields(form: f, location: @location)
#
class Components::FormCompassFields < Components::Base
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/admin_session_form.rb | Ruby | mit | 84 | main | 608 | # frozen_string_literal: true
# Form for admins to switch to another user's account.
# Allows admins to impersonate users for debugging/support.
class Components::AdminSessionForm < Components::ApplicationForm
def initialize(model, **)
super(model, id: "admin_switch_users_form", **)
end
def view_template
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/ips_manager.rb | Ruby | mit | 84 | main | 5,299 | # frozen_string_literal: true
# Superform component for managing IP lists (blocked or okay).
# Renders a Panel containing a management form (PATCH) with:
# - Panel heading with title and count
# - Add IP input + ADD button + Clear List button
# - Optional filter form with pagination (for blocked IPs)
# - Table of IPs ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/commercial_inquiry_form.rb | Ruby | mit | 84 | main | 1,358 | # frozen_string_literal: true
# Form for sending a commercial inquiry about an image.
# Creates its own FormObject internally from the provided kwargs.
class Components::CommercialInquiryForm < Components::ApplicationForm
# Accept optional model arg for ModalForm compatibility (ignored - we create
# our own FormOb... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/account_profile_form.rb | Ruby | mit | 84 | main | 2,350 | # frozen_string_literal: true
# Form for editing a user's profile.
# Renders name, location, notes, image upload, and mailing address fields.
# Upload fields are nested under user[upload][...] via ApplicationForm's
# upload_fields helper (namespace(:upload) inside the user form).
class Components::AccountProfileForm <... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/license_form.rb | Ruby | mit | 84 | main | 1,052 | # frozen_string_literal: true
# Form for creating/editing licenses
class Components::LicenseForm < Components::ApplicationForm
def view_template
render_display_name_field
render_url_field
render_deprecated_checkbox
submit(:SUBMIT.t, center: true)
end
private
# Automatically determine action U... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/image_exif_link.rb | Ruby | mit | 84 | main | 654 | # frozen_string_literal: true
# Component for rendering a link to view image EXIF data in a modal.
#
# @example Basic usage
# render Components::ImageEXIFLink.new(
# image_id: @image.id
# )
#
# @example With custom CSS class
# render Components::ImageEXIFLink.new(
# image_id: @image.id,
# link_class:... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/object_footer.rb | Ruby | mit | 84 | main | 4,666 | # frozen_string_literal: true
module Components
# Component for rendering object footer metadata on show pages.
#
# Displays creation/modification dates, version info, view counts,
# and links to activity logs.
#
# @example Basic usage (non-versioned object)
# render(Components::ObjectFooter.new(user: ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/form_image_fields.rb | Ruby | mit | 84 | main | 3,469 | # frozen_string_literal: true
# Form fields for editing image metadata in the observation form.
#
# Fields include:
# - Notes (text area)
# - When taken (date select)
# - Copyright holder (text field)
# - License (select)
# - Original name (text field, existing images only)
#
# Handles both upload images (image) and e... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_alias_form.rb | Ruby | mit | 84 | main | 3,670 | # frozen_string_literal: true
# Form for creating or editing project aliases.
# Project aliases map short names to Users or Locations for field slip forms.
#
# Uses a type-switch controller to show/hide the appropriate autocompleter
# based on the target_type select value.
class Components::ProjectAliasForm < Componen... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/bounds_hidden_fields.rb | Ruby | mit | 84 | main | 1,143 | # frozen_string_literal: true
# Hidden fields for location bounds used by the map controller.
# Renders hidden inputs for north, south, east, west, low, and high values
# that the Stimulus map controller can read and update.
#
# Note: These fields are namespaced as location[north], location[south], etc.
# NOT nested u... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/name_approve_synonym_form.rb | Ruby | mit | 84 | main | 1,201 | # frozen_string_literal: true
# Form for approving a deprecated name
#
# @example
# render(Components::NameApproveSynonymForm.new(
# FormObject::ApproveSynonym.new,
# name: @name,
# approved_names: @approved_names
# ))
#
class Components::NameApproveSynonymForm < Components::ApplicationForm
def initi... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_admin_request_form.rb | Ruby | mit | 84 | main | 907 | # frozen_string_literal: true
# Form for requesting project admin access
class Components::ProjectAdminRequestForm < Components::ApplicationForm
def initialize(model, project:, **)
@project = project
super(model, **)
end
def view_template
raw(:admin_request_note.tp) # rubocop:disable Rails/OutputSaf... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/activity_log_type_filters.rb | Ruby | mit | 84 | main | 3,301 | # frozen_string_literal: true
# Phlex component for activity logs type filter form.
# Renders checkbox buttons for filtering RssLog by type.
#
# @example Usage in helper
# render(Components::ActivityLogTypeFilters.new(query:, types:))
#
class Components::ActivityLogTypeFilters < Components::Base
register_value_hel... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/inat_import_form.rb | Ruby | mit | 84 | main | 1,757 | # frozen_string_literal: true
# Form for creating a new iNat import.
# Renders username, observation IDs, consent, and details.
class Components::InatImportForm < Components::ApplicationForm
def initialize(model, super_importer: false, **)
@super_importer = super_importer
super(model, **)
end
def view_t... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/table.rb | Ruby | mit | 84 | main | 2,971 | # frozen_string_literal: true
# Table component for rendering data tables with Bootstrap styling.
#
# Uses the Phlex pattern of collecting columns via block, then rendering.
# Columns are defined with headers and content blocks that receive each row.
#
# @example Basic usage
# render(Components::Table.new(@users)) d... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/live_data_filter_form.rb | Ruby | mit | 84 | main | 3,738 | # frozen_string_literal: true
# Superform component for filtering paginated data by text prefix.
# Renders prev/next pagination buttons with a filter text field between them.
#
# @example Usage
# <%= render(Components::LiveDataFilterForm.new(
# FormObject::TextFilter.new(starts_with: @starts_with),
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/name_classification_form.rb | Ruby | mit | 84 | main | 835 | # frozen_string_literal: true
# Form for editing a Name's classification
#
# @example
# render(Components::NameClassificationForm.new(@name))
#
class Components::NameClassificationForm < Components::ApplicationForm
def initialize(name, **)
@name = name
super
end
def view_template
textarea_field(:c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.