Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
aecc9891
Commit
aecc9891
authored
Jun 12, 2015
by
Nicolas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make snippet filename optional.
Fixes #2384.
parent
e9c40a9c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
3 deletions
+1
-3
app/models/snippet.rb
app/models/snippet.rb
+0
-1
app/views/shared/snippets/_form.html.haml
app/views/shared/snippets/_form.html.haml
+1
-1
spec/models/snippet_spec.rb
spec/models/snippet_spec.rb
+0
-1
No files found.
app/models/snippet.rb
View file @
aecc9891
...
@@ -34,7 +34,6 @@ class Snippet < ActiveRecord::Base
...
@@ -34,7 +34,6 @@ class Snippet < ActiveRecord::Base
validates
:author
,
presence:
true
validates
:author
,
presence:
true
validates
:title
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:title
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:file_name
,
validates
:file_name
,
presence:
true
,
length:
{
within:
0
..
255
},
length:
{
within:
0
..
255
},
format:
{
with:
Gitlab
::
Regex
.
file_name_regex
,
format:
{
with:
Gitlab
::
Regex
.
file_name_regex
,
message:
Gitlab
::
Regex
.
file_name_regex_message
}
message:
Gitlab
::
Regex
.
file_name_regex_message
}
...
...
app/views/shared/snippets/_form.html.haml
View file @
aecc9891
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
.col-sm-10
.col-sm-10
.file-holder.snippet
.file-holder.snippet
.file-title
.file-title
=
f
.
text_field
:file_name
,
placeholder:
"
example.rb"
,
class:
'form-control snippet-file-name'
,
required:
true
=
f
.
text_field
:file_name
,
placeholder:
"
Optionally name this file to add code highlighting, e.g. example.rb for Ruby."
,
class:
'form-control snippet-file-name'
.file-content.code
.file-content.code
%pre
#editor
=
@snippet
.
content
%pre
#editor
=
@snippet
.
content
=
f
.
hidden_field
:content
,
class:
'snippet-file-content'
=
f
.
hidden_field
:content
,
class:
'snippet-file-content'
...
...
spec/models/snippet_spec.rb
View file @
aecc9891
...
@@ -40,7 +40,6 @@ describe Snippet do
...
@@ -40,7 +40,6 @@ describe Snippet do
it
{
is_expected
.
to
validate_presence_of
(
:title
)
}
it
{
is_expected
.
to
validate_presence_of
(
:title
)
}
it
{
is_expected
.
to
validate_length_of
(
:title
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validate_length_of
(
:title
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validate_presence_of
(
:file_name
)
}
it
{
is_expected
.
to
validate_length_of
(
:file_name
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validate_length_of
(
:file_name
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validate_presence_of
(
:content
)
}
it
{
is_expected
.
to
validate_presence_of
(
:content
)
}
...
...
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