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
bbb06e50
Commit
bbb06e50
authored
Jul 18, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add seeds and improve ui. Remove snippet expires_at
parent
02e39563
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
26 deletions
+59
-26
_form.html.haml
app/views/snippets/_form.html.haml
+4
-3
_snippet.html.haml
app/views/snippets/_snippet.html.haml
+9
-15
_snippets.html.haml
app/views/snippets/_snippets.html.haml
+1
-1
show.html.haml
app/views/snippets/show.html.haml
+20
-5
12_snippets.rb
db/fixtures/development/12_snippets.rb
+24
-0
snippets.rb
features/steps/snippets/snippets.rb
+1
-2
No files found.
app/views/snippets/_form.html.haml
View file @
bbb06e50
...
...
@@ -16,9 +16,6 @@
=
f
.
label
"Private?"
.input
=
f
.
check_box
:private
,
{
class:
''
}
.clearfix
=
f
.
label
"Lifetime"
.input
=
f
.
select
:expires_at
,
lifetime_select_options
,
{},
{
class:
'chosen span2'
}
.clearfix
.file-editor
=
f
.
label
:file_name
,
"File"
.input
...
...
@@ -30,7 +27,11 @@
=
f
.
hidden_field
:content
,
class:
'snippet-file-content'
.form-actions
-
if
@snippet
.
new_record?
=
f
.
submit
'Create snippet'
,
class:
"btn-create btn"
-
else
=
f
.
submit
'Save'
,
class:
"btn-save btn"
=
link_to
"Cancel"
,
snippets_path
(
@project
),
class:
" btn"
-
unless
@snippet
.
new_record?
.pull-right
=
link_to
'Destroy'
,
snippet_path
(
@snippet
),
confirm:
'Removed snippet cannot be restored! Are you sure?'
,
method: :delete
,
class:
"btn pull-right danger delete-snippet"
,
id:
"destroy_snippet_
#{
@snippet
.
id
}
"
...
...
app/views/snippets/_snippet.html.haml
View file @
bbb06e50
%li
.snippet-title
-
if
snippet
.
private?
=
private_icon
-
else
=
public_icon
%h4
.snippet-title
=
link_to
reliable_snippet_path
(
snippet
)
do
%h5
.inline
=
truncate
(
snippet
.
title
,
length:
60
)
%span
.cgray
-
if
snippet
.
private?
%span
.label.label-success
%i
.icon-lock
private
%span
.cgray.monospace.tiny.pull-right
=
snippet
.
file_name
%small
.pull-right.cgray
...
...
@@ -15,16 +14,11 @@
=
link_to
snippet
.
project
.
name_with_namespace
,
project_path
(
snippet
.
project
)
%span
\|
Expires:
-
if
snippet
.
expires_at
=
snippet
.
expires_at
.
to_date
.
to_s
(
:short
)
-
else
Never
.snippet-info
.prepend-left-20
.snippet-info
=
"#
#{
snippet
.
id
}
"
%span
.light
%span
by
=
image_tag
gravatar_icon
(
snippet
.
author_email
),
class:
"avatar avatar-inline s16"
,
alt:
''
=
snippet
.
author_name
%span
.light
#{
time_ago_in_words
(
snippet
.
created_at
)
}
ago
app/views/snippets/_snippets.html.haml
View file @
bbb06e50
...
...
@@ -4,4 +4,4 @@
%li
%h3
.nothing_here_message
Nothing here.
=
paginate
@snippets
=
paginate
@snippets
,
theme:
'gitlab'
app/views/snippets/show.html.haml
View file @
bbb06e50
%h3
.page-title
=
@snippet
.
title
-
if
@snippet
.
private?
%
i
{
:class
=>
"icon-lock cgreen has_bottom_tooltip"
,
"data-original-title"
=>
"Private snippet"
}
-
else
%i
{
:class
=>
"icon-globe cblue has_bottom_tooltip"
,
"data-original-title"
=>
"Public snippet"
}
%
span
.label.label-success
%i
.icon-lock
private
=
@snippet
.
title
.pull-right
=
link_to
new_snippet_path
,
class:
"btn btn-small add_new grouped btn-primary"
,
title:
"New Snippet"
do
Add new snippet
%small
.pull-right
.append-bottom-20
.pull-right
=
"#
#{
@snippet
.
id
}
"
%span
.light
by
=
image_tag
gravatar_icon
(
@snippet
.
author_email
),
class:
"avatar avatar-inline s16"
=
@snippet
.
author_name
.back-link
-
if
@snippet
.
author
==
current_user
=
link_to
user_snippets_path
(
current_user
)
do
←
my snippets
-
else
=
link_to
snippets_path
do
←
discover snippets
%div
=
render
'blob'
db/fixtures/development/12_snippets.rb
0 → 100644
View file @
bbb06e50
ActiveRecord
::
Base
.
observers
.
disable
:all
Gitlab
::
Seeder
.
quiet
do
contents
=
[
`curl https://gist.github.com/randx/4275756/raw/da2f262920c96d1a970d48bf2e99147954b1f4bd/glus1204.sh`
,
`curl https://gist.github.com/randx/3754594/raw/11026a295e6ef3a151c635707a3e1e8e15fc4725/gitlab_setup.sh `
,
`curl https://gist.github.com/randx/3065552/raw/29fbd09f4605a5ea22a5a9095e35fd1938dea4d6/gistfile1.sh`
,
]
(
1
..
50
).
each
do
|
i
|
user
=
User
.
all
.
sample
PersonalSnippet
.
seed
(
:id
,
[{
id:
i
,
author_id:
user
.
id
,
title:
Faker
::
Lorem
.
sentence
(
6
),
file_name:
Faker
::
Internet
.
domain_word
+
'.sh'
,
private:
[
true
,
false
].
sample
,
content:
contents
.
sample
,
}])
print
(
'.'
)
end
end
features/steps/snippets/snippets.rb
View file @
bbb06e50
...
...
@@ -24,12 +24,11 @@ class SnippetsFeature < Spinach::FeatureSteps
And
'I submit new snippet "Personal snippet three"'
do
fill_in
"personal_snippet_title"
,
:with
=>
"Personal snippet three"
select
"forever"
,
:from
=>
"personal_snippet_expires_at"
fill_in
"personal_snippet_file_name"
,
:with
=>
"my_snippet.rb"
within
(
'.file-editor'
)
do
find
(
:xpath
,
"//input[@id='personal_snippet_content']"
).
set
'Content of snippet three'
end
click_button
"
Save
"
click_button
"
Create snippet
"
end
Then
'I should see snippet "Personal snippet three"'
do
...
...
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