-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/snippets_expiration' into dev
Conflicts: db/schema.rb
- Loading branch information
Showing
11 changed files
with
71 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
module SnippetsHelper | ||
def lifetime_select_options | ||
options = [ | ||
['forever', nil], | ||
['1 day', "#{Date.current + 1.day}"], | ||
['1 week', "#{Date.current + 1.week}"], | ||
['1 month', "#{Date.current + 1.month}"] | ||
] | ||
options_for_select(options) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
%tr{ :id => dom_id(snippet), :class => "snippet", :url => project_snippet_path(@project, snippet) } | ||
%td | ||
= image_tag gravatar_icon(snippet.author.email), :class => "left", :width => 40, :style => "padding:0 5px;" | ||
= truncate snippet.author.name, :lenght => 20 | ||
%td= html_escape snippet.title | ||
%td= html_escape snippet.file_name | ||
%td | ||
- if can?(current_user, :admin_snippet, @project) || snippet.author == current_user | ||
= link_to 'Edit', edit_project_snippet_path(@project, snippet), :class => "lbutton positive" | ||
- if can?(current_user, :admin_snippet, @project) || snippet.author == current_user | ||
= link_to 'Destroy', [@project, snippet], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{snippet.id}" | ||
- unless snippet.expired? | ||
%tr{ :id => dom_id(snippet), :class => "snippet", :url => project_snippet_path(@project, snippet) } | ||
%td | ||
= image_tag gravatar_icon(snippet.author.email), :class => "left", :width => 40, :style => "padding:0 5px;" | ||
= truncate snippet.author.name, :lenght => 20 | ||
%td= html_escape snippet.title | ||
%td= html_escape snippet.file_name | ||
%td | ||
- if can?(current_user, :admin_snippet, @project) || snippet.author == current_user | ||
= link_to 'Edit', edit_project_snippet_path(@project, snippet), :class => "lbutton positive" | ||
- if can?(current_user, :admin_snippet, @project) || snippet.author == current_user | ||
= link_to 'Destroy', [@project, snippet], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{snippet.id}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
%h2 | ||
= "Snippet ##{@snippet.id} - #{@snippet.title}" | ||
- if !@snippet.expired? | ||
%h2 | ||
= "Snippet ##{@snippet.id} - #{@snippet.title}" | ||
|
||
.view_file | ||
.view_file_header | ||
%strong | ||
= @snippet.file_name | ||
%br/ | ||
.view_file_content | ||
:erb | ||
<%= raw @snippet.colorize %> | ||
.view_file | ||
.view_file_header | ||
%strong | ||
= @snippet.file_name | ||
%br/ | ||
.view_file_content | ||
:erb | ||
<%= raw @snippet.colorize %> | ||
|
||
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user | ||
= link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "lbutton positive" | ||
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user | ||
= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" | ||
.clear | ||
%br | ||
.snippet_notes= render "notes/notes" | ||
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user | ||
= link_to 'Edit', edit_project_snippet_path(@project, @snippet), :class => "lbutton positive" | ||
- if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user | ||
= link_to 'Destroy', [@project, @snippet], :confirm => 'Are you sure?', :method => :delete, :class => "lbutton delete-snippet negative", :id => "destroy_snippet_#{@snippet.id}" | ||
.clear | ||
%br | ||
.snippet_notes= render "notes/notes" | ||
|
||
.clear | ||
.clear | ||
|
||
- else | ||
%h2 | ||
Sorry, this snippet is no longer exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddExpiresAtToSnippets < ActiveRecord::Migration | ||
def change | ||
add_column :snippets, :expires_at, :datetime | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,5 +26,6 @@ | |
# created_at :datetime | ||
# updated_at :datetime | ||
# file_name :string(255) | ||
# expires_at :datetime | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters