Commit 79f8abc5 authored by Marin Jankovski's avatar Marin Jankovski

Replace snippets scopes in view and controller.

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