kublog 0.0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +8 -0
  3. data/Gemfile.lock +177 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.rdoc +102 -0
  6. data/Rakefile +39 -0
  7. data/app/assets/images/kublog/.gitkeep +0 -0
  8. data/app/assets/images/kublog/missing_image.png +0 -0
  9. data/app/assets/javascripts/kublog/application.js +13 -0
  10. data/app/assets/javascripts/kublog/categories.js.coffee +48 -0
  11. data/app/assets/javascripts/kublog/comments.js.coffee +30 -0
  12. data/app/assets/javascripts/kublog/email.js.coffee +32 -0
  13. data/app/assets/javascripts/kublog/images.js.coffee +77 -0
  14. data/app/assets/javascripts/kublog/posts.js.coffee +44 -0
  15. data/app/assets/javascripts/kublog/shared.js.coffee.erb +19 -0
  16. data/app/assets/javascripts/kublog/wysiwyg.controls.js.coffee +68 -0
  17. data/app/assets/plugins/kublog/ajaxyupload/images/ajax-loader.gif +0 -0
  18. data/app/assets/plugins/kublog/ajaxyupload/javascripts/jquery.ajaxyupload.js +126 -0
  19. data/app/assets/plugins/kublog/fancybox/images/blank.gif +0 -0
  20. data/app/assets/plugins/kublog/fancybox/images/fancy_close.png +0 -0
  21. data/app/assets/plugins/kublog/fancybox/images/fancy_loading.png +0 -0
  22. data/app/assets/plugins/kublog/fancybox/images/fancy_nav_left.png +0 -0
  23. data/app/assets/plugins/kublog/fancybox/images/fancy_nav_right.png +0 -0
  24. data/app/assets/plugins/kublog/fancybox/images/fancy_shadow_e.png +0 -0
  25. data/app/assets/plugins/kublog/fancybox/images/fancy_shadow_n.png +0 -0
  26. data/app/assets/plugins/kublog/fancybox/images/fancy_shadow_ne.png +0 -0
  27. data/app/assets/plugins/kublog/fancybox/images/fancy_shadow_nw.png +0 -0
  28. data/app/assets/plugins/kublog/fancybox/images/fancy_shadow_s.png +0 -0
  29. data/app/assets/plugins/kublog/fancybox/images/fancy_shadow_se.png +0 -0
  30. data/app/assets/plugins/kublog/fancybox/images/fancy_shadow_sw.png +0 -0
  31. data/app/assets/plugins/kublog/fancybox/images/fancy_shadow_w.png +0 -0
  32. data/app/assets/plugins/kublog/fancybox/images/fancy_title_left.png +0 -0
  33. data/app/assets/plugins/kublog/fancybox/images/fancy_title_main.png +0 -0
  34. data/app/assets/plugins/kublog/fancybox/images/fancy_title_over.png +0 -0
  35. data/app/assets/plugins/kublog/fancybox/images/fancy_title_right.png +0 -0
  36. data/app/assets/plugins/kublog/fancybox/images/fancybox-x.png +0 -0
  37. data/app/assets/plugins/kublog/fancybox/images/fancybox-y.png +0 -0
  38. data/app/assets/plugins/kublog/fancybox/images/fancybox.png +0 -0
  39. data/app/assets/plugins/kublog/fancybox/javascripts/fancybox-1.3.4.js +46 -0
  40. data/app/assets/plugins/kublog/fancybox/stylesheets/fancybox-1.3.4.css +359 -0
  41. data/app/assets/plugins/kublog/livequery/javascripts/jquery.livequery.js +250 -0
  42. data/app/assets/plugins/kublog/wysiwyg/images/ajax-loader.gif +0 -0
  43. data/app/assets/plugins/kublog/wysiwyg/images/jquery.wysiwyg.bg.png +0 -0
  44. data/app/assets/plugins/kublog/wysiwyg/images/jquery.wysiwyg.gif +0 -0
  45. data/app/assets/plugins/kublog/wysiwyg/images/jquery.wysiwyg.jpg +0 -0
  46. data/app/assets/plugins/kublog/wysiwyg/images/jquery.wysiwyg.no-alpha.gif +0 -0
  47. data/app/assets/plugins/kublog/wysiwyg/javascripts/jquery.wysiwyg.js +2377 -0
  48. data/app/assets/plugins/kublog/wysiwyg/javascripts/wysiwyg.image.js +284 -0
  49. data/app/assets/plugins/kublog/wysiwyg/javascripts/wysiwyg.link.js +249 -0
  50. data/app/assets/plugins/kublog/wysiwyg/stylesheets/jquery.wysiwyg.css +94 -0
  51. data/app/assets/stylesheets/kublog/application.css +9 -0
  52. data/app/assets/stylesheets/kublog/categories.css +4 -0
  53. data/app/assets/stylesheets/kublog/comments.css +4 -0
  54. data/app/assets/stylesheets/kublog/email.css +7 -0
  55. data/app/assets/stylesheets/kublog/images.css +41 -0
  56. data/app/assets/stylesheets/kublog/posts.css +39 -0
  57. data/app/controllers/kublog/application_controller.rb +12 -0
  58. data/app/controllers/kublog/categories_controller.rb +47 -0
  59. data/app/controllers/kublog/comments_controller.rb +37 -0
  60. data/app/controllers/kublog/images_controller.rb +44 -0
  61. data/app/controllers/kublog/posts_controller.rb +66 -0
  62. data/app/helpers/kublog/application_helper.rb +4 -0
  63. data/app/helpers/kublog/posts_helper.rb +38 -0
  64. data/app/mailers/kublog/post_mailer.rb +11 -0
  65. data/app/models/kublog/category.rb +26 -0
  66. data/app/models/kublog/comment.rb +46 -0
  67. data/app/models/kublog/image.rb +23 -0
  68. data/app/models/kublog/post.rb +51 -0
  69. data/app/presenters/kublog/post_presenter.rb +23 -0
  70. data/app/presenters/kublog/posts_presenter.rb +29 -0
  71. data/app/uploaders/kublog/file_uploader.rb +56 -0
  72. data/app/views/kublog/post_mailer/new_post.html.erb +1 -0
  73. data/app/views/kublog/post_mailer/new_post.liquid.html.erb +7 -0
  74. data/app/views/kublog/posts/_email_form.html.erb +13 -0
  75. data/app/views/kublog/posts/_form.html.erb +71 -0
  76. data/app/views/kublog/posts/_image_form.html.erb +26 -0
  77. data/app/views/kublog/posts/edit.html.erb +3 -0
  78. data/app/views/kublog/posts/index.atom.builder +15 -0
  79. data/app/views/kublog/posts/index.html.erb +36 -0
  80. data/app/views/kublog/posts/new.html.erb +3 -0
  81. data/app/views/kublog/posts/show.html.erb +46 -0
  82. data/app/views/layouts/kublog/application.html.erb +14 -0
  83. data/config/locales/kublog/en.yml +54 -0
  84. data/config/routes.rb +13 -0
  85. data/db/migrate/20110816211552_create_kublog_posts.rb +27 -0
  86. data/db/migrate/20110817215828_create_kublog_images.rb +11 -0
  87. data/db/migrate/20110818181434_create_kublog_categories.rb +11 -0
  88. data/db/migrate/20110822194341_create_kublog_comments.rb +14 -0
  89. data/kublog.gemspec +39 -0
  90. data/lib/kublog.rb +92 -0
  91. data/lib/kublog/author.rb +13 -0
  92. data/lib/kublog/engine.rb +5 -0
  93. data/lib/kublog/notifiable.rb +26 -0
  94. data/lib/kublog/notification/email.rb +86 -0
  95. data/lib/kublog/notification/email_job.rb +14 -0
  96. data/lib/kublog/notification/fb_post.rb +43 -0
  97. data/lib/kublog/notification/fb_post_job.rb +16 -0
  98. data/lib/kublog/notification/tweet.rb +68 -0
  99. data/lib/kublog/notification/tweet_job.rb +16 -0
  100. data/lib/kublog/user_integration/common.rb +31 -0
  101. data/lib/kublog/user_integration/devise.rb +23 -0
  102. data/lib/kublog/version.rb +3 -0
  103. data/lib/kublog/xhr_upload/file_helper.rb +36 -0
  104. data/lib/tasks/kublog_tasks.rake +4 -0
  105. data/script/rails +6 -0
  106. data/test/dummy/Rakefile +7 -0
  107. data/test/dummy/app/assets/javascripts/application.js +9 -0
  108. data/test/dummy/app/assets/javascripts/sessions.js +2 -0
  109. data/test/dummy/app/assets/javascripts/users.js +2 -0
  110. data/test/dummy/app/assets/stylesheets/application.css +157 -0
  111. data/test/dummy/app/assets/stylesheets/sessions.css +4 -0
  112. data/test/dummy/app/assets/stylesheets/users.css +4 -0
  113. data/test/dummy/app/controllers/application_controller.rb +19 -0
  114. data/test/dummy/app/controllers/sessions_controller.rb +22 -0
  115. data/test/dummy/app/controllers/users_controller.rb +17 -0
  116. data/test/dummy/app/helpers/application_helper.rb +2 -0
  117. data/test/dummy/app/helpers/error_messages_helper.rb +23 -0
  118. data/test/dummy/app/helpers/layout_helper.rb +22 -0
  119. data/test/dummy/app/helpers/sessions_helper.rb +2 -0
  120. data/test/dummy/app/helpers/users_helper.rb +2 -0
  121. data/test/dummy/app/mailers/.gitkeep +0 -0
  122. data/test/dummy/app/models/.gitkeep +0 -0
  123. data/test/dummy/app/models/ability.rb +2 -0
  124. data/test/dummy/app/models/user.rb +25 -0
  125. data/test/dummy/app/views/layouts/_account.html.erb +8 -0
  126. data/test/dummy/app/views/layouts/application.html.erb +29 -0
  127. data/test/dummy/app/views/layouts/kublog/application.html.erb +31 -0
  128. data/test/dummy/app/views/sessions/new.html.erb +15 -0
  129. data/test/dummy/app/views/users/new.html.erb +28 -0
  130. data/test/dummy/config.ru +4 -0
  131. data/test/dummy/config/application.rb +42 -0
  132. data/test/dummy/config/boot.rb +10 -0
  133. data/test/dummy/config/database.yml +25 -0
  134. data/test/dummy/config/environment.rb +5 -0
  135. data/test/dummy/config/environments/development.rb +38 -0
  136. data/test/dummy/config/environments/production.rb +51 -0
  137. data/test/dummy/config/environments/test.rb +39 -0
  138. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  139. data/test/dummy/config/initializers/inflections.rb +10 -0
  140. data/test/dummy/config/initializers/mime_types.rb +5 -0
  141. data/test/dummy/config/initializers/secret_token.rb +7 -0
  142. data/test/dummy/config/initializers/session_store.rb +8 -0
  143. data/test/dummy/config/initializers/wrap_parameters.rb +12 -0
  144. data/test/dummy/config/locales/en.yml +54 -0
  145. data/test/dummy/config/routes.rb +13 -0
  146. data/test/dummy/db/migrate/20110816225222_create_users.rb +11 -0
  147. data/test/dummy/db/migrate/20110819135547_create_delayed_jobs.rb +21 -0
  148. data/test/dummy/db/schema.rb +96 -0
  149. data/test/dummy/lib/assets/.gitkeep +0 -0
  150. data/test/dummy/log/.gitkeep +0 -0
  151. data/test/dummy/public/404.html +26 -0
  152. data/test/dummy/public/422.html +26 -0
  153. data/test/dummy/public/500.html +26 -0
  154. data/test/dummy/public/favicon.ico +0 -0
  155. data/test/dummy/script/delayed_job +5 -0
  156. data/test/dummy/script/rails +6 -0
  157. data/test/dummy/test/fixtures/users.yml +9 -0
  158. data/test/dummy/test/functional/sessions_controller_test.rb +7 -0
  159. data/test/dummy/test/functional/users_controller_test.rb +7 -0
  160. data/test/dummy/test/unit/helpers/sessions_helper_test.rb +4 -0
  161. data/test/dummy/test/unit/helpers/users_helper_test.rb +4 -0
  162. data/test/dummy/test/unit/user_test.rb +7 -0
  163. data/test/factories.rb +9 -0
  164. data/test/fixtures/kublog/categories.yml +7 -0
  165. data/test/fixtures/kublog/comments.yml +7 -0
  166. data/test/fixtures/kublog/images.yml +9 -0
  167. data/test/fixtures/kublog/posts.yml +9 -0
  168. data/test/functional/kublog/categories_controller_test.rb +9 -0
  169. data/test/functional/kublog/comments_controller_test.rb +9 -0
  170. data/test/functional/kublog/images_controller_test.rb +9 -0
  171. data/test/functional/kublog/post_mailer_test.rb +9 -0
  172. data/test/functional/kublog/posts_controller_test.rb +9 -0
  173. data/test/integration/navigation_test.rb +10 -0
  174. data/test/kublog_test.rb +7 -0
  175. data/test/test_helper.rb +12 -0
  176. data/test/unit/helpers/kublog/categories_helper_test.rb +6 -0
  177. data/test/unit/helpers/kublog/comments_helper_test.rb +6 -0
  178. data/test/unit/helpers/kublog/images_helper_test.rb +6 -0
  179. data/test/unit/helpers/kublog/posts_helper_test.rb +6 -0
  180. data/test/unit/kublog/category_test.rb +9 -0
  181. data/test/unit/kublog/comment_test.rb +9 -0
  182. data/test/unit/kublog/image_test.rb +9 -0
  183. data/test/unit/kublog/post_test.rb +19 -0
  184. metadata +439 -0
@@ -0,0 +1,9 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ *.gem
5
+ test/dummy/db/*.sqlite3
6
+ test/dummy/log/*.log
7
+ test/dummy/tmp/
8
+ test/dummy/public/uploads/
9
+ test/dummy/config/initializers/kublog.rb
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ # Optional Gems
6
+ gem 'delayed_job'
7
+ gem 'sprockets', '2.0.0.beta.13' # Only here until official release
8
+ gem 'ruby-debug19', :require => 'ruby-debug'
@@ -0,0 +1,177 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ kublog (0.0.1)
5
+ carrierwave (~> 0.5.7)
6
+ coffee-script (~> 2.2.0)
7
+ fb_graph (~> 1.9.5)
8
+ friendly_id (~> 4.0.0.beta8)
9
+ jquery-rails (~> 1.0.13)
10
+ liquid (~> 2.2.2)
11
+ rails (~> 3.1.0.rc5)
12
+ rmagick (~> 2.13.1)
13
+ sanitize (~> 2.0.3)
14
+ twitter (~> 1.6.2)
15
+
16
+ GEM
17
+ remote: http://rubygems.org/
18
+ specs:
19
+ actionmailer (3.1.0.rc6)
20
+ actionpack (= 3.1.0.rc6)
21
+ mail (~> 2.3.0)
22
+ actionpack (3.1.0.rc6)
23
+ activemodel (= 3.1.0.rc6)
24
+ activesupport (= 3.1.0.rc6)
25
+ builder (~> 3.0.0)
26
+ erubis (~> 2.7.0)
27
+ i18n (~> 0.6)
28
+ rack (~> 1.3.2)
29
+ rack-cache (~> 1.0.2)
30
+ rack-mount (~> 0.8.1)
31
+ rack-test (~> 0.6.0)
32
+ sprockets (~> 2.0.0.beta.12)
33
+ activemodel (3.1.0.rc6)
34
+ activesupport (= 3.1.0.rc6)
35
+ bcrypt-ruby (~> 2.1.4)
36
+ builder (~> 3.0.0)
37
+ i18n (~> 0.6)
38
+ activerecord (3.1.0.rc6)
39
+ activemodel (= 3.1.0.rc6)
40
+ activesupport (= 3.1.0.rc6)
41
+ arel (~> 2.2.1)
42
+ tzinfo (~> 0.3.29)
43
+ activeresource (3.1.0.rc6)
44
+ activemodel (= 3.1.0.rc6)
45
+ activesupport (= 3.1.0.rc6)
46
+ activesupport (3.1.0.rc6)
47
+ multi_json (~> 1.0)
48
+ addressable (2.2.6)
49
+ archive-tar-minitar (0.5.2)
50
+ arel (2.2.1)
51
+ attr_required (0.0.3)
52
+ bcrypt-ruby (2.1.4)
53
+ builder (3.0.0)
54
+ carrierwave (0.5.7)
55
+ activesupport (~> 3.0)
56
+ coffee-script (2.2.0)
57
+ coffee-script-source
58
+ execjs
59
+ coffee-script-source (1.1.2)
60
+ columnize (0.3.4)
61
+ daemons (1.1.4)
62
+ delayed_job (2.1.4)
63
+ activesupport (~> 3.0)
64
+ daemons
65
+ erubis (2.7.0)
66
+ execjs (1.2.4)
67
+ multi_json (~> 1.0)
68
+ factory_girl (2.0.4)
69
+ factory_girl_rails (1.1.0)
70
+ factory_girl (~> 2.0.0)
71
+ railties (>= 3.0.0)
72
+ faraday (0.7.4)
73
+ addressable (~> 2.2.6)
74
+ multipart-post (~> 1.1.0)
75
+ rack (< 2, >= 1.1.0)
76
+ faraday_middleware (0.7.0)
77
+ faraday (~> 0.7.3)
78
+ fb_graph (1.9.5)
79
+ httpclient (>= 2.2.0.2)
80
+ rack-oauth2 (>= 0.8.0)
81
+ friendly_id (4.0.0.beta8)
82
+ hashie (1.1.0)
83
+ hike (1.2.1)
84
+ httpclient (2.2.1)
85
+ i18n (0.6.0)
86
+ jquery-rails (1.0.13)
87
+ railties (~> 3.0)
88
+ thor (~> 0.14)
89
+ json (1.5.3)
90
+ linecache19 (0.5.12)
91
+ ruby_core_source (>= 0.1.4)
92
+ liquid (2.2.2)
93
+ mail (2.3.0)
94
+ i18n (>= 0.4.0)
95
+ mime-types (~> 1.16)
96
+ treetop (~> 1.4.8)
97
+ mime-types (1.16)
98
+ multi_json (1.0.3)
99
+ multi_xml (0.2.2)
100
+ multipart-post (1.1.3)
101
+ nokogiri (1.5.0)
102
+ polyglot (0.3.2)
103
+ rack (1.3.2)
104
+ rack-cache (1.0.2)
105
+ rack (>= 0.4)
106
+ rack-mount (0.8.2)
107
+ rack (>= 1.0.0)
108
+ rack-oauth2 (0.9.2)
109
+ activesupport (>= 2.3)
110
+ attr_required (>= 0.0.3)
111
+ httpclient (>= 2.2.0.2)
112
+ i18n
113
+ json (>= 1.4.3)
114
+ rack (>= 1.1)
115
+ rack-ssl (1.3.2)
116
+ rack
117
+ rack-test (0.6.1)
118
+ rack (>= 1.0)
119
+ rails (3.1.0.rc6)
120
+ actionmailer (= 3.1.0.rc6)
121
+ actionpack (= 3.1.0.rc6)
122
+ activerecord (= 3.1.0.rc6)
123
+ activeresource (= 3.1.0.rc6)
124
+ activesupport (= 3.1.0.rc6)
125
+ bundler (~> 1.0)
126
+ railties (= 3.1.0.rc6)
127
+ railties (3.1.0.rc6)
128
+ actionpack (= 3.1.0.rc6)
129
+ activesupport (= 3.1.0.rc6)
130
+ rack-ssl (~> 1.3.2)
131
+ rake (>= 0.8.7)
132
+ rdoc (~> 3.4)
133
+ thor (~> 0.14.6)
134
+ rake (0.9.2)
135
+ rdoc (3.9.2)
136
+ rmagick (2.13.1)
137
+ ruby-debug-base19 (0.11.25)
138
+ columnize (>= 0.3.1)
139
+ linecache19 (>= 0.5.11)
140
+ ruby_core_source (>= 0.1.4)
141
+ ruby-debug19 (0.11.6)
142
+ columnize (>= 0.3.1)
143
+ linecache19 (>= 0.5.11)
144
+ ruby-debug-base19 (>= 0.11.19)
145
+ ruby_core_source (0.1.5)
146
+ archive-tar-minitar (>= 0.5.2)
147
+ sanitize (2.0.3)
148
+ nokogiri (< 1.6, >= 1.4.4)
149
+ simple_oauth (0.1.5)
150
+ sprockets (2.0.0.beta.13)
151
+ hike (~> 1.2)
152
+ rack (~> 1.0)
153
+ tilt (!= 1.3.0, ~> 1.1)
154
+ sqlite3 (1.3.4)
155
+ thor (0.14.6)
156
+ tilt (1.3.2)
157
+ treetop (1.4.10)
158
+ polyglot
159
+ polyglot (>= 0.3.1)
160
+ twitter (1.6.2)
161
+ faraday (~> 0.7.4)
162
+ faraday_middleware (~> 0.7.0)
163
+ hashie (~> 1.1.0)
164
+ multi_json (~> 1.0.0)
165
+ multi_xml (~> 0.2.0)
166
+ simple_oauth (~> 0.1.5)
167
+ tzinfo (0.3.29)
168
+
169
+ PLATFORMS
170
+ ruby
171
+
172
+ DEPENDENCIES
173
+ delayed_job
174
+ factory_girl_rails
175
+ kublog!
176
+ ruby-debug19
177
+ sqlite3
@@ -0,0 +1,20 @@
1
+ Copyright 2011 INNKU
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,102 @@
1
+ = Kublog
2
+
3
+ Kublog is a complete yet simple way to have a Product Blog that integrates with your apps user base. It includes social sharing, atom feeds and moderated comments.
4
+
5
+ Built for Rails 3.1, Kublog is a complete stack, fully configurable solution.
6
+
7
+ Currently in alpha and under continuous development, hackers welcome.
8
+
9
+ == Features
10
+
11
+ * Publish posts with the most basic and simple wysiwyg
12
+ * Attach multiple images to your content
13
+ * Share your posts on your Product's Twitter Page and Facebook Fan Page
14
+ * E-mail personalized versions of your posts to your users
15
+ * Optional background processing with Delayed Job
16
+ * Moderated comments from apps users, apps admins, and visitors
17
+ * Atom feed for main blog and individual post categories
18
+
19
+ == What you need
20
+
21
+ * Ruby 1.9.x
22
+ * Rails 3.1
23
+ * Bundler
24
+
25
+ == Install
26
+
27
+ Require in your Gemfile
28
+
29
+ gem 'kublog', '0.0.1'
30
+
31
+ Migrate the Kublog posts into your database
32
+
33
+ rake kublog:install:migrations
34
+
35
+ Mount Kublog on your routes file
36
+
37
+ mount Kublog::Engine => "/blog(.:format)"
38
+
39
+ == How to Use
40
+
41
+ On your user model:
42
+
43
+ include Kublog::Author
44
+ include Kublog::Notifiable
45
+
46
+ === User Integration
47
+
48
+ Kublog User Integration depends on two functioning methods living on Kublog::ApplicationController
49
+
50
+ * current_user
51
+ * is_admin?
52
+
53
+ ==== Basic User Management
54
+
55
+ If you are currently storing your users on session[:user_id] and have the method *admin?* for your user class, things should just work.
56
+
57
+ ==== Devise
58
+
59
+ Replace this line
60
+
61
+ include UserIntegration::Common
62
+
63
+ With this line
64
+
65
+ include UserIntegration::Devise
66
+
67
+ ==== Uber custom user integration
68
+
69
+ Override current_user, is_admin? methods for Kublog::ApplicationController
70
+
71
+ Override admin? for your Kublog::Author class
72
+
73
+ TODO: Better docs
74
+
75
+ ==== Custom Integration, Social Networks and Image Uploading
76
+
77
+ Take a look at this example configuration:
78
+
79
+ Kublog.setup do |config|
80
+
81
+ config.blog_name = 'Rutanet'
82
+ config.default_url_options = {:host => 'www.rutanet.com'}
83
+ config.notification_processing = :immediate # or :delayed_job
84
+
85
+ config.user_kinds = %w(shipper carrier logistics)
86
+
87
+ config.image_storage = :file # or :s3
88
+
89
+ config.twitter do |twitter|
90
+ twitter.consumer_key = 'xxx'
91
+ twitter.consumer_secret = 'xxx'
92
+ twitter.oauth_token = 'xxx'
93
+ twitter.oauth_token_secret = 'xxx'
94
+ end
95
+
96
+ config.facebook_page_token = 'xxx'
97
+
98
+ end
99
+
100
+ TODO: More docs
101
+
102
+ Will include much more documentation as development continues, please be patient.
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Kublog'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+ Bundler::GemHelper.install_tasks
28
+
29
+ require 'rake/testtask'
30
+
31
+ Rake::TestTask.new(:test) do |t|
32
+ t.libs << 'lib'
33
+ t.libs << 'test'
34
+ t.pattern = 'test/**/*_test.rb'
35
+ t.verbose = false
36
+ end
37
+
38
+
39
+ task :default => :test
File without changes
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_directory ../../plugins/kublog/wysiwyg/javascripts
10
+ //= require_directory ../../plugins/kublog/fancybox/javascripts
11
+ //= require_directory ../../plugins/kublog/livequery/javascripts
12
+ //= require_directory ../../plugins/kublog/ajaxyupload/javascripts
13
+ //= require_tree .
@@ -0,0 +1,48 @@
1
+ $(document).ready ->
2
+ # Create category on the Fly
3
+ $('#kublog #post_category_id').change ->
4
+ $select = $('#post_category_id')
5
+ if $select.val() is 'create_new_category'
6
+ new_name = prompt('New category name')
7
+ if new_name?
8
+ $.post "#{kublogPath}categories", {category: {name: new_name}}, (data)->
9
+ $(optionTemplate(data)).insertAfter($select.find('option:first'))
10
+ $select.val(data.id)
11
+ if $select.find('optgroup option').length is 0
12
+ $select.append(optGroupTemplate(data))
13
+ else
14
+ $select.find('optgroup').prepend(optionTemplate(data))
15
+ else
16
+ $select.val('')
17
+ else if $select.find('option:selected').parent('optgroup').length isnt 0
18
+ console.log 'Deleting category'
19
+ $.post "#{kublogPath}categories/#{$select.val()}.json", {_method: 'delete'}, ->
20
+ selected_val = $select.find('option:selected').val()
21
+ $select.find("option[value=#{selected_val}]").remove()
22
+ $optgroup = $select.find('optgroup')
23
+ $optgroup.remove() if $optgroup.find('option').length is 0
24
+ $select.val('')
25
+
26
+ # Delete Category
27
+ $('#kublog #categories .delete').click ->
28
+ $list_item = $(this).closest('li')
29
+ if confirm($(this).attr('data-confirm'))
30
+ $.post $list_item.children('a').attr('href'), {_method: 'delete'}, ->
31
+ $list_item.remove()
32
+ return false
33
+
34
+ # Edit Category
35
+ $('#kublog #categories .edit').click ->
36
+ $link = $(this).closest('li').children('a')
37
+ new_name = prompt($(this).attr('data-prompt'), $link.text())
38
+ if new_name?
39
+ $.post $link.attr('href'), {_method: 'put', category: {name: new_name}}, (data)->
40
+ $link.text(data.name)
41
+ $link.attr('href', data.path)
42
+ return false
43
+
44
+ optionTemplate = (category) ->
45
+ "<option value=#{category.id}>#{category.name}</option>"
46
+
47
+ optGroupTemplate = (category) ->
48
+ "<optgroup label='Remove Category'>#{optionTemplate(category)}</optgroup>"
@@ -0,0 +1,30 @@
1
+ $(document).ready ->
2
+
3
+ $('#kublog #new_kublog_comment').submit ->
4
+ resetErrors()
5
+
6
+ $('#kublog #new_kublog_comment').bind 'ajax:success', (xhr, data, status)->
7
+ $('.post-comments').append(commentTemplate(data))
8
+ $(this).find('textarea,input[type=text]').val('')
9
+
10
+ $('#kublog #new_kublog_comment').bind 'ajax:error', (xhr, error, status)->
11
+ errors = JSON.parse(error.responseText)
12
+ setErrors('comment', errors)
13
+
14
+ $('#kublog .comment a.delete').click ->
15
+ $link = $(this)
16
+ if confirm($(this).attr('data-confirm'))
17
+ $.post $link.attr('href'), { _method: 'delete'}, (data) ->
18
+ $link.closest('.comment').remove()
19
+ false
20
+
21
+ # Templates
22
+ commentTemplate = (comment) ->
23
+ extra_class = ' admin' if comment['admin?']?
24
+ """
25
+ <div class='comment#{extra_class}'>
26
+ <h4>#{comment.author}</h4>
27
+ <span>#{comment.ftime}</span>
28
+ <p class='body'>#{comment.body}</p>
29
+ </div>
30
+ """