clipster 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. data/MIT-LICENSE +20 -20
  2. data/README.md +76 -72
  3. data/Rakefile +34 -34
  4. data/app/assets/javascripts/clipster/application.js +15 -15
  5. data/app/assets/javascripts/clipster/bootstrap.js +2026 -2026
  6. data/app/assets/javascripts/clipster/bootstrap.min.js +5 -5
  7. data/app/assets/javascripts/clipster/clip.js +2 -2
  8. data/app/assets/javascripts/clipster/clips.js +6 -6
  9. data/app/assets/javascripts/clipster/users.js +2 -2
  10. data/app/assets/stylesheets/clipster/application.css +27 -27
  11. data/app/assets/stylesheets/clipster/bootstrap.css +5774 -5774
  12. data/app/assets/stylesheets/clipster/clip.css +31 -31
  13. data/app/assets/stylesheets/clipster/clips.css +4 -4
  14. data/app/assets/stylesheets/clipster/users.css +4 -4
  15. data/app/controllers/clipster/application_controller.rb +14 -14
  16. data/app/controllers/clipster/clips_controller.rb +86 -86
  17. data/app/controllers/clipster/users_controller.rb +17 -17
  18. data/app/helpers/clipster/application_helper.rb +19 -19
  19. data/app/helpers/clipster/clip_helper.rb +4 -4
  20. data/app/helpers/clipster/clips_helper.rb +4 -4
  21. data/app/helpers/clipster/users_helper.rb +4 -4
  22. data/app/models/clipster/clip.rb +97 -99
  23. data/app/views/clipster/clips/about.html.erb +14 -14
  24. data/app/views/clipster/clips/create.html.erb +56 -56
  25. data/app/views/clipster/clips/list.atom.builder +21 -21
  26. data/app/views/clipster/clips/list.html.erb +60 -60
  27. data/app/views/clipster/clips/show.html.erb +8 -8
  28. data/app/views/clipster/users/index.html.erb +2 -2
  29. data/app/views/clipster/users/show.html.erb +45 -45
  30. data/app/views/kaminari/_first_page.html.erb +3 -3
  31. data/app/views/kaminari/_gap.html.erb +3 -3
  32. data/app/views/kaminari/_last_page.html.erb +3 -3
  33. data/app/views/kaminari/_next_page.html.erb +3 -3
  34. data/app/views/kaminari/_page.html.erb +3 -3
  35. data/app/views/kaminari/_paginator.html.erb +17 -17
  36. data/app/views/kaminari/_prev_page.html.erb +3 -3
  37. data/app/views/layouts/clipster/application.html.erb +62 -62
  38. data/config/initializers/clipster.rb +12 -0
  39. data/config/routes.rb +16 -16
  40. data/config/schedule.rb +10 -10
  41. data/db/migrate/20121126185058_create_clipster_clips.rb +18 -0
  42. data/lib/clipster.rb +5 -5
  43. data/lib/clipster/configuration.rb +22 -22
  44. data/lib/clipster/engine.rb +23 -23
  45. data/lib/clipster/version.rb +3 -3
  46. data/lib/generators/clipster/install_generator.rb +19 -19
  47. data/lib/generators/templates/clipster.rb +12 -12
  48. data/lib/tasks/clipster_tasks.rake +4 -4
  49. metadata +5 -11
  50. data/db/migrate/20121004010757_create_clipster_clips.rb +0 -16
  51. data/db/migrate/20121007154400_add_hash_index_to_clips.rb +0 -13
  52. data/db/migrate/20121007155125_populate_clip_defaults.rb +0 -21
  53. data/db/migrate/20121007162741_rename_hash_to_url_hash.rb +0 -9
  54. data/db/migrate/20121007223358_remove_default_from_language.rb +0 -9
  55. data/db/migrate/20121007223631_set_default_title_to_untitled.rb +0 -9
  56. data/db/migrate/20121105212724_add_lifespan_to_clips.rb +0 -9
  57. data/db/migrate/20121114175749_add_user_id_to_clips.rb +0 -9
@@ -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,62 +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
- <%=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>
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>
@@ -0,0 +1,12 @@
1
+ Clipster.config do |config|
2
+ # Specify the user class as a string
3
+ # This is set to User by default
4
+ #config.user_class = "User"
5
+
6
+ # If you would like to turn on User associations uncomment the following line
7
+ # This will save the user id with clips to allow for user analytics
8
+ #config.associates_clip_with_user = true
9
+
10
+ # Change this line to the attribute you would like to be displayed for the User model
11
+ #config.user_display_attribute = "email"
12
+ end
data/config/routes.rb CHANGED
@@ -1,16 +1,16 @@
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
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
@@ -0,0 +1,18 @@
1
+ class CreateClipsterClips < ActiveRecord::Migration
2
+ def up
3
+ create_table :clipster_clips, :id => false, :primary_key => :id do |t|
4
+ t.string :id, :null => false, :unique => true
5
+ t.text :clip, :null => false
6
+ t.string :language, :null => false, :default => 'text'
7
+ t.string :title, :null => false, :default => 'Untitled'
8
+ t.boolean :private, :null => false, :default => false
9
+ t.integer :user_id
10
+ t.datetime :expires
11
+ t.timestamps
12
+ end
13
+ end
14
+
15
+ def down
16
+ drop_table :clipster_clips
17
+ end
18
+ end
data/lib/clipster.rb CHANGED
@@ -1,5 +1,5 @@
1
- require "clipster/engine"
2
- require "clipster/configuration"
3
- module Clipster
4
-
5
- end
1
+ require "clipster/engine"
2
+ require "clipster/configuration"
3
+ module Clipster
4
+
5
+ end
@@ -1,23 +1,23 @@
1
- module Clipster
2
- class Configuration
3
- attr_accessor :user_class
4
- attr_accessor :associates_clip_with_user
5
- attr_accessor :user_display_attribute
6
-
7
- def associates_clip_with_user
8
- @associates_clip_with_user || false
9
- end
10
-
11
- def user_class
12
- @user_class.constantize || "User".constantize
13
- end
14
-
15
- def user_class=(user_class)
16
- @user_class = user_class
17
- end
18
-
19
- def user_display_attribute
20
- @user_display_attribute || "email"
21
- end
22
- end
1
+ module Clipster
2
+ class Configuration
3
+ attr_accessor :user_class
4
+ attr_accessor :associates_clip_with_user
5
+ attr_accessor :user_display_attribute
6
+
7
+ def associates_clip_with_user
8
+ @associates_clip_with_user || false
9
+ end
10
+
11
+ def user_class
12
+ @user_class.constantize || "User".constantize
13
+ end
14
+
15
+ def user_class=(user_class)
16
+ @user_class = user_class
17
+ end
18
+
19
+ def user_display_attribute
20
+ @user_display_attribute || "email"
21
+ end
22
+ end
23
23
  end
@@ -1,23 +1,23 @@
1
- require 'coderay'
2
- require 'dynamic_form'
3
- require 'kaminari'
4
-
5
- module Clipster
6
- class Engine < ::Rails::Engine
7
- isolate_namespace Clipster
8
-
9
- # so we can use rspec generators
10
- config.generators do |g|
11
- g.test_framework :rspec
12
- g.integration_tool :rspec
13
- end
14
- end
15
-
16
- def self.config (&block)
17
- @@config ||= Clipster::Configuration.new
18
-
19
- yield @@config if block
20
-
21
- return @@config
22
- end
23
- end
1
+ require 'coderay'
2
+ require 'dynamic_form'
3
+ require 'kaminari'
4
+
5
+ module Clipster
6
+ class Engine < ::Rails::Engine
7
+ isolate_namespace Clipster
8
+
9
+ # so we can use rspec generators
10
+ config.generators do |g|
11
+ g.test_framework :rspec
12
+ g.integration_tool :rspec
13
+ end
14
+ end
15
+
16
+ def self.config (&block)
17
+ @@config ||= Clipster::Configuration.new
18
+
19
+ yield @@config if block
20
+
21
+ return @@config
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
- module Clipster
2
- VERSION = "0.4.0"
3
- end
1
+ module Clipster
2
+ VERSION = "0.4.1"
3
+ end
@@ -1,19 +1,19 @@
1
- #!/usr/bin/env rake
2
- module Clipster
3
- module Generators
4
- class InstallGenerator < Rails::Generators::Base
5
- source_root File.expand_path("../../templates", __FILE__)
6
-
7
- desc "Creates a Clipster initializer and copies it to your application"
8
-
9
- def copy_initializer
10
- template "clipster.rb", "config/initializers/clipster.rb"
11
- end
12
-
13
- def copy_migrations
14
- rake("clipster:install:migrations")
15
- end
16
-
17
- end
18
- end
19
- end
1
+ #!/usr/bin/env rake
2
+ module Clipster
3
+ module Generators
4
+ class InstallGenerator < Rails::Generators::Base
5
+ source_root File.expand_path("../../templates", __FILE__)
6
+
7
+ desc "Creates a Clipster initializer and copies it to your application"
8
+
9
+ def copy_initializer
10
+ template "clipster.rb", "config/initializers/clipster.rb"
11
+ end
12
+
13
+ def copy_migrations
14
+ rake("clipster:install:migrations")
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -1,12 +1,12 @@
1
- Clipster.config do |config|
2
- # Specify the user class as a string
3
- # This is set to User by default
4
- #config.user_class = "User"
5
-
6
- # If you would like to turn on User associations uncomment the following line
7
- # This will save the user id with clips to allow for user analytics
8
- #config.associates_clip_with_user = true
9
-
10
- # Change this line to the attribute you would like to be displayed for the User model
11
- #config.user_display_attribute = "email"
12
- end
1
+ Clipster.config do |config|
2
+ # Specify the user class as a string
3
+ # This is set to User by default
4
+ #config.user_class = "User"
5
+
6
+ # If you would like to turn on User associations uncomment the following line
7
+ # This will save the user id with clips to allow for user analytics
8
+ #config.associates_clip_with_user = true
9
+
10
+ # Change this line to the attribute you would like to be displayed for the User model
11
+ #config.user_display_attribute = "email"
12
+ end