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
9be5425a
Unverified
Commit
9be5425a
authored
Jun 14, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor snippets views
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
600f4c68
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
86 additions
and
106 deletions
+86
-106
snippets.scss
app/assets/stylesheets/sections/snippets.scss
+3
-0
_blob.html.haml
app/views/projects/snippets/_blob.html.haml
+0
-13
_form.html.haml
app/views/projects/snippets/_form.html.haml
+0
-42
edit.html.haml
app/views/projects/snippets/edit.html.haml
+4
-1
new.html.haml
app/views/projects/snippets/new.html.haml
+4
-1
show.html.haml
app/views/projects/snippets/show.html.haml
+30
-4
_blob.html.haml
app/views/shared/snippets/_blob.html.haml
+0
-0
_form.html.haml
app/views/shared/snippets/_form.html.haml
+22
-25
_blob.html.haml
app/views/snippets/_blob.html.haml
+0
-13
edit.html.haml
app/views/snippets/edit.html.haml
+4
-1
new.html.haml
app/views/snippets/new.html.haml
+4
-1
show.html.haml
app/views/snippets/show.html.haml
+13
-1
snippets.feature
features/project/snippets.feature
+0
-1
snippets.feature
features/snippets/snippets.feature
+0
-1
snippets.rb
features/steps/project/snippets.rb
+1
-1
snippets.rb
features/steps/snippets/snippets.rb
+1
-1
No files found.
app/assets/stylesheets/sections/snippets.scss
View file @
9be5425a
...
...
@@ -3,3 +3,6 @@
padding-top
:
0
;
}
.snippet-form-holder
.file-holder
.file-title
{
padding
:
2px
;
}
app/views/projects/snippets/_blob.html.haml
deleted
100644 → 0
View file @
600f4c68
.file-holder
.file-title
%i
.icon-file
%span
.file_name
=
@snippet
.
file_name
.options
.btn-group
-
if
can?
(
current_user
,
:modify_project_snippet
,
@snippet
)
=
link_to
"edit"
,
edit_project_snippet_path
(
@project
,
@snippet
),
class:
"btn btn-small"
,
title:
'Edit Snippet'
=
link_to
"raw"
,
raw_project_snippet_path
(
@project
,
@snippet
),
class:
"btn btn-small"
,
target:
"_blank"
-
if
can?
(
current_user
,
:admin_project_snippet
,
@snippet
)
=
link_to
"remove"
,
project_snippet_path
(
@project
,
@snippet
),
method: :delete
,
data:
{
confirm:
"Are you sure?"
},
class:
"btn btn-small btn-remove"
,
title:
'Delete Snippet'
=
render
'snippets/blob_content'
app/views/projects/snippets/_form.html.haml
deleted
100644 → 0
View file @
600f4c68
%h3
.page-title
=
@snippet
.
new_record?
?
"New Snippet"
:
"Edit Snippet #
#{
@snippet
.
id
}
"
%hr
.snippet-form-holder
=
form_for
[
@project
,
@snippet
],
as: :project_snippet
,
url:
url
,
html:
{
class:
"form-horizontal snippet-form"
}
do
|
f
|
-
if
@snippet
.
errors
.
any?
.alert.alert-danger
%ul
-
@snippet
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
.form-group
=
f
.
label
:title
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:title
,
placeholder:
"Example Snippet"
,
class:
'form-control'
,
required:
true
.form-group
.file-editor
=
f
.
label
:file_name
,
"File"
,
class:
'control-label'
.col-sm-10
.file-holder.snippet
.file-title
=
f
.
text_field
:file_name
,
placeholder:
"example.rb"
,
class:
'form-control snippet-file-name'
,
required:
true
.file-content.code
%pre
#editor
=
@snippet
.
content
=
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"
-
unless
@snippet
.
new_record?
.pull-right.prepend-left-20
=
link_to
'Remove snippet'
,
project_snippet_path
(
@project
,
@snippet
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn pull-right btn-remove delete-snippet prepend-left-10"
,
id:
"destroy_snippet_
#{
@snippet
.
id
}
"
=
link_to
"Cancel"
,
project_snippets_path
(
@project
),
class:
"btn btn-cancel"
:javascript
var
editor
=
ace
.
edit
(
"editor"
);
$
(
".snippet-form-holder form"
).
submit
(
function
(){
$
(
".snippet-file-content"
).
val
(
editor
.
getValue
());
});
app/views/projects/snippets/edit.html.haml
View file @
9be5425a
=
render
"projects/snippets/form"
,
url:
project_snippet_path
(
@project
,
@snippet
)
%h3
.page-title
Edit snippet
%hr
=
render
"shared/snippets/form"
,
url:
project_snippet_path
(
@project
,
@snippet
)
app/views/projects/snippets/new.html.haml
View file @
9be5425a
=
render
"projects/snippets/form"
,
url:
project_snippets_path
(
@project
,
@snippet
)
%h3
.page-title
New snippet
%hr
=
render
"shared/snippets/form"
,
url:
project_snippets_path
(
@project
,
@snippet
)
app/views/projects/snippets/show.html.haml
View file @
9be5425a
%h3
.page-title
=
@snippet
.
title
%small
.pull-right
.pull-right
=
link_to
new_project_snippet_path
(
@project
),
class:
"btn btn-new"
,
title:
"New Snippet"
do
Add new snippet
%hr
.append-bottom-20
.pull-right
=
"#
#{
@snippet
.
id
}
"
%span
.light
by
=
image_tag
avatar_icon
(
@snippet
.
author_email
),
class:
"avatar avatar-inline s16"
=
@snippet
.
author_name
%div
=
render
'projects/snippets/blob'
=
link_to
user_path
(
@snippet
.
author
)
do
=
image_tag
avatar_icon
(
@snippet
.
author_email
),
class:
"avatar avatar-inline s16"
=
@snippet
.
author_name
.back-link
=
link_to
project_snippets_path
(
@project
)
do
←
project snippets
.file-holder
.file-title
%i
.icon-file
%span
.file_name
=
@snippet
.
file_name
.options
.btn-group
-
if
can?
(
current_user
,
:modify_project_snippet
,
@snippet
)
=
link_to
"edit"
,
edit_project_snippet_path
(
@project
,
@snippet
),
class:
"btn btn-small"
,
title:
'Edit Snippet'
=
link_to
"raw"
,
raw_project_snippet_path
(
@project
,
@snippet
),
class:
"btn btn-small"
,
target:
"_blank"
-
if
can?
(
current_user
,
:admin_project_snippet
,
@snippet
)
=
link_to
"remove"
,
project_snippet_path
(
@project
,
@snippet
),
method: :delete
,
data:
{
confirm:
"Are you sure?"
},
class:
"btn btn-small btn-remove"
,
title:
'Delete Snippet'
=
render
'shared/snippets/blob'
%div
#notes
=
render
"projects/notes/notes_with_form"
app/views/s
nippets/_blob_content
.html.haml
→
app/views/s
hared/snippets/_blob
.html.haml
View file @
9be5425a
File moved
app/views/snippets/_form.html.haml
→
app/views/s
hared/s
nippets/_form.html.haml
View file @
9be5425a
%h3
.page-title
=
@snippet
.
new_record?
?
"New Snippet"
:
"Edit Snippet #
#{
@snippet
.
id
}
"
%hr
.snippet-form-holder
=
form_for
@snippet
,
as: :personal_snippet
,
url:
url
,
html:
{
class:
"form-horizontal snippet-form"
}
do
|
f
|
-
if
@snippet
.
errors
.
any?
=
form_for
@snippet
,
url:
url
,
html:
{
class:
"form-horizontal snippet-form"
}
do
|
f
|
-
if
@snippet
.
errors
.
any?
.alert.alert-danger
%ul
-
@snippet
.
errors
.
full_messages
.
each
do
|
msg
|
...
...
@@ -12,20 +9,22 @@
.form-group
=
f
.
label
:title
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:title
,
placeholder:
"Example Snippet"
,
class:
'form-control'
,
required:
true
.form-group
=
f
.
label
"Access"
,
class:
'control-label'
.col-sm-10
=
f
.
label
:private_true
,
class:
'radio-label'
do
=
f
.
radio_button
:private
,
true
%span
%strong
Private
(only you can see this snippet)
%br
=
f
.
label
:private_false
,
class:
'radio-label'
do
=
f
.
radio_button
:private
,
false
%span
%strong
Public
(GitLab users can see this snippet)
-
unless
@snippet
.
respond_to?
(
:project
)
.form-group
=
f
.
label
"Access"
,
class:
'control-label'
.col-sm-10
=
f
.
label
:private_true
,
class:
'radio-label'
do
=
f
.
radio_button
:private
,
true
%span
%strong
Private
(only you can see this snippet)
%br
=
f
.
label
:private_false
,
class:
'radio-label'
do
=
f
.
radio_button
:private
,
false
%span
%strong
Public
(GitLab users can see this snippet)
.form-group
.file-editor
...
...
@@ -44,15 +43,13 @@
-
else
=
f
.
submit
'Save'
,
class:
"btn-save btn"
-
unless
@snippet
.
new_record?
.pull-right.prepend-left-20
=
link_to
'Remove'
,
snippet_path
(
@snippet
),
data:
{
confirm:
'Removed snippet cannot be restored! Are you sure?'
},
method: :delete
,
class:
"btn btn-remove delete-snippet"
,
id:
"destroy_snippet_
#{
@snippet
.
id
}
"
=
link_to
"Cancel"
,
snippets_path
(
@project
),
class:
"btn btn-cancel"
-
if
@snippet
.
respond_to?
(
:project
)
=
link_to
"Cancel"
,
project_snippets_path
(
@project
),
class:
"btn btn-cancel"
-
else
=
link_to
"Cancel"
,
snippets_path
(
@project
),
class:
"btn btn-cancel"
:javascript
var
editor
=
ace
.
edit
(
"editor"
);
$
(
".snippet-form-holder form"
).
submit
(
function
(){
$
(
".snippet-file-content"
).
val
(
editor
.
getValue
());
});
app/views/snippets/_blob.html.haml
deleted
100644 → 0
View file @
600f4c68
.file-holder
.file-title
%i
.icon-file
%span
.file_name
=
@snippet
.
file_name
.options
.btn-group
-
if
can?
(
current_user
,
:modify_personal_snippet
,
@snippet
)
=
link_to
"edit"
,
edit_snippet_path
(
@snippet
),
class:
"btn btn-small"
,
title:
'Edit Snippet'
=
link_to
"raw"
,
raw_snippet_path
(
@snippet
),
class:
"btn btn-small"
,
target:
"_blank"
-
if
can?
(
current_user
,
:admin_personal_snippet
,
@snippet
)
=
link_to
"remove"
,
snippet_path
(
@snippet
),
method: :delete
,
data:
{
confirm:
"Are you sure?"
},
class:
"btn btn-small btn-remove"
,
title:
'Delete Snippet'
=
render
'snippets/blob_content'
app/views/snippets/edit.html.haml
View file @
9be5425a
=
render
"snippets/form"
,
url:
snippet_path
(
@snippet
)
%h3
.page-title
Edit snippet
%hr
=
render
"shared/snippets/form"
,
url:
snippet_path
(
@snippet
)
app/views/snippets/new.html.haml
View file @
9be5425a
=
render
"snippets/form"
,
url:
snippets_path
(
@snippet
)
%h3
.page-title
New snippet
%hr
=
render
"shared/snippets/form"
,
url:
snippets_path
(
@snippet
)
app/views/snippets/show.html.haml
View file @
9be5425a
...
...
@@ -28,4 +28,16 @@
=
link_to
snippets_path
do
←
discover snippets
%div
=
render
'blob'
.file-holder
.file-title
%i
.icon-file
%span
.file_name
=
@snippet
.
file_name
.options
.btn-group
-
if
can?
(
current_user
,
:modify_personal_snippet
,
@snippet
)
=
link_to
"edit"
,
edit_snippet_path
(
@snippet
),
class:
"btn btn-small"
,
title:
'Edit Snippet'
=
link_to
"raw"
,
raw_snippet_path
(
@snippet
),
class:
"btn btn-small"
,
target:
"_blank"
-
if
can?
(
current_user
,
:admin_personal_snippet
,
@snippet
)
=
link_to
"remove"
,
snippet_path
(
@snippet
),
method: :delete
,
data:
{
confirm:
"Are you sure?"
},
class:
"btn btn-small btn-remove"
,
title:
'Delete Snippet'
=
render
'shared/snippets/blob'
features/project/snippets.feature
View file @
9be5425a
...
...
@@ -30,6 +30,5 @@ Feature: Project Snippets
Scenario
:
I
destroy
"Snippet one"
Given
I visit snippet page
"Snippet one"
And
I click link
"Edit"
And
I click link
"Remove Snippet"
Then
I should not see
"Snippet one"
in snippets
features/snippets/snippets.feature
View file @
9be5425a
...
...
@@ -24,6 +24,5 @@ Feature: Snippets Feature
Scenario
:
I
destroy
"Personal snippet one"
Given
I visit snippet page
"Personal snippet one"
And
I click link
"Edit"
And
I click link
"Destroy"
Then
I should not see
"Personal snippet one"
in snippets
features/steps/project/snippets.rb
View file @
9be5425a
...
...
@@ -48,7 +48,7 @@ class ProjectSnippets < Spinach::FeatureSteps
end
And
'I click link "Remove Snippet"'
do
click_link
"
Remove snippet
"
click_link
"
remove
"
end
And
'I submit new snippet "Snippet three"'
do
...
...
features/steps/snippets/snippets.rb
View file @
9be5425a
...
...
@@ -19,7 +19,7 @@ class SnippetsFeature < Spinach::FeatureSteps
end
And
'I click link "Destroy"'
do
click_link
"
R
emove"
click_link
"
r
emove"
end
And
'I submit new 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