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/carousel_thumbnail.rb | Ruby | mit | 84 | main | 1,958 | # frozen_string_literal: true
# Carousel thumbnail navigation item component.
#
# Renders a thumbnail indicator for carousel navigation.
# Handles both uploaded images (no Image record) and existing images.
#
# @example
# render Components::CarouselThumbnail.new(
# user: @user,
# image: @image,
# index: ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/crud_action_button.rb | Ruby | mit | 84 | main | 2,195 | # frozen_string_literal: true
# Renders a button_to with turbo support and optional confirmation.
# Used as the base for patch_button, post_button, put_button, destroy_button.
#
# Usage:
# render(Components::CrudActionButton.new(
# name: :REMOVE.l,
# target: @herbarium, # or a path string
# method: :pat... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/visual_group_form.rb | Ruby | mit | 84 | main | 1,433 | # frozen_string_literal: true
# Form for creating or editing visual groups within a visual model.
# Visual groups are used to organize and categorize images for visual
# classification training.
class Components::VisualGroupForm < Components::ApplicationForm
def initialize(model, visual_model:, **)
@visual_model... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/modal_progress_spinner.rb | Ruby | mit | 84 | main | 1,102 | # frozen_string_literal: true
# Bootstrap modal with spinner for progress indicator (e.g., "saving vote").
# Cannot be dismissed by user - must be hidden programmatically by JS.
#
# Usage: Rendered once in the application layout.
# render(Components::ModalProgressSpinner.new)
#
class Components::ModalProgressSpinner... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/show_prev_next_nav.rb | Ruby | mit | 84 | main | 2,233 | # frozen_string_literal: true
# Prev/Index/Next navigation for show pages.
# Displays when viewing an object in the context of a query.
class Components::ShowPrevNextNav < Components::Base
BTN_CLASSES = %w[navbar-link navbar-left btn btn-lg px-0].freeze
prop :object, _Nilable(AbstractModel), default: nil
prop :... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/carousel_item.rb | Ruby | mit | 84 | main | 2,927 | # frozen_string_literal: true
# Individual carousel slide item component.
#
# Renders a single slide in a Bootstrap carousel with:
# - Large image with object-fit: contain
# - Stretched link overlay
# - Lightbox button
# - Carousel caption with votes and image info
#
# @example
# render Components::CarouselItem.new(... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/occurrence_resolve_form.rb | Ruby | mit | 84 | main | 2,914 | # frozen_string_literal: true
# Form content for the project membership confirmation modal.
# Renders the intro text, project list, and Cancel/Add All buttons.
#
# Use .modal() to get the full modal wrapper that auto-opens:
# render(Components::OccurrenceResolveForm.modal(gaps:, ...))
class Components::OccurrenceRes... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/lightbox_observation_title.rb | Ruby | mit | 84 | main | 1,452 | # frozen_string_literal: true
# Lightbox caption observation title component.
#
# Renders the observation title heading used in lightbox captions
# and turbo stream updates. This component displays the observation ID
# as a link along with the author attribution.
#
# @example Basic usage
# render LightboxObservation... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/observation_form_projects.rb | Ruby | mit | 84 | main | 3,817 | # frozen_string_literal: true
# Projects section of the observation form.
# Renders a collapsible panel with project checkboxes and constraint messages.
#
# @param form [Components::ApplicationForm] the parent form
# @param observation [Observation] the observation model
# @param user [User] the current user
# @param ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_field_slip_tracker_row.rb | Ruby | mit | 84 | main | 1,750 | # frozen_string_literal: true
# Renders a table row for a field slip job tracker.
# Replaces field_slips/_tracker_row.erb partial.
class Components::ProjectFieldSlipTrackerRow < Components::Base
register_value_helper :field_slip_link
register_value_helper :field_slip_job_tracker_path
include Phlex::Rails::Helper... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/occurrence_resolve_modal.rb | Ruby | mit | 84 | main | 1,508 | # frozen_string_literal: true
# Bootstrap modal wrapper for the project membership confirmation.
# Auto-opens on page load with a static backdrop.
class Components::OccurrenceResolveModal < Components::Base
def initialize(gaps:, primary:, user:, selected: nil,
occurrence: nil)
super()
@gaps ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/carousel_controls.rb | Ruby | mit | 84 | main | 933 | # frozen_string_literal: true
# Carousel navigation controls component.
#
# Renders previous/next navigation buttons for Bootstrap carousels.
#
# @example
# render Components::CarouselControls.new(carousel_id: "my_carousel")
class Components::CarouselControls < Components::Base
prop :carousel_id, String
def vie... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/map.rb | Ruby | mit | 84 | main | 7,857 | # frozen_string_literal: true
# Interactive map component for displaying locations and observations.
# Works with the Stimulus map controller to render Google Maps with
# markers and bounding boxes.
#
# Replaces the `make_map` helper from MapHelper.
#
# @example Basic usage
# render(Components::Map.new(objects: [@lo... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/trusted_html.rb | Ruby | mit | 84 | main | 865 | # frozen_string_literal: true
# Shared helper for safely rendering HTML content in Phlex components.
# Include this module to get the `trusted_html` method.
#
# @example
# class MyComponent < Phlex::HTML
# include Components::TrustedHtml
#
# def view_template
# trusted_html(:some_translation.l)
# e... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/base_image.rb | Ruby | mit | 84 | main | 7,601 | # frozen_string_literal: true
# Abstract base class for image components.
#
# This component replaces the ImagePresenter class, handling all image
# presentation logic internally through Literal properties and methods.
#
# Provides shared functionality for rendering images with:
# - Lazy loading with aspect ratio pres... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/api_key_form.rb | Ruby | mit | 84 | main | 1,619 | # frozen_string_literal: true
# Form for creating API keys
class Components::APIKeyForm < Components::ApplicationForm
def initialize(model, cancel_target: nil, cancel_parent: nil, **)
@cancel_target = cancel_target
@cancel_parent = cancel_parent
super(model, **)
end
def view_template
if @cancel_... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/lightbox_caption.rb | Ruby | mit | 84 | main | 5,847 | # frozen_string_literal: true
# Lightbox caption component for building the HTML caption shown in the
# lightbox.
#
# Handles two types of captions:
# 1. Observation captions - full details with when/where/who, notes, and naming
# 2. Image captions - just the image notes
#
# Both types include image links (original, E... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/modal_confirm.rb | Ruby | mit | 84 | main | 1,468 | # frozen_string_literal: true
# Bootstrap modal for Turbo confirmation dialogs.
# Replaces the browser's native confirm() with a styled modal.
# Used by Turbo.config.forms.confirm via the confirm-modal Stimulus controller.
#
# Usage: Rendered once in the application layout.
# render(Components::ModalConfirm.new)
#
c... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/form_location_map.rb | Ruby | mit | 84 | main | 2,081 | # frozen_string_literal: true
# Map component for location forms with toggle and clear buttons.
# Works with the Stimulus map controller to allow users to select locations
# visually on an interactive map.
#
# @example Basic usage in a Phlex form
# render(Components::FormLocationMap.new(
# id: "herbarium_form_ma... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/base.rb | Ruby | mit | 84 | main | 2,121 | # frozen_string_literal: true
class Components::Base < Phlex::HTML
extend Literal::Properties
# Include any helpers you want to be available across all components
include Phlex::Rails::Helpers::Routes
include Phlex::Rails::Helpers::AssetPath
include Phlex::Rails::Helpers::LinkTo
include Phlex::Rails::Help... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/observation_form_notes.rb | Ruby | mit | 84 | main | 2,452 | # frozen_string_literal: true
# Notes section of the observation form.
# Renders a collapsible panel with textarea fields for notes parts.
#
# @param form [Components::ApplicationForm] the parent form
# @param observation [Observation] the observation model
# @param user [User] the current user
# @param mode [Symbol] ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/interactive_image.rb | Ruby | mit | 84 | main | 2,209 | # frozen_string_literal: true
# Draw an interactive image with all the fixin's.
#
# This Phlex component renders an interactive image with lazy loading,
# lightbox support, voting, and other features. It inherits shared
# functionality from BaseImage.
#
# @example
# render Components::InteractiveImage.new(
# use... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/webmaster_question_form.rb | Ruby | mit | 84 | main | 1,317 | # frozen_string_literal: true
# Form for submitting a question to the webmaster.
# Creates its own FormObject internally from the provided kwargs.
class Components::WebmasterQuestionForm < Components::ApplicationForm
# Accept optional model arg for ModalForm compatibility (ignored - we create
# our own FormObject)... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/image_vote_interface.rb | Ruby | mit | 84 | main | 2,912 | # frozen_string_literal: true
# Image vote interface component for displaying image voting UI.
#
# Renders a vote meter (progress bar) and vote buttons for users to
# vote on images.
# The component handles:
# - Vote percentage calculation and display
# - Progress bar visualization
# - Vote buttons for all vote values... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/name_inherit_classification_form.rb | Ruby | mit | 84 | main | 1,218 | # frozen_string_literal: true
# Form for inheriting classification from a parent name.
# Creates its own FormObject internally from the provided kwargs.
#
# @example
# render(Components::NameInheritClassificationForm.new(
# name: @name,
# parent: @parent_text_name,
# options: @options,
# message: @me... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/textile_sandbox_form.rb | Ruby | mit | 84 | main | 3,587 | # frozen_string_literal: true
# Form for testing Textile markup in a sandbox environment.
# Users can enter Textile code and see both the rendered output and HTML codes.
#
# @example Usage in view
# render(Components::TextileSandboxForm.new(
# textile_sandbox,
# show_result: !code.nil?,
# submit_type: su... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/donations_review_form.rb | Ruby | mit | 84 | main | 1,657 | # frozen_string_literal: true
# Admin form for reviewing donations.
# Renders a table of donations with checkboxes for marking
# each donation as reviewed.
class Components::DonationsReviewForm < Components::ApplicationForm
def initialize(form, donations:, **)
@donations = donations
super(form, id: "admin_re... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/authors_and_editors.rb | Ruby | mit | 84 | main | 3,763 | # frozen_string_literal: true
module Components
# Component for rendering authors and editors metadata on show pages.
#
# Displays authors and editors with appropriate links for requesting
# authorship credit or reviewing authors (for admins).
#
# @example For description objects
# render(Components::A... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/occurrence_form.rb | Ruby | mit | 84 | main | 3,253 | # frozen_string_literal: true
# Form for creating an Occurrence by selecting observations.
# Renders a grid of observation matrix boxes with Include
# checkboxes and Primary radio buttons.
class Components::OccurrenceForm < Components::ApplicationForm
def initialize(source_obs:, recent_observations:, user:, **)
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/naming_form.rb | Ruby | mit | 84 | main | 3,805 | # frozen_string_literal: true
# Form for proposing or editing a naming on an observation.
# Extends ApplicationForm (Superform) and uses the field builder methods.
#
# @param naming [Naming] the naming model
# @param observation [Observation] the parent observation
# @param vote [Vote] the vote object (defaults to new... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/form_location_feedback.rb | Ruby | mit | 84 | main | 1,002 | # frozen_string_literal: true
# Displays feedback about dubious location reasons when creating/editing
# observations, species lists, or locations.
#
# @param dubious_where_reasons [Array<String>, nil] dubious reasons
# @param button [String, Symbol] button name for help text
class Components::FormLocationFeedback < C... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/image_copyright.rb | Ruby | mit | 84 | main | 1,119 | # frozen_string_literal: true
# Component for displaying image copyright information.
#
# @example Basic usage
# render Components::ImageCopyright.new(
# user: @user,
# image: @image
# )
#
# @example With context object
# render Components::ImageCopyright.new(
# user: @user,
# image: @image,
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/index_pagination_nav.rb | Ruby | mit | 84 | main | 6,237 | # frozen_string_literal: true
class Components::IndexPaginationNav < Components::Base
include Phlex::Slotable
slot :sorter
prop :pagination_data, _Nilable(PaginationData)
prop :position, Symbol, default: -> { :top }
prop :args, Hash, default: -> { {} }
# These need to be passed from the helper which has ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_sidebar.rb | Ruby | mit | 84 | main | 4,850 | # frozen_string_literal: true
module Components
# Renders the main application sidebar with navigation and user controls
#
# @example Basic usage in layout
# <%= render(Components::ApplicationSidebar.new(
# user: @user,
# browser: browser,
# request: request,
# in_admin_mode: in_admin... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_violations_form.rb | Ruby | mit | 84 | main | 4,339 | # frozen_string_literal: true
# Form for viewing and removing project constraint violations.
# Renders a table of non-compliant observations with checkboxes
# for removal by authorized users.
class Components::ProjectViolationsForm < Components::ApplicationForm
def initialize(model, violations:, user:, **)
@viol... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/donation_form.rb | Ruby | mit | 84 | main | 652 | # frozen_string_literal: true
# Form for creating donations (admin only).
# Allows admins to manually enter donation information.
class Components::DonationForm < Components::ApplicationForm
def view_template
super do
text_field(:amount, size: 7, label: "#{:confirm_amount.t}:",
in... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/name_lifeform_form.rb | Ruby | mit | 84 | main | 852 | # frozen_string_literal: true
# Form for editing Name lifeform tags
#
# @example
# render(Components::NameLifeformForm.new(
# FormObject::Lifeform.from_name(@name),
# name: @name
# ))
#
class Components::NameLifeformForm < Components::ApplicationForm
def initialize(model, name:, **)
@name = name
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/observation_form_specimen.rb | Ruby | mit | 84 | main | 4,958 | # frozen_string_literal: true
# Specimen section of the observation form.
# Renders specimen checkbox and collapsible collection number/herbarium fields.
#
# @param form [Components::ApplicationForm] the parent form
# @param observation [Observation] the observation model
# @param mode [Symbol] :create or :update
# @p... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/email_new_password_form.rb | Ruby | mit | 84 | main | 417 | # frozen_string_literal: true
# Form for requesting a new password via email
class Components::EmailNewPasswordForm < Components::ApplicationForm
def view_template
text_field(:login, label: "#{:login_user.t}:", wrap_class: "mt-3",
data: { autofocus: true })
submit(:SEND.l, center: tru... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/naming_reasons_fields.rb | Ruby | mit | 84 | main | 2,416 | # frozen_string_literal: true
# Renders naming reason checkboxes and collapsible textareas.
# Used in naming form to allow users to provide notes for each reason.
#
# @param reasons [Hash] the naming reasons from Naming#init_reasons
# @param naming_ns [Superform::Namespace] the naming namespace
class Components::Namin... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_list_item.rb | Ruby | mit | 84 | main | 951 | # frozen_string_literal: true
# Renders a single project in a list-group.
# Replaces _project.html.erb partial.
class Components::ProjectListItem < Components::Base
def initialize(project:)
super()
@project = project
end
def view_template
div(class: "list-group-item d-flex align-items-start") do
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/qr_reader_form.rb | Ruby | mit | 84 | main | 661 | # frozen_string_literal: true
# Form for scanning QR codes
class Components::QRReaderForm < Components::ApplicationForm
def initialize(model, **options)
options[:id] ||= "qr_reader_form"
options[:data] = { controller: "qr-reader" }.merge(options[:data] || {})
super(model, **options) # rubocop:disable Sty... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/translators_credit.rb | Ruby | mit | 84 | main | 1,858 | # frozen_string_literal: true
module Components
# Renders credit to translators at bottom of pages for non-official languages
# and/or edit translation links when tracking translation usage
#
# @example Basic usage in layout
# <%= render(Components::TranslatorsCredit.new) %>
#
class TranslatorsCredit <... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/collapse_help_block.rb | Ruby | mit | 84 | main | 844 | # frozen_string_literal: true
# Collapse help block component - collapsible help text block
#
# @example
# CollapseHelpBlock(id: "help_1") { "This is help text" }
# CollapseHelpBlock(id: "help_2", direction: "up") { "More help" }
class Components::CollapseHelpBlock < Components::Base
prop :target_id, String
pr... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/form_list_feedback.rb | Ruby | mit | 84 | main | 3,180 | # frozen_string_literal: true
# Displays feedback for species list name fields when:
# - Names are not recognized (missing)
# - Names are deprecated (with valid synonyms)
# - Names are ambiguous (multiple matches)
#
# @param new_names [Array<String>, nil] unrecognized name strings
# @param deprecated_names [Array<Name... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/form_carousel.rb | Ruby | mit | 84 | main | 3,012 | # frozen_string_literal: true
# Form carousel component for uploading and editing observation images.
#
# This carousel is used in observation forms to display and manage images.
# It includes form fields for each image and EXIF camera metadata display.
#
# @example
# render Components::FormCarousel.new(
# user:... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/search_form.rb | Ruby | mit | 84 | main | 14,093 | # frozen_string_literal: true
# Superform component for rendering faceted search forms.
# Replaces shared/search_form.erb and shared/search_panel.erb partials.
#
# Uses the Query model (e.g., Query::Observations) directly as the form model.
# Field layout is determined by FIELD_COLUMNS on the controller.
# Field types... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/collection_number_form.rb | Ruby | mit | 84 | main | 1,705 | # frozen_string_literal: true
# Form for creating or editing collection numbers.
# Collection numbers are specimen identifiers assigned by collectors.
class Components::CollectionNumberForm < Components::ApplicationForm
def initialize(model, observation: nil, back: nil, **)
@observation = observation || model.ob... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/matrix_box.rb | Ruby | mit | 84 | main | 8,334 | # frozen_string_literal: true
# Matrix box component for displaying objects in a responsive grid.
# Essentially a wrapper for a Panel component
#
# This component can be used in two ways:
# 1. With an object - calculates everything it needs from the @object and
# renders a standard layout for Image, Observation, Rs... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/visual_model_form.rb | Ruby | mit | 84 | main | 886 | # frozen_string_literal: true
# Form for creating or editing visual models.
# Visual models are used to organize visual groups for image classification.
class Components::VisualModelForm < Components::ApplicationForm
def view_template
super do
render_errors if model.errors.any?
render_name_field
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/article_form.rb | Ruby | mit | 84 | main | 1,024 | # frozen_string_literal: true
# Form for creating or editing articles.
# Articles support Textile markup for formatting.
class Components::ArticleForm < Components::ApplicationForm
def view_template
super do
render_title_field
render_body_field
submit(:SUBMIT.t, center: true)
end
end
p... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/translation_form.rb | Ruby | mit | 84 | main | 6,038 | # frozen_string_literal: true
# Phlex form for editing translation strings.
# Creates its own FormObject internally (Pattern B).
# Uses FieldProxy for dynamic textarea fields with flat param names.
class Components::TranslationForm < Components::ApplicationForm
def initialize(lang:, tag:, edit_tags:,
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_member_form.rb | Ruby | mit | 84 | main | 1,594 | # frozen_string_literal: true
# Form for adding or editing project members.
#
# For new members: renders autocompleter to select a user
# For existing members: renders status change buttons
class Components::ProjectMemberForm < Components::ApplicationForm
def initialize(model, project:, **)
@project = project
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/herbarium_curator_request_form.rb | Ruby | mit | 84 | main | 849 | # frozen_string_literal: true
# Form for requesting to be a herbarium curator
class Components::HerbariumCuratorRequestForm < Components::ApplicationForm
register_value_helper :herbaria_curator_requests_path
def initialize(model, herbarium:, back: nil, q_param: nil, **options)
@herbarium = herbarium
@back... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/herbarium_form.rb | Ruby | mit | 84 | main | 5,145 | # frozen_string_literal: true
# Form for creating or editing herbaria (fungaria).
# Handles both personal and institutional herbaria with optional location
# selection via map.
class Components::HerbariumForm < Components::ApplicationForm
# rubocop:disable Metrics/ParameterLists
def initialize(model, user:, back: ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/observation_form_lists.rb | Ruby | mit | 84 | main | 1,576 | # frozen_string_literal: true
# Species lists section of the observation form.
# Renders a collapsible panel with species list checkboxes.
#
# @param form [Components::ApplicationForm] the parent form
# @param lists [Array<SpeciesList>] available species lists
# @param list_checks [Hash] list_id => checked state
class... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/image_original_link.rb | Ruby | mit | 84 | main | 1,223 | # frozen_string_literal: true
# Component for rendering a link to view the original image.
#
# @example Basic usage with an image instance
# render Components::ImageOriginalLink.new(
# image: @image
# )
#
# @example With an image ID
# render Components::ImageOriginalLink.new(
# image_id: @image.id
# )
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/name_deprecate_synonym_form.rb | Ruby | mit | 84 | main | 2,385 | # frozen_string_literal: true
# Form for deprecating a name in favor of another.
# Creates its own FormObject internally from the provided kwargs.
#
# @example
# render(Components::NameDeprecateSynonymForm.new(
# name: @name,
# proposed_name: @given_name,
# is_misspelling: @misspelling,
# comment: @c... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/identify_filter_form.rb | Ruby | mit | 84 | main | 3,807 | # frozen_string_literal: true
# Superform component for the identify observations filter form.
# Renders a navbar search form with a swappable autocompleter
# (clade/region) for filtering observations that need identification.
#
# Uses dual Stimulus autocompleter targets (clade + region) on all
# elements so the swap ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/region_with_box_fields.rb | Ruby | mit | 84 | main | 4,181 | # frozen_string_literal: true
# Composite component for region search with bounding box map integration.
# Renders a region text field plus compass direction inputs for defining
# a geographic bounding box, integrated with a Stimulus map controller.
#
# @example Usage in SearchForm
# RegionWithBoxFields(query: model... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/panel.rb | Ruby | mit | 84 | main | 6,582 | # frozen_string_literal: true
# Component for rendering Bootstrap panels (cards).
#
# Accepts slots for panel subcomponents:
# heading, heading_links, thumbnail, body, footer
#
# @example Basic panel with heading and body
# render(Components::Panel.new do |panel|
# panel.with_heading { "Title" }
# panel.wi... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/observations_download_form.rb | Ruby | mit | 84 | main | 2,253 | # frozen_string_literal: true
# Phlex form component for downloading observations in various formats.
# Shared between observations/downloads and species_lists/downloads views.
#
# @example
# render(Components::ObservationsDownloadForm.new(
# query_param: q_param
# ))
#
class Components::ObservationsDownloadFo... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form.rb | Ruby | mit | 84 | main | 22,940 | # frozen_string_literal: true
# Base form component for all Superform forms in the application.
#
# Provides custom Bootstrap-styled field components and shared helper methods
# for building consistent form layouts with labels, help text, validation, etc.
#
# @example Basic usage
# class UserForm < Components::Appli... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/name_tracker_form.rb | Ruby | mit | 84 | main | 1,371 | # frozen_string_literal: true
# Form for creating or updating a name tracker.
# Allows users to enable/disable tracking for a name and configure
# email notification templates.
class Components::NameTrackerForm < Components::ApplicationForm
def initialize(model, note_template: nil, **)
@note_template = note_temp... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/user_question_form.rb | Ruby | mit | 84 | main | 1,202 | # frozen_string_literal: true
# Form for sending a question to another user.
# Creates its own FormObject internally from the provided kwargs.
class Components::UserQuestionForm < Components::ApplicationForm
# Accept optional model arg for ModalForm compatibility (ignored - we create
# our own FormObject). This is... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/names_lookup_field_group.rb | Ruby | mit | 84 | main | 4,462 | # frozen_string_literal: true
# Composite component for the names lookup field with conditional modifier
# checkboxes. Used in search forms for both Name and Observation searches.
#
# Renders a textarea autocompleter for name lookup, plus conditional rows
# of checkbox modifiers that appear when the autocompleter has ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/name_change_request_form.rb | Ruby | mit | 84 | main | 1,325 | # frozen_string_literal: true
# Form for submitting a name change request email to admins.
# Allows users to request changing a taxonomic name.
class Components::NameChangeRequestForm < Components::ApplicationForm
def initialize(model, name:, new_name_with_icn_id:, **)
@name = name
@new_name_with_icn_id = ne... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/user_bonuses_form.rb | Ruby | mit | 84 | main | 667 | # frozen_string_literal: true
# Form for editing user contribution bonuses (admin only).
# Allows admins to manually adjust user bonus points.
class Components::UserBonusesForm < Components::ApplicationForm
def view_template
super do
div(class: "help-note mr-3") { :change_user_bonuses_help.tp }
texta... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/account_signup_form.rb | Ruby | mit | 84 | main | 1,882 | # frozen_string_literal: true
# Form for creating a new user account (signup).
# Collects login, password, email, name, and theme preference.
class Components::AccountSignupForm < Components::ApplicationForm
def initialize(model, **)
super(model, method: :post, **)
end
def view_template
super do
r... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/merge_request_form.rb | Ruby | mit | 84 | main | 1,295 | # frozen_string_literal: true
# Form for submitting a merge request email to admins.
# Allows users to request merging two objects (e.g., names or locations).
class Components::MergeRequestForm < Components::ApplicationForm
def initialize(model, old_obj:, new_obj:, model_class:, **)
@old_obj = old_obj
@new_o... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/publication_form.rb | Ruby | mit | 84 | main | 1,296 | # frozen_string_literal: true
# Form for creating/editing publications
class Components::PublicationForm < Components::ApplicationForm
def view_template
render_full_field
render_link_field
render_peer_reviewed_field
render_how_helped_field
render_mo_mentioned_field
submit(submit_text, center:... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_banner.rb | Ruby | mit | 84 | main | 3,708 | # frozen_string_literal: true
module Components
# Renders a project banner with title, location, date range, tabs,
# and optional banner image
#
# @example Basic usage in helper
# content_for(:project_banner) do
# render(Components::ProjectBanner.new(
# project: @project,
# on_project... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/image_vote_anonymity_form.rb | Ruby | mit | 84 | main | 908 | # frozen_string_literal: true
# Form for changing image vote anonymity (no fields, just submit buttons)
class Components::ImageVoteAnonymityForm < Components::ApplicationForm
def initialize(model, **)
super(model, method: :put, **)
end
def view_template
div(class: "mt-3") do
render_anonymous_count... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/sequence_form.rb | Ruby | mit | 84 | main | 3,417 | # frozen_string_literal: true
# Form for creating or editing DNA sequences attached to observations.
# Sequences can contain genetic data (bases) or reference external archives.
class Components::SequenceForm < Components::ApplicationForm
def initialize(model, observation: nil, back: nil, **)
@observation = obse... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/comment_form.rb | Ruby | mit | 84 | main | 891 | # frozen_string_literal: true
# Form for creating/editing comments
class Components::CommentForm < Components::ApplicationForm
def view_template
render_summary_field
render_comment_field
submit(submit_text, center: true)
end
private
def form_action
if @model.persisted?
comment_path(id: ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_aliases.rb | Ruby | mit | 84 | main | 1,095 | # frozen_string_literal: true
# Renders alias management links for a project target (User or Location).
# Replaces _aliases.html.erb partial.
class Components::ProjectAliases < Components::Base
register_output_helper :edit_project_alias_link, mark_safe: true
register_output_helper :new_project_alias_link, mark_saf... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/project_form.rb | Ruby | mit | 84 | main | 2,995 | # frozen_string_literal: true
# Phlex form for creating/editing projects.
# Replaces the ERB partial projects/_form.html.erb.
class Components::ProjectForm < Components::ApplicationForm
def initialize(model, dates_any: true, upload_params: nil, **)
@dates_any = dates_any
@upload_params = upload_params
su... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/banner_form.rb | Ruby | mit | 84 | main | 646 | # frozen_string_literal: true
# Form for admins to create or update site-wide banners.
# Displays a textarea for the banner message with a submit button.
# Always creates a new banner record (with incremented version) rather than
# updating existing records, so always uses POST method.
class Components::BannerForm < C... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/login_layout.rb | Ruby | mit | 84 | main | 711 | # frozen_string_literal: true
module Components
# Renders a welcome/description layout for login pages
#
# Displays MO logo (mobile only) and description text for unverified users
#
# @example Basic usage
# <%= render(Components::LoginLayout.new) %>
#
class LoginLayout < Base
def view_template
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/sidebar/user.rb | Ruby | mit | 84 | main | 2,377 | # frozen_string_literal: true
module Components
module Sidebar
# Renders the user section of the sidebar for logged-in users (mobile only)
#
# @example Basic usage
# render(Components::Sidebar::User.new(
# user: @user,
# classes: sidebar_css_classes,
# in_admin_mode: in_admi... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/sidebar/login.rb | Ruby | mit | 84 | main | 658 | # frozen_string_literal: true
module Components
module Sidebar
# Renders the "Account" section of the sidebar for non-logged-in users
#
# @example Basic usage
# render(Components::Sidebar::Login.new(
# heading_key: :app_account,
# tabs: sidebar_login_tabs,
# classes: sidebar... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/sidebar/admin.rb | Ruby | mit | 84 | main | 962 | # frozen_string_literal: true
module Components
module Sidebar
# Renders the "Admin" section of the sidebar for admin users in admin mode
#
# @example Basic usage
# render(Components::Sidebar::Admin.new(
# heading_key: :app_admin,
# tabs: sidebar_admin_tabs,
# classes: sideb... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/sidebar/languages.rb | Ruby | mit | 84 | main | 2,176 | # frozen_string_literal: true
module Components
module Sidebar
# Renders the language dropdown in the sidebar
#
# @example Basic usage
# render(Components::Sidebar::Languages.new(
# browser: browser,
# request: request
# ))
#
class Languages < Components::Base
pr... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/sidebar/section.rb | Ruby | mit | 84 | main | 1,352 | # frozen_string_literal: true
module Components
module Sidebar
# Base class for sidebar sections that render a heading and list of links
#
# Can be used directly by passing heading_key and tabs as props, or
# subclassed for more complex rendering (e.g., Login and Admin components).
#
# @examp... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/descriptions/author_request_form.rb | Ruby | mit | 84 | main | 822 | # frozen_string_literal: true
module Components::Descriptions
# Form to request authorship of a description.
# Sends an email to the authors/reviewers.
class AuthorRequestForm < Components::ApplicationForm
def initialize(model, object:, action:, **)
@object = object
super(model, action: action, *... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/descriptions/merge_form.rb | Ruby | mit | 84 | main | 2,697 | # frozen_string_literal: true
# Form for merging a description into another description of the same parent.
# Used for both NameDescription and LocationDescription.
class Components::Descriptions::MergeForm < Components::ApplicationForm
def initialize(description, user:)
@description = description
@user = us... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/descriptions/permissions_form.rb | Ruby | mit | 84 | main | 5,220 | # frozen_string_literal: true
# Form for editing permissions on a description.
# Allows setting reader/writer/admin permissions for groups and users.
# Used for both NameDescription and LocationDescription.
#
# Note: This form uses dynamic field names (group_reader[14], writein_name[1])
# that don't map to model attri... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/descriptions/move_form.rb | Ruby | mit | 84 | main | 2,260 | # frozen_string_literal: true
# Form for moving a description to a synonym of its parent.
# Only meaningful for NameDescription since Location has no synonyms.
# For LocationDescription, moves will be empty and only the header shows.
class Components::Descriptions::MoveForm < Components::ApplicationForm
def initiali... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/matrix_box/render_data.rb | Ruby | mit | 84 | main | 3,568 | # frozen_string_literal: true
class Components::MatrixBox
# Build render data for MatrixBox based on @object type
module RenderData
def build_render_data
case @object
when ::Image
extract_image_data
when Observation
extract_observation_data
when RssLog
extract_rs... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/projects/tabs.rb | Ruby | mit | 84 | main | 2,706 | # frozen_string_literal: true
module Components
module Projects
# Renders the project tab bar (Summary, Observations, Names, etc.)
# Extracted so it can be re-rendered independently via Turbo Stream.
class Tabs < Components::Base
def initialize(project:, user: nil, current_tab: nil)
super()... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/projects/locations_table.rb | Ruby | mit | 84 | main | 5,725 | # frozen_string_literal: true
module Components
module Projects
# Renders the project locations table with target location
# grouping, collapsible sub-locations, and aliases.
class LocationsTable < Components::Base
def initialize(project:, grouped_data:,
ungrouped_locations:, o... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/projects/obs_footer.rb | Ruby | mit | 84 | main | 1,430 | # frozen_string_literal: true
module Components
module Projects
# Renders action buttons on a project Updates tab matrix box.
# When showing excluded observations, only an Add button is shown
# (which also un-excludes). Otherwise, both Add and Exclude are shown.
class ObsFooter < Components::Base
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/select_range_field.rb | Ruby | mit | 84 | main | 1,492 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Renders a pair of select fields for range selection (e.g., rank range,
# confidence range). Both selects share the same options list.
#
# @example Usage in a form
# render(SelectRangeField.new(
# form: f,
# ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/text_field.rb | Ruby | mit | 84 | main | 2,865 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Bootstrap text input field component with form-group wrapper and slots
class TextField < Superform::Rails::Components::Input
include Phlex::Slotable
include FieldWithHelp
include FieldLabelRow
slot :between
... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/field_with_help.rb | Ruby | mit | 84 | main | 1,310 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Shared module for rendering collapsible help blocks on form fields
module FieldWithHelp
def render_help_in_label_row
render_help_icon if help_slot
end
def render_help_after_field
render_help_text if ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/date_field.rb | Ruby | mit | 84 | main | 3,831 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Bootstrap date field component with three selects (year, month, day).
# Compatible with Rails date_select parameter format.
#
# @example
# field(:when).date(wrapper_options: { label: "Date:" })
#
class DateField ... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/autocompleter_field.rb | Ruby | mit | 84 | main | 11,359 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Bootstrap autocompleter input field component with dropdown suggestions
# Wraps a text input with Stimulus autocompleter controller
# rubocop:disable Metrics/ClassLength
class AutocompleterField < Superform::Rails::Compo... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/radio_field.rb | Ruby | mit | 84 | main | 2,110 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Bootstrap radio button group component with radio wrapper per option
#
# Renders each option as:
# <div class="radio">
# <label><input type="radio" ...> label text</label>
# </div>
#
# Accepts a Superform... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/autocompleter_prefill.rb | Ruby | mit | 84 | main | 1,884 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Helper methods for prefilling autocompleter fields with display values
# when the stored values are IDs.
#
# @example Include in a form
# class MyForm < Components::ApplicationForm
# include AutocompleterPrefil... |
github | MushroomObserver/mushroom-observer | https://github.com/MushroomObserver/mushroom-observer | app/components/application_form/file_field.rb | Ruby | mit | 84 | main | 3,451 | # frozen_string_literal: true
class Components::ApplicationForm < Superform::Rails::Form
# Bootstrap file input field component with form-group wrapper and slots
# Matches the markup and behavior of file_field_with_label helper
#
# Supports two modes:
# 1. Default (file-input controller): Single file with va... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.