Skip to content
Snippets Groups Projects
Commit 79f8abc5 authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Replace snippets scopes in view and controller.

parent 90c2e0d9
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -26,15 +26,15 @@ class SnippetsController < ApplicationController
 
if @user == current_user
@snippets = case params[:scope]
when 'public' then
@snippets.public
when 'private' then
@snippets.private
when 'is_public' then
@snippets.is_public
when 'is_private' then
@snippets.is_private
else
@snippets
end
else
@snippets = @snippets.public
@snippets = @snippets.is_public
end
 
@snippets = @snippets.page(params[:page]).per(20)
Loading
Loading
Loading
Loading
@@ -18,16 +18,16 @@
All
%span.pull-right
= @user.snippets.count
= nav_tab :scope, 'private' do
= link_to user_snippets_path(@user, scope: 'private') do
= nav_tab :scope, 'is_private' do
= link_to user_snippets_path(@user, scope: 'is_private') do
Private
%span.pull-right
= @user.snippets.private.count
= nav_tab :scope, 'public' do
= link_to user_snippets_path(@user, scope: 'public') do
= @user.snippets.is_private.count
= nav_tab :scope, 'is_public' do
= link_to user_snippets_path(@user, scope: 'is_public') do
Public
%span.pull-right
= @user.snippets.public.count
= @user.snippets.is_public.count
 
.col-md-9.my-snippets
= render 'snippets'
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment