Skip to content

Commit b55822e

Browse files
Move remaining flex models - Attempt #2 (#205)
Reverts #204
1 parent df995ad commit b55822e

162 files changed

Lines changed: 543 additions & 1115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cd.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Update flex
1+
name: Update strata
22

33
on:
44
push:
@@ -49,17 +49,17 @@ jobs:
4949
with:
5050
ruby-version: ${{ steps.ruby-version.outputs.RUBY_VERSION }}
5151

52-
- name: Update flex
52+
- name: Update strata
5353
working-directory: project-repo/${{ matrix.project.app }}
5454
run: |
5555
bundle install
56-
bundle update flex
56+
bundle update strata
5757
5858
- name: Commit changes
5959
working-directory: project-repo
6060
run: |
6161
git add .
62-
git commit -m "Update flex to ${{ github.sha }}" || echo "No changes to commit"
62+
git commit -m "Update strata to ${{ github.sha }}" || echo "No changes to commit"
6363
6464
- name: Push changes to project repo
6565
working-directory: project-repo

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source "https://rubygems.org"
22
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
33

4-
# Specify your gem's dependencies in flex.gemspec.
4+
# Specify your gem's dependencies in strata.gemspec.
55
gemspec
66

77
gem "puma"

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
flex (0.1.0)
4+
strata (0.1.0)
55
pundit (>= 2.5.0)
66
rails (>= 7.1.5.1)
77
validates_timeliness (>= 7.0.0)
@@ -414,7 +414,6 @@ DEPENDENCIES
414414
dotenv
415415
factory_bot_rails
416416
faker
417-
flex!
418417
guard-rspec
419418
listen
420419
lookbook (>= 2.3.9)
@@ -430,6 +429,7 @@ DEPENDENCIES
430429
shoulda-matchers (~> 6.0)
431430
simplecov
432431
sprockets-rails
432+
strata!
433433
temporary_tables
434434
validates_timeliness (>= 7.0.0)
435435

app/controllers/strata/tasks_controller.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Strata
2-
# Controller for managing Flex::Task records. Handles listing, filtering, showing, and updating tasks.
2+
# Controller for managing Strata::Task records. Handles listing, filtering, showing, and updating tasks.
33
# This controller helps a parent application manage tasks by not forcing the parent application to implement the same functionality.
44
class TasksController < ::StaffController
55
helper DateHelper
@@ -10,9 +10,9 @@ class TasksController < ::StaffController
1010
before_action :add_task_details_view_path, only: %i[ show ]
1111

1212
def index
13-
@task_types = Flex::Task.distinct(:type).unscope(:order).pluck(:type) # Postgres does not support using `order` with `distinct`, thus we have to unscope `order` here.
13+
@task_types = Strata::Task.distinct(:type).unscope(:order).pluck(:type) # Postgres does not support using `order` with `distinct`, thus we have to unscope `order` here.
1414
@tasks = filter_tasks
15-
@unassigned_tasks = Flex::Task.incomplete.unassigned
15+
@unassigned_tasks = Strata::Task.incomplete.unassigned
1616
end
1717

1818
def show
@@ -29,21 +29,21 @@ def update
2929
end
3030

3131
def pick_up_next_task
32-
task = Flex::Task.assign_next_task_to(current_user.id)
32+
task = Strata::Task.assign_next_task_to(current_user.id)
3333

3434
if task
35-
flash["task-message"] = I18n.t("flex.tasks.messages.task_picked_up")
35+
flash["task-message"] = I18n.t("strata.tasks.messages.task_picked_up")
3636
redirect_to url_for(action: :show, id: task.id)
3737
else
38-
flash["task-message"] = I18n.t("flex.tasks.messages.no_tasks_available")
38+
flash["task-message"] = I18n.t("strata.tasks.messages.no_tasks_available")
3939
redirect_to url_for(action: :index)
4040
end
4141
end
4242

4343
private
4444

4545
def set_task
46-
@task = Flex::Task.find(params[:id]) if params[:id].present?
46+
@task = Strata::Task.find(params[:id]) if params[:id].present?
4747
end
4848

4949
def set_case
@@ -63,7 +63,7 @@ def index_filter_params
6363
end
6464

6565
def filter_tasks
66-
tasks = filter_tasks_by_date(Flex::Task.all, index_filter_params[:filter_date])
66+
tasks = filter_tasks_by_date(Strata::Task.all, index_filter_params[:filter_date])
6767
tasks = filter_tasks_by_type(tasks, index_filter_params[:filter_type])
6868
tasks = filter_tasks_by_status(tasks, index_filter_params[:filter_status])
6969

app/lib/strata/attributes.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ module Strata
1010
# class MyModel < ApplicationRecord
1111
# include Strata::Attributes
1212
#
13-
# flex_attribute :birth_date, :memorable_date
14-
# flex_attribute :applicant_name, :name
15-
# flex_attribute :salary, :money
13+
# strata_attribute :birth_date, :memorable_date
14+
# strata_attribute :applicant_name, :name
15+
# strata_attribute :salary, :money
1616
# end
1717
#
1818
module Attributes
@@ -53,7 +53,7 @@ def self.resolve_class(type)
5353
# - `:range` (Boolean): If true, the attribute will be a Strata::ValueRange of the specified type
5454
# @raise [ArgumentError] If an unsupported attribute type is provided
5555
# @return [void]
56-
def flex_attribute(name, type, options = {})
56+
def strata_attribute(name, type, options = {})
5757
is_array = options.delete(:array) || false
5858
is_range = options.delete(:range) || false
5959

app/lib/strata/attributes/array_attribute.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Attributes
77
# class Company < ApplicationRecord
88
# include Strata::Attributes
99
#
10-
# flex_attribute :office_locations, :address, array: true
10+
# strata_attribute :office_locations, :address, array: true
1111
# end
1212
#
1313
# company = Company.new
@@ -110,7 +110,7 @@ def self.get_item_class(item_type)
110110
is_nested_type_a_range = nested_options.delete(:range) || false
111111

112112
raise ArgumentError, "Arrays of arrays are not currently supported" if is_nested_type_an_array
113-
raise ArgumentError, "Expected range to be true for array item type when using syntax: `flex_attribute :name, [:type, range: true], array: true`" unless is_nested_type_a_range
113+
raise ArgumentError, "Expected range to be true for array item type when using syntax: `strata_attribute :name, [:type, range: true], array: true`" unless is_nested_type_a_range
114114

115115
value_class = Strata::Attributes.resolve_class(nested_type)
116116
Strata::ValueRange[value_class]

app/lib/strata/attributes/basic_value_object_attribute.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module BasicValueObjectAttribute
3030
def basic_value_object_attribute(name, value_class, nested_attribute_types, options = {})
3131
# Define the base attribute with its subfields
3232
nested_attribute_types.each do |nested_attribute_name, nested_attribute_type|
33-
flex_attribute "#{name}_#{nested_attribute_name}", nested_attribute_type
33+
strata_attribute "#{name}_#{nested_attribute_name}", nested_attribute_type
3434
end
3535

3636
# Define the getter method

app/lib/strata/attributes/memorable_date_attribute.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Attributes
77
# class MyForm < Flex::ApplicationForm
88
# include Strata::Attributes
99
#
10-
# flex_attribute :birth_date, :memorable_date
10+
# strata_attribute :birth_date, :memorable_date
1111
# end
1212
#
1313
# Key features:

app/lib/strata/attributes/money_attribute.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Attributes
88
# class MyForm < Flex::ApplicationForm
99
# include Strata::Attributes
1010
#
11-
# flex_attribute :salary, :money
11+
# strata_attribute :salary, :money
1212
# end
1313
#
1414
# Key features:

app/lib/strata/attributes/name_attribute.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Attributes
99
# class Person < ApplicationRecord
1010
# include Strata::Attributes
1111
#
12-
# flex_attribute :name, :name
12+
# strata_attribute :name, :name
1313
# end
1414
#
1515
# person = Person.new

0 commit comments

Comments
 (0)