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 | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/forms/previews_controller.rb | Ruby | mit | 186 | master | 671 | # frozen_string_literal: true
class Forms::PreviewsController < Forms::ApplicationController
before_action :set_strict_loaded_fields
before_action :set_preview
before_action :set_preview_page_layout
def show
@instance = @preview.new
end
def create
@instance = @preview.new(preview_params)
if @... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/forms/fields_controller.rb | Ruby | mit | 186 | master | 1,625 | # frozen_string_literal: true
class Forms::FieldsController < Forms::ApplicationController
before_action :set_field, only: %i[show edit update destroy]
before_action :set_field_page_layout, only: %i[index new create show edit update]
def index
@fields = @form.fields.order(position: :asc)
end
def new
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/forms/overrides_controller.rb | Ruby | mit | 186 | master | 1,529 | # frozen_string_literal: true
class Forms::OverridesController < Forms::ApplicationController
before_action :set_override, only: %i[edit update destroy]
before_action :set_override_page_layout, only: %i[index new create show edit update]
def index
@overrides = @form.overrides.order(position: :asc)
end
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/forms/application_controller.rb | Ruby | mit | 186 | master | 584 | # frozen_string_literal: true
class Forms::ApplicationController < ApplicationController
before_action :set_form
before_action :set_form_layout_data
protected
# Use callbacks to share common setup or constraints between actions.
def set_form
@form = FormKit::Form.find(params[:form_id])
end
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/form_override.rb | Ruby | mit | 186 | master | 754 | # frozen_string_literal: true
module FormKit
class FormOverride < ApplicationRecord
self.table_name = "form_kit_form_overrides"
belongs_to :form, class_name: "FormKit::MetalForm", foreign_key: "form_id"
has_many :field_overrides, class_name: "FormKit::FieldOverride", inverse_of: :form_override, depende... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/data_source.rb | Ruby | mit | 186 | master | 1,052 | # frozen_string_literal: true
module FormKit
class DataSource < FormKit::FieldOptions
def type_key
self.class.type_key
end
def stored_type
:integer
end
def foreign_field_name_suffix
"_id"
end
def foreign_field_name(field_name)
"#{field_name}#{foreign_field_name_... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/virtual_model.rb | Ruby | mit | 186 | master | 770 | # frozen_string_literal: true
module FormKit
class VirtualModel < FormCore::VirtualModel
include SerializableModel::ActsAsDefaultValue
include SerializableModel::EnumAttributeLocalizable
def persisted?
false
end
def dump
self.class.dump(self)
end
class << self
def res... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/application_record.rb | Ruby | mit | 186 | master | 224 | # frozen_string_literal: true
module FormKit
class ApplicationRecord < ::ApplicationRecord
self.abstract_class = true
include ModelKit::ActsAsDefaultValue
include ModelKit::EnumAttributeLocalizable
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/metal_form.rb | Ruby | mit | 186 | master | 1,421 | # frozen_string_literal: true
module FormKit
class MetalForm < ApplicationRecord
self.table_name = "form_kit_forms"
has_many :fields, class_name: "FormKit::Field", foreign_key: "form_id", inverse_of: :form, dependent: :destroy
has_many :overrides, class_name: "FormKit::FormOverride", foreign_key: "form... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields.rb | Ruby | mit | 186 | master | 831 | # frozen_string_literal: true
module FormKit::Fields
def self.all_types
@all_types ||= [
FormKit::Fields::Text,
FormKit::Fields::Boolean,
FormKit::Fields::Decimal,
FormKit::Fields::Integer,
FormKit::Fields::Date,
FormKit::Fields::Datetime,
FormKit::Fields::Choice,
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/choice.rb | Ruby | mit | 186 | master | 389 | # frozen_string_literal: true
module FormKit
class Choice < FormKit::ApplicationRecord
self.table_name = "form_kit_choices"
belongs_to :form, class_name: "FormKit::MetalForm"
belongs_to :field
validates :label,
presence: true
acts_as_list scope: [:field_id]
before_validation... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/field_override.rb | Ruby | mit | 186 | master | 459 | # frozen_string_literal: true
module FormKit
class FieldOverride < FormKit::ApplicationRecord
self.table_name = "form_kit_field_overrides"
belongs_to :form_override, class_name: "FormKit::FormOverride"
belongs_to :field, class_name: "FormKit::Field", foreign_key: "field_id"
enum accessibility: { re... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/field.rb | Ruby | mit | 186 | master | 3,894 | # frozen_string_literal: true
module FormKit
class Field < ApplicationRecord
self.table_name = "form_kit_fields"
has_many :overrides, class_name: "FormKit::FieldOverride", foreign_key: "field_id", inverse_of: :field, dependent: :delete_all
belongs_to :form, class_name: "FormKit::MetalForm", touch: true... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/data_sources/empty.rb | Ruby | mit | 186 | master | 444 | # frozen_string_literal: true
module FormKit::DataSources
class Empty < FormKit::DataSource
def foreign_field_name_suffix
""
end
def foreign_field_name(field_name)
field_name
end
def text_method
nil
end
def interpret_to(_model, _field_name, _accessibility, _options = ... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/field/helper.rb | Ruby | mit | 186 | master | 495 | # frozen_string_literal: true
class FormKit::Field
module Helper
extend ActiveSupport::Concern
def options_configurable?
options.is_a?(SerializableModel::Base) && options.attributes.any?
end
def validations_configurable?
validations.is_a?(SerializableModel::Base) && validations.attribut... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/embeds/date_range.rb | Ruby | mit | 186 | master | 559 | # frozen_string_literal: true
module FormKit
module Embeds
class DateRange < FormKit::VirtualModel
attribute :begin, :datetime
attribute :end, :datetime
validates :end,
timeliness: {
after: :begin,
type: :date
},
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/embeds/datetime_range.rb | Ruby | mit | 186 | master | 567 | # frozen_string_literal: true
module FormKit
module Embeds
class DatetimeRange < FormKit::VirtualModel
attribute :begin, :datetime
attribute :end, :datetime
validates :end,
timeliness: {
after: :begin,
type: :datetime
},
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/embeds/integer_range.rb | Ruby | mit | 186 | master | 507 | # frozen_string_literal: true
module FormKit
module Embeds
class IntegerRange < FormKit::VirtualModel
attribute :begin, :integer
attribute :end, :integer
validates :begin, :end,
numericality: { only_integer: true },
allow_blank: true
validates :end,
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/embeds/decimal_range.rb | Ruby | mit | 186 | master | 508 | # frozen_string_literal: true
module FormKit
module Embeds
class DecimalRange < FormKit::VirtualModel
attribute :begin, :decimal
attribute :end, :decimal
validates :begin, :end,
numericality: { only_integer: false },
allow_blank: true
validates :end,
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/datetime_range.rb | Ruby | mit | 186 | master | 577 | # frozen_string_literal: true
module FormKit::Fields
class DatetimeRange < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
protected
def interpret_attribute_to(model, _accessibility, _overrides = {})
nested_model = Class.new(FormKit::Embeds::Da... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/decimal_range.rb | Ruby | mit | 186 | master | 575 | # frozen_string_literal: true
module FormKit::Fields
class DecimalRange < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
protected
def interpret_attribute_to(model, _accessibility, _overrides = {})
nested_model = Class.new(FormKit::Embeds::Dec... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/datetime.rb | Ruby | mit | 186 | master | 482 | # frozen_string_literal: true
module FormKit::Fields
class Datetime < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
def stored_type
:datetime
end
protected
def interpret_extra_to(model, _accessibility, _overrides = {})
model.cl... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_resource_select.rb | Ruby | mit | 186 | master | 682 | # frozen_string_literal: true
module FormKit::Fields
class MultipleResourceSelect < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
def stored_type
:string
end
delegate :data_source, to: :options
def collection
data_source.scoped_rec... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/date.rb | Ruby | mit | 186 | master | 478 | # frozen_string_literal: true
module FormKit::Fields
class Date < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
def stored_type
:datetime
end
protected
def interpret_extra_to(model, _accessibility, _overrides = {})
model.class_... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_nested_form.rb | Ruby | mit | 186 | master | 788 | # frozen_string_literal: true
module FormKit::Fields
class MultipleNestedForm < FormKit::Field
after_create do
build_nested_form.save!
end
serialize :validations, coder: Validations
serialize :options, coder: FormKit::NonConfigurable
def attached_nested_form?
true
end
def a... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/decimal.rb | Ruby | mit | 186 | master | 227 | # frozen_string_literal: true
module FormKit::Fields
class Decimal < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
def stored_type
:decimal
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/text.rb | Ruby | mit | 186 | master | 223 | # frozen_string_literal: true
module FormKit::Fields
class Text < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
def stored_type
:string
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/date_range.rb | Ruby | mit | 186 | master | 569 | # frozen_string_literal: true
module FormKit::Fields
class DateRange < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
protected
def interpret_attribute_to(model, _accessibility, _overrides = {})
nested_model = Class.new(FormKit::Embeds::DateRa... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_resource.rb | Ruby | mit | 186 | master | 650 | # frozen_string_literal: true
module FormKit::Fields
class MultipleResource < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
def stored_type
:string
end
delegate :data_source, to: :options
def collection
data_source.scoped_records
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/resource_select.rb | Ruby | mit | 186 | master | 642 | # frozen_string_literal: true
module FormKit::Fields
class ResourceSelect < FormKit::Field
serialize :options, coder: Options
serialize :validations, coder: Validations
def stored_type
:string
end
delegate :data_source, to: :options
def collection
data_source.scoped_records
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/integer_range.rb | Ruby | mit | 186 | master | 575 | # frozen_string_literal: true
module FormKit::Fields
class IntegerRange < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
protected
def interpret_attribute_to(model, _accessibility, _overrides = {})
nested_model = Class.new(FormKit::Embeds::Int... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/boolean.rb | Ruby | mit | 186 | master | 244 | # frozen_string_literal: true
module FormKit::Fields
class Boolean < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: FormKit::NonConfigurable
def stored_type
:boolean
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/resource.rb | Ruby | mit | 186 | master | 611 | # frozen_string_literal: true
module FormKit::Fields
class Resource < FormKit::Field
serialize :options, coder: Options
serialize :validations, coder: Validations
def stored_type
:integer
end
delegate :data_source, to: :options
def collection
data_source.scoped_records
end
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/integer.rb | Ruby | mit | 186 | master | 458 | # frozen_string_literal: true
module FormKit::Fields
class Integer < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
def stored_type
:integer
end
protected
def interpret_extra_to(model, accessibility, _overrides = {})
return if a... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_choice.rb | Ruby | mit | 186 | master | 651 | # frozen_string_literal: true
module FormKit::Fields
class MultipleChoice < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: FormKit::NonConfigurable
include Fakable
def stored_type
:integer
end
def attached_choices?
true
end
def arr... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_select.rb | Ruby | mit | 186 | master | 593 | # frozen_string_literal: true
module FormKit::Fields
class MultipleSelect < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
include Fakable
def stored_type
:string
end
def attached_choices?
true
end
def array?
true
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/nested_form.rb | Ruby | mit | 186 | master | 744 | # frozen_string_literal: true
module FormKit::Fields
class NestedForm < FormKit::Field
after_create do
build_nested_form.save!
end
serialize :validations, coder: Validations
serialize :options, coder: FormKit::NonConfigurable
def attached_nested_form?
true
end
protected
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/choice.rb | Ruby | mit | 186 | master | 611 | # frozen_string_literal: true
module FormKit::Fields
class Choice < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: FormKit::NonConfigurable
include Fakable
def stored_type
:integer
end
def attached_choices?
true
end
protected
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/select.rb | Ruby | mit | 186 | master | 553 | # frozen_string_literal: true
module FormKit::Fields
class Select < FormKit::Field
serialize :validations, coder: Validations
serialize :options, coder: Options
include Fakable
def stored_type
:string
end
def attached_choices?
true
end
protected
def interpret_ex... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/integer_range/options.rb | Ruby | mit | 186 | master | 5,995 | # frozen_string_literal: true
class FormKit::Fields::IntegerRange
class Options < FormKit::FieldOptions
attribute :step, :integer, default: 1
validates :step,
numericality: {
greater_than_or_equal_to: 1
}
attribute :begin_from, :string, default: "unlimited"
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_choice/validations.rb | Ruby | mit | 186 | master | 207 | # frozen_string_literal: true
class FormKit::Fields::MultipleChoice
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
prepend FormKit::Validations::Length
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_choice/fakable.rb | Ruby | mit | 186 | master | 432 | # frozen_string_literal: true
class FormKit::Fields::MultipleChoice
module Fakable
extend ActiveSupport::Concern
module ClassMethods
def configure_fake_options_to(field)
field.choices.build label: Faker::Artist.name
field.choices.build label: Faker::Artist.name
field.choices.bu... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_nested_form/validations.rb | Ruby | mit | 186 | master | 211 | # frozen_string_literal: true
class FormKit::Fields::MultipleNestedForm
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
prepend FormKit::Validations::Length
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/decimal_range/options.rb | Ruby | mit | 186 | master | 6,001 | # frozen_string_literal: true
class FormKit::Fields::DecimalRange
class Options < FormKit::FieldOptions
attribute :step, :decimal, default: 0.01
validates :step,
numericality: {
greater_than_or_equal_to: 0.01
}
attribute :begin_from, :string, default: "unlimi... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/date_range/options.rb | Ruby | mit | 186 | master | 9,367 | # frozen_string_literal: true
class FormKit::Fields::DateRange
class Options < FormKit::FieldOptions
attribute :begin_from, :string, default: "unlimited"
enum begin_from: {
unlimited: "unlimited",
today: "today",
date: "date",
days_before_end: "days_before_end"
}, _prefix: :begin_... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/choice/validations.rb | Ruby | mit | 186 | master | 205 | # frozen_string_literal: true
class FormKit::Fields::Choice
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
# prepend FormKit::Validations::Uniqueness
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/choice/fakable.rb | Ruby | mit | 186 | master | 424 | # frozen_string_literal: true
class FormKit::Fields::Choice
module Fakable
extend ActiveSupport::Concern
module ClassMethods
def configure_fake_options_to(field)
field.choices.build label: Faker::Artist.name
field.choices.build label: Faker::Artist.name
field.choices.build labe... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/text/validations.rb | Ruby | mit | 186 | master | 285 | # frozen_string_literal: true
class FormKit::Fields::Text
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
prepend FormKit::Validations::Length
prepend FormKit::Validations::Format
# prepend FormKit::Validations::Uniqueness
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/datetime/validations.rb | Ruby | mit | 186 | master | 207 | # frozen_string_literal: true
class FormKit::Fields::Datetime
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
# prepend FormKit::Validations::Uniqueness
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/datetime/options.rb | Ruby | mit | 186 | master | 4,576 | # frozen_string_literal: true
class FormKit::Fields::Datetime
class Options < FormKit::FieldOptions
attribute :begin_from, :string, default: "unlimited"
enum begin_from: {
unlimited: "unlimited",
now: "now",
time: "time",
minutes_before_end: "minutes_before_end"
}, _prefix: :begin... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_resource_select/options.rb | Ruby | mit | 186 | master | 223 | # frozen_string_literal: true
class FormKit::Fields::MultipleResourceSelect
class Options < FormKit::FieldOptions
include FormKit::Options::DataSource
attribute :strict_select, :boolean, default: true
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_resource_select/validations.rb | Ruby | mit | 186 | master | 215 | # frozen_string_literal: true
class FormKit::Fields::MultipleResourceSelect
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
prepend FormKit::Validations::Length
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/resource_select/validations.rb | Ruby | mit | 186 | master | 213 | # frozen_string_literal: true
class FormKit::Fields::ResourceSelect
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
# prepend FormKit::Validations::Uniqueness
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/resource_select/options.rb | Ruby | mit | 186 | master | 215 | # frozen_string_literal: true
class FormKit::Fields::ResourceSelect
class Options < FormKit::FieldOptions
include FormKit::Options::DataSource
attribute :strict_select, :boolean, default: true
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/select/fakable.rb | Ruby | mit | 186 | master | 424 | # frozen_string_literal: true
class FormKit::Fields::Select
module Fakable
extend ActiveSupport::Concern
module ClassMethods
def configure_fake_options_to(field)
field.choices.build label: Faker::Artist.name
field.choices.build label: Faker::Artist.name
field.choices.build labe... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/select/validations.rb | Ruby | mit | 186 | master | 205 | # frozen_string_literal: true
class FormKit::Fields::Select
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
# prepend FormKit::Validations::Uniqueness
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/decimal/validations.rb | Ruby | mit | 186 | master | 253 | # frozen_string_literal: true
class FormKit::Fields::Decimal
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
prepend FormKit::Validations::Numericality
# prepend FormKit::Validations::Uniqueness
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/decimal/options.rb | Ruby | mit | 186 | master | 271 | # frozen_string_literal: true
class FormKit::Fields::Decimal
class Options < FormKit::FieldOptions
attribute :step, :decimal, default: 0.01
validates :step,
numericality: {
greater_than_or_equal_to: 0.0
}
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/datetime_range/options.rb | Ruby | mit | 186 | master | 9,852 | # frozen_string_literal: true
class FormKit::Fields::DatetimeRange
class Options < FormKit::FieldOptions
attribute :begin_from, :string, default: "unlimited"
enum begin_from: {
unlimited: "unlimited",
now: "now",
time: "time",
minutes_before_end: "minutes_before_end"
}, _prefix: :... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_resource/validations.rb | Ruby | mit | 186 | master | 209 | # frozen_string_literal: true
class FormKit::Fields::MultipleResource
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
prepend FormKit::Validations::Length
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/integer/options.rb | Ruby | mit | 186 | master | 302 | # frozen_string_literal: true
class FormKit::Fields::Integer
class Options < FormKit::FieldOptions
attribute :step, :integer, default: 0
validates :step,
numericality: {
only_integer: true,
greater_than_or_equal_to: 0
}
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/integer/validations.rb | Ruby | mit | 186 | master | 253 | # frozen_string_literal: true
class FormKit::Fields::Integer
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
prepend FormKit::Validations::Numericality
# prepend FormKit::Validations::Uniqueness
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/resource/validations.rb | Ruby | mit | 186 | master | 207 | # frozen_string_literal: true
class FormKit::Fields::Resource
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
# prepend FormKit::Validations::Uniqueness
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/date/validations.rb | Ruby | mit | 186 | master | 203 | # frozen_string_literal: true
class FormKit::Fields::Date
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
# prepend FormKit::Validations::Uniqueness
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/date/options.rb | Ruby | mit | 186 | master | 4,291 | # frozen_string_literal: true
class FormKit::Fields::Date
class Options < FormKit::FieldOptions
attribute :begin_from, :string, default: "unlimited"
enum begin_from: {
unlimited: "unlimited",
today: "today",
date: "date",
days_before_end: "days_before_end"
}, _prefix: :begin_from
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_select/validations.rb | Ruby | mit | 186 | master | 207 | # frozen_string_literal: true
class FormKit::Fields::MultipleSelect
class Validations < FormKit::FieldOptions
prepend FormKit::Validations::Presence
prepend FormKit::Validations::Length
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/fields/multiple_select/fakable.rb | Ruby | mit | 186 | master | 432 | # frozen_string_literal: true
class FormKit::Fields::MultipleSelect
module Fakable
extend ActiveSupport::Concern
module ClassMethods
def configure_fake_options_to(field)
field.choices.build label: Faker::Artist.name
field.choices.build label: Faker::Artist.name
field.choices.bu... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/form_kit/form/fakable.rb | Ruby | mit | 186 | master | 1,963 | # frozen_string_literal: true
class FormKit::Form
module Fakable
extend ActiveSupport::Concern
def build_random_fields(type_key_seq:)
transaction do
type_key_seq.each do |type_key|
if type_key.is_a? Hash
type_key.each do |k, v|
klass = FormKit::Fields.all_ty... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/business_pipeline.rb | Ruby | mit | 186 | master | 313 | # frozen_string_literal: true
module FlowKit
class BusinessPipeline < FlowCore::Pipeline
belongs_to :form, class_name: "FormKit::Form"
private
def on_build_workflow(workflow)
workflow.form = form
end
def workflow_class
FlowKit::BusinessWorkflow
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/human_task.rb | Ruby | mit | 186 | master | 4,477 | # frozen_string_literal: true
module FlowKit
class HumanTask < FlowCore::ApplicationRecord
self.table_name = "flow_kit_human_tasks"
include FlowCore::TaskExecutable
belongs_to :workflow, class_name: "FlowCore::Workflow"
belongs_to :instance, class_name: "FlowCore::Instance", autosave: true
bel... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/steps.rb | Ruby | mit | 186 | master | 281 | # frozen_string_literal: true
module FlowKit::Steps
def self.all_types
@all_types ||= [
FlowCore::Steps::Task,
FlowCore::Steps::ParallelSplit,
FlowCore::Steps::ExclusiveChoice,
FlowCore::Steps::Redirection,
FlowCore::Steps::End
]
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/assignee_candidate.rb | Ruby | mit | 186 | master | 279 | # frozen_string_literal: true
module FlowKit
class AssigneeCandidate < FlowCore::ApplicationRecord
self.table_name = "flow_kit_assignee_candidates"
belongs_to :assignable, polymorphic: true
belongs_to :trigger, class_name: "FlowCore::TransitionTrigger"
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/transition_triggers.rb | Ruby | mit | 186 | master | 211 | # frozen_string_literal: true
module FlowKit::TransitionTriggers
def self.all_types
@all_types ||= [
FlowKit::TransitionTriggers::HumanTask,
FlowKit::TransitionTriggers::Timer
]
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/business_instance.rb | Ruby | mit | 186 | master | 1,062 | # frozen_string_literal: true
module FlowKit
class BusinessInstance < FlowCore::Instance
belongs_to :creator, polymorphic: true
belongs_to :form, class_name: "FormKit::Form"
validate if: ->(r) { r.form && r.form_record_changed? } do
errors.add :form_record, :invalid if form && !form_record_valid?
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/business_workflow.rb | Ruby | mit | 186 | master | 313 | # frozen_string_literal: true
module FlowKit
class BusinessWorkflow < FlowCore::Workflow
belongs_to :form, class_name: "FormKit::Form"
private
def on_build_instance(instance)
instance.form = form
end
def instance_class
FlowKit::BusinessInstance
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/arc_guards/ruby_script.rb | Ruby | mit | 186 | master | 462 | # frozen_string_literal: true
module FlowKit::ArcGuards
class RubyScript < FlowCore::ArcGuard
serialize :configuration, coder: Configuration
def permit?(task)
result = ScriptEngine.run_inline configuration.script, payload: task.payload
if result.errors.any?
raise "Script has errored"
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/arc_guards/ruby_script/configuration.rb | Ruby | mit | 186 | master | 272 | # frozen_string_literal: true
module FlowKit::ArcGuards
class RubyScript
class Configuration < SerializableModel::Base
attribute :name, :string
attribute :script, :string
validates :name, :script,
presence: true
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/transition_triggers/human_task.rb | Ruby | mit | 186 | master | 1,601 | # frozen_string_literal: true
module FlowKit::TransitionTriggers
class HumanTask < FlowCore::TransitionTrigger
belongs_to :attached_form, class_name: "FormKit::Form", optional: true
belongs_to :form_override, class_name: "FormKit::FormOverride", optional: true
has_many :assignee_candidates, foreign_key:... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/transition_triggers/timer.rb | Ruby | mit | 186 | master | 347 | # frozen_string_literal: true
module FlowKit::TransitionTriggers
class Timer < FlowCore::TransitionTrigger
serialize :configuration, coder: Configuration
def configurable?
true
end
def on_task_enable(task)
TimerTaskJob.set(wait: configuration.countdown_in_seconds.seconds).perform_later(... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/transition_triggers/timer/configuration.rb | Ruby | mit | 186 | master | 382 | # frozen_string_literal: true
module FlowKit::TransitionTriggers
class Timer
class Configuration < SerializableModel::Base
attribute :countdown_in_seconds, :integer, default: 0
validates :countdown_in_seconds,
numericality: {
only_integer: true,
gr... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/flow_kit/transition_triggers/human_task/configuration.rb | Ruby | mit | 186 | master | 479 | # frozen_string_literal: true
module FlowKit::TransitionTriggers
class HumanTask
class Configuration < SerializableModel::Base
ASSIGN_TO_ENUM = {
instance_creator: "instance_creator",
candidate: "candidate"
}.freeze
attribute :assign_to, :string, default: ASSIGN_TO_ENUM[:instan... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/concerns/form_kit/validations/acceptance.rb | Ruby | mit | 186 | master | 378 | # frozen_string_literal: true
module FormKit::Validations
module Acceptance
extend ActiveSupport::Concern
prepended do
attribute :acceptance, :boolean, default: false
end
def interpret_to(model, field_name, _accessibility, _options = {})
super
return unless acceptance
model... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/concerns/form_kit/validations/length.rb | Ruby | mit | 186 | master | 1,758 | # frozen_string_literal: true
module FormKit::Validations
module Length
extend ActiveSupport::Concern
prepended do
embeds_one :length, class_name: "FormKit::Validations::Length::LengthOptions"
accepts_nested_attributes_for :length
after_initialize do
build_length unless length
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/concerns/form_kit/validations/numericality.rb | Ruby | mit | 186 | master | 1,910 | # frozen_string_literal: true
module FormKit::Validations
module Numericality
extend ActiveSupport::Concern
prepended do
embeds_one :numericality, class_name: "FormKit::Validations::Numericality::NumericalityOptions"
accepts_nested_attributes_for :numericality
after_initialize do
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/concerns/form_kit/validations/inclusion.rb | Ruby | mit | 186 | master | 975 | # frozen_string_literal: true
module FormKit::Validations
module Inclusion
extend ActiveSupport::Concern
prepended do
embeds_one :inclusion, class_name: "FormKit::Validations::Inclusion::InclusionOptions"
accepts_nested_attributes_for :inclusion
after_initialize do
build_inclusion... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/concerns/form_kit/validations/confirmation.rb | Ruby | mit | 186 | master | 386 | # frozen_string_literal: true
module FormKit::Validations
module Confirmation
extend ActiveSupport::Concern
prepended do
attribute :confirmation, :boolean, default: false
end
def interpret_to(model, field_name, _accessibility, _options = {})
super
return unless confirmation
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/concerns/form_kit/validations/presence.rb | Ruby | mit | 186 | master | 370 | # frozen_string_literal: true
module FormKit::Validations
module Presence
extend ActiveSupport::Concern
prepended do
attribute :presence, :boolean, default: false
end
def interpret_to(model, field_name, _accessibility, _options = {})
super
return unless presence
model.valid... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/concerns/form_kit/validations/uniqueness.rb | Ruby | mit | 186 | master | 392 | # frozen_string_literal: true
module FormKit::Validations
module Uniqueness
extend ActiveSupport::Concern
prepended do
attribute :uniqueness, :boolean, default: false
end
def interpret_to(model, field_name, _accessibility, _options = {})
super
return unless uniqueness
# TOD... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/concerns/form_kit/validations/exclusion.rb | Ruby | mit | 186 | master | 975 | # frozen_string_literal: true
module FormKit::Validations
module Exclusion
extend ActiveSupport::Concern
prepended do
embeds_one :exclusion, class_name: "FormKit::Validations::Exclusion::ExclusionOptions"
accepts_nested_attributes_for :exclusion
after_initialize do
build_exclusion... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/concerns/form_kit/validations/format.rb | Ruby | mit | 186 | master | 1,099 | # frozen_string_literal: true
module FormKit::Validations
module Format
extend ActiveSupport::Concern
prepended do
embeds_one :format, class_name: "FormKit::Validations::Format::FormatOptions"
accepts_nested_attributes_for :format
after_initialize do
build_format unless format
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/models/concerns/form_kit/options/data_source.rb | Ruby | mit | 186 | master | 844 | # frozen_string_literal: true
module FormKit::Options
module DataSource
extend ActiveSupport::Concern
included do
attribute :data_source_type, :string, default: FormKit::DataSources::Empty.to_s
FormKit::DataSource.descendants.each do |klass|
key = :"#{klass.type_key}_data_source"
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/helpers/navigation_helper.rb | Ruby | mit | 186 | master | 4,229 | # frozen_string_literal: true
module NavigationHelper
# Navigation helper
#
# Returns an `li` element with an 'active' class if the supplied
# controller(s) and/or action(s) are currently active. The content of the
# element is the value passed to the block.
#
# options - The options hash used to determi... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/helpers/fields_helper.rb | Ruby | mit | 186 | master | 974 | # frozen_string_literal: true
module FieldsHelper
def options_for_field_types(form, selected: nil)
fields = FormKit::Fields.all_types
if form.attachable_id.present?
fields -= [FormKit::Fields::NestedForm, FormKit::Fields::MultipleNestedForm]
end
options_for_select(fields.map { |klass| [klass.m... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/helpers/workflows_helper.rb | Ruby | mit | 186 | master | 942 | # frozen_string_literal: true
module WorkflowsHelper
def forms_options_for_select(selected: nil)
forms = FormKit::Form.all
options_from_collection_for_select(forms, :id, :name, selected)
end
def form_overrides_for_select(form, selected: nil)
options_from_collection_for_select(form.overrides, :id, :n... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/helpers/breadcrumbs_helper.rb | Ruby | mit | 186 | master | 322 | # frozen_string_literal: true
module BreadcrumbsHelper
def breadcrumbs
@_breadcrumbs ||= []
end
def add_to_breadcrumbs(text, link = nil)
breadcrumbs.push(
text: text,
link: link
)
end
def render_breadcrumbs
return unless breadcrumbs.any?
render "layouts/breadcrumb"
end
en... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/helpers/application_helper.rb | Ruby | mit | 186 | master | 2,767 | # frozen_string_literal: true
module ApplicationHelper
def present(model, options = {})
klass = options.delete(:presenter_class) || "#{model.class}Presenter".constantize
presenter = klass.new(model, self, options)
yield(presenter) if block_given?
presenter
end
def options_for_enum_select(klass... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/helpers/forms_helper.rb | Ruby | mit | 186 | master | 285 | # frozen_string_literal: true
module FormsHelper
def smart_form_fields_path(form)
case form
when FormKit::Form
form_fields_path(form)
when FormKit::NestedForm
nested_form_fields_path(form)
else
raise "Unknown form: #{form.class}"
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/mruby/lib/input.rb | Ruby | mit | 186 | master | 411 | module Input
class << self
def load(input)
@input = input || {}
@input.freeze
end
def value
@input
end
def pack
@input.pack
end
def [](key)
@input[key]
end
def each(*args, &block)
@input.each(*args, &block)
end
def map(*args, &block)... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/mruby/lib/core_ext.rb | Ruby | mit | 186 | master | 1,463 | class FalseClass
def dup
self
end
def pack
dup
end
end
class TrueClass
def dup
self
end
def pack
dup
end
end
class Method
def dup
self
end
end
class NilClass
def dup
self
end
def pack
dup
end
end
class String
def pack
dup
end
end
class Numeric
de... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/mruby/lib/script_kernel.rb | Ruby | mit | 186 | master | 284 | def prepare
input = @input || {}
remove_instance_variable "@input"
configuration = input[:configuration] || {}
Time.formatted_offset = configuration[:time_zone_offset] || 0
Input.load input[:payload]
end
def pack_output
instance_variable_set "@output", Output.pack
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.