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
Léo-Paul Géneau
gitlab-ce
Commits
5e584ee6
Commit
5e584ee6
authored
Oct 27, 2011
by
Nihad Abbasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor lifetime_select helper
parent
de4e8599
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
app/helpers/snippets_helper.rb
app/helpers/snippets_helper.rb
+4
-4
app/views/snippets/_form.html.haml
app/views/snippets/_form.html.haml
+1
-1
No files found.
app/helpers/snippets_helper.rb
View file @
5e584ee6
module
SnippetsHelper
module
SnippetsHelper
def
snippet_
lifetime_select_options
def
lifetime_select_options
options
=
[
options
=
[
[
'forever'
,
nil
],
[
'forever'
,
nil
],
[
'1 day'
,
Date
.
strptime
(
"
#{
Date
.
current
.
day
}
.
#{
Date
.
current
.
month
}
.
#{
Date
.
current
.
year
}
"
,
"%d.%m.%Y"
)
+
1
.
day
],
[
'1 day'
,
"
#{
Date
.
current
+
1
.
day
}
"
],
[
'1 week'
,
Date
.
strptime
(
"
#{
Date
.
current
.
day
}
.
#{
Date
.
current
.
month
}
.
#{
Date
.
current
.
year
}
"
,
"%d.%m.%Y"
)
+
1
.
week
],
[
'1 week'
,
"
#{
Date
.
current
+
1
.
week
}
"
],
[
'1 month'
,
Date
.
strptime
(
"
#{
Date
.
current
.
day
}
.
#{
Date
.
current
.
month
}
.
#{
Date
.
current
.
year
}
"
,
"%d.%m.%Y"
)
+
1
.
month
]
[
'1 month'
,
"
#{
Date
.
current
+
1
.
month
}
"
]
]
]
options_for_select
(
options
)
options_for_select
(
options
)
end
end
...
...
app/views/snippets/_form.html.haml
View file @
5e584ee6
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
%td
=
f
.
text_field
:file_name
,
:placeholder
=>
"example.rb"
%td
=
f
.
text_field
:file_name
,
:placeholder
=>
"example.rb"
%tr
%tr
%td
=
f
.
label
"Lifetime"
%td
=
f
.
label
"Lifetime"
%td
=
f
.
select
:expires_at
,
snippet_
lifetime_select_options
%td
=
f
.
select
:expires_at
,
lifetime_select_options
%tr
%tr
%td
{
:colspan
=>
2
}
%td
{
:colspan
=>
2
}
=
f
.
label
:content
,
"Code"
=
f
.
label
:content
,
"Code"
...
...
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