Class: InnerPlan::Tasks::EditView
- Inherits:
-
ApplicationView
- Object
- Phlex::HTML
- ApplicationView
- InnerPlan::Tasks::EditView
- Includes:
- Phlex::Rails::Helpers::ContentTag, Phlex::Rails::Helpers::DOMID, Phlex::Rails::Helpers::Debug, Phlex::Rails::Helpers::FormWith, Phlex::Rails::Helpers::LinkTo, Phlex::Rails::Helpers::Routes
- Defined in:
- app/components/inner_plan/tasks/edit_view.rb
Instance Attribute Summary collapse
-
#focus ⇒ Object
readonly
Returns the value of attribute focus.
Instance Method Summary collapse
-
#initialize(task:, focus: nil) ⇒ EditView
constructor
A new instance of EditView.
- #template ⇒ Object
Constructor Details
#initialize(task:, focus: nil) ⇒ EditView
Returns a new instance of EditView.
12 13 14 15 |
# File 'app/components/inner_plan/tasks/edit_view.rb', line 12 def initialize(task:, focus: nil) @task = task @focus = focus&.to_sym end |
Instance Attribute Details
#focus ⇒ Object (readonly)
Returns the value of attribute focus.
10 11 12 |
# File 'app/components/inner_plan/tasks/edit_view.rb', line 10 def focus @focus end |
Instance Method Details
#template ⇒ Object
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'app/components/inner_plan/tasks/edit_view.rb', line 17 def template header(class: "mb-3") do render(InnerPlan::BreadcrumbsComponent.new) do |c| c. do link_to "Home", helpers.root_path, class: "text-reset", data: { turbo_frame: :_top } end if @task.list.sub? c. do link_to @task.list.list.title, @task.list.list, class: "text-reset" end c. do link_to @task.list.title, helpers.group_path(@task.list), class: "text-reset" end else c. do link_to @task.list.title, @task.list, class: "text-reset" end end c. do link_to "Task ##{@task.id}", @task, class: "text-reset" end c.(active: true) { "Edit" } end end form_with model: @task do |f| div(class: "d-flex mb-4") do div(class: "text-end me-2 opacity-50") do content_tag :a, style: "display:block; margin-top: -0.1rem;margin-left:-0.6rem", data: { turbo: true, turbo_stream: true } do render(Phlex::Icons::Tabler::SquareRounded.new(width: 39, height: 39)) end end div(class: "w-100") do plain f.text_field :title, class: "form-control form-control-lg", autofocus: (@focus == "title") end end InnerPlan.configuration.task_edit_view_rows.each do |row| render InnerPlan::Tasks::Form::RowComponent.new do |component| row.content.each do |item| component.with_column(span: item.[:span]) do render(item.content.call(context: self, form: f)) end end end end plain f.submit "Save changes", class: "btn btn-success btn-sm me-2" link_to "Cancel", @task, class: "btn btn-outline-secondary btn-sm" end end |