-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow the home page to have a path other than '/' #3368
Conversation
Strange: errors in a place this PR doesn't touch.
Reran rake a few times locally and on some runs saw other errors, each of which could be triggered if the three pages created by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @anitagraham ! It's a great and simple feature. Could you fix the specs?
@@ -101,7 +104,7 @@ def action_page_finder | |||
module Finders | |||
class Home | |||
def self.call(_params) | |||
Refinery::Page.find_by link_url: "/" | |||
Refinery::Page.find_by link_url: Refinery::Pages.home_page_path || "/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a fallback to "/"
if the Refinery::Pages.home_page_path
config has "/"
as default ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. Just making sure it happens somewhere.
@@ -2,21 +2,32 @@ | |||
|
|||
module Refinery | |||
describe PagesController, :type => :controller do | |||
before do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the before block ?
@@ -811,20 +813,19 @@ module Admin | |||
describe "a page with a single locale" do | |||
before do | |||
allow(Refinery::I18n).to receive(:frontend_locales).and_return([:en, :lv]) | |||
Page.create :title => 'First Page' | |||
# Page.create :title => 'First Page' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is commented
@@ -10,6 +10,9 @@ class PagesController < ::ApplicationController | |||
|
|||
# This action is usually accessed with the root path, normally '/' | |||
def home | |||
if page.link_url.present? && page.link_url != "/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you also allow a redirect of the homepage if there is a path in link_url
? It's nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed as recommended
4fd892b
to
d779dba
Compare
end | ||
end | ||
|
||
describe "#show" do | ||
render_views |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how come this needs render_views
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because when I ran the tests it came back from this (and another similar test) saying the view was rendered with []
. (from memory).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I remove render_views
from the file completely the tests still pass. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the same (removed the 'render_views' and also got no failures. So out they go.
I was just doing the same. And yes they pass.
I was having odd testing problems – but all gone now.
Thanks,
Anita
|
No description provided.