Skip to content
Snippets Groups Projects
Commit fd8d1d9b authored by Valery Sizov's avatar Valery Sizov
Browse files

Snippets: rename public to internal

parent 70004f4e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -14,7 +14,7 @@ class SnippetsController < ApplicationController
layout 'navless'
 
def index
@snippets = Snippet.are_public.fresh.non_expired.page(params[:page]).per(20)
@snippets = Snippet.are_internal.fresh.non_expired.page(params[:page]).per(20)
end
 
def user_index
Loading
Loading
@@ -26,15 +26,15 @@ class SnippetsController < ApplicationController
 
if @user == current_user
@snippets = case params[:scope]
when 'are_public' then
@snippets.are_public
when 'are_internal' then
@snippets.are_internal
when 'are_private' then
@snippets.are_private
else
@snippets
end
else
@snippets = @snippets.are_public
@snippets = @snippets.are_internal
end
 
@snippets = @snippets.page(params[:page]).per(20)
Loading
Loading
Loading
Loading
@@ -32,7 +32,7 @@ class Snippet < ActiveRecord::Base
validates :content, presence: true
 
# Scopes
scope :are_public, -> { where(private: false) }
scope :are_internal, -> { where(private: false) }
scope :are_private, -> { where(private: true) }
scope :fresh, -> { order("created_at DESC") }
scope :expired, -> { where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) }
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@
= f.label :private_false, class: 'radio-label' do
= f.radio_button :private, false
%span
%strong Public
%strong Internal
(GitLab users can see this snippet)
 
.form-group
Loading
Loading
Loading
Loading
@@ -23,11 +23,11 @@
Private
%span.pull-right
= @user.snippets.are_private.count
= nav_tab :scope, 'are_public' do
= link_to user_snippets_path(@user, scope: 'are_public') do
Public
= nav_tab :scope, 'are_internal' do
= link_to user_snippets_path(@user, scope: 'are_internal') do
Internal
%span.pull-right
= @user.snippets.are_public.count
= @user.snippets.are_internal.count
 
.col-md-9.my-snippets
= render 'snippets'
Loading
Loading
Loading
Loading
@@ -18,6 +18,6 @@ Feature: Snippets User
 
Scenario: I can see only my public snippets
Given I visit my snippets page
And I click "Public" filter
And I click "Internal" filter
Then I should see "Personal snippet one" in snippets
And I should not see "Personal snippet private" in snippets
Loading
Loading
@@ -46,7 +46,7 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
end
 
step 'I uncheck "Private" checkbox' do
choose "Public"
choose "Internal"
click_button "Save"
end
 
Loading
Loading
Loading
Loading
@@ -23,9 +23,9 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps
page.should_not have_content "Personal snippet private"
end
 
step 'I click "Public" filter' do
step 'I click "Internal" filter' do
within('.nav-stacked') do
click_link "Public"
click_link "Internal"
end
end
 
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