postablr 0.0.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 (82) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +22 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/javascripts/postablr/application.js +15 -0
  5. data/app/assets/javascripts/postablr/blog.js +2 -0
  6. data/app/assets/javascripts/postablr/entries.js +2 -0
  7. data/app/assets/stylesheets/postablr/application.css +13 -0
  8. data/app/assets/stylesheets/postablr/blog.css +4 -0
  9. data/app/assets/stylesheets/postablr/entries.css +4 -0
  10. data/app/controllers/postablr/application_controller.rb +4 -0
  11. data/app/controllers/postablr/blog_controller.rb +21 -0
  12. data/app/controllers/postablr/entries_controller.rb +43 -0
  13. data/app/helpers/postablr/application_helper.rb +4 -0
  14. data/app/helpers/postablr/blog_helper.rb +27 -0
  15. data/app/helpers/postablr/entries_helper.rb +4 -0
  16. data/app/helpers/postablr/truncate_html_helper.rb +52 -0
  17. data/app/models/postablr/ar_publish.rb +172 -0
  18. data/app/models/postablr/entry.rb +37 -0
  19. data/app/models/postablr/entry/audio.rb +23 -0
  20. data/app/models/postablr/entry/image.rb +17 -0
  21. data/app/models/postablr/entry/link.rb +8 -0
  22. data/app/models/postablr/entry/post.rb +8 -0
  23. data/app/models/postablr/entry/quote.rb +7 -0
  24. data/app/models/postablr/entry/video.rb +29 -0
  25. data/app/uploaders/entry_audio_uploader.rb +55 -0
  26. data/app/uploaders/entry_photo_uploader.rb +42 -0
  27. data/app/views/layouts/postablr/application.html.erb +14 -0
  28. data/app/views/postablr/blog/_entry_display.haml +3 -0
  29. data/app/views/postablr/blog/comments/_comment.haml +10 -0
  30. data/app/views/postablr/blog/comments/_form.haml +6 -0
  31. data/app/views/postablr/blog/comments/create.js.haml +5 -0
  32. data/app/views/postablr/blog/comments/new.html.haml +0 -0
  33. data/app/views/postablr/blog/comments/new.js.haml +2 -0
  34. data/app/views/postablr/blog/entries/show.haml +39 -0
  35. data/app/views/postablr/blog/show.html.haml +46 -0
  36. data/app/views/postablr/blog/show/_aside.haml +19 -0
  37. data/app/views/postablr/blog/show/_audio.haml +13 -0
  38. data/app/views/postablr/blog/show/_image.haml +13 -0
  39. data/app/views/postablr/blog/show/_link.haml +11 -0
  40. data/app/views/postablr/blog/show/_post.haml +14 -0
  41. data/app/views/postablr/blog/show/_quote.haml +12 -0
  42. data/app/views/postablr/blog/show/_video.haml +16 -0
  43. data/app/views/postablr/entries/_entries_menu.haml +14 -0
  44. data/app/views/postablr/entries/_entry.haml +4 -0
  45. data/app/views/postablr/entries/_form.haml +58 -0
  46. data/app/views/postablr/entries/edit.haml +1 -0
  47. data/app/views/postablr/entries/fields/_audio.haml +4 -0
  48. data/app/views/postablr/entries/fields/_image.haml +2 -0
  49. data/app/views/postablr/entries/fields/_link.haml +3 -0
  50. data/app/views/postablr/entries/fields/_post.haml +3 -0
  51. data/app/views/postablr/entries/fields/_quote.haml +3 -0
  52. data/app/views/postablr/entries/fields/_video.haml +2 -0
  53. data/app/views/postablr/entries/index.html.haml +11 -0
  54. data/app/views/postablr/entries/index.js.haml +2 -0
  55. data/app/views/postablr/entries/list/_audio.haml +14 -0
  56. data/app/views/postablr/entries/list/_image.haml +12 -0
  57. data/app/views/postablr/entries/list/_link.haml +11 -0
  58. data/app/views/postablr/entries/list/_post.haml +14 -0
  59. data/app/views/postablr/entries/list/_quote.haml +11 -0
  60. data/app/views/postablr/entries/list/_video.haml +17 -0
  61. data/app/views/postablr/entries/new.html.haml +2 -0
  62. data/app/views/postablr/entries/show.html.haml +5 -0
  63. data/config/routes.rb +20 -0
  64. data/db/migrate/20121222195404_create_postablr_entries.rb +18 -0
  65. data/db/migrate/20121222195417_create_postablr_entry_videos.rb +16 -0
  66. data/db/migrate/20121222200141_create_postablr_entry_quotes.rb +10 -0
  67. data/db/migrate/20121222200237_create_postablr_entry_posts.rb +10 -0
  68. data/db/migrate/20121222200303_create_postablr_entry_links.rb +10 -0
  69. data/db/migrate/20121222200402_create_postablr_entry_images.rb +12 -0
  70. data/db/migrate/20121222200810_create_postablr_entry_audios.rb +12 -0
  71. data/lib/postablr.rb +4 -0
  72. data/lib/postablr/engine.rb +11 -0
  73. data/lib/postablr/version.rb +3 -0
  74. data/lib/tasks/postablr_tasks.rake +4 -0
  75. data/test/factories/postablr_entries.rb +16 -0
  76. data/test/factories/postablr_entry_audios.rb +9 -0
  77. data/test/factories/postablr_entry_images.rb +10 -0
  78. data/test/factories/postablr_entry_links.rb +8 -0
  79. data/test/factories/postablr_entry_posts.rb +9 -0
  80. data/test/factories/postablr_entry_quotes.rb +8 -0
  81. data/test/factories/postablr_entry_videos.rb +14 -0
  82. metadata +358 -0
@@ -0,0 +1,12 @@
1
+ %li.article.quote
2
+ %blockquote.article_quote
3
+ = raw sanitize_relaxed( postable.body)
4
+ .article_meta
5
+ %h3
6
+ %a{:href => "#"}= raw postable.source
7
+ %span.meta.author
8
+ Por
9
+ = postable.entry.user.name
10
+
11
+
12
+ = render :partial=>'postablr/blog/show/aside', :locals=>{:postable=>postable}
@@ -0,0 +1,16 @@
1
+ .article.video
2
+
3
+ .article_meta
4
+ %span.meta.kind Video
5
+ %h3
6
+ = postable.title
7
+
8
+ .article_video
9
+ = raw postable.embed_html
10
+
11
+ %p= raw sanitize_relaxed( postable.body )
12
+
13
+ %span.meta.author
14
+ = postable.entry.user.name
15
+
16
+ = render :partial=>'postablr/blog/show/aside', :locals=>{:postable=>postable}
@@ -0,0 +1,14 @@
1
+
2
+ %ul
3
+ %li
4
+ = link_to "Publish Text", new_entries_for_path("post")
5
+ %li
6
+ = link_to "Publish Quote", new_entries_for_path("quote")
7
+ %li
8
+ = link_to "Publish Image", new_entries_for_path("image")
9
+ %li
10
+ = link_to "Publish Audio", new_entries_for_path("audio")
11
+ %li
12
+ = link_to "Publish Video", new_entries_for_path("video")
13
+ %li
14
+ = link_to "Publish Link", new_entries_for_path("link")
@@ -0,0 +1,4 @@
1
+ = render "postablr/entries/entries_menu"
2
+
3
+ - cache("UserEntries-#{entry.id}-#{entry.updated_at}") do
4
+ = render "postablr/entries/list/#{entry.postable_name}", :postable => entry.postable
@@ -0,0 +1,58 @@
1
+
2
+ - path = @entry.new_record? ? new_fast_upload_path : edit_fast_upload_path
3
+
4
+ - tag_list = ActsAsTaggableOn::Tag.all.map(&:name)
5
+ %iframe{:id=>"upload_frame", :name=>"upload_frame", :style=>"display: none"}
6
+
7
+ = semantic_form_for @entry , :url=> path, :html=>{:multipart=>true, :path=>new_fast_upload_path} do |f|
8
+ .col_system.col.fluid
9
+ .col.medium.publisher
10
+
11
+ - unless @entry.new_record?
12
+ %input{:name=>:post_id, :type=>:hidden, :value=>@entry.id}
13
+ - else
14
+ %input{:name=>:type, :type=>:hidden, :value=>params[:type]}
15
+
16
+ = f.inputs do
17
+ = f.semantic_fields_for :postable do |postable|
18
+
19
+ %h3 Publicar → #{postable.object.class.to_s.underscore.split('/')[1]}
20
+ = render "postablr/entries/fields/#{@entry.postable_name}", :f => postable
21
+
22
+ %li#facebook-list.input-text
23
+ %input#tag_list_input{:type => "text", :value => "", :placeholder => "Etiquetas"}/
24
+ %ul#preadded{:style => "display:none"}
25
+ - @entry.tags.each do |tag|
26
+ %li{:rel=> "#{tag.id}"}= tag.name
27
+
28
+ #autosuggest
29
+ .default Escribe las etiquetas
30
+ %ul#feed
31
+
32
+ = f.actions do
33
+ = f.action :submit, :button_html => { :disable_with => 'Wait...' }
34
+ .uploader_div
35
+ #uploading{ :style => "display:none" }
36
+ #progress.bar
37
+ #progressbar
38
+ #statusBar
39
+ .plane
40
+ #load_photos{ :style => "display:none" }
41
+
42
+ .col.small.publisher_options
43
+ = f.inputs do
44
+ .form_block.options
45
+ %h4
46
+ %span.icons.mini.circle.magenta ⚙
47
+ Opciones
48
+ = f.input :comments_enabled
49
+ -#= f.input :highlight
50
+
51
+ -#= f.input :slug
52
+ -#= f.input :content_source
53
+ -#= f.input :is_published
54
+ -#= f.input :publish_at
55
+ -#= f.input :unpublish_at
56
+
57
+ -#= f.input :tag_list #, :as=>:hidden
58
+
@@ -0,0 +1 @@
1
+ = render "form"
@@ -0,0 +1,4 @@
1
+ = f.input :file, :as=>:file
2
+ = f.input :title
3
+ = f.input :body
4
+
@@ -0,0 +1,2 @@
1
+ = f.input :photo, :as=>:file
2
+ = f.input :body
@@ -0,0 +1,3 @@
1
+ = f.input :title
2
+ = f.input :url
3
+
@@ -0,0 +1,3 @@
1
+ = f.input :title, :label => false, :placeholder => "Título"
2
+ = f.input :body
3
+
@@ -0,0 +1,3 @@
1
+ = f.input :body
2
+ = f.input :source, :placeholder => 'Fuente'
3
+ = f.input :fake_file , :as=>:file, :wrapper_html=>{:style=>"display:none"}
@@ -0,0 +1,2 @@
1
+ = f.input :url, :placeholder => "Video Url"
2
+ = f.input :title, :label => false, :placeholder => "Título"
@@ -0,0 +1,11 @@
1
+ = render "entries_menu"
2
+
3
+ %h1= t("MyEntries")
4
+
5
+ %section.publications
6
+ %ul.publication_stream
7
+ = render :partial=>"entry", :collection => @entries
8
+
9
+ %nav.pagination.publication_paginator
10
+ -#= paginate @entries, :remote => true
11
+
@@ -0,0 +1,2 @@
1
+
2
+ $(".publication_paginator").html( "#{escape_javascript( paginate( @entries, :remote => true ) )}" )
@@ -0,0 +1,14 @@
1
+ %li.article.video{:id=>"entry-#{postable.entry.id}"}
2
+ %span.editor
3
+
4
+ .article_meta
5
+ %span.meta.kind Audio
6
+ %span.meta.author
7
+ Por
8
+ = postable.entry.user.name
9
+
10
+ %ul.playlist
11
+ %li
12
+ %a{ :href=>"#{postable.file.url}"}= postable.audio_title
13
+ .article_text
14
+ %p= raw sanitize_clean(postable.body , 200 , " #{link_to t('read_more'), blog_entry_path( postable.entry ) } ..." )
@@ -0,0 +1,12 @@
1
+ %li.article.photo{:id=>"entry-#{postable.entry.id}" }
2
+ %span.editor
3
+
4
+ = link_to image_tag(postable.photo.url(:thumb_large)), entry_path(postable.entry)
5
+ .article_meta
6
+ %span.meta.kind Image
7
+ %span.meta.author
8
+ Por
9
+ = postable.entry.user.name
10
+
11
+ .article_text
12
+ %p= raw sanitize_clean(postable.body , 200 , " #{link_to t('read_more'), ''}" )
@@ -0,0 +1,11 @@
1
+ %li.article.link{:id=>"entry-#{postable.entry.id}"}
2
+ %span.editor
3
+
4
+ .article_meta
5
+ %span.meta.kind Enlace
6
+ %h3
7
+ %a{:href => "#{postable.url}"}="#{postable.title} →"
8
+ %span.meta.author
9
+ Por
10
+ = postable.entry.user.name
11
+
@@ -0,0 +1,14 @@
1
+ %li.article.text{:id=>"entry-#{postable.entry.id}"}
2
+ %span.editor
3
+
4
+ .article_meta
5
+ %span.meta.kind Post
6
+ %h3
7
+ %a{:href => blog_entry_path(postable.entry)}= postable.title
8
+ %span.meta.author
9
+ Por
10
+ = postable.entry.user.name
11
+
12
+
13
+ .article_text
14
+ %p= raw sanitize_clean(postable.body , 200 , " #{link_to t('read_more'), blog_entry_path( postable.entry ) } ..." )
@@ -0,0 +1,11 @@
1
+ %li.article.quote{:id=>"entry-#{postable.entry.id}"}
2
+ %span.editor
3
+
4
+ %blockquote.article_quote
5
+ = raw postable.body
6
+ .article_meta
7
+ %h3
8
+ =link_to raw( postable.source), entry_path(postable.entry)
9
+ %span.meta.author
10
+ Por
11
+ = postable.entry.user.name
@@ -0,0 +1,17 @@
1
+ %li.article.video{:id=>"entry-#{postable.entry.id}"}
2
+ %span.editor
3
+
4
+ .article_video
5
+ = raw postable.embed_html
6
+
7
+ .article_meta
8
+ %span.meta.kind Video
9
+ %h3
10
+ = postable.title
11
+ %span.meta.author
12
+ Por
13
+ = postable.entry.user.name
14
+
15
+ .article_text
16
+ %p
17
+ -#= raw sanitize_clean(postable.body , 200 , " #{link_to t('read_more'), blog_entry_path( postable.entry ) } ..." )
@@ -0,0 +1,2 @@
1
+ = render "entries_menu"
2
+ = render "form"
@@ -0,0 +1,5 @@
1
+ = render "postablr/entries/entries_menu"
2
+
3
+ %section.publications
4
+ %ul.publication_stream.wide
5
+ = render "postablr/entries/list/#{@entry.postable_name}", :postable => @entry.postable
@@ -0,0 +1,20 @@
1
+ Postablr::Engine.routes.draw do
2
+
3
+ resources :entries
4
+
5
+ match 'entries/new/:type' => 'entries#new', :as=>:new_entries_for, :via => [:get]
6
+ match 'entries/new/:type' => 'entries#create', :as=>:new_entries_for, :via => [:post]
7
+ match 'entries/:type/:id/edit' => 'entries#edit', :as=>:edit_entry_for, :via => [:get]
8
+ match 'entries/fast_upload' => 'entries#create', :as => :new_fast_upload, :via=>[:post]
9
+ match 'entries/fast_upload' => 'entries#update', :as => :edit_fast_upload, :via=>[:put]
10
+ match 'blog/:filter' => 'blog#filter', :as=>:filter_blog, :via => [:get]
11
+
12
+ resource :blog, :controller=>"blog" do
13
+ #resources :entries, :controller=> "blog/entries" do
14
+ #resources :comments, :controller => "blog/comments"
15
+ #end
16
+ #resources :tags, :controller=>"blog/tags"
17
+ #resources :authors
18
+ end
19
+
20
+ end
@@ -0,0 +1,18 @@
1
+ class CreatePostablrEntries < ActiveRecord::Migration
2
+ def change
3
+ create_table :postablr_entries do |t|
4
+ t.integer :user_id
5
+ t.integer :postable_id
6
+ t.string :postable_type
7
+ t.boolean :comments_enabled
8
+ t.boolean :highlight
9
+ t.string :slug
10
+ t.string :content_source
11
+ t.boolean :is_published
12
+ t.datetime :publish_at
13
+ t.datetime :unpublish_at
14
+
15
+ t.timestamps
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ class CreatePostablrEntryVideos < ActiveRecord::Migration
2
+ def change
3
+ create_table :postablr_entry_videos do |t|
4
+ t.string :title
5
+ t.string :thumbnail
6
+ t.string :embed_url
7
+ t.text :embed_html
8
+ t.string :flv
9
+ t.string :download_url
10
+ t.string :service
11
+ t.integer :duration
12
+ t.text :caption
13
+ t.timestamps
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ class CreatePostablrEntryQuotes < ActiveRecord::Migration
2
+ def change
3
+ create_table :postablr_entry_quotes do |t|
4
+ t.text :body
5
+ t.string :source
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreatePostablrEntryPosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :postablr_entry_posts do |t|
4
+ t.string :title
5
+ t.text :body
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreatePostablrEntryLinks < ActiveRecord::Migration
2
+ def change
3
+ create_table :postablr_entry_links do |t|
4
+ t.string :title
5
+ t.string :url
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ class CreatePostablrEntryImages < ActiveRecord::Migration
2
+ def change
3
+ create_table :postablr_entry_images do |t|
4
+ t.string :photo
5
+ t.text :body
6
+ t.string :photo_content_type
7
+ t.string :photo_size
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ class CreatePostablrEntryAudios < ActiveRecord::Migration
2
+ def change
3
+ create_table :postablr_entry_audios do |t|
4
+ t.string :file
5
+ t.string :file_size
6
+ t.string :file_content_type
7
+ t.text :body
8
+ t.string :title
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ require "postablr/engine"
2
+
3
+ module Postablr
4
+ end
@@ -0,0 +1,11 @@
1
+ module Postablr
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Postablr
4
+ config.generators do |g|
5
+ g.test_framework :rspec,
6
+ :fixture_replacement => :factory_girl ,
7
+ :dir => "spec/factories"
8
+ g.integration_tool :rspec
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module Postablr
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :postablr do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,16 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :postablr_entry, :class => 'Entry' do
5
+ user_id 1
6
+ postable_id 1
7
+ postable_type "MyString"
8
+ comments_enabled false
9
+ highlight false
10
+ slug "MyString"
11
+ content_source "MyString"
12
+ is_published false
13
+ publish_at "2012-12-22 16:54:05"
14
+ unpublish_at "2012-12-22 16:54:05"
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :postablr_entry_audio, :class => 'Entry::Audio' do
5
+ file "MyString"
6
+ file_size "MyString"
7
+ file_content_type "MyString"
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :postablr_entry_image, :class => 'Entry::Image' do
5
+ photo "MyString"
6
+ body "MyText"
7
+ photo_content_type "MyString"
8
+ photo_size "MyString"
9
+ end
10
+ end