forked from lujanfernaud/prevy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8f16e6
commit 73bb002
Showing
3 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
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,13 +1,27 @@ | ||
class StaticPagesController < ApplicationController | ||
def home | ||
if signed_in? | ||
store_user_events | ||
store_user_groups | ||
end | ||
|
||
store_unhidden_groups | ||
end | ||
|
||
private | ||
|
||
def store_user_events | ||
@user = User.find(current_user.id) | ||
user_events = @user.events_from_groups | ||
@events_count = user_events.count | ||
@events = EventDecorator.collection(user_events.limit(6)) | ||
end | ||
|
||
def store_user_groups | ||
@user_groups = @user.groups | ||
end | ||
|
||
@groups = Group.where(hidden: false).random_selection | ||
end | ||
def store_unhidden_groups | ||
@unhidden_groups = Group.where(hidden: false).random_selection | ||
end | ||
end |
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