diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-10-07 10:05:59 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-10-07 10:05:59 +0000 |
commit | c0306f78d2686202aa56cf862a7c787d07c85d1a (patch) | |
tree | 3181e97345b8947361b280002dc22820e883c908 | |
parent | bbc52b000008c9020d2a38dafc09ff3341a69cae (diff) | |
parent | fd8d1d9b62066766c96610b7d42b20fa0e84b0ac (diff) | |
download | gitlab-ce-c0306f78d2686202aa56cf862a7c787d07c85d1a.tar.gz |
Merge branch 't1254-snippets-refactoring' into 'master'
Snippets refactoring: rename public to internal. STEP 1
See merge request !1157
-rw-r--r-- | app/controllers/snippets_controller.rb | 8 | ||||
-rw-r--r-- | app/models/snippet.rb | 2 | ||||
-rw-r--r-- | app/views/shared/snippets/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/snippets/current_user_index.html.haml | 8 | ||||
-rw-r--r-- | features/snippets/user.feature | 2 | ||||
-rw-r--r-- | features/steps/snippets/snippets.rb | 2 | ||||
-rw-r--r-- | features/steps/snippets/user.rb | 4 |
7 files changed, 14 insertions, 14 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index 3927584235e..5904dbbceda 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -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 @@ -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) diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 80c1af8f337..addde2d106a 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -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]) } diff --git a/app/views/shared/snippets/_form.html.haml b/app/views/shared/snippets/_form.html.haml index 49ea8460e7d..f4d74045f77 100644 --- a/app/views/shared/snippets/_form.html.haml +++ b/app/views/shared/snippets/_form.html.haml @@ -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 diff --git a/app/views/snippets/current_user_index.html.haml b/app/views/snippets/current_user_index.html.haml index e3edd856983..14b5b072ec2 100644 --- a/app/views/snippets/current_user_index.html.haml +++ b/app/views/snippets/current_user_index.html.haml @@ -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' diff --git a/features/snippets/user.feature b/features/snippets/user.feature index 424794f73fd..ae34e8e7ffa 100644 --- a/features/snippets/user.feature +++ b/features/snippets/user.feature @@ -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 diff --git a/features/steps/snippets/snippets.rb b/features/steps/snippets/snippets.rb index dedbdd2c4f0..de936db85ee 100644 --- a/features/steps/snippets/snippets.rb +++ b/features/steps/snippets/snippets.rb @@ -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 diff --git a/features/steps/snippets/user.rb b/features/steps/snippets/user.rb index ca9aa64bee6..c41bc436142 100644 --- a/features/steps/snippets/user.rb +++ b/features/steps/snippets/user.rb @@ -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 |