Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional theme layouts for events #362

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/controllers/staff/themes_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Staff::ThemesController < Staff::ApplicationController
before_action :require_website
before_action :enable_website_subnav

def show
render template: "staff/pages/themes/#{current_website.theme}/#{theme_params['name']}", layout: "themes/#{current_website.theme}"
end

def theme_params
params.permit(:name)
end
end
13 changes: 13 additions & 0 deletions app/decorators/staff/theme_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Staff::ThemeDecorator < ApplicationDecorator
delegate_all

# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover comments


end
1 change: 1 addition & 0 deletions app/models/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class Page < ApplicationRecord
TEMPLATES = {
'splash' => { hide_header: true, hide_footer: true },
'home' => { },
'about' => { },
}

belongs_to :website
Expand Down
342 changes: 342 additions & 0 deletions app/views/staff/pages/themes/default/about.html.erb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

#Staff URLS
namespace 'staff' do
get 'themes/:name', controller: :themes, action: :show
get '/' => 'events#show'
get :show

Expand Down
4 changes: 4 additions & 0 deletions spec/decorators/staff/theme_decorator_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'rails_helper'

RSpec.describe Staff::ThemeDecorator do
end
7 changes: 7 additions & 0 deletions spec/requests/staff/themes_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'rails_helper'

RSpec.describe "Staff::Themes", type: :request do
describe "GET /index" do
pending "add some examples (or delete) #{__FILE__}"
end
end