Skip to content

Commit

Permalink
Abandon Avo Literal types.
Browse files Browse the repository at this point in the history
  • Loading branch information
simi committed Oct 31, 2024
1 parent b4616c9 commit de4c4bf
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 37 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ gem "view_component", "~> 3.14.0"
gem "pundit", "~> 2.4"
gem "chartkick", "~> 5.1"
gem "groupdate", "~> 6.5"
gem "prop_initializer", "~> 0.2"

group :avo, optional: true do
source "https://packager.dev/avo-hq/" do
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ DEPENDENCIES
pghero (~> 3.6)
phlex-rails (~> 1.2)
pp (= 0.5.0)
prop_initializer (~> 0.2)
propshaft (~> 1.1.0)
prosopite (~> 1.4)
pry-byebug (~> 3.10)
Expand Down
1 change: 1 addition & 0 deletions app/views/application_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ApplicationView < ApplicationComponent
# By default, it inherits from `ApplicationComponent`, but you
# can change that to `Phlex::HTML` if you want to keep views and
# components independent.
extend PropInitializer::Properties

def title=(title)
@_view_context.instance_variable_set :@title, title
Expand Down
1 change: 1 addition & 0 deletions app/views/components/application_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class ApplicationComponent < Phlex::HTML
include Phlex::Rails::Helpers::Routes
extend PropInitializer::Properties

class TranslationHelper
include ActionView::Helpers::TranslationHelper
Expand Down
4 changes: 1 addition & 3 deletions app/views/components/events/table_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ class Events::TableComponent < ApplicationComponent
register_value_helper :page_entries_info
register_value_helper :paginate

extend Literal::Properties

prop :security_events, _Union(ActiveRecord::Relation, Array), reader: :private
prop :security_events, reader: :public

def view_template
header(class: "gems__header push--s") do
Expand Down
4 changes: 2 additions & 2 deletions app/views/components/events/table_details_component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Events::TableDetailsComponent < ApplicationComponent
extend Literal::Properties
extend PropInitializer::Properties

prop :event, _Any, reader: :private
prop :event, reader: :public
delegate :additional, :rubygem, to: :event

def view_template
Expand Down
3 changes: 1 addition & 2 deletions app/views/components/oidc/api_key_role/table_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

class OIDC::ApiKeyRole::TableComponent < ApplicationComponent
include Phlex::Rails::Helpers::LinkTo
extend Literal::Properties

prop :api_key_roles, _Any, reader: :private
prop :api_key_roles, reader: :public

def view_template
table(class: "t-body") do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# frozen_string_literal: true

class OIDC::IdToken::KeyValuePairsComponent < ApplicationComponent
extend Literal::Properties
prop :pairs, _Any, reader: :private
prop :pairs, reader: :public

def view_template
dl(class: "t-body provider_attributes full-width overflow-wrap") do
Expand Down
3 changes: 1 addition & 2 deletions app/views/components/oidc/id_token/table_component.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# frozen_string_literal: true

class OIDC::IdToken::TableComponent < ApplicationComponent
extend Literal::Properties
prop :id_tokens, _Any, reader: :private
prop :id_tokens, reader: :public

include Phlex::Rails::Helpers::TimeTag
include Phlex::Rails::Helpers::LinkToUnlessCurrent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# frozen_string_literal: true

class OIDC::TrustedPublisher::GitHubAction::FormComponent < ApplicationComponent
extend Literal::Properties

prop :github_action_form, _Any, reader: :private
prop :github_action_form, reader: :public

def view_template
github_action_form.fields_for :trusted_publisher do |trusted_publisher_form|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
class OIDC::TrustedPublisher::GitHubAction::TableComponent < ApplicationComponent
extend Literal::Properties

prop :github_action, _Any, reader: :private
prop :github_action, reader: :public

def view_template
dl(class: "tw-flex tw-flex-col sm:tw-grid sm:tw-grid-cols-2 tw-items-baseline tw-gap-4 full-width overflow-wrap") do
Expand Down
3 changes: 1 addition & 2 deletions app/views/oidc/id_tokens/show_view.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# frozen_string_literal: true

class OIDC::IdTokens::ShowView < ApplicationView
extend Literal::Properties
include Phlex::Rails::Helpers::TimeTag
include Phlex::Rails::Helpers::LinkTo

prop :id_token, OIDC::IdToken, reader: :private
prop :id_token, reader: :public

def view_template # rubocop:disable Metrics/AbcSize
self.title = t(".title")
Expand Down
3 changes: 1 addition & 2 deletions app/views/oidc/pending_trusted_publishers/index_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ class OIDC::PendingTrustedPublishers::IndexView < ApplicationView
include Phlex::Rails::Helpers::ContentFor
include Phlex::Rails::Helpers::DistanceOfTimeInWordsToNow
include Phlex::Rails::Helpers::LinkTo
extend Literal::Properties

prop :trusted_publishers, _Any, reader: :private
prop :trusted_publishers, reader: :public

def view_template
title_content
Expand Down
4 changes: 1 addition & 3 deletions app/views/oidc/pending_trusted_publishers/new_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ class OIDC::PendingTrustedPublishers::NewView < ApplicationView
include Phlex::Rails::Helpers::OptionsForSelect
include Phlex::Rails::Helpers::FormWith

extend Literal::Properties

prop :pending_trusted_publisher, OIDC::PendingTrustedPublisher, reader: :private
prop :pending_trusted_publisher, reader: :public

def view_template
self.title = t(".title")
Expand Down
5 changes: 2 additions & 3 deletions app/views/oidc/rubygem_trusted_publishers/index_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ class OIDC::RubygemTrustedPublishers::IndexView < ApplicationView
include Phlex::Rails::Helpers::LinkTo
include Phlex::Rails::Helpers::ContentFor
include OIDC::RubygemTrustedPublishers::Concerns::Title
extend Literal::Properties

prop :rubygem, Rubygem, reader: :private
prop :trusted_publishers, _Any, reader: :private
prop :rubygem, reader: :public
prop :trusted_publishers, reader: :public

def view_template
title_content
Expand Down
4 changes: 1 addition & 3 deletions app/views/oidc/rubygem_trusted_publishers/new_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ class OIDC::RubygemTrustedPublishers::NewView < ApplicationView
include Phlex::Rails::Helpers::SelectTag
include OIDC::RubygemTrustedPublishers::Concerns::Title

extend Literal::Properties

prop :rubygem_trusted_publisher, OIDC::RubygemTrustedPublisher, reader: :private
prop :rubygem_trusted_publisher, reader: :public

def view_template
title_content
Expand Down
3 changes: 1 addition & 2 deletions app/views/profiles/security_events_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ class Profiles::SecurityEventsView < ApplicationView
include Phlex::Rails::Helpers::DistanceOfTimeInWordsToNow
include Phlex::Rails::Helpers::TimeTag
include Phlex::Rails::Helpers::LinkTo
extend Literal::Properties

prop :security_events, _Any, reader: :private
prop :security_events, reader: :public

def view_template
title_content
Expand Down
5 changes: 2 additions & 3 deletions app/views/rubygems/security_events_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ class Rubygems::SecurityEventsView < ApplicationView
include Phlex::Rails::Helpers::ButtonTo
include Phlex::Rails::Helpers::ContentFor
include Phlex::Rails::Helpers::LinkTo
extend Literal::Properties

prop :rubygem, Rubygem, reader: :private
prop :security_events, _Any, reader: :private
prop :rubygem, reader: :public
prop :security_events, reader: :public

def view_template
title_content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def default(factory: :oidc_rubygem_trusted_publisher, environment: nil, reposito
class Wrapper < Phlex::HTML
include Phlex::Rails::Helpers::FormWith

extend Literal::Properties
prop :form_object, _Any
extend PropInitializer::Properties
prop :form_object

def view_template
form_with(model: @form_object, url: "/") do |github_action_form|
Expand Down

0 comments on commit de4c4bf

Please sign in to comment.