refactor lifetime_select helper
This commit is contained in:
parent
de4e859928
commit
5e584ee626
2 changed files with 5 additions and 5 deletions
|
@ -1,10 +1,10 @@
|
||||||
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
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue