BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
fd8d1d9b
Commit
fd8d1d9b
authored
Oct 07, 2014
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Snippets: rename public to internal
parent
70004f4e
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
14 deletions
+14
-14
snippets_controller.rb
app/controllers/snippets_controller.rb
+4
-4
snippet.rb
app/models/snippet.rb
+1
-1
_form.html.haml
app/views/shared/snippets/_form.html.haml
+1
-1
current_user_index.html.haml
app/views/snippets/current_user_index.html.haml
+4
-4
user.feature
features/snippets/user.feature
+1
-1
snippets.rb
features/steps/snippets/snippets.rb
+1
-1
user.rb
features/steps/snippets/user.rb
+2
-2
No files found.
app/controllers/snippets_controller.rb
View file @
fd8d1d9b
...
...
@@ -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
)
...
...
app/models/snippet.rb
View file @
fd8d1d9b
...
...
@@ -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
])
}
...
...
app/views/shared/snippets/_form.html.haml
View file @
fd8d1d9b
...
...
@@ -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
...
...
app/views/snippets/current_user_index.html.haml
View file @
fd8d1d9b
...
...
@@ -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'
...
...
features/snippets/user.feature
View file @
fd8d1d9b
...
...
@@ -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
features/steps/snippets/snippets.rb
View file @
fd8d1d9b
...
...
@@ -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
...
...
features/steps/snippets/user.rb
View file @
fd8d1d9b
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment