-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove creating default offer for service Add panel `offers` in the service view Move links to offers_path Use wrapper in service views Closes #83
- Loading branch information
Showing
98 changed files
with
508 additions
and
609 deletions.
There are no files selected for viewing
37 changes: 11 additions & 26 deletions
37
app/components/presentable/description_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,12 @@ | ||
#desc.tab-pane.container.active.desc{ "aria-labelledby" => "home-tab", role: "tabpanel" } | ||
.row.justify-content-between | ||
%main.col-12.col-xl-9.pr-4.pt-4{ "data-shepherd-tour-target": "service-about" } | ||
.service-description-container | ||
= markdown(@object.description) | ||
.details-box-wrapper.mt-5 | ||
= render Presentable::SidebarComponent.new(@object) | ||
.service-description-container | ||
= markdown(@object.description) | ||
.details-box-wrapper.mt-5 | ||
= render Presentable::SidebarComponent.new(@object) | ||
|
||
= description_panels | ||
.related-container | ||
- unless @object.suspended? | ||
.row | ||
.col-12 | ||
= render "services/related", related_services: @related_services, title: related_services_title, | ||
preview: @preview | ||
%sidebar.col-12.col-xl-3{ "data-shepherd-tour-target": "service-classification" } | ||
= render "components/presentable/explore_links", object: @object | ||
.right-panel-links | ||
- if [email protected]_contacts.empty? && (@question || @preview) | ||
= render "components/presentable/header_component/ask_question", question_link: new_question_link, | ||
question: @question, | ||
prompt: new_question_prompt, | ||
preview: @preview | ||
= render Presentable::LinksComponent.new(object: @object, preview: @preview) | ||
= additional_backoffice_info | ||
= render Presentable::ProviderInfoComponent.new(base: @object, preview: @preview) if @object.respond_to?(:resource_organisation) | ||
= description_panels | ||
.related-container | ||
- unless @object.suspended? | ||
.row | ||
.col-12 | ||
= render "services/related", related_services: @related_services, title: related_services_title, | ||
preview: @preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,25 @@ | ||
#opinions.tab-pane.container.active{ "aria-labelledby": "opinions-tab", role: "tabpanel", | ||
"data-shepherd-tour-target": "service-details-content" } | ||
.row.justify-content-between | ||
%main.col-12.col-xl-9.pr-4.mb-4.pt-4 | ||
.details-box-wrapper | ||
= render Presentable::SidebarComponent.new(@object) | ||
- details_columns.each do |column| | ||
- column.map do |group| | ||
- next unless display_detail?(group, @object) | ||
.details-box{ | ||
class: "#{group[:name]}" | ||
} | ||
.details-header | ||
%h5= t("components.presentable.details_component.details.title.#{group[:name]}") | ||
.details-content | ||
= render "components/presentable/details_component/#{group[:template]}", | ||
object: @object, | ||
fields: group[:fields], | ||
type: group[:type] || "single", | ||
clazz: group[:clazz] || "", | ||
nested: group[:nested] || {}, | ||
inactive: @object.suspended? && !group[:active_when_suspended], | ||
with_desc: group[:with_desc] || false, | ||
preview: @preview | ||
.related-container | ||
.row | ||
.col-12 | ||
= render "services/related", related_services: @related_services, title: related_services_title, | ||
preview: @preview | ||
|
||
%sidebar.col-12.col-xl-3{ "data-shepherd-tour-target": "service-classification" } | ||
= render "components/presentable/explore_links", object: @object | ||
.right-panel-links | ||
- if [email protected]_contacts.empty? && (@question || @preview) | ||
= render "components/presentable/header_component/ask_question", question_link: new_question_link, | ||
question: @question, | ||
prompt: new_question_prompt, | ||
preview: @preview | ||
= render Presentable::LinksComponent.new(object: @object, preview: @preview) | ||
= render Presentable::ProviderInfoComponent.new(base: @object, preview: @preview) if @object.respond_to?(:resource_organisation) | ||
.details-box-wrapper | ||
= render Presentable::SidebarComponent.new(@object) | ||
- details_columns.each do |column| | ||
- column.map do |group| | ||
- next unless display_detail?(group, @object) | ||
.details-box{ | ||
class: "#{group[:name]}" | ||
} | ||
.details-header | ||
%h5= t("components.presentable.details_component.details.title.#{group[:name]}") | ||
.details-content | ||
= render "components/presentable/details_component/#{group[:template]}", | ||
object: @object, | ||
fields: group[:fields], | ||
type: group[:type] || "single", | ||
clazz: group[:clazz] || "", | ||
nested: group[:nested] || {}, | ||
inactive: @object.suspended? && !group[:active_when_suspended], | ||
with_desc: group[:with_desc] || false, | ||
preview: @preview | ||
.related-container | ||
.row | ||
.col-12 | ||
= render "services/related", related_services: @related_services, title: related_services_title, | ||
preview: @preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# frozen_string_literal: true | ||
|
||
class Services::ChooseOffersController < Services::ApplicationController | ||
skip_before_action :authenticate_user! | ||
|
||
def show | ||
init_step_data | ||
|
||
unless step.visible? | ||
if @offers.inclusive.size.positive? | ||
params[:customizable_project_item] = { offer_id: @offers.inclusive.first.iid } | ||
elsif @bundles.published.size.positive? | ||
params[:customizable_project_item] = { bundle_id: @bundles.published.first.iid } | ||
end | ||
|
||
update | ||
end | ||
end | ||
|
||
def update | ||
@step = step(step_params) | ||
|
||
if @step.valid? | ||
save_in_session(@step) | ||
redirect_to url_for([@service, next_step_key]) | ||
else | ||
init_step_data | ||
flash[:alert] = @step.error | ||
render :show | ||
end | ||
end | ||
|
||
private | ||
|
||
def step_key | ||
:choose_offer | ||
end | ||
|
||
def step_params | ||
{ offer_id: offer&.id, bundle_id: bundle&.id, project_id: session[:selected_project] } | ||
end | ||
|
||
def offer | ||
form_params = params.fetch(:customizable_project_item, session[session_key] || {}).permit(:offer_id) | ||
@service.offers.find_by(iid: form_params[:offer_id] || bundle&.main_offer&.iid) | ||
end | ||
|
||
def bundle | ||
form_params = params.fetch(:customizable_project_item, session[session_key] || {}).permit(:bundle_id) | ||
@service.bundles.find_by(iid: form_params[:bundle_id]) | ||
end | ||
|
||
def init_step_data | ||
@offers = policy_scope(@service.offers.inclusive).order(:iid) | ||
@bundles = policy_scope(@service.bundles.published).order(:iid) | ||
@bundled = policy_scope(@service.offers.published).order(:iid).select(&:bundled?).map(&:bundles)&.flatten | ||
@step = step(session[session_key]) | ||
end | ||
end |
Oops, something went wrong.