Skip to content

Commit

Permalink
Merge pull request #2110 from unboxed/consultee-engine
Browse files Browse the repository at this point in the history
Add initial setup for BOPS consultees engine
  • Loading branch information
benbaumann95 authored Jan 14, 2025
2 parents 0146914 + 466ea39 commit 70d3152
Show file tree
Hide file tree
Showing 19 changed files with 149 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
- { group: "bops_config", module: "engines" }
- { group: "bops_core", module: "engines" }
- { group: "bops_uploads", module: "engines" }
- { group: "bops_consultees", module: "engines" }
fail-fast: false
with:
name: "${{matrix.specs.group}}"
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ gem "csv"
gem "logger"
gem "ostruct"

# Gem for shared code across engines
gem "bops_core", path: "engines/bops_core"

gem "bops_admin", path: "engines/bops_admin"
gem "bops_api", path: "engines/bops_api"
gem "bops_config", path: "engines/bops_config"
gem "bops_consultees", path: "engines/bops_consultees"
gem "bops_uploads", path: "engines/bops_uploads"

group :development, :test do
Expand Down
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ PATH
bops_config (0.1.0)
bops_core (= 0.1.0)

PATH
remote: engines/bops_consultees
specs:
bops_consultees (0.1.0)
bops_core (= 0.1.0)

PATH
remote: engines/bops_core
specs:
Expand Down Expand Up @@ -660,6 +666,7 @@ DEPENDENCIES
bops_admin!
bops_api!
bops_config!
bops_consultees!
bops_core!
bops_uploads!
brakeman
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

mount BopsAdmin::Engine, at: "/admin", as: :bops_admin

mount BopsConsultees::Engine, at: "/consultees", as: :bops_consultees

defaults format: "json" do
get "/os_places_api",
to: "os_places_api#index",
Expand Down
Empty file.
2 changes: 2 additions & 0 deletions engines/bops_consultees/app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//= link_tree ../builds
//= link_tree ../images
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

module BopsConsultees
class ApplicationController < ActionController::Base
include BopsCore::ApplicationController

layout "application"
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module BopsConsultees
class DashboardsController < ApplicationController
def show
respond_to do |format|
format.html
end
end
end
end
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

module BopsConsultees
module ApplicationHelper
include BopsCore::ApplicationHelper
include BreadcrumbNavigationHelper

def nav_items
[]
end

def home_path
root_path
end
end
end
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<% content_for :page_title do %>
<%= t(".consultee_overview") %> - <%= t("page_title") %>
<% end %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<h1 class="govuk-heading-l">
BOPS consultees
</h1>
</div>
</div>
20 changes: 20 additions & 0 deletions engines/bops_consultees/bin/rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.

ENGINE_ROOT = File.expand_path("..", __dir__)
ENGINE_PATH = File.expand_path("../lib/bops_consultees/engine", __dir__)
APP_PATH = File.expand_path("../../../config/application", __dir__)

# Set up gems listed in the Gemfile.
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])

require "rails"

require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "rails/engine/commands"
16 changes: 16 additions & 0 deletions engines/bops_consultees/bops_consultees.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

Gem::Specification.new do |spec|
spec.name = "bops_consultees"
spec.version = "0.1.0"
spec.authors = ["Unboxed Consulting Ltd"]
spec.email = ["[email protected]"]
spec.homepage = "https://unboxed.co/"
spec.summary = "Provides the interface for consultees using BOPS"

spec.files = Dir.chdir(File.expand_path(__dir__)) do
Dir["{app,consultees,db,lib}/**/*"]
end

spec.add_dependency "bops_core", "0.1.0"
end
6 changes: 6 additions & 0 deletions engines/bops_consultees/config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
en:
bops_consultees:
dashboards:
show:
consultee_overview: Consultee overview
7 changes: 7 additions & 0 deletions engines/bops_consultees/config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

BopsConsultees::Engine.routes.draw do
root to: redirect("dashboard")

resource :dashboard, only: %i[show]
end
15 changes: 15 additions & 0 deletions engines/bops_consultees/lib/bops_consultees.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

require "bops_consultees/engine"

module BopsConsultees
class << self
def table_name_prefix
""
end

def env
ActiveSupport::StringInquirer.new(ENV.fetch("BOPS_ENVIRONMENT", "development"))
end
end
end
7 changes: 7 additions & 0 deletions engines/bops_consultees/lib/bops_consultees/engine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

module BopsConsultees
class Engine < ::Rails::Engine
isolate_namespace BopsConsultees
end
end
16 changes: 16 additions & 0 deletions engines/bops_consultees/spec/system/dashboard_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Dashboard", type: :system do
let!(:local_authority) { create(:local_authority, :default) }

before do
visit "/consultees"
end

it "I can view the dashboard" do
expect(page).to have_current_path("/consultees/dashboard")
expect(page).to have_content("BOPS consultees")
end
end

0 comments on commit 70d3152

Please sign in to comment.