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 | app/models/flow_core/end_place.rb | Ruby | mit | 186 | master | 284 | # frozen_string_literal: true
module FlowCore
class EndPlace < FlowCore::Place
validates :type,
uniqueness: {
scope: :workflow
}
validates :output_arcs,
length: { is: 0 }
def end?
true
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/arc.rb | Ruby | mit | 186 | master | 1,329 | # frozen_string_literal: true
module FlowCore
class Arc < FlowCore::ApplicationRecord
self.table_name = "flow_core_arcs"
belongs_to :workflow, class_name: "FlowCore::Workflow"
belongs_to :transition, class_name: "FlowCore::Transition"
belongs_to :place, class_name: "FlowCore::Place"
has_many :g... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/instance.rb | Ruby | mit | 186 | master | 2,762 | # frozen_string_literal: true
module FlowCore
class Instance < FlowCore::ApplicationRecord
self.table_name = "flow_core_instances"
FORBIDDEN_ATTRIBUTES = %i[
workflow_id stage activated_at finished_at canceled_at terminated_at terminate_reason
created_at updated_at
].freeze
belongs_to :... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/task.rb | Ruby | mit | 186 | master | 5,692 | # frozen_string_literal: true
module FlowCore
class Task < FlowCore::ApplicationRecord
self.table_name = "flow_core_tasks"
belongs_to :workflow, class_name: "FlowCore::Workflow"
belongs_to :transition, class_name: "FlowCore::Transition"
belongs_to :instance, class_name: "FlowCore::Instance", autosa... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/pipeline.rb | Ruby | mit | 186 | master | 1,695 | # frozen_string_literal: true
module FlowCore
class Pipeline < FlowCore::ApplicationRecord
self.table_name = "flow_core_pipelines"
has_many :generated_workflows,
class_name: "FlowCore::Workflow", foreign_key: :generated_by_pipeline_id,
inverse_of: :generated_by, dependent: :nullify... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/transition_trigger.rb | Ruby | mit | 186 | master | 1,163 | # frozen_string_literal: true
module FlowCore
class TransitionTrigger < FlowCore::ApplicationRecord
self.table_name = "flow_core_transition_triggers"
belongs_to :workflow, class_name: "FlowCore::Workflow", optional: true
belongs_to :transition, class_name: "FlowCore::Transition", optional: true
bel... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/workflow.rb | Ruby | mit | 186 | master | 5,301 | # frozen_string_literal: true
module FlowCore
class Workflow < FlowCore::ApplicationRecord
self.table_name = "flow_core_workflows"
FORBIDDEN_ATTRIBUTES = %i[verified verified_at created_at updated_at].freeze
belongs_to :generated_by,
class_name: "FlowCore::Pipeline", foreign_key: :genera... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/arc_guard.rb | Ruby | mit | 186 | master | 1,153 | # frozen_string_literal: true
module FlowCore
class ArcGuard < FlowCore::ApplicationRecord
self.table_name = "flow_core_arc_guards"
belongs_to :workflow, class_name: "FlowCore::Workflow", optional: true
belongs_to :arc, class_name: "FlowCore::Arc", optional: true
has_one :transition, through: :arc,... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/place.rb | Ruby | mit | 186 | master | 1,648 | # frozen_string_literal: true
module FlowCore
class Place < FlowCore::ApplicationRecord
self.table_name = "flow_core_places"
FORBIDDEN_ATTRIBUTES = %i[workflow_id created_at updated_at].freeze
belongs_to :workflow, class_name: "FlowCore::Workflow"
# NOTE: Place - out -> Transition - in -> Place
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/token.rb | Ruby | mit | 186 | master | 2,264 | # frozen_string_literal: true
module FlowCore
class Token < FlowCore::ApplicationRecord
self.table_name = "flow_core_tokens"
belongs_to :workflow, class_name: "FlowCore::Workflow"
belongs_to :instance, class_name: "FlowCore::Instance"
belongs_to :place, class_name: "FlowCore::Place"
belongs_to ... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/branch.rb | Ruby | mit | 186 | master | 1,245 | # frozen_string_literal: true
module FlowCore
class Branch < FlowCore::ApplicationRecord
self.table_name = "flow_core_branches"
belongs_to :pipeline, class_name: "FlowCore::Pipeline"
belongs_to :step, class_name: "FlowCore::Step"
has_many :arc_guards, class_name: "FlowCore::ArcGuard", dependent: :d... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/start_place.rb | Ruby | mit | 186 | master | 287 | # frozen_string_literal: true
module FlowCore
class StartPlace < FlowCore::Place
validates :type,
uniqueness: {
scope: :workflow
}
validates :input_arcs,
length: { is: 0 }
def start?
true
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/step.rb | Ruby | mit | 186 | master | 10,399 | # frozen_string_literal: true
module FlowCore
class Step < FlowCore::ApplicationRecord
self.table_name = "flow_core_steps"
has_many :generated_transitions,
class_name: "FlowCore::Transition", foreign_key: :generated_by_step_id,
inverse_of: :generated_by, dependent: :nullify
be... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/steps/parallel_split.rb | Ruby | mit | 186 | master | 1,234 | # frozen_string_literal: true
module FlowCore::Steps
class ParallelSplit < FlowCore::Step
def deploy_to_workflow!(workflow, input_transition)
return input_transition if branches.empty?
input_place = find_or_create_input_place(workflow, input_transition)
parallel_split_transition =
inpu... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/steps/end.rb | Ruby | mit | 186 | master | 705 | # frozen_string_literal: true
module FlowCore::Steps
class End < FlowCore::Step
def deploy_to_workflow!(workflow, input_place_or_transition)
target_place = workflow.end_place || workflow.create_end_place!
if input_place_or_transition.is_a? FlowCore::Transition
target_place.input_transitions ... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/steps/task.rb | Ruby | mit | 186 | master | 563 | # frozen_string_literal: true
module FlowCore::Steps
class Task < FlowCore::Step
def deploy_to_workflow!(workflow, input_place_or_transition)
input_place = find_or_create_input_place(workflow, input_place_or_transition)
transition = input_place.output_transitions.create! workflow: workflow, name: na... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/steps/exclusive_choice.rb | Ruby | mit | 186 | master | 1,923 | # frozen_string_literal: true
module FlowCore::Steps
class ExclusiveChoice < FlowCore::Step
after_create :auto_create_fallback_branch
def deploy_to_workflow!(workflow, input_transition)
return input_transition if branches.empty?
input_place = find_or_create_input_place(workflow, input_transitio... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | app/models/flow_core/steps/redirection.rb | Ruby | mit | 186 | master | 867 | # frozen_string_literal: true
module FlowCore::Steps
class Redirection < FlowCore::Step
def deploy_to_workflow!(workflow, input_place_or_transition)
target_transition = workflow.transitions.find_by! generated_by_step_id: redirect_to_step_id
target_place = target_transition.input_places.first
i... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/test_helper.rb | Ruby | mit | 186 | master | 802 | # frozen_string_literal: true
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require_relative "../test/dummy/config/environment"
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)]
require "rails/test_help"
# Filter out the backtrace from minitest while preservi... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/lib/script_engine.rb | Ruby | mit | 186 | master | 2,954 | # frozen_string_literal: true
module ScriptEngine
class << self
ENGINE_PATH = Rails.root.join("mruby")
def engine
@engine ||= ScriptCore::Engine.new ENGINE_PATH.join("bin")
end
def precompile(code, with_lib: true)
wrapped_code =
if with_lib
"prepare; Output.value = cla... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/lib/model_kit/acts_as_default_value.rb | Ruby | mit | 186 | master | 5,164 | # frozen_string_literal: true
# https://github.com/FooBarWidget/default_value_for
#
# Copyright (c) 2008-2012 Phusion
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, i... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/lib/model_kit/enum_attribute_localizable.rb | Ruby | mit | 186 | master | 1,103 | # frozen_string_literal: true
module ModelKit
module EnumAttributeLocalizable
extend ActiveSupport::Concern
module ClassMethods
def human_enum_value(attribute, value, options = {})
parts = attribute.to_s.split(".")
attribute = parts.pop.pluralize
attributes_scope = "#{i18n_... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/lib/serializable_model/enum_attribute_localizable.rb | Ruby | mit | 186 | master | 1,112 | # frozen_string_literal: true
module SerializableModel
module EnumAttributeLocalizable
extend ActiveSupport::Concern
module ClassMethods
def human_enum_value(attribute, value, options = {})
parts = attribute.to_s.split(".")
attribute = parts.pop.pluralize
attributes_scope =... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/lib/serializable_model/base.rb | Ruby | mit | 186 | master | 2,645 | # frozen_string_literal: true
require "active_entity"
require "serializable_model/acts_as_default_value"
require "serializable_model/enum_attribute_localizable"
module SerializableModel
class Base < ActiveEntity::Base
include ActsAsDefaultValue
include EnumAttributeLocalizable
class_attribute :keeping_... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/lib/serializable_model/acts_as_default_value.rb | Ruby | mit | 186 | master | 4,734 | # frozen_string_literal: true
# https://github.com/FooBarWidget/default_value_for
#
# Copyright (c) 2008-2012 Phusion
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, i... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/config/application.rb | Ruby | mit | 186 | master | 1,047 | # frozen_string_literal: true
require_relative "boot"
require "rails/all"
Bundler.require(*Rails.groups)
require "flow_core"
# Require monkey patches
Dir[Pathname.new(File.dirname(__FILE__)).realpath.parent.join("lib", "patches", "*.rb")].map do |file|
require file
end
module Dummy
class Application < Rails::A... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/config/routes.rb | Ruby | mit | 186 | master | 2,606 | # frozen_string_literal: true
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
Rails.application.routes.draw do
resources :pipelines do
member do
post "deploy"
end
scope module: :pipelines do
resources :steps, except: %i[index] do
s... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/config/puma.rb | Ruby | mit | 186 | master | 1,616 | # frozen_string_literal: true
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for mini... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/config/initializers/inflections.rb | Ruby | mit | 186 | master | 712 | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
ActiveSupport::Inflecto... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/config/environments/test.rb | Ruby | mit | 186 | master | 1,937 | # frozen_string_literal: true
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.applic... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/config/environments/development.rb | Ruby | mit | 186 | master | 2,273 | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/config/environments/production.rb | Ruby | mit | 186 | master | 5,035 | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, a... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/db/schema.rb | Ruby | mit | 186 | master | 17,453 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rai... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/db/seeds.rb | Ruby | mit | 186 | master | 1,078 | # frozen_string_literal: true
FlowCore::Definition.new name: "Simple sequence" do |net|
net.start_place :start, name: "Start"
net.end_place :end, name: "End"
net.transition :t1, input: :start, output: :p1
net.transition :t2, input: :p1, output: :end
end.deploy!
FlowCore::Definition.new name: "Parallel routin... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/db/migrate/20200523233225_create_assignee_candidates.rb | Ruby | mit | 186 | master | 430 | # frozen_string_literal: true
class CreateAssigneeCandidates < ActiveRecord::Migration[6.0]
def change
create_table :flow_kit_assignee_candidates do |t|
t.references :assignable, polymorphic: true, null: false, index: { name: "index_flow_kit_assignee_candidates_on_assignable" }
t.references :trigger,... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/db/migrate/20200523233221_create_human_tasks.rb | Ruby | mit | 186 | master | 769 | # frozen_string_literal: true
class CreateHumanTasks < ActiveRecord::Migration[6.0]
def change
create_table :flow_kit_human_tasks do |t|
t.references :workflow, foreign_key: { to_table: :flow_core_workflows }, null: false
t.references :instance, foreign_key: { to_table: :flow_core_instances }, null: ... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/db/migrate/20200205175443_add_columns_to_flow_core_tables.rb | Ruby | mit | 186 | master | 762 | # frozen_string_literal: true
class AddColumnsToFlowCoreTables < ActiveRecord::Migration[6.0]
def change
change_table :flow_core_workflows do |t|
t.references :form, foreign_key: { to_table: :form_kit_forms }
end
change_table :flow_core_pipelines do |t|
t.references :form, foreign_key: { to_... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/db/migrate/20200205175444_create_notifications.rb | Ruby | mit | 186 | master | 293 | # frozen_string_literal: true
class CreateNotifications < ActiveRecord::Migration[6.0]
def change
create_table :notifications do |t|
t.references :user, null: false, foreign_key: true
t.references :task, null: false, foreign_key: false
t.timestamps
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/db/migrate/20200205175440_create_form_kit_tables.rb | Ruby | mit | 186 | master | 1,802 | # frozen_string_literal: true
class CreateFormKitTables < ActiveRecord::Migration[6.0]
def change
create_table :form_kit_forms do |t|
t.references :attachable, polymorphic: true
t.string :name
t.string :key, null: false, index: { unique: true }
t.string :type, null: false
t.time... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/overrides/action_view/helpers/form_builder_override.rb | Ruby | mit | 186 | master | 3,468 | # frozen_string_literal: true
ActionView::Helpers::FormBuilder.class_eval do
def error_message(method, tag: :div, ref_method: nil, escape: true, **options, &block)
return if object.errors.empty?
error = object.errors[method]&.first
error ||= object.errors[ref_method]&.first if ref_method
return unle... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/overrides/models/flow_core/pipeline_override.rb | Ruby | mit | 186 | master | 1,988 | # frozen_string_literal: true
FlowCore::Pipeline.class_eval do
def start_graphviz_node(graph)
if graph.nodes["start"]
return graph.nodes["start"]
end
attrs = {
label: "Start", shape: :circle, style: :filled, fillcolor: :white
}
Graphviz::Node.new "start", graph, **attrs
end
def... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/overrides/models/flow_core/step_override.rb | Ruby | mit | 186 | master | 3,756 | # frozen_string_literal: true
FlowCore::Step.class_eval do
def graphviz_name
"pipeline_#{pipeline_id}_step_#{id}"
end
def graphviz_node(graph, interactive: false)
if graph.nodes[graphviz_name]
return graph.nodes[graphviz_name]
end
attrs = {
label: name, style: :filled, fillcolor: :w... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/overrides/models/flow_core/workflow_override.rb | Ruby | mit | 186 | master | 1,962 | # frozen_string_literal: true
FlowCore::Workflow.class_eval do
def internal?
false
end
def to_graphviz(instance: nil)
graph = Graphviz::Graph.new(rankdir: "LR", splines: :spline, ratio: :auto)
free_token_places =
if instance
instance.tokens.where(stage: %i[free locked]).map(&:place_id)... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/overrides/models/flow_core/branch_override.rb | Ruby | mit | 186 | master | 2,585 | # frozen_string_literal: true
FlowCore::Branch.class_eval do
def graphviz_name
"pipeline_#{pipeline_id}_step_#{step_id}_branch_#{id}"
end
def graphviz_node(graph, interactive: false)
if graph.nodes[graphviz_name]
return graph.nodes[graphviz_name]
end
attrs = {
label: name, shape: :b... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/overrides/models/flow_core/steps/end_override.rb | Ruby | mit | 186 | master | 942 | # frozen_string_literal: true
FlowCore::Steps::End.class_eval do
def graphviz_name
"pipeline_#{pipeline_id}_step_#{id}"
end
def graphviz_node(graph, interactive: false)
if graph.nodes[graphviz_name]
return graph.nodes[graphviz_name]
end
attrs = {
style: :filled, fillcolor: :white
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/jobs/timer_task_job.rb | Ruby | mit | 186 | master | 258 | # frozen_string_literal: true
class TimerTaskJob < ApplicationJob
queue_as :default
def perform(task_id)
task = FlowCore::Task.find(task_id)
return unless task.enabled?
return if task.errored? || task.suspended?
task.finish!
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/composite_field_presenter.rb | Ruby | mit | 186 | master | 233 | # frozen_string_literal: true
module FormKit
class CompositeFieldPresenter < FormKit::FieldPresenter
def value
target&.send(@model.key)
end
def value_for_preview
target&.send(@model.key)
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/field_presenter.rb | Ruby | mit | 186 | master | 1,049 | # frozen_string_literal: true
module FormKit
class FieldPresenter < ApplicationPresenter
def required
@model.validations&.presence
end
alias required? required
def target
@options[:target]
end
def value
if target.respond_to?(:read_attribute)
target.read_attribute(@... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/datetime_presenter.rb | Ruby | mit | 186 | master | 1,904 | # frozen_string_literal: true
module FormKit::Fields
class DatetimePresenter < FormKit::FieldPresenter
def value
super&.in_time_zone
end
def value_for_preview
value = self.value
I18n.l(value) if value
end
def field_options
return {} if access_readonly?
options = {... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/text_presenter.rb | Ruby | mit | 186 | master | 200 | # frozen_string_literal: true
module FormKit::Fields
class TextPresenter < FormKit::FieldPresenter
def multiline
@model.options.multiline
end
alias multiline? multiline
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/choice_presenter.rb | Ruby | mit | 186 | master | 341 | # frozen_string_literal: true
module FormKit::Fields
class ChoicePresenter < FormKit::FieldPresenter
def value_for_preview
id = value
return if id.blank?
if choices.loaded?
choices.target.find { |choice| choice.id == id }&.label
else
choices.find_by(id: id)&.label
e... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/decimal_range_presenter.rb | Ruby | mit | 186 | master | 2,900 | # frozen_string_literal: true
module FormKit::Fields
class DecimalRangePresenter < FormKit::CompositeFieldPresenter
def value_for_preview
record = value
return unless record
"#{record.begin} ~ #{record.end}"
end
def begin_options
{ min: min_begin, max: max_begin, disabled: begin... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/datetime_range_presenter.rb | Ruby | mit | 186 | master | 3,101 | # frozen_string_literal: true
module FormKit::Fields
class DatetimeRangePresenter < FormKit::CompositeFieldPresenter
def value_for_preview
record = value
return unless record
from =
if record.begin && record.begin != -Float::INFINITY
I18n.l(record.begin.in_time_zone)
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/select_presenter.rb | Ruby | mit | 186 | master | 514 | # frozen_string_literal: true
module FormKit::Fields
class SelectPresenter < FormKit::FieldPresenter
def include_blank?
required?
end
def can_custom_value?
!@model.options.strict_select
end
def collection
collection = @model.choices.map(&:label)
if can_custom_value? && v... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/integer_presenter.rb | Ruby | mit | 186 | master | 210 | # frozen_string_literal: true
module FormKit::Fields
class IntegerPresenter < FormKit::FieldPresenter
include FormKit::Fields::PresenterForNumberField
def integer_only?
true
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/member_presenter.rb | Ruby | mit | 186 | master | 461 | # frozen_string_literal: true
module FormKit::Fields
class MemberPresenter < FormKit::FieldPresenter
def value_for_preview
id = value
return if id.blank?
collection.find_by(id: id)&.name
end
def include_blank?
required?
end
def collection
@model.collection
end... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/date_presenter.rb | Ruby | mit | 186 | master | 1,794 | # frozen_string_literal: true
module FormKit::Fields
class DatePresenter < FormKit::FieldPresenter
def value
super&.in_time_zone&.to_date
end
def value_for_preview
value = self.value
I18n.l(value) if value
end
def field_options
return {} if access_readonly?
option... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/resource_presenter.rb | Ruby | mit | 186 | master | 858 | # frozen_string_literal: true
module FormKit::Fields
class ResourcePresenter < FormKit::FieldPresenter
def value_for_preview
return unless @model.collection
id = value
return if id.blank?
collection
.where(@model.data_source.value_method => id)
.first
&.send(@mod... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/resource_select_presenter.rb | Ruby | mit | 186 | master | 670 | # frozen_string_literal: true
module FormKit::Fields
class ResourceSelectPresenter < FormKit::FieldPresenter
def include_blank?
required?
end
def can_custom_value?
!@model.options.strict_select
end
def collection
values =
if @model.collection
# TODO: limit 10... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/multiple_choice_presenter.rb | Ruby | mit | 186 | master | 395 | # frozen_string_literal: true
module FormKit::Fields
class MultipleChoicePresenter < FormKit::FieldPresenter
def value_for_preview
ids = Array.wrap(value)
return if ids.blank?
if choices.loaded?
choices.target.select { |choice| ids.include?(choice.id) }.map(&:label)
else
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/multiple_select_presenter.rb | Ruby | mit | 186 | master | 759 | # frozen_string_literal: true
module FormKit::Fields
class MultipleSelectPresenter < FormKit::FieldPresenter
MAX_HARD_CODE_ITEMS_SIZE = 20
def include_blank?
required?
end
def value_for_preview
Array.wrap(value).join(", ")
end
def can_custom_value?
!@model.options.strict_... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/integer_range_presenter.rb | Ruby | mit | 186 | master | 2,895 | # frozen_string_literal: true
module FormKit::Fields
class IntegerRangePresenter < FormKit::CompositeFieldPresenter
def value_for_preview
record = value
return unless record
"#{record.begin} ~ #{record.end}"
end
def begin_options
{ min: min_begin, max: max_begin, disabled: begin... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/multiple_resource_presenter.rb | Ruby | mit | 186 | master | 1,017 | # frozen_string_literal: true
module FormKit::Fields
class MultipleResourcePresenter < FormKit::FieldPresenter
MAX_HARD_CODE_ITEMS_SIZE = 20
def include_blank?
required?
end
def value_for_preview
return unless @model.collection
return if @model.collection.none?
collection
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/date_range_presenter.rb | Ruby | mit | 186 | master | 3,057 | # frozen_string_literal: true
module FormKit::Fields
class DateRangePresenter < FormKit::CompositeFieldPresenter
def value_for_preview
record = value
return unless record
from =
if record.begin && record.begin != -Float::INFINITY
I18n.l(record.begin.in_time_zone.to_date)
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/boolean_presenter.rb | Ruby | mit | 186 | master | 273 | # frozen_string_literal: true
module FormKit::Fields
class BooleanPresenter < FormKit::FieldPresenter
def required
@model.validations&.acceptance
end
def value_for_preview
super ? I18n.t("values.true") : I18n.t("values.false")
end
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/form_kit/fields/multiple_resource_select_presenter.rb | Ruby | mit | 186 | master | 917 | # frozen_string_literal: true
module FormKit::Fields
class MultipleResourceSelectPresenter < FormKit::FieldPresenter
MAX_HARD_CODE_ITEMS_SIZE = 20
def include_blank?
required?
end
def value_for_preview
Array.wrap(value).join(", ")
end
def can_custom_value?
!@model.options... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/presenters/concerns/form_kit/fields/presenter_for_number_field.rb | Ruby | mit | 186 | master | 815 | # frozen_string_literal: true
module FormKit::Fields
module PresenterForNumberField
extend ActiveSupport::Concern
def min
return if @model.validations.numericality.lower_bound_check_disabled?
min = @model.validations.numericality.lower_bound_value
integer_only? ? min.to_i : min
end
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/workflows_controller.rb | Ruby | mit | 186 | master | 1,252 | # frozen_string_literal: true
class WorkflowsController < ApplicationController
before_action :set_workflow, only: %i[show edit update destroy verify]
def index
@workflows = FlowCore::Workflow.all.includes(:generated_by)
end
def show; end
def new
@workflow = FlowCore::Workflow.new
end
def edi... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/human_tasks_controller.rb | Ruby | mit | 186 | master | 575 | # frozen_string_literal: true
class HumanTasksController < ApplicationController
before_action :set_human_task
def show; end
def update
if @human_task.fill_form!(human_task_params)
@human_task.finish!
redirect_to instance_url(@human_task.instance), notice: "Task finished."
else
rende... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/application_controller.rb | Ruby | mit | 186 | master | 424 | # frozen_string_literal: true
class ApplicationController < ActionController::Base
helper_method :current_user
private
def current_user
if session[:current_user_id].present?
@_current_user ||=
User.find_by(id: session[:current_user_id])
end
end
def require_signed_in
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/notifications_controller.rb | Ruby | mit | 186 | master | 339 | # frozen_string_literal: true
class NotificationsController < ApplicationController
before_action :authenticate_user!
def index
@notifications = current_user
.notifications
.includes(task: { executable: %i[workflow transition] })
.order(created_at... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/session_controller.rb | Ruby | mit | 186 | master | 300 | # frozen_string_literal: true
class SessionController < ApplicationController
def sign_in_as
session[:current_user_id] = params[:id]
redirect_back fallback_location: root_url
end
def sign_out
session[:current_user_id] = nil
redirect_back fallback_location: root_url
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/instances_controller.rb | Ruby | mit | 186 | master | 726 | # frozen_string_literal: true
class InstancesController < ApplicationController
before_action :set_instance, only: %i[show activate]
def index
@instances = FlowCore::Instance.all.includes(:workflow)
end
def show
@human_tasks = FlowKit::HumanTask.where(instance: @instance).includes(:assignable)
@t... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines_controller.rb | Ruby | mit | 186 | master | 1,372 | # frozen_string_literal: true
class PipelinesController < ApplicationController
before_action :set_pipeline, only: %i[show edit update destroy deploy]
def index
@pipelines = FlowKit::BusinessPipeline.all
end
def show; end
def new
@pipeline = FlowKit::BusinessPipeline.new
end
def edit; end
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/forms_controller.rb | Ruby | mit | 186 | master | 1,682 | # frozen_string_literal: true
class FormsController < ApplicationController
before_action :set_form, only: %i[show edit update destroy]
before_action :set_form_layout_data, only: %i[show edit update]
# GET /forms
def index
@forms = FormKit::Form.all
end
# GET /forms/new
def new
@form = FormKit:... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/nested_forms/application_controller.rb | Ruby | mit | 186 | master | 1,103 | # frozen_string_literal: true
class NestedForms::ApplicationController < ApplicationController
before_action :set_nested_form
before_action :set_nested_form_layout_data
protected
# Use callbacks to share common setup or constraints between actions.
def set_nested_form
@nested_form = FormKit::Nest... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/nested_forms/fields_controller.rb | Ruby | mit | 186 | master | 1,706 | # frozen_string_literal: true
class NestedForms::FieldsController < NestedForms::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 = @nested_form.fields.order(position: :asc)
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/instances/application_controller.rb | Ruby | mit | 186 | master | 237 | # frozen_string_literal: true
class Instances::ApplicationController < ::ApplicationController
before_action :set_instance
protected
def set_instance
@instance = FlowCore::Instance.find(params[:instance_id])
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/instances/tasks_controller.rb | Ruby | mit | 186 | master | 462 | # frozen_string_literal: true
class Instances::TasksController < Instances::ApplicationController
before_action :set_task, only: %i[finish]
def finish
unless @task.can_finish?
redirect_to instance_url(@instance), notice: "Task can not finish."
return
end
@task.finish!
redirect_to ins... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/workflows/application_controller.rb | Ruby | mit | 186 | master | 237 | # frozen_string_literal: true
class Workflows::ApplicationController < ::ApplicationController
before_action :set_workflow
protected
def set_workflow
@workflow = FlowCore::Workflow.find(params[:workflow_id])
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/workflows/instances_controller.rb | Ruby | mit | 186 | master | 754 | # frozen_string_literal: true
class Workflows::InstancesController < Workflows::ApplicationController
def new
if @workflow.type.blank?
@instance = @workflow.create_instance!
redirect_to instance_url(@instance), notice: "Instance created."
return
end
unless current_user
redirect_t... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/workflows/transitions_controller.rb | Ruby | mit | 186 | master | 585 | # frozen_string_literal: true
class Workflows::TransitionsController < Workflows::ApplicationController
before_action :set_transition, only: %i[show update]
def show; end
def update
if @transition.update transition_params
redirect_to workflow_transition_url(@workflow, @transition), notice: "Transitio... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/workflows/arcs_controller.rb | Ruby | mit | 186 | master | 517 | # frozen_string_literal: true
class Workflows::ArcsController < Workflows::ApplicationController
before_action :set_arc, only: %i[edit update]
def edit; end
def update
if @arc.update arc_params
redirect_back fallback_location: workflow_transition_url(@workflow, @arc.transition), notice: "Arc updated.... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/workflows/transitions/triggers_controller.rb | Ruby | mit | 186 | master | 1,178 | # frozen_string_literal: true
class Workflows::Transitions::TriggersController < Workflows::Transitions::ApplicationController
before_action :set_trigger, only: %i[edit update destroy]
def new
trigger_type = FlowKit::TransitionTriggers.all_types.map(&:to_s).include?(params[:type]) ? params[:type] : nil
if... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/workflows/transitions/application_controller.rb | Ruby | mit | 186 | master | 270 | # frozen_string_literal: true
class Workflows::Transitions::ApplicationController < Workflows::ApplicationController
before_action :set_transition
protected
def set_transition
@transition = @workflow.transitions.find(params[:transition_id])
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines/application_controller.rb | Ruby | mit | 186 | master | 244 | # frozen_string_literal: true
class Pipelines::ApplicationController < ::ApplicationController
before_action :set_pipeline
protected
def set_pipeline
@pipeline = FlowKit::BusinessPipeline.find(params[:pipeline_id])
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines/steps_controller.rb | Ruby | mit | 186 | master | 1,250 | # frozen_string_literal: true
class Pipelines::StepsController < Pipelines::ApplicationController
before_action :set_step, only: %i[show edit update destroy]
def new
@step = @pipeline.steps.new
@step.append_to = params[:append_to]
end
def create
@step = @pipeline.steps.new(step_params)
if @s... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines/branches_controller.rb | Ruby | mit | 186 | master | 726 | # frozen_string_literal: true
class Pipelines::BranchesController < Pipelines::ApplicationController
before_action :set_branch, only: %i[show edit update destroy]
def show; end
def edit; end
def update
if @branch.update(branch_params)
redirect_to edit_pipeline_step_url(@pipeline, @branch.step), no... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines/branches/steps_controller.rb | Ruby | mit | 186 | master | 731 | # frozen_string_literal: true
class Pipelines::Branches::StepsController < Pipelines::Branches::ApplicationController
def new
@step = @branch.steps.new
@step.append_to = params[:append_to]
end
def create
@step = @branch.steps.new(step_params)
if @step.save
redirect_to pipeline_branch_url(... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines/branches/application_controller.rb | Ruby | mit | 186 | master | 248 | # frozen_string_literal: true
class Pipelines::Branches::ApplicationController < Pipelines::ApplicationController
before_action :set_branch
protected
def set_branch
@branch = @pipeline.branches.find(params[:branch_id])
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines/branches/arc_guards_controller.rb | Ruby | mit | 186 | master | 1,273 | # frozen_string_literal: true
class Pipelines::Branches::ArcGuardsController < Pipelines::Branches::ApplicationController
before_action :set_arc_guard, only: %i[show edit update destroy]
def new
guard_type = FlowKit::ArcGuards.all_types.map(&:to_s).include?(params[:type]) ? params[:type] : nil
if guard_ty... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines/steps/branches_controller.rb | Ruby | mit | 186 | master | 488 | # frozen_string_literal: true
class Pipelines::Steps::BranchesController < Pipelines::Steps::ApplicationController
def new
@branch = @step.branches.new
end
def create
@branch = @step.branches.new(branch_params)
if @branch.save
redirect_to pipeline_branch_url(@pipeline, @branch), notice: "Bran... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines/steps/transition_triggers_controller.rb | Ruby | mit | 186 | master | 1,481 | # frozen_string_literal: true
class Pipelines::Steps::TransitionTriggersController < Pipelines::Steps::ApplicationController
before_action :set_transition_trigger, only: %i[show edit update destroy]
def new
trigger_type = FlowKit::TransitionTriggers.all_types.map(&:to_s).include?(params[:type]) ? params[:type... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines/steps/application_controller.rb | Ruby | mit | 186 | master | 240 | # frozen_string_literal: true
class Pipelines::Steps::ApplicationController < Pipelines::ApplicationController
before_action :set_step
protected
def set_step
@step = @pipeline.whole_steps.find(params[:step_id])
end
end |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/pipelines/steps/redirections_controller.rb | Ruby | mit | 186 | master | 526 | # frozen_string_literal: true
class Pipelines::Steps::RedirectionsController < Pipelines::Steps::ApplicationController
def show
redirect_to edit_pipeline_step_redirection_url(@pipeline, @step)
end
def edit; end
def update
if @step.update(step_params)
redirect_to edit_pipeline_step_url(@pipeline... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/fields/application_controller.rb | Ruby | mit | 186 | master | 1,517 | # frozen_string_literal: true
class Fields::ApplicationController < ApplicationController
before_action :set_field
before_action :set_field_layout_data
protected
# Use callbacks to share common setup or constraints between actions.
def set_field
@field = FormKit::Field.find(params[:field_id])
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/fields/choices_controller.rb | Ruby | mit | 186 | master | 1,313 | # frozen_string_literal: true
class Fields::ChoicesController < Fields::ApplicationController
before_action :require_attach_choices!
before_action :set_choice, only: %i[edit update destroy]
before_action :set_page_layout
def new
@_breadcrumbs << { text: "New" }
@choice = @field.choices.build
end
... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/fields/validations_controller.rb | Ruby | mit | 186 | master | 672 | # frozen_string_literal: true
class Fields::ValidationsController < Fields::ApplicationController
before_action :set_validations
before_action :set_page_layout
def edit; end
def update
@validations.assign_attributes(validations_params)
if @validations.valid? && @field.save(validate: false)
redi... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/fields/options_controller.rb | Ruby | mit | 186 | master | 629 | # frozen_string_literal: true
class Fields::OptionsController < Fields::ApplicationController
before_action :set_options
before_action :set_page_layout
def edit; end
def update
@options.assign_attributes(options_params)
if @options.valid? && @field.save(validate: false)
redirect_to fields_url, ... |
github | rails-engine/flow_core | https://github.com/rails-engine/flow_core | test/dummy/app/controllers/fields/data_source_options_controller.rb | Ruby | mit | 186 | master | 824 | # frozen_string_literal: true
class Fields::DataSourceOptionsController < Fields::ApplicationController
before_action :require_data_source_options
before_action :set_options
before_action :set_page_layout
def edit; end
def update
@options.assign_attributes(options_params)
if @options.valid? && @fie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.