Commit 79f8abc51fa876e12de4150ab3ec489208aaed84
1 parent
90c2e0d9
Exists in
spb-stable
and in
2 other branches
Replace snippets scopes in view and controller.
Showing
2 changed files
with
11 additions
and
11 deletions
Show diff stats
app/controllers/snippets_controller.rb
| @@ -26,15 +26,15 @@ class SnippetsController < ApplicationController | @@ -26,15 +26,15 @@ class SnippetsController < ApplicationController | ||
| 26 | 26 | ||
| 27 | if @user == current_user | 27 | if @user == current_user |
| 28 | @snippets = case params[:scope] | 28 | @snippets = case params[:scope] |
| 29 | - when 'public' then | ||
| 30 | - @snippets.public | ||
| 31 | - when 'private' then | ||
| 32 | - @snippets.private | 29 | + when 'is_public' then |
| 30 | + @snippets.is_public | ||
| 31 | + when 'is_private' then | ||
| 32 | + @snippets.is_private | ||
| 33 | else | 33 | else |
| 34 | @snippets | 34 | @snippets |
| 35 | end | 35 | end |
| 36 | else | 36 | else |
| 37 | - @snippets = @snippets.public | 37 | + @snippets = @snippets.is_public |
| 38 | end | 38 | end |
| 39 | 39 | ||
| 40 | @snippets = @snippets.page(params[:page]).per(20) | 40 | @snippets = @snippets.page(params[:page]).per(20) |
app/views/snippets/current_user_index.html.haml
| @@ -18,16 +18,16 @@ | @@ -18,16 +18,16 @@ | ||
| 18 | All | 18 | All |
| 19 | %span.pull-right | 19 | %span.pull-right |
| 20 | = @user.snippets.count | 20 | = @user.snippets.count |
| 21 | - = nav_tab :scope, 'private' do | ||
| 22 | - = link_to user_snippets_path(@user, scope: 'private') do | 21 | + = nav_tab :scope, 'is_private' do |
| 22 | + = link_to user_snippets_path(@user, scope: 'is_private') do | ||
| 23 | Private | 23 | Private |
| 24 | %span.pull-right | 24 | %span.pull-right |
| 25 | - = @user.snippets.private.count | ||
| 26 | - = nav_tab :scope, 'public' do | ||
| 27 | - = link_to user_snippets_path(@user, scope: 'public') do | 25 | + = @user.snippets.is_private.count |
| 26 | + = nav_tab :scope, 'is_public' do | ||
| 27 | + = link_to user_snippets_path(@user, scope: 'is_public') do | ||
| 28 | Public | 28 | Public |
| 29 | %span.pull-right | 29 | %span.pull-right |
| 30 | - = @user.snippets.public.count | 30 | + = @user.snippets.is_public.count |
| 31 | 31 | ||
| 32 | .col-md-9.my-snippets | 32 | .col-md-9.my-snippets |
| 33 | = render 'snippets' | 33 | = render 'snippets' |