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
c0df5ff1
Commit
c0df5ff1
authored
Jun 20, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'snippet_optional_filename' into 'master'
Make snippet filename optional. Fixes #2384. See merge request !1866
parents
473fb23a
aecc9891
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
3 deletions
+1
-3
snippet.rb
app/models/snippet.rb
+0
-1
_form.html.haml
app/views/shared/snippets/_form.html.haml
+1
-1
snippet_spec.rb
spec/models/snippet_spec.rb
+0
-1
No files found.
app/models/snippet.rb
View file @
c0df5ff1
...
...
@@ -34,7 +34,6 @@ class Snippet < ActiveRecord::Base
validates
:author
,
presence:
true
validates
:title
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:file_name
,
presence:
true
,
length:
{
within:
0
..
255
},
format:
{
with:
Gitlab
::
Regex
.
file_name_regex
,
message:
Gitlab
::
Regex
.
file_name_regex_message
}
...
...
app/views/shared/snippets/_form.html.haml
View file @
c0df5ff1
...
...
@@ -18,7 +18,7 @@
.col-sm-10
.file-holder.snippet
.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
%pre
#editor
=
@snippet
.
content
=
f
.
hidden_field
:content
,
class:
'snippet-file-content'
...
...
spec/models/snippet_spec.rb
View file @
c0df5ff1
...
...
@@ -40,7 +40,6 @@ describe Snippet do
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_presence_of
(
:file_name
)
}
it
{
is_expected
.
to
validate_length_of
(
:file_name
).
is_within
(
0
..
255
)
}
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