show different content to logged in users

閲覧: 29 回
最初の未読メッセージにスキップ

lawrenc...@gmail.com

未読、
2015/04/16 20:16:192015/04/16
To: refine...@googlegroups.com
With RefineryCMS, is there a standard way to show some content to users who are not logged in, but different content for users who are logged in? 

We have these pages:

Education

Music

Community

For all 3 pages, we wish to show some static content to people who are not logged in, but we wish to show some (very different) dynamic content to people who are logged in.


lawrenc...@gmail.com

未読、
2015/04/16 20:29:222015/04/16
To: refine...@googlegroups.com
To be clear, ideally, we would show one set of pages to logged in users, and different pages to non-logged in users. If this can be solved entirely in routes.rb, I'd love to know how.

lawrenc...@gmail.com

未読、
2015/04/16 20:54:202015/04/16
To: refine...@googlegroups.com
Hmm, so I got part of this. If I add this to config/routes.rb:

  devise_scope :refinery_user do
    get 'community', :to => 'discussion#show', :as => :community_show
    post 'community', :to => 'discussion#show', :as => :community_post
    get 'discussion/show', :to => 'discussion#show', :as => :discussion_show
    post 'discussion/show', :to => 'discussion#show', :as => :discussion_post

    get 'join-the-fight', :to => 'refinery/users#new'
    get 'profile', :to => 'refinery/users#show'
    put 'profile', :to => 'refinery/users#update'
  end
  mount Refinery::Core::Engine, at: Refinery::Core.mounted_path

I have, in Refinery CMS, created a page called "community". Now if I go to the url "/community", and if I am logged in, then I end up seeing the discussions page, which is the behavior I want. However, if I am not logged in, then I asked to log in. 

But if I am not logged in, I just want to see the "/community" page, which should be controlled from the RefineryCMS admin. What do I need to add to routes.rb to make that happen? 

lawrenc...@gmail.com

未読、
2015/04/16 21:12:252015/04/16
To: refine...@googlegroups.com
If I do this:

  get 'community', :to => 'refinery/pages#show'


  devise_scope :refinery_user do
    get 'community', :to => 'discussion#show', :as => :community_show
    post 'community', :to => 'discussion#show', :as => :community_post
    get 'discussion/show', :to => 'discussion#show', :as => :discussion_show
    post 'discussion/show', :to => 'discussion#show', :as => :discussion_post

    get 'join-the-fight', :to => 'refinery/users#new'
    get 'profile', :to => 'refinery/users#show'
    put 'profile', :to => 'refinery/users#update'
  end
  mount Refinery::Core::Engine, at: Refinery::Core.mounted_path

and then I point my browser at: 

/community

if I am not logged in, I get a 404 error. The page exists in the database. How do I connect the url to the controller, when I am not logged in? 
全員に返信
投稿者に返信
転送
新着メール 0 件