Skip to content

Commit eb26e49

Browse files
authored
Move application form previews to flex folder (#64)
- Move the application form and step indicator previews to the flex engine so that the host application can also inherit / benefit from these lookbook previews - Rename previews from FlexSomethingPreview to SomethingPreview but put it in the module Flex namespace ## Context These previews were previously in spec/dummy/app/previews which means the host application can't see them but I think they are pretty useful for host application developers to see since these are for reusable views I already added [this commit](90c5099) which adds the engine's previews to the host application's lookbook (if they have lookbook)
1 parent 90c5099 commit eb26e49

6 files changed

Lines changed: 91 additions & 85 deletions
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module Flex
2+
class ApplicationFormsIndexPreview < Lookbook::Preview
3+
def empty
4+
render template: "flex/application_forms/index", locals: {
5+
title: "My Applications",
6+
intro: "Start a new application or continue an existing one.",
7+
new_button_text: "Start New Application",
8+
in_progress_applications_heading: "Your Applications",
9+
application_forms: []
10+
}
11+
end
12+
13+
def with_applications
14+
render template: "flex/application_forms/index", locals: {
15+
title: "My Applications",
16+
intro: "Start a new application or continue an existing one.",
17+
new_button_text: "Start New Application",
18+
in_progress_applications_heading: "Your Applications",
19+
application_forms: [
20+
{
21+
created_at: "2024-01-15",
22+
path: "/applications/1",
23+
status: :in_progress
24+
},
25+
{
26+
created_at: "2024-01-10",
27+
path: "/applications/2",
28+
status: :submitted
29+
}
30+
]
31+
}
32+
end
33+
end
34+
end
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module Flex
2+
class ApplicationFormsShowPreview < Lookbook::Preview
3+
def in_progress
4+
render template: "flex/application_forms/show", locals: {
5+
title: "My Application",
6+
back_link_text: "Back to Applications",
7+
index_path: "/applications",
8+
created_at: "2024-01-15",
9+
current_status: :in_progress,
10+
next_step: "Please complete all required fields.",
11+
submitted_on_text: "Started on"
12+
}
13+
end
14+
15+
def submitted
16+
render template: "flex/application_forms/show", locals: {
17+
title: "My Application",
18+
back_link_text: "Back to Applications",
19+
index_path: "/applications",
20+
created_at: "2024-01-10",
21+
current_status: :submitted,
22+
next_step: "Your application is under review.",
23+
submitted_on_text: "Submitted on"
24+
}
25+
end
26+
end
27+
end
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module Flex
2+
class StepIndicatorPreview < Lookbook::Preview
3+
layout "component_preview"
4+
5+
# @!group Statuses
6+
7+
def in_progress
8+
render template: "flex/shared/_step_indicator", locals: {
9+
steps: [ :in_progress, :submitted, :decision_made ],
10+
current_step: :in_progress
11+
}
12+
end
13+
14+
def submitted
15+
render template: "flex/shared/_step_indicator", locals: {
16+
steps: [ :in_progress, :submitted, :decision_made ],
17+
current_step: :submitted
18+
}
19+
end
20+
21+
def decision_made
22+
render template: "flex/shared/_step_indicator", locals: {
23+
steps: [ :in_progress, :submitted, :decision_made ],
24+
current_step: :decision_made
25+
}
26+
end
27+
28+
# @!endgroup
29+
end
30+
end

spec/dummy/app/previews/flex_application_forms_index_preview.rb

Lines changed: 0 additions & 32 deletions
This file was deleted.

spec/dummy/app/previews/flex_application_forms_show_preview.rb

Lines changed: 0 additions & 25 deletions
This file was deleted.

spec/dummy/app/previews/flex_step_indicator_preview.rb

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)