Class: Migrations::HeaderActions
- Inherits:
-
Components::Base
- Object
- Components::Base
- Migrations::HeaderActions
- Includes:
- Phlex::Rails::Helpers::ButtonTo, Phlex::Rails::Helpers::FormWith, Phlex::Rails::Helpers::LinkTo, Phlex::Rails::Helpers::Routes, Phlex::Rails::Helpers::TurboFrameTag
- Defined in:
- app/components/databasium/migrations/header_actions.rb
Instance Method Summary collapse
-
#initialize(migration:) ⇒ HeaderActions
constructor
A new instance of HeaderActions.
- #view_template ⇒ Object
Constructor Details
#initialize(migration:) ⇒ HeaderActions
Returns a new instance of HeaderActions.
12 13 14 |
# File 'app/components/databasium/migrations/header_actions.rb', line 12 def initialize(migration:) @migration = migration end |
Instance Method Details
#view_template ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/components/databasium/migrations/header_actions.rb', line 16 def view_template div(id: "header_actions", class: "max-w-full overflow-x-auto flex") do render Components::Databasium::Navigation::IconPanel.new( icons_with_text: [ *( if @migration render_migration_actions else [] end ), { icon: "document-plus", text: "New Migration", method: :get, path: databasium.new_migration_path, turbo_frame: "main" }, { icon: "forward", text: "Run Pending Migrations", method: :post, path: databasium.run_pending_migrations_migrations_path, turbo_frame: "main" } ] ) form_with( url: databasium.rollback_migration_migrations_path, method: :post, class: "w-fit flex gap-2 border-1 border-border rounded-xl bg-background text-sm mx-2" ) do |form| form.number_field :rollback_steps, placeholder: "Rollback steps", class: "ps-4 w-35 focus:outline-none" form.submit "Rollback", class: "hover:cursor-pointer hover:text-hover text-accent w-fit pe-4" end end end |