added groups route thing
This commit is contained in:
parent
d1a6c512c4
commit
f93624fa2c
|
@ -46,6 +46,17 @@ class UserController < ApplicationController
|
|||
end
|
||||
# endregion
|
||||
|
||||
# region Groups
|
||||
def groups
|
||||
@user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first!
|
||||
@groups = if current_user == @user
|
||||
@user.groups.all
|
||||
else
|
||||
@user.groups.where(private: false).all
|
||||
end
|
||||
end
|
||||
# endregion
|
||||
|
||||
def followers
|
||||
@title = 'Followers'
|
||||
@user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first!
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
.profile--header
|
||||
.container.j2-page
|
||||
.col-md-3.col-xs-12.col-sm-4
|
||||
= render 'user/profile_info'
|
||||
.hidden-xs= render 'shared/links'
|
||||
.col-md-9.col-xs-12.col-sm-8
|
||||
%h1.j2-lh.hidden-xs Groups
|
||||
%h1.visible-xs Groups
|
||||
|
||||
%ul
|
||||
- @groups.each do |group|
|
||||
%li= group.title
|
||||
|
||||
.visible-xs= render 'shared/links'
|
|
@ -89,6 +89,7 @@ Rails.application.routes.draw do
|
|||
match '/@:username/q/:id', to: 'question#show', via: 'get', as: :show_user_question
|
||||
match '/@:username/followers(/p/:page)', to: 'user#followers', via: 'get', as: :show_user_followers, defaults: {page: 1}
|
||||
match '/@:username/friends(/p/:page)', to: 'user#friends', via: 'get', as: :show_user_friends, defaults: {page: 1}
|
||||
match '/@:username/groups(/p/:page)', to: 'user#groups', via: 'get', as: :show_user_groups, defaults: {page: 1}
|
||||
match '/:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile_alt, defaults: {page: 1}
|
||||
match '/:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer_alt
|
||||
match '/:username/q/:id', to: 'question#show', via: 'get', as: :show_user_question_alt
|
||||
|
|
Loading…
Reference in New Issue