clipster 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -20
- data/README.md +72 -0
- data/Rakefile +34 -34
- data/app/assets/images/clipster/rss_logo_small.png +0 -0
- data/app/assets/javascripts/clipster/application.js +15 -15
- data/app/assets/javascripts/clipster/bootstrap.js +2026 -2026
- data/app/assets/javascripts/clipster/bootstrap.min.js +5 -5
- data/app/assets/javascripts/clipster/clip.js +2 -2
- data/app/assets/javascripts/clipster/clips.js +7 -2
- data/app/assets/javascripts/clipster/users.js +2 -0
- data/app/assets/stylesheets/clipster/application.css +27 -27
- data/app/assets/stylesheets/clipster/bootstrap.css +5774 -5774
- data/app/assets/stylesheets/clipster/clip.css +31 -21
- data/app/assets/stylesheets/clipster/clips.css +4 -4
- data/app/assets/stylesheets/clipster/users.css +4 -0
- data/app/controllers/clipster/application_controller.rb +14 -7
- data/app/controllers/clipster/clips_controller.rb +86 -80
- data/app/controllers/clipster/users_controller.rb +17 -0
- data/app/helpers/clipster/application_helper.rb +19 -4
- data/app/helpers/clipster/clip_helper.rb +4 -4
- data/app/helpers/clipster/clips_helper.rb +4 -4
- data/app/helpers/clipster/users_helper.rb +4 -0
- data/app/models/clipster/clip.rb +99 -74
- data/app/views/clipster/clips/about.html.erb +14 -14
- data/app/views/clipster/clips/create.html.erb +56 -46
- data/app/views/clipster/clips/list.atom.builder +22 -0
- data/app/views/clipster/clips/list.html.erb +60 -43
- data/app/views/clipster/clips/show.html.erb +8 -8
- data/app/views/clipster/users/index.html.erb +2 -0
- data/app/views/clipster/users/show.html.erb +46 -0
- data/app/views/kaminari/_first_page.html.erb +3 -3
- data/app/views/kaminari/_gap.html.erb +3 -3
- data/app/views/kaminari/_last_page.html.erb +3 -3
- data/app/views/kaminari/_next_page.html.erb +3 -3
- data/app/views/kaminari/_page.html.erb +3 -3
- data/app/views/kaminari/_paginator.html.erb +17 -17
- data/app/views/kaminari/_prev_page.html.erb +3 -3
- data/app/views/layouts/clipster/application.html.erb +62 -49
- data/config/routes.rb +16 -14
- data/config/schedule.rb +10 -10
- data/db/migrate/20121004010757_create_clipster_clips.rb +16 -16
- data/db/migrate/20121007154400_add_hash_index_to_clips.rb +13 -13
- data/db/migrate/20121007155125_populate_clip_defaults.rb +21 -21
- data/db/migrate/20121007162741_rename_hash_to_url_hash.rb +9 -9
- data/db/migrate/20121007223358_remove_default_from_language.rb +9 -9
- data/db/migrate/20121007223631_set_default_title_to_untitled.rb +9 -9
- data/db/migrate/20121105212724_add_lifespan_to_clips.rb +9 -9
- data/db/migrate/20121114175749_add_user_id_to_clips.rb +9 -0
- data/lib/clipster/configuration.rb +23 -0
- data/lib/clipster/engine.rb +23 -15
- data/lib/clipster/version.rb +3 -3
- data/lib/clipster.rb +5 -4
- data/lib/generators/clipster/install_generator.rb +19 -0
- data/lib/generators/templates/clipster.rb +12 -0
- data/lib/tasks/clipster_tasks.rake +4 -4
- metadata +16 -4
- data/README.rdoc +0 -54
@@ -0,0 +1,22 @@
|
|
1
|
+
atom_feed do |feed|
|
2
|
+
feed.title("Clipster - Recent")
|
3
|
+
feed.updated(@updated_at) unless @updated_at.nil?
|
4
|
+
|
5
|
+
@clips.each do |clip|
|
6
|
+
feed.entry(clip) do |entry|
|
7
|
+
entry.title(clip.title)
|
8
|
+
if clip.expires.nil?
|
9
|
+
entry.subtitle("A #{clip.language} clip that never expires")
|
10
|
+
else
|
11
|
+
entry.subtitle("A #{clip.language} clip that expires on #{clip.expires}")
|
12
|
+
end
|
13
|
+
entry.updated(clip.updated_at)
|
14
|
+
entry.content(clip.div.html_safe, :type => 'html')
|
15
|
+
|
16
|
+
#TODO set author once user integration is compleate
|
17
|
+
#entry.author do |author|
|
18
|
+
# author.name("DHH")
|
19
|
+
#end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,44 +1,61 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
<th>
|
16
|
-
|
17
|
-
</th>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
<
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
<
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
1
|
+
<%= content_for :head, auto_discovery_link_tag(:atom) %>
|
2
|
+
|
3
|
+
<legend>
|
4
|
+
Recent Clips<%= " - #{params[:lang]}" unless params[:lang].nil? %>
|
5
|
+
<%= link_to "", list_clips_path(:lang => params[:lang], :format=>:atom), :class=>"image-feed pull-right" %>
|
6
|
+
</legend>
|
7
|
+
<div class="span7">
|
8
|
+
<table class="table table-striped table-bordered table-hover span6">
|
9
|
+
<thead>
|
10
|
+
<tr>
|
11
|
+
<th>
|
12
|
+
Title
|
13
|
+
</th>
|
14
|
+
<% if Clipster.config.associates_clip_with_user %>
|
15
|
+
<th>
|
16
|
+
User
|
17
|
+
</th>
|
18
|
+
<% end %>
|
19
|
+
<th>
|
20
|
+
Language
|
21
|
+
</th>
|
22
|
+
<th>
|
23
|
+
Created On
|
24
|
+
</th>
|
25
|
+
<th>
|
26
|
+
Expires
|
27
|
+
</th>
|
28
|
+
</tr>
|
29
|
+
</thead>
|
30
|
+
<tbody>
|
31
|
+
<% @clips.each do |clip| %>
|
32
|
+
<tr>
|
33
|
+
<td><%= link_to clip.title, clip %></td>
|
34
|
+
<% if Clipster.config.associates_clip_with_user %>
|
35
|
+
<td>
|
36
|
+
<%= link_to(display_user_text(clip.user), clip.user) if clip.user %>
|
37
|
+
</td>
|
38
|
+
<% end %>
|
39
|
+
<td><%= clip.language.capitalize %></td>
|
40
|
+
<td><%= l clip.created_at, :format => :short %></td>
|
41
|
+
<td><%= clip.expires_in_words %></td>
|
42
|
+
</tr>
|
43
|
+
<% end %>
|
44
|
+
<% unless @clips.length > 0 %>
|
45
|
+
<tr>
|
46
|
+
<td colspan="3" style="text-align: center;">There are no public clips.</td>
|
47
|
+
</tr>
|
48
|
+
<% end %>
|
49
|
+
</tbody>
|
50
|
+
</table>
|
51
|
+
<div class="clearfix"></div>
|
52
|
+
<%= paginate @clips %>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<%# Refactor out into common partial %>
|
56
|
+
<aside class="languages bordered span3 offset1">
|
57
|
+
<div class="title">Languages</div>
|
58
|
+
<% get_language_counts.each do |lang| %>
|
59
|
+
<div><%= link_to lang.language, list_clips_path(:lang => lang.language) %> (<%= lang.count %>)</div>
|
60
|
+
<% end %>
|
44
61
|
</aside>
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<legend>
|
2
|
-
<div class="span10"><%=@clip.title %></div>
|
3
|
-
<div class="span3 secondary">A <%=@clip.language.capitalize %> clip</div>
|
4
|
-
<div class="span5 secondary">Expires: <%= @clip.
|
5
|
-
<div class="clearfix"></div>
|
6
|
-
</legend>
|
7
|
-
<div class="clearfix"></div>
|
8
|
-
<%= @
|
1
|
+
<legend>
|
2
|
+
<div class="span10"><%=@clip.title %></div>
|
3
|
+
<div class="span3 secondary">A <%=@clip.language.capitalize %> clip</div>
|
4
|
+
<div class="span5 secondary">Expires: <%= @clip.expires_in_words %></div>
|
5
|
+
<div class="clearfix"></div>
|
6
|
+
</legend>
|
7
|
+
<div class="clearfix"></div>
|
8
|
+
<%= @clip.div.html_safe %>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<legend>Recent Clips from <%= @user %></legend>
|
2
|
+
<div class="span7">
|
3
|
+
<table class="table table-striped table-bordered table-hover span6">
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th>
|
7
|
+
Title
|
8
|
+
</th>
|
9
|
+
<th>
|
10
|
+
Language
|
11
|
+
</th>
|
12
|
+
<th>
|
13
|
+
Created On
|
14
|
+
</th>
|
15
|
+
<th>
|
16
|
+
Expires
|
17
|
+
</th>
|
18
|
+
</tr>
|
19
|
+
</thead>
|
20
|
+
<tbody>
|
21
|
+
<% @clips.each do |clip| %>
|
22
|
+
<tr>
|
23
|
+
<td><%= link_to clip.title, clip_path %></td>
|
24
|
+
<td><%= clip.language.capitalize %></td>
|
25
|
+
<td><%= l clip.created_at, :format => :short %></td>
|
26
|
+
<td><%= clip.expires_in_words %></td>
|
27
|
+
</tr>
|
28
|
+
<% end %>
|
29
|
+
<% unless @clips.length > 0 %>
|
30
|
+
<tr>
|
31
|
+
<td colspan="3" style="text-align: center;">There are no public clips.</td>
|
32
|
+
</tr>
|
33
|
+
<% end %>
|
34
|
+
</tbody>
|
35
|
+
</table>
|
36
|
+
<div class="clearfix"></div>
|
37
|
+
<%= paginate @clips %>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<%# Refactor out into common partial %>
|
41
|
+
<aside class="languages bordered span3 offset1">
|
42
|
+
<div class="title">Languages</div>
|
43
|
+
<% get_language_counts.each do |lang| %>
|
44
|
+
<div><%= link_to lang.language.capitalize, list_clips_path(:lang => lang.language) %> (<%= lang.count %>)</div>
|
45
|
+
<% end %>
|
46
|
+
</aside>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<li>
|
2
|
-
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
|
3
|
-
</li>
|
1
|
+
<li>
|
2
|
+
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
|
3
|
+
</li>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<li class="disabled">
|
2
|
-
<%= link_to raw(t 'views.pagination.truncate'), '#' %>
|
3
|
-
</li>
|
1
|
+
<li class="disabled">
|
2
|
+
<%= link_to raw(t 'views.pagination.truncate'), '#' %>
|
3
|
+
</li>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<li>
|
2
|
-
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
|
3
|
-
</li>
|
1
|
+
<li>
|
2
|
+
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
|
3
|
+
</li>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<li>
|
2
|
-
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
|
3
|
-
</li>
|
1
|
+
<li>
|
2
|
+
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
|
3
|
+
</li>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<li class="<%= 'active' if page.current? %>">
|
2
|
-
<%= link_to page, page.current? ? '#' : url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
|
3
|
-
</li>
|
1
|
+
<li class="<%= 'active' if page.current? %>">
|
2
|
+
<%= link_to page, page.current? ? '#' : url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
|
3
|
+
</li>
|
@@ -1,17 +1,17 @@
|
|
1
|
-
<%= paginator.render do -%>
|
2
|
-
<div class="pagination">
|
3
|
-
<ul>
|
4
|
-
<%= first_page_tag unless current_page.first? %>
|
5
|
-
<%= prev_page_tag unless current_page.first? %>
|
6
|
-
<% each_page do |page| -%>
|
7
|
-
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
8
|
-
<%= page_tag page %>
|
9
|
-
<% elsif !page.was_truncated? -%>
|
10
|
-
<%= gap_tag %>
|
11
|
-
<% end -%>
|
12
|
-
<% end -%>
|
13
|
-
<%= next_page_tag unless current_page.last? %>
|
14
|
-
<%= last_page_tag unless current_page.last? %>
|
15
|
-
</ul>
|
16
|
-
</div>
|
17
|
-
<% end -%>
|
1
|
+
<%= paginator.render do -%>
|
2
|
+
<div class="pagination">
|
3
|
+
<ul>
|
4
|
+
<%= first_page_tag unless current_page.first? %>
|
5
|
+
<%= prev_page_tag unless current_page.first? %>
|
6
|
+
<% each_page do |page| -%>
|
7
|
+
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
8
|
+
<%= page_tag page %>
|
9
|
+
<% elsif !page.was_truncated? -%>
|
10
|
+
<%= gap_tag %>
|
11
|
+
<% end -%>
|
12
|
+
<% end -%>
|
13
|
+
<%= next_page_tag unless current_page.last? %>
|
14
|
+
<%= last_page_tag unless current_page.last? %>
|
15
|
+
</ul>
|
16
|
+
</div>
|
17
|
+
<% end -%>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<li>
|
2
|
-
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
|
3
|
-
</li>
|
1
|
+
<li>
|
2
|
+
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
|
3
|
+
</li>
|
@@ -1,49 +1,62 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<title>Clipster</title>
|
5
|
-
<%= stylesheet_link_tag "clipster/application", :media => "all" %>
|
6
|
-
|
7
|
-
<%= javascript_include_tag "clipster/application" %>
|
8
|
-
<%= csrf_meta_tags %>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
<li><%= link_to "
|
20
|
-
<li><%= link_to "
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<title>Clipster</title>
|
5
|
+
<%= stylesheet_link_tag "clipster/application", :media => "all" %>
|
6
|
+
|
7
|
+
<%= javascript_include_tag "clipster/application" %>
|
8
|
+
<%= csrf_meta_tags %>
|
9
|
+
<%=h yield(:head) %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div class="container">
|
13
|
+
<div class="navbar navbar-inverse navbar-fixed-top">
|
14
|
+
<div class="navbar-inner">
|
15
|
+
<div class="container">
|
16
|
+
<div class="nav-collapse collapse">
|
17
|
+
<%= link_to "Clipster", root_path, :class => "brand" %>
|
18
|
+
<ul class="nav">
|
19
|
+
<li><%= link_to "New Clip", new_clip_path %></li>
|
20
|
+
<li><%= link_to "Recent Clips", list_clips_path %></li>
|
21
|
+
<li><%= link_to "About", about_clips_path %></li>
|
22
|
+
<% if Clipster.config.associates_clip_with_user %>
|
23
|
+
<li><a href="javascript:void(0);"><%= Clipster.config.user_class %></a></li>
|
24
|
+
<% end %>
|
25
|
+
</ul>
|
26
|
+
<!-- <form class="navbar-search pull-right"> -->
|
27
|
+
<%= form_tag(search_clips_path, :method => 'get', :class => 'navbar-search pull-right') do %>
|
28
|
+
<%= text_field_tag(:search_term, "", :class=>"search-query", :placeholder=>"Search") %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
<%#
|
37
|
+
Do we want a header, if so this is how we do it. not sure if needed with fixed navbar
|
38
|
+
<header class="jumbotron">
|
39
|
+
<div class="container">
|
40
|
+
<h3>Clipster</h3>
|
41
|
+
<p class="lead">Code snippets before they were cool</p>
|
42
|
+
</div>
|
43
|
+
</header>
|
44
|
+
%>
|
45
|
+
<div class="flash">
|
46
|
+
<% if notice %>
|
47
|
+
<p class="notice"><%= notice %></p>
|
48
|
+
<% end %>
|
49
|
+
<% if alert %>
|
50
|
+
<p class="alert"><%= alert %></p>
|
51
|
+
<% end -%>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<div class="container">
|
55
|
+
<div class="row">
|
56
|
+
<div class="span12">
|
57
|
+
<%= yield %>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</body>
|
62
|
+
</html>
|
data/config/routes.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
-
Clipster::Engine.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
get '
|
9
|
-
get '
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
Clipster::Engine.routes.draw do
|
2
|
+
|
3
|
+
resources :users, :only => :show
|
4
|
+
#/clipster route
|
5
|
+
|
6
|
+
resources :clips, :path => "/" do
|
7
|
+
collection do
|
8
|
+
get 'list', :action => :list
|
9
|
+
get 'list(/:lang)(.:format)', :action => :list
|
10
|
+
get 'search', :action => :search
|
11
|
+
get 'about', :action => :about
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
root :to => :clips
|
16
|
+
end
|
data/config/schedule.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
# Use this file to easily define all of your cron jobs.
|
2
|
-
#
|
3
|
-
# It's helpful, but not entirely necessary to understand cron before proceeding.
|
4
|
-
# http://en.wikipedia.org/wiki/Cron
|
5
|
-
|
6
|
-
every :day, :at => '3:00 am' do
|
7
|
-
runner "Clip.delete_expired_clips"
|
8
|
-
end
|
9
|
-
|
10
|
-
# Learn more: http://github.com/javan/whenever
|
1
|
+
# Use this file to easily define all of your cron jobs.
|
2
|
+
#
|
3
|
+
# It's helpful, but not entirely necessary to understand cron before proceeding.
|
4
|
+
# http://en.wikipedia.org/wiki/Cron
|
5
|
+
|
6
|
+
every :day, :at => '3:00 am' do
|
7
|
+
runner "Clip.delete_expired_clips"
|
8
|
+
end
|
9
|
+
|
10
|
+
# Learn more: http://github.com/javan/whenever
|
@@ -1,16 +1,16 @@
|
|
1
|
-
class CreateClipsterClips < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
create_table :clipster_clips do |t|
|
4
|
-
t.string :hash, :null => false
|
5
|
-
t.text :clip, :null => false
|
6
|
-
t.string :language, :null => false
|
7
|
-
t.string :title, :null => false
|
8
|
-
t.boolean :private, :null => false
|
9
|
-
t.timestamps
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def down
|
14
|
-
drop_table :clipster_clips
|
15
|
-
end
|
16
|
-
end
|
1
|
+
class CreateClipsterClips < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :clipster_clips do |t|
|
4
|
+
t.string :hash, :null => false
|
5
|
+
t.text :clip, :null => false
|
6
|
+
t.string :language, :null => false
|
7
|
+
t.string :title, :null => false
|
8
|
+
t.boolean :private, :null => false
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table :clipster_clips
|
15
|
+
end
|
16
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
class AddHashIndexToClips < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
change_table :clipster_clips do |t|
|
4
|
-
t.index :hash, :unique => true
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def down
|
9
|
-
change_table :clipster_clips do |t|
|
10
|
-
t.remove_index :hash
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
1
|
+
class AddHashIndexToClips < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
change_table :clipster_clips do |t|
|
4
|
+
t.index :hash, :unique => true
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
change_table :clipster_clips do |t|
|
10
|
+
t.remove_index :hash
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
class PopulateClipDefaults < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
change_table :clipster_clips do |t|
|
4
|
-
t.change_default :hash, ''
|
5
|
-
t.change_default :clip, ''
|
6
|
-
t.change_default :title, ''
|
7
|
-
t.change_default :language, ''
|
8
|
-
t.change_default :private, false
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def down
|
13
|
-
change_table :clipster_clips do |t|
|
14
|
-
t.change_default :hash, nil
|
15
|
-
t.change_default :clip, nil
|
16
|
-
t.change_default :title, nil
|
17
|
-
t.change_default :language, nil
|
18
|
-
t.change_default :private, false
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
class PopulateClipDefaults < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
change_table :clipster_clips do |t|
|
4
|
+
t.change_default :hash, ''
|
5
|
+
t.change_default :clip, ''
|
6
|
+
t.change_default :title, ''
|
7
|
+
t.change_default :language, ''
|
8
|
+
t.change_default :private, false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
change_table :clipster_clips do |t|
|
14
|
+
t.change_default :hash, nil
|
15
|
+
t.change_default :clip, nil
|
16
|
+
t.change_default :title, nil
|
17
|
+
t.change_default :language, nil
|
18
|
+
t.change_default :private, false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class RenameHashToUrlHash < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
rename_column :clipster_clips, :hash, :url_hash
|
4
|
-
end
|
5
|
-
|
6
|
-
def down
|
7
|
-
rename_column :clipster_clips, :url_hash, :hash
|
8
|
-
end
|
9
|
-
end
|
1
|
+
class RenameHashToUrlHash < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
rename_column :clipster_clips, :hash, :url_hash
|
4
|
+
end
|
5
|
+
|
6
|
+
def down
|
7
|
+
rename_column :clipster_clips, :url_hash, :hash
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class RemoveDefaultFromLanguage < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
change_column_default :clipster_clips, :language, nil
|
4
|
-
end
|
5
|
-
|
6
|
-
def down
|
7
|
-
change_column_default :clipster_clips, :language, ''
|
8
|
-
end
|
9
|
-
end
|
1
|
+
class RemoveDefaultFromLanguage < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
change_column_default :clipster_clips, :language, nil
|
4
|
+
end
|
5
|
+
|
6
|
+
def down
|
7
|
+
change_column_default :clipster_clips, :language, ''
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class SetDefaultTitleToUntitled < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
change_column_default :clipster_clips, :title, 'Untitled'
|
4
|
-
end
|
5
|
-
|
6
|
-
def down
|
7
|
-
change_column_default :clipster_clips, :title, ''
|
8
|
-
end
|
9
|
-
end
|
1
|
+
class SetDefaultTitleToUntitled < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
change_column_default :clipster_clips, :title, 'Untitled'
|
4
|
+
end
|
5
|
+
|
6
|
+
def down
|
7
|
+
change_column_default :clipster_clips, :title, ''
|
8
|
+
end
|
9
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class AddLifespanToClips < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
add_column :clipster_clips, :expires, :datetime
|
4
|
-
end
|
5
|
-
|
6
|
-
def down
|
7
|
-
remove_column :clipster_clips, :expires
|
8
|
-
end
|
9
|
-
end
|
1
|
+
class AddLifespanToClips < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :clipster_clips, :expires, :datetime
|
4
|
+
end
|
5
|
+
|
6
|
+
def down
|
7
|
+
remove_column :clipster_clips, :expires
|
8
|
+
end
|
9
|
+
end
|