summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2014-10-07 10:05:59 +0000
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2014-10-07 10:05:59 +0000
commitc0306f78d2686202aa56cf862a7c787d07c85d1a (patch)
tree3181e97345b8947361b280002dc22820e883c908 /app
parentbbc52b000008c9020d2a38dafc09ff3341a69cae (diff)
parentfd8d1d9b62066766c96610b7d42b20fa0e84b0ac (diff)
downloadgitlab-ce-c0306f78d2686202aa56cf862a7c787d07c85d1a.tar.gz
Merge branch 't1254-snippets-refactoring' into 'master'
Snippets refactoring: rename public to internal. STEP 1 See merge request !1157
Diffstat (limited to 'app')
-rw-r--r--app/controllers/snippets_controller.rb8
-rw-r--r--app/models/snippet.rb2
-rw-r--r--app/views/shared/snippets/_form.html.haml2
-rw-r--r--app/views/snippets/current_user_index.html.haml8
4 files changed, 10 insertions, 10 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'