Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #58 from novito/internationalized

Internationalized
  • Loading branch information...
commit 089f99d9e4a5fefe6f03ab3319d437338c283177 2 parents 8b38955 + 9387cda
@xaviershay authored
Showing with 1,292 additions and 13,740 deletions.
  1. +3 −0  .travis.yml
  2. +32 −9 Gemfile
  3. +185 −98 Gemfile.lock
  4. +2 −2 README.textile
  5. +1 −1  Rakefile
  6. 0  {public → app/assets}/images/admin/flash_bg.gif
  7. 0  {public → app/assets}/images/admin/future_bg.png
  8. 0  {public → app/assets}/images/admin/gray_bg.gif
  9. 0  {public → app/assets}/images/admin/new_button.png
  10. 0  {public → app/assets}/images/admin/silver_bg.gif
  11. 0  {public → app/assets}/images/admin/submit_bg.gif
  12. 0  {public → app/assets}/images/admin/subnav_bg.gif
  13. 0  {public → app/assets}/images/openid_icon.png
  14. 0  {public → app/assets}/images/rails.png
  15. 0  {public → app/assets}/images/silk/arrow_undo.png
  16. 0  {public → app/assets}/images/silk/delete.png
  17. 0  {public → app/assets}/images/silk/pencil.png
  18. +19 −0 app/assets/javascripts/admin.js
  19. 0  {public → app/assets}/javascripts/admin/actions.js
  20. +11 −0 {public → app/assets}/javascripts/admin/common.js
  21. +35 −0 app/assets/javascripts/admin/dashboard.js
  22. +2 −1  {public → app/assets}/javascripts/admin/edit-preview.js
  23. 0  {public → app/assets}/javascripts/admin/shortcut.js
  24. +17 −0 app/assets/javascripts/application.js
  25. 0  {public → app/assets}/javascripts/common.js
  26. +1 −1  {public → app/assets}/javascripts/live-comment-preview.js
  27. +15 −0 {public → app/assets}/stylesheets/admin.css
  28. +39 −22 public/stylesheets/application.css → app/assets/stylesheets/application.css.scss
  29. 0  {public → app/assets}/stylesheets/humanmsg.css
  30. 0  {public → app/assets}/stylesheets/login.css
  31. +1 −1  app/controllers/admin/comments_controller.rb
  32. +2 −2 app/controllers/admin/pages_controller.rb
  33. +3 −3 app/controllers/admin/posts_controller.rb
  34. +5 −4 app/controllers/admin/sessions_controller.rb
  35. +0 −28 app/controllers/admin/tags_controller.rb
  36. +1 −1  app/controllers/admin/undo_items_controller.rb
  37. +0 −5 app/controllers/application_controller.rb
  38. +38 −19 app/controllers/comments_controller.rb
  39. +0 −2  app/controllers/posts_controller.rb
  40. +1 −1  app/helpers/application_helper.rb
  41. +8 −0 app/helpers/page_title_helper.rb
  42. +1 −1  app/helpers/url_helper.rb
  43. +3 −1 app/models/comment.rb
  44. +1 −1  app/models/delete_post_undo.rb
  45. +5 −2 app/models/post.rb
  46. +1 −1  app/models/tag.rb
  47. +7 −5 app/models/tagging.rb
  48. +1 −6 app/views/admin/comments/index.html.erb
  49. +2 −2 app/views/admin/comments/show.html.erb
  50. +0 −6 app/views/admin/dashboard/show.html.erb
  51. +0 −4 app/views/admin/pages/_form.html.erb
  52. +1 −5 app/views/admin/pages/index.html.erb
  53. +3 −3 app/views/admin/pages/new.html.erb
  54. +2 −2 app/views/admin/pages/show.html.erb
  55. +0 −4 app/views/admin/posts/_form.html.erb
  56. +1 −1  app/views/admin/posts/_post.html.erb
  57. +2 −5 app/views/admin/posts/index.html.erb
  58. +2 −2 app/views/admin/posts/new.html.erb
  59. +3 −3 app/views/admin/posts/show.html.erb
  60. +0 −10 app/views/admin/tags/edit.html.erb
  61. +0 −38 app/views/admin/tags/index.html.erb
  62. +1 −4 app/views/admin/undo_items/index.html.erb
  63. +5 −12 app/views/layouts/admin.html.erb
  64. +24 −21 app/views/layouts/application.html.erb
  65. +7 −1 app/views/posts/index.atom.builder
  66. +0 −4 app/views/posts/show.html.erb
  67. BIN  config/.DS_Store
  68. +34 −7 config/application.rb
  69. +3 −10 config/boot.rb
  70. +1 −1  config/cucumber.yml
  71. +1 −0  config/database.example.yml
  72. +10 −4 config/environments/development.rb
  73. +29 −14 config/environments/production.rb
  74. +8 −8 config/environments/test.rb
  75. +11 −0 config/initializers/acts_as_taggable_on_steroids.rb
  76. +5 −2 config/initializers/exception_notifier.rb
  77. +5 −0 config/initializers/inflections.rb
  78. +0 −19 config/initializers/new_rails_defaults.rb
  79. +2 −2 config/initializers/session_store.rb
  80. +1 −0  config/initializers/set_chronic_timezone.rb
  81. +3 −0  {vendor/plugins/verification/lib/action_controller → config/initializers}/verification.rb
  82. +10 −0 config/initializers/wrap_parameters.rb
  83. +151 −0 config/locales/es.yml
  84. +200 −0 config/locales/rails/es.yml
  85. +4 −3 config/routes.rb
  86. +16 −0 db/migrate/20110709024316_add_indexes.rb
  87. +2 −2 features/admin_health.feature
  88. +0 −17 features/admin_tags.feature
  89. +1 −1  features/admin_undo.feature
  90. +4 −1 features/step_definitions/admin.rb
  91. +1 −2  features/step_definitions/browsing.rb
  92. +1 −281 features/step_definitions/web_steps.rb
  93. +47 −45 features/support/env.rb
  94. +39 −0 features/support/selectors.rb
  95. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/CHANGELOG
  96. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/MIT-LICENSE
  97. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/README
  98. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/Rakefile
  99. 0  .../acts_as_taggable_on_steroids/generators/acts_as_taggable_migration/acts_as_taggable_migration_generator.rb
  100. 0  ...ugins → lib}/acts_as_taggable_on_steroids/generators/acts_as_taggable_migration/templates/migration.rb
  101. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/init.rb
  102. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb
  103. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/lib/tag_counts_extension.rb
  104. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/lib/tag_list.rb
  105. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/lib/tags_helper.rb
  106. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/abstract_unit.rb
  107. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/acts_as_taggable_test.rb
  108. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/database.yml
  109. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/magazine.rb
  110. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/magazines.yml
  111. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/photo.rb
  112. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/photos.yml
  113. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/post.rb
  114. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/posts.yml
  115. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/special_post.rb
  116. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/subscription.rb
  117. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/subscriptions.yml
  118. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/taggings.yml
  119. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/tags.yml
  120. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/user.rb
  121. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/fixtures/users.yml
  122. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/schema.rb
  123. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/tag_list_test.rb
  124. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/tag_test.rb
  125. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/tagging_test.rb
  126. 0  {vendor/plugins → lib}/acts_as_taggable_on_steroids/test/tags_helper_test.rb
  127. +16 −14 lib/core_extensions/string.rb
  128. +12 −0 lib/tasks/cucumber.rake
  129. +0 −1  public/javascripts/admin/comments.js
  130. +0 −33 public/javascripts/admin/dashboard.js
  131. +0 −1  public/javascripts/admin/pages.js
  132. +0 −1  public/javascripts/admin/posts.js
  133. 0  public/javascripts/application.js
  134. +0 −963 public/javascripts/controls.js
  135. +0 −973 public/javascripts/dragdrop.js
  136. +0 −1,128 public/javascripts/effects.js
  137. +0 −4,241 public/javascripts/jquery.js
  138. +0 −4,320 public/javascripts/prototype.js
  139. +0 −92 public/stylesheets/formtastic.css
  140. +5 −4 spec/controllers/admin/comments_controller_spec.rb
  141. +4 −4 spec/controllers/admin/posts_controller_spec.rb
  142. +0 −22 spec/controllers/admin/tags_controller_spec.rb
  143. +1 −1  spec/controllers/admin/undo_items_controller_spec.rb
  144. +1 −119 spec/controllers/comments_controller_spec.rb
  145. +0 −5 spec/controllers/pages_routing_spec.rb
  146. +11 −2 spec/controllers/posts_controller_spec.rb
  147. +11 −0 spec/helpers/page_title_helper_spec.rb
  148. +15 −0 spec/helpers/url_helper_spec.rb
  149. +17 −4 spec/lib/slugorize_spec.rb
  150. +27 −0 spec/models/comment_spec.rb
  151. +14 −0 spec/models/delete_post_undo_spec.rb
  152. +8 −0 spec/models/post_spec.rb
  153. +24 −0 spec/models/tagging_spec.rb
  154. +3 −4 spec/support/be_valid_html5.rb
  155. +2 −2 spec/support/be_valid_xhtml.rb
  156. +2 −2 spec/views/admin/comments/{index.html.erb_spec.rb → index.html_spec.rb}
  157. +2 −2 spec/views/admin/comments/{show.html.erb_spec.rb → show.html_spec.rb}
  158. +2 −2 spec/views/admin/dashboard/{show.html.erb_spec.rb → show.html_spec.rb}
  159. +2 −2 spec/views/admin/pages/{index.html.erb_spec.rb → index.html_spec.rb}
  160. +2 −2 spec/views/admin/pages/{new.html.erb_spec.rb → new.html_spec.rb}
  161. +2 −2 spec/views/admin/pages/{show.html.erb_spec.rb → show.html_spec.rb}
  162. +2 −2 spec/views/admin/posts/{index.html.erb_spec.rb → index.html_spec.rb}
  163. +2 −2 spec/views/admin/posts/{new.html.erb_spec.rb → new.html_spec.rb}
  164. +2 −2 spec/views/admin/posts/{show.html.erb_spec.rb → show.html_spec.rb}
  165. +2 −2 spec/views/admin/sessions/{new.html.erb_spec.rb → new.html_spec.rb}
  166. +2 −2 spec/views/admin/undo_items/{index.html.erb_spec.rb → index.html_spec.rb}
  167. +2 −2 spec/views/archives/{index.html.erb_spec.rb → index.html_spec.rb}
  168. +2 −2 spec/views/layouts/{login.html.erb_spec.rb → admin.html_spec.rb}
  169. +2 −2 spec/views/layouts/{application.html.erb_spec.rb → application.html_spec.rb}
  170. +2 −2 spec/views/layouts/{admin.html.erb_spec.rb → login.html_spec.rb}
  171. +2 −2 spec/views/pages/{show.html.erb_spec.rb → show.html_spec.rb}
  172. +2 −2 spec/views/posts/index.atom.builder_spec.rb
  173. +3 −3 spec/views/posts/{index.html.erb_spec.rb → index.html_spec.rb}
  174. +2 −2 spec/views/posts/{show.html.erb_spec.rb → show.html_spec.rb}
  175. 0  {public → vendor/assets}/javascripts/humanmsg.js
  176. 0  {public → vendor/assets}/javascripts/jquery.easing.1.3.js
  177. 0  {public → vendor/assets}/javascripts/jquery.form.js
  178. 0  {public → vendor/assets}/javascripts/jquery.jfeed.js
  179. 0  {public → vendor/assets}/javascripts/jquery.livequery.js
  180. +0 −81 vendor/plugins/exception_notification/README
  181. +0 −11 vendor/plugins/exception_notification/exception_notification.gemspec
  182. +0 −31 vendor/plugins/exception_notification/lib/exception_notifier.rb
  183. +0 −83 vendor/plugins/exception_notification/lib/exception_notifier/notifier.rb
  184. +0 −1  vendor/plugins/exception_notification/lib/exception_notifier/views/exception_notifier/_backtrace.text.erb
  185. +0 −8 vendor/plugins/exception_notification/lib/exception_notifier/views/exception_notifier/_environment.text.erb
  186. +0 −4 vendor/plugins/exception_notification/lib/exception_notifier/views/exception_notifier/_request.text.erb
  187. +0 −2  vendor/plugins/exception_notification/lib/exception_notifier/views/exception_notifier/_session.text.erb
  188. +0 −3  vendor/plugins/exception_notification/lib/exception_notifier/views/exception_notifier/_title.text.erb
  189. +0 −13 ...gins/exception_notification/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb
  190. +0 −37 vendor/plugins/open_id_authentication/CHANGELOG
  191. +0 −223 vendor/plugins/open_id_authentication/README
  192. +0 −12 vendor/plugins/open_id_authentication/init.rb
  193. +0 −128 vendor/plugins/open_id_authentication/lib/open_id_authentication.rb
  194. +0 −20 vendor/plugins/verification/MIT-LICENSE
  195. +0 −34 vendor/plugins/verification/README
  196. +0 −22 vendor/plugins/verification/Rakefile
  197. +0 −3  vendor/plugins/verification/init.rb
  198. +0 −18 vendor/plugins/verification/test/test_helper.rb
  199. +0 −270 vendor/plugins/verification/test/verification_test.rb
View
3  .travis.yml
@@ -0,0 +1,3 @@
+before_script:
+ - "cp config/database.example.yml config/database.yml"
+script: "bundle exec rake db:migrate --trace && bundle exec rake --trace"
View
41 Gemfile
@@ -1,11 +1,27 @@
-source 'http://rubygems.org'
+source 'https://rubygems.org'
-gem 'rails', '3.0.3'
+gem 'rails', '3.2.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
-gem 'sqlite3-ruby', :require => 'sqlite3'
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+end
+
+platforms :ruby do
+ gem 'sqlite3'
+end
+
+platforms :jruby do
+ gem 'activerecord-jdbcsqlite3-adapter'
+ gem 'trinidad'
+ gem 'jruby-openssl'
+end
+
+gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
@@ -17,23 +33,30 @@ gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'ruby-debug'
# Bundle the extra gems:
-gem 'RedCloth', :require => 'redcloth'
+gem 'RedCloth', '~> 4.2.9', :require => 'redcloth'
gem 'ruby-openid', :require => 'openid'
gem 'rack-openid', :require => 'rack/openid'
gem 'aaronh-chronic', :require => 'chronic' # Fixes for 1.9.2
gem 'coderay'
gem 'lesstile'
gem 'formtastic'
-gem 'will_paginate', '~> 3.0.pre3'
+gem 'will_paginate', '~> 3.0.2'
+gem 'exception_notification', '~> 2.5.2'
+gem 'open_id_authentication'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
-group :development, :test do
- gem 'cucumber-rails'
- gem 'webrat'
+group :test do
+ gem 'database_cleaner'
+ gem 'cucumber-rails', :require => false
+ gem 'cucumber-websteps', :require => false
gem 'factory_girl'
gem 'rspec'
+ gem 'nokogiri', '~> 1.5.0'
+ gem 'webrat'
+end
+
+group :development, :test do
gem 'rspec-rails'
- gem 'hpricot'
end
View
283 Gemfile.lock
@@ -1,131 +1,218 @@
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
- RedCloth (4.2.3)
+ RedCloth (4.2.9)
+ RedCloth (4.2.9-java)
aaronh-chronic (0.3.9)
- abstract (1.0.0)
- actionmailer (3.0.3)
- actionpack (= 3.0.3)
- mail (~> 2.2.9)
- actionpack (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
- builder (~> 2.1.2)
- erubis (~> 2.6.6)
- i18n (~> 0.4)
- rack (~> 1.2.1)
- rack-mount (~> 0.6.13)
- rack-test (~> 0.5.6)
- tzinfo (~> 0.3.23)
- activemodel (3.0.3)
- activesupport (= 3.0.3)
- builder (~> 2.1.2)
- i18n (~> 0.4)
- activerecord (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
- arel (~> 2.0.2)
- tzinfo (~> 0.3.23)
- activeresource (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
- activesupport (3.0.3)
- arel (2.0.4)
- builder (2.1.2)
- coderay (0.9.5)
- cucumber (0.9.4)
- builder (~> 2.1.2)
- diff-lcs (~> 1.1.2)
- gherkin (~> 2.2.9)
- json (~> 1.4.6)
- term-ansicolor (~> 1.0.5)
- cucumber-rails (0.3.2)
- cucumber (>= 0.8.0)
- diff-lcs (1.1.2)
- erubis (2.6.6)
- abstract (>= 1.0.0)
- factory_girl (1.3.2)
- formtastic (1.2.0)
- actionpack (>= 2.3.7)
- activesupport (>= 2.3.7)
+ actionmailer (3.2.6)
+ actionpack (= 3.2.6)
+ mail (~> 2.4.4)
+ actionpack (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.3)
+ activemodel (3.2.6)
+ activesupport (= 3.2.6)
+ builder (~> 3.0.0)
+ activerecord (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activerecord-jdbc-adapter (1.2.1)
+ activerecord-jdbcsqlite3-adapter (1.2.1)
+ activerecord-jdbc-adapter (~> 1.2.1)
+ jdbc-sqlite3 (~> 3.7.2)
+ activeresource (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ activesupport (3.2.6)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ addressable (2.2.6)
+ arel (3.0.2)
+ bouncy-castle-java (1.5.0146.1)
+ builder (3.0.0)
+ capybara (1.1.2)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ childprocess (0.3.0)
+ ffi (~> 1.0.6)
+ coderay (1.0.5)
+ cucumber (1.1.4)
+ builder (>= 2.1.2)
+ diff-lcs (>= 1.1.2)
+ gherkin (~> 2.7.1)
+ json (>= 1.4.6)
+ term-ansicolor (>= 1.0.6)
+ cucumber-rails (1.2.1)
+ capybara (>= 1.1.2)
+ cucumber (>= 1.1.3)
+ nokogiri (>= 1.5.0)
+ cucumber-websteps (0.9.0)
+ capybara
+ cucumber
+ launchy
+ database_cleaner (0.7.0)
+ diff-lcs (1.1.3)
+ erubis (2.7.0)
+ exception_notification (2.5.2)
+ actionmailer (>= 3.0.4)
+ factory_girl (2.4.2)
+ activesupport
+ ffi (1.0.11)
+ ffi (1.0.11-java)
+ formtastic (2.2.1)
+ actionpack (>= 3.0)
+ gherkin (2.7.3)
+ json (>= 1.4.6)
+ gherkin (2.7.3-java)
+ json (>= 1.4.6)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jdbc-sqlite3 (3.7.2)
+ journey (1.0.4)
+ jquery-rails (2.0.0)
+ railties (>= 3.2.0.beta, < 5.0)
+ thor (~> 0.14)
+ jruby-openssl (0.7.4)
+ bouncy-castle-java
+ jruby-rack (1.1.3)
+ json (1.7.3)
+ json (1.7.3-java)
+ launchy (2.0.5)
+ addressable (~> 2.2.6)
+ launchy (2.0.5-java)
+ addressable (~> 2.2.6)
+ ffi (~> 1.0.9)
+ spoon (~> 0.0.1)
+ lesstile (1.0.1)
+ mail (2.4.4)
i18n (>= 0.4.0)
- gherkin (2.2.9)
- json (~> 1.4.6)
- term-ansicolor (~> 1.0.5)
- hpricot (0.8.3)
- i18n (0.4.2)
- json (1.4.6)
- lesstile (1.0.0)
- mail (2.2.10)
- activesupport (>= 2.3.6)
- i18n (~> 0.4.1)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- mime-types (1.16)
- nokogiri (1.4.4)
- polyglot (0.3.1)
- rack (1.2.1)
- rack-mount (0.6.13)
- rack (>= 1.0.0)
- rack-openid (1.2.0)
+ mime-types (1.18)
+ multi_json (1.0.4)
+ nokogiri (1.5.0)
+ nokogiri (1.5.0-java)
+ open_id_authentication (1.1.0)
+ rack-openid (~> 1.3)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-openid (1.3.1)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
- rack-test (0.5.6)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
rack (>= 1.0)
- rails (3.0.3)
- actionmailer (= 3.0.3)
- actionpack (= 3.0.3)
- activerecord (= 3.0.3)
- activeresource (= 3.0.3)
- activesupport (= 3.0.3)
+ rails (3.2.6)
+ actionmailer (= 3.2.6)
+ actionpack (= 3.2.6)
+ activerecord (= 3.2.6)
+ activeresource (= 3.2.6)
+ activesupport (= 3.2.6)
bundler (~> 1.0)
- railties (= 3.0.3)
- railties (3.0.3)
- actionpack (= 3.0.3)
- activesupport (= 3.0.3)
+ railties (= 3.2.6)
+ railties (3.2.6)
+ actionpack (= 3.2.6)
+ activesupport (= 3.2.6)
+ rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
- thor (~> 0.14.4)
- rake (0.8.7)
- rspec (2.1.0)
- rspec-core (~> 2.1.0)
- rspec-expectations (~> 2.1.0)
- rspec-mocks (~> 2.1.0)
- rspec-core (2.1.0)
- rspec-expectations (2.1.0)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
- rspec-mocks (2.1.0)
- rspec-rails (2.1.0)
- rspec (~> 2.1.0)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
ruby-openid (2.1.8)
- sqlite3-ruby (1.3.2)
- term-ansicolor (1.0.5)
- thor (0.14.4)
- treetop (1.4.9)
+ rubyzip (0.9.5)
+ sass (3.1.12)
+ sass-rails (3.2.3)
+ railties (~> 3.2.0.beta)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ selenium-webdriver (2.17.0)
+ childprocess (>= 0.2.5)
+ ffi (~> 1.0.9)
+ multi_json (~> 1.0.4)
+ rubyzip
+ spoon (0.0.1)
+ sprockets (2.1.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.5)
+ term-ansicolor (1.0.7)
+ thor (0.15.2)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.23)
- webrat (0.7.2)
+ trinidad (1.3.2)
+ jruby-rack (>= 1.1.1)
+ trinidad_jars (>= 1.0.1)
+ trinidad_jars (1.0.2)
+ tzinfo (0.3.33)
+ webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
- will_paginate (3.0.pre2)
+ will_paginate (3.0.2)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
PLATFORMS
+ java
ruby
DEPENDENCIES
- RedCloth
+ RedCloth (~> 4.2.9)
aaronh-chronic
+ activerecord-jdbcsqlite3-adapter
coderay
cucumber-rails
+ cucumber-websteps
+ database_cleaner
+ exception_notification (~> 2.5.2)
factory_girl
formtastic
- hpricot
+ jquery-rails
+ jruby-openssl
lesstile
+ nokogiri (~> 1.5.0)
+ open_id_authentication
rack-openid
- rails (= 3.0.3)
+ rails (= 3.2.6)
rspec
rspec-rails
ruby-openid
- sqlite3-ruby
+ sass-rails (~> 3.2.3)
+ sqlite3
+ trinidad
webrat
- will_paginate (~> 3.0.pre3)
+ will_paginate (~> 3.0.2)
View
4 README.textile
@@ -41,8 +41,6 @@ h2. How it differs from Mephisto
Mephisto is feature packed and quite customizable. It can however be daunting trying to find your way around the code, which isn’t so good if you’re trying to hack in your own features. Enki strips out a lot of the features that you probably don’t need (multiple authors and liquid templates, for example), and focuses on keeping a tight code base that is easy to comprehend and extend.
-*If you’re converting from Mephisto,* be sure to have a look at "enki-translator":http://github.com/xaviershay/enki-translator/tree/master
-
h2. How it differs from SimpleLog
Enki embodies much of the philosophy of SimpleLog, but does so in a style that is much more consistent with Rails best practices, making it easier to understand and hack the code.
@@ -55,6 +53,8 @@ h2. Contributors, these guys rock
<pre><code>git log | grep Author | sort | uniq</code></pre>
+If you want to help out, try tackling an "open issue":https://github.com/xaviershay/enki/issues. Please include specs for any fixes. Enki is by design feature light. Unless you feel very strongly your feature should be in core, add a link to your fork in the wiki instead.
+
h2. License
GPL(General Public License) - See LICENSE
View
2  Rakefile
@@ -1,7 +1,7 @@
+#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
-require 'rake'
Enki::Application.load_tasks
View
0  public/images/admin/flash_bg.gif → app/assets/images/admin/flash_bg.gif
File renamed without changes
View
0  public/images/admin/future_bg.png → app/assets/images/admin/future_bg.png
File renamed without changes
View
0  public/images/admin/gray_bg.gif → app/assets/images/admin/gray_bg.gif
File renamed without changes
View
0  public/images/admin/new_button.png → app/assets/images/admin/new_button.png
File renamed without changes
View
0  public/images/admin/silver_bg.gif → app/assets/images/admin/silver_bg.gif
File renamed without changes
View
0  public/images/admin/submit_bg.gif → app/assets/images/admin/submit_bg.gif
File renamed without changes
View
0  public/images/admin/subnav_bg.gif → app/assets/images/admin/subnav_bg.gif
File renamed without changes
View
0  public/images/openid_icon.png → app/assets/images/openid_icon.png
File renamed without changes
View
0  public/images/rails.png → app/assets/images/rails.png
File renamed without changes
View
0  public/images/silk/arrow_undo.png → app/assets/images/silk/arrow_undo.png
File renamed without changes
View
0  public/images/silk/delete.png → app/assets/images/silk/delete.png
File renamed without changes
View
0  public/images/silk/pencil.png → app/assets/images/silk/pencil.png
File renamed without changes
View
19 app/assets/javascripts/admin.js
@@ -0,0 +1,19 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require jquery.livequery
+//= require jquery.form
+//= require jquery.easing.1.3
+//= require humanmsg
+//= require_tree ./admin
View
0  public/javascripts/admin/actions.js → app/assets/javascripts/admin/actions.js
File renamed without changes
View
11 public/javascripts/admin/common.js → app/assets/javascripts/admin/common.js
@@ -6,6 +6,10 @@ jQuery.delegate = function(rules) {
}
}
+$(document).ajaxSend(function(e, xhr, options) {
+ var token = $("meta[name='csrf-token']").attr("content");
+ xhr.setRequestHeader("X-CSRF-Token", token);
+});
function restripe() {
$('table tr:odd').removeClass('alt');
@@ -103,3 +107,10 @@ function destroyAndUndoBehaviour(type) {
}
}
+$(document).ready(function() {
+ $(['posts', 'comments', 'pages']).each(function() {
+ if ($('#' + this).length > 0) {
+ destroyAndUndoBehaviour(this)();
+ }
+ });
+});
View
35 app/assets/javascripts/admin/dashboard.js
@@ -0,0 +1,35 @@
+function extractId(obj) {
+ tokens = obj.attr('id').split('-');
+ return tokens[tokens.length-1];
+}
+
+$(document).ready(function (){
+ if ($('#recent-comments').length) {
+ $('.comment-body').hide();
+
+ $('.comment-link').click (function() {
+ comment_body_id = '#comment-body-' + extractId($(this));
+
+ $('.comment-body').not(comment_body_id).hide();
+ $(comment_body_id).toggle();
+
+ return false;
+ })
+
+ $(document).click(function() {
+ $('.comment-body').hide();
+ });
+
+ asyncUndoBehaviour();
+
+ $('form.delete-item').submit(function () {
+ asyncDeleteForm($(this));
+
+ // Assume success and remove comment
+ comment_link_id = '#comment-link-' + extractId($(this));
+ $(comment_link_id).remove();
+ $(this).parent('div').parent('div').remove();
+ return false;
+ });
+ }
+})
View
3  public/javascripts/admin/edit-preview.js → app/assets/javascripts/admin/edit-preview.js
@@ -15,6 +15,7 @@ $(document).ready(function() {
type: 'POST',
data: form.serialize().replace(/&*_method=\w+&*/, ''),
url: dest,
+ dataType: 'html',
error: function() {
$('#preview .content').html('<p>Failed to generate preview. Toggle back to edit mode and check that all required fields are filled in and valid.</p>');
},
@@ -30,7 +31,7 @@ $(document).ready(function() {
}
$(document).keyup(function(e) {
- if (e.metaKey && (e.which == 69)) { // Works in recent Safari and FF, unsure about IE
+ if (e.ctrlKey && (e.which == 69)) { // Works in recent Safari and FF, unsure about IE
toggle_preview();
e.preventDefault();
}
View
0  public/javascripts/admin/shortcut.js → app/assets/javascripts/admin/shortcut.js
File renamed without changes
View
17 app/assets/javascripts/application.js
@@ -0,0 +1,17 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require common
+//= require live-comment-preview
+//= require_self
View
0  public/javascripts/common.js → app/assets/javascripts/common.js
File renamed without changes
View
2  public/javascripts/live-comment-preview.js → ...ssets/javascripts/live-comment-preview.js
@@ -12,8 +12,8 @@ $(function() { // onload
jQuery.ajax({
data: comment_form.serialize(),
url: dest + '/new',
+ dataType: 'html',
timeout: 2000,
- dataType: 'text/html',
error: function() {
if ($('#comment-preview').length == 0) {
comment_form.after('<div id="comment-preview"></div>')
View
15 public/stylesheets/admin.css → app/assets/stylesheets/admin.css
@@ -1,3 +1,18 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
+ * compiled file, but it's generally better to create a new file per style scope.
+ *
+ *= require_self
+ *= require formtastic
+ *= require humanmsg
+ */
+
#nav {
position: absolute;
width: 100%;
View
61 public/stylesheets/application.css → app/assets/stylesheets/application.css.scss
@@ -1,3 +1,16 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
+ * compiled file, but it's generally better to create a new file per style scope.
+ *
+ *= require_self
+ */
+
/* High level containers */
body
{
@@ -11,41 +24,43 @@ body
#page_container
{
- width: 70em;
position: absolute;
min-height: 400px;
color: black;
+ width: 100%;
+}
- margin-top: 5px;
- padding-left: 10px;
- border-right: solid 1px #aaaaaa;
- border-top: solid 1px #aaaaaa;
+#content {
+ width: 900px;
+ margin: 5px auto;
+ position: relative;
+ padding-right: 55px;
+/* display: inline;*/
}
#footer
{
- position: absolute;
- bottom: -1px;
- right: -1px;
+ position: relative;
font-size: 8pt;
- padding-top: 5px;
+/* padding-top: 5px;*/
padding-right: 15px;
padding-bottom: 5px;
padding-left: 5px;
color: gray;
- border-bottom: solid 1px #aaaaaa;
+/* border-bottom: solid 1px #aaaaaa;*/
}
/* Headings */
h1#page_heading
{
font-size: 24pt;
+ color: #000 !important;
}
h2
{
- font-size: 1.2em;
+ font-size: 1.4em;
color: #333333;
}
@@ -71,7 +86,7 @@ strong
/* Links */
.openid
{
- background-image: url("/images/openid_icon.png");
+ background-image: image-url("openid_icon.png");
padding-left: 15px;
background-repeat: no-repeat;
background-position: 0px 2px;
@@ -109,17 +124,12 @@ img
#navigation
{
position: absolute;
- width: 10em;
+ width: 15em;
top: -1px;
right: -1px;
border: none;
- border-left: solid 1px #aaaaaa;
- border-bottom: solid 1px #aaaaaa;
- border-top: solid 1px white;
- border-right: solid 1px white;
-
- padding: 10px;
+ padding: 5px;
}
#navigation h2
@@ -160,6 +170,7 @@ img
{
border: solid 1px black;
width: 100%;
+ margin-left: 10px;
}
#navigation form
@@ -171,7 +182,7 @@ img
{
padding-right: 150px;
padding-left: 0px;
- padding-top: 15px;
+ padding-top: 0px;
padding-bottom: 40px;
}
@@ -190,7 +201,7 @@ div.meta
padding-bottom: 0.5em;
display: inline;
color: #cccccc;
- font-size: 10pt;
+ font-size: 9pt;
}
.archive-month .tags
{
@@ -266,15 +277,21 @@ textarea
background-color: #fafafa;
}
+div.date
+{
+ color: #999;
+ font-size: .8em;
+}
div.comments div.body
{
padding: 5px;
}
+
div.comments div.meta
{
min-height: 0px;
- padding: 0px
+ padding: 0px;
}
div.comments div.separator
View
0  public/stylesheets/humanmsg.css → app/assets/stylesheets/humanmsg.css
File renamed without changes
View
0  public/stylesheets/login.css → app/assets/stylesheets/login.css
File renamed without changes
View
2  app/controllers/admin/comments_controller.rb
@@ -38,7 +38,7 @@ def destroy
render :json => {
:undo_path => undo_admin_undo_item_path(undo_item),
:undo_message => undo_item.description,
- :comment => @comment
+ :comment => @comment.attributes
}.to_json
}
end
View
4 app/controllers/admin/pages_controller.rb
@@ -60,7 +60,7 @@ def preview
respond_to do |format|
format.js {
- render :partial => 'pages/page.html.erb', :locals => {:page => @page}
+ render :partial => 'pages/page', :locals => {:page => @page}
}
end
end
@@ -77,7 +77,7 @@ def destroy
render :json => {
:undo_path => undo_admin_undo_item_path(undo_item),
:undo_message => undo_item.description,
- :page => @page
+ :page => @page.attributes
}.to_json
}
end
View
6 app/controllers/admin/posts_controller.rb
@@ -60,7 +60,7 @@ def preview
respond_to do |format|
format.js {
- render :partial => 'posts/post.html.erb', :locals => {:post => @post}
+ render :partial => 'posts/post', :locals => {:post => @post}
}
end
end
@@ -77,8 +77,8 @@ def destroy
render :json => {
:undo_path => undo_admin_undo_item_path(undo_item),
:undo_message => undo_item.description,
- :post => @post
- }.to_json
+ :post => @post.attributes
+ }
}
end
end
View
9 app/controllers/admin/sessions_controller.rb
@@ -14,7 +14,11 @@ def new
def create
return successful_login if allow_login_bypass? && params[:bypass_login]
- if not params[:openid_url].blank?
+
+ if params[:openid_url].blank? && !request.env[Rack::OpenID::RESPONSE]
+ flash.now[:error] = "You must provide an OpenID URL"
+ render :action => 'new'
+ else
authenticate_with_open_id(params[:openid_url]) do |result, identity_url|
if result.successful?
if enki_config.author_open_ids.include?(URI.parse(identity_url))
@@ -27,9 +31,6 @@ def create
end
render :action => 'new'
end
- else
- flash.now[:error] = "Sorry, the OpenID server couldn't be found"
- render :action => 'new'
end
end
View
28 app/controllers/admin/tags_controller.rb
@@ -1,28 +0,0 @@
-class Admin::TagsController < Admin::BaseController
- before_filter :find_tag, :except => 'index'
-
- def index
- @tags = Tag.paginate(:order => 'name', :page => params[:page])
- end
-
- def show
- end
-
- def edit
- end
-
- def update
- if @tag.update_attributes(params[:tag])
- flash[:notice] = "Tag updated"
- redirect_to :action => 'index'
- else
- render :action => 'edit'
- end
- end
-
- protected
-
- def find_tag
- @tag = Tag.find(params[:id])
- end
-end
View
2  app/controllers/admin/undo_items_controller.rb
@@ -19,7 +19,7 @@ def undo
format.json {
render :json => {
:message => item.complete_description,
- :obj => object
+ :obj => object.attributes
}
}
end
View
5 app/controllers/application_controller.rb
@@ -1,13 +1,8 @@
class ApplicationController < ActionController::Base
protect_from_forgery
- after_filter :set_content_type
protected
- def set_content_type
- headers['Content-Type'] ||= 'text/html; charset=utf-8'
- end
-
def enki_config
@@enki_config = Enki::Config.default
end
View
57 app/controllers/comments_controller.rb
@@ -1,4 +1,7 @@
class CommentsController < ApplicationController
+ skip_before_filter :verify_authenticity_token, :only => :create
+ before_filter :verify_authenticity_token_unless_openid, :only => :create
+
include UrlHelper
OPEN_ID_ERRORS = {
:missing => "Sorry, the OpenID server couldn't be found",
@@ -8,11 +11,7 @@ class CommentsController < ApplicationController
before_filter :find_post, :except => [:new]
def index
- if request.post? || using_open_id?
- create
- else
- redirect_to(post_path(@post))
- end
+ redirect_to(post_path(@post))
end
def new
@@ -20,28 +19,37 @@ def new
respond_to do |format|
format.js do
- render :partial => 'comment.html.erb', :locals => {:comment => @comment}
+ render :partial => 'comment', :locals => {:comment => @comment}
end
end
end
+ # TODO: Spec OpenID with cucumber and rack-my-id
def create
- @comment = Comment.new((session[:pending_comment] || params[:comment] || {}).reject {|key, value| !Comment.protected_attribute?(key) })
+ @comment = Comment.new((session[:pending_comment] || params[:comment] || {}).
+ reject {|key, value| !Comment.protected_attribute?(key) })
@comment.post = @post
session[:pending_comment] = nil
- unless @comment.requires_openid_authentication?
- @comment.blank_openid_fields
- else
+ if @comment.requires_openid_authentication?
session[:pending_comment] = params[:comment]
- return if authenticate_with_open_id(@comment.author, :optional => [:nickname, :fullname, :email]) do |result, identity_url, registration|
+ authenticate_with_open_id(@comment.author,
+ :optional => [:nickname, :fullname, :email]
+ ) do |result, identity_url, registration|
if result.status == :successful
@comment.post = @post
- @comment.author_url = @comment.author
- @comment.author = (registration["fullname"] || registration["nickname"] || @comment.author_url).to_s
- @comment.author_email = (registration["email"] || @comment.author_url).to_s
+ @comment.author_url = @comment.author
+ @comment.author = (
+ registration["fullname"] ||
+ registration["nickname"] ||
+ @comment.author_url
+ ).to_s
+ @comment.author_email = (
+ registration["email"] ||
+ @comment.author_url
+ ).to_s
@comment.openid_error = ""
session[:pending_comment] = nil
@@ -49,18 +57,29 @@ def create
@comment.openid_error = OPEN_ID_ERRORS[ result.status ]
end
end
+ else
+ @comment.blank_openid_fields
end
- if session[:pending_comment].nil? && @comment.save
- redirect_to post_path(@post)
- else
- render :template => 'posts/show'
+ # #authenticate_with_open_id may have already provided a response
+ unless response.headers[Rack::OpenID::AUTHENTICATE_HEADER]
+ if @comment.save
+ redirect_to post_path(@post)
+ else
+ render :template => 'posts/show'
+ end
end
end
protected
def find_post
- @post = Post.find_by_permalink(*[:year, :month, :day, :slug].collect {|x| params[x] })
+ @post = Post.find_by_permalink(*[:year, :month, :day, :slug].map {|x|
+ params[x]
+ })
+ end
+
+ def verify_authenticity_token_unless_openid
+ verify_authenticity_token unless using_open_id?
end
end
View
2  app/controllers/posts_controller.rb
@@ -3,8 +3,6 @@ def index
@tag = params[:tag]
@posts = Post.find_recent(:tag => @tag, :include => :tags)
- raise(ActiveRecord::RecordNotFound) if @tag && @posts.empty?
-
respond_to do |format|
format.html
format.atom { render :layout => false }
View
2  app/helpers/application_helper.rb
@@ -15,6 +15,6 @@ def format_comment_error(error)
'body' => 'Please comment',
'author' => 'Please provide your name or OpenID identity URL',
'base' => error.last
- }[error.first]
+ }[error.first.to_s]
end
end
View
8 app/helpers/page_title_helper.rb
@@ -15,6 +15,14 @@ def page_title(page)
compose_title(page.title)
end
+ def html_title(content)
+ if content.present?
+ content
+ else
+ enki_config[:title]
+ end
+ end
+
private
def compose_title(*parts)
View
2  app/helpers/url_helper.rb
@@ -6,7 +6,7 @@ def post_path(post, options = {})
path
end
- def post_comments_path(post)
+ def post_comments_path(post, comment)
post_path(post) + "/comments"
end
View
4 app/models/comment.rb
@@ -27,7 +27,9 @@ def blank_openid_fields
end
def requires_openid_authentication?
- !!self.author.index(".")
+ return false unless author
+
+ !!(author =~ %r{^https?://} || author.index('.'))
end
def trusted_user?
View
2  app/models/delete_post_undo.rb
@@ -7,7 +7,7 @@ def process!
transaction do
post = Post.create!(post_attributes)
loaded_data[:comments].each do |comment|
- post.comments.create!(comment.except('id'))
+ post.comments.create!(comment.except('id', 'post_id'))
end
self.destroy
end
View
7 app/models/post.rb
@@ -89,8 +89,9 @@ def find_all_grouped_by_month
def destroy_with_undo
transaction do
+ undo = DeletePostUndo.create_undo(self)
self.destroy
- return DeletePostUndo.create_undo(self)
+ return undo
end
end
@@ -104,7 +105,9 @@ def apply_filter
def set_dates
self.edited_at = Time.now if self.edited_at.nil? || !minor_edit?
- self.published_at = Chronic.parse(self.published_at_natural)
+ if new_published_at = Chronic.parse(self.published_at_natural)
+ self.published_at = new_published_at
+ end
end
def denormalize_comments_count!
View
2  app/models/tag.rb
@@ -17,7 +17,7 @@ class Tag < ActiveRecord::Base
end
cattr_accessor :destroy_unused
- self.destroy_unused = false
+ self.destroy_unused = true
# LIKE is used for cross-database case-insensitivity
def self.find_or_create_with_like_by_name(name)
View
12 app/models/tagging.rb
@@ -1,10 +1,12 @@
class Tagging < ActiveRecord::Base #:nodoc:
belongs_to :tag, :counter_cache => true
belongs_to :taggable, :class_name => 'Post', :foreign_key => 'taggable_id' #:polymorphic => true
-
- def self.after_destroy
- if Tag.destroy_unused and tag.taggings.count.zero?
- tag.destroy
- end
+
+ after_destroy :remove_unused_tags
+
+ private
+
+ def remove_unused_tags
+ Tag.destroy_all :taggings_count => 0 if Tag.destroy_unused
end
end
View
7 app/views/admin/comments/index.html.erb
@@ -1,10 +1,5 @@
-<% content_for(:head) do -%>
- <%= javascript_include_tag('jquery.form.js') %>
- <%= javascript_include_tag('admin/comments.js') %>
-<% end -%>
-
<h1><%= t('admin.comments.index.title') %></h1>
-<table>
+<table id='comments'>
<thead>
<tr>
<th><%= t('admin.comments.index.created_at') %></th>
View
4 app/views/admin/comments/show.html.erb
@@ -7,7 +7,7 @@
<%= form.input :author_email, :required => false, :label => t('admin.comments.form.author_email') %>
<%= form.input :body, :label => t('admin.comments.form.body'), :hint => t('admin.comments.form.body_hint.html') %>
<% end %>
- <%= form.buttons do -%>
- <%= form.commit_button(t('admin.comments.form.save')) %>
+ <%= form.actions do -%>
+ <%= form.action :submit, :as => :button, :label => t('admin.comments.form.save')%>
<% end -%>
<% end -%>
View
6 app/views/admin/dashboard/show.html.erb
@@ -1,9 +1,3 @@
-<% content_for(:head) do -%>
- <%= javascript_include_tag 'jquery.jfeed.js' %>
- <%= javascript_include_tag 'common' %>
- <%= javascript_include_tag 'admin/dashboard' %>
-<% end -%>
-
<div id="summary">
<h1><%= link_to(enki_config[:title], '/') %></h1>
<p class="stats"><%= t 'admin.dashboard.post', :count => @stats.post_count %>, <%= t 'admin.dashboard.comment', :count => @stats.comment_count %>, <%= t 'admin.dashboard.tag', :count => @stats.tag_count %></p>
View
4 app/views/admin/pages/_form.html.erb
@@ -1,7 +1,3 @@
-<% content_for(:head) do -%>
- <%= javascript_include_tag 'admin/edit-preview' %>
-<% end -%>
-
<%= form.inputs do -%>
<%= form.input :title, :label => t('admin.pages.form.title') %>
<%= form.input :slug, :label => t('admin.pages.form.slug'), :hint => t('admin.pages.form.slug_hint') %>
View
6 app/views/admin/pages/index.html.erb
@@ -1,10 +1,6 @@
-<% content_for(:head) do -%>
- <%= javascript_include_tag('admin/pages.js') %>
-<% end -%>
-
<h1><%= t('admin.pages.index.title') %></h1>
-<table>
+<table id='pages'>
<thead>
<tr>
<th><%= t('admin.pages.index.created_at') %></th>
View
6 app/views/admin/pages/new.html.erb
@@ -2,7 +2,7 @@
<%= semantic_form_for([:admin, @page]) do |form| -%>
<%= render :partial => 'form', :locals => {:form => form} %>
- <%= form.buttons do -%>
- <%= form.commit_button(t('admin.pages.form.save')) -%>
- <% end -%>
+ <%= form.actions do -%>
+ <%= form.action :submit, :as => :button, :label => t('admin.pages.form.save')-%>
+ <% end -%>
<% end -%>
View
4 app/views/admin/pages/show.html.erb
@@ -2,7 +2,7 @@
<%= semantic_form_for([:admin, @page]) do |form| -%>
<%= render :partial => 'form', :locals => {:form => form} %>
- <%= form.buttons do -%>
- <%= form.commit_button("Save") -%>
+ <%= form.actions do -%>
+ <%= form.action :submit, :as => :button -%>
<% end -%>
<% end -%>
View
4 app/views/admin/posts/_form.html.erb
@@ -1,7 +1,3 @@
-<% content_for(:head) do -%>
- <%= javascript_include_tag 'admin/edit-preview' %>
-<% end -%>
-
<%= form.inputs do -%>
<%= form.input :title, :label => t('admin.posts.form.title') -%>
<%= form.input :body, :label => t('admin.posts.form.body'), :hint => t('admin.posts.form.body_hint.html') -%>
View
2  app/views/admin/posts/_post.html.erb
@@ -6,7 +6,7 @@
<td>
<%= link_to(image_tag('silk/pencil.png', :alt => 'edit'), admin_post_path(post)) %>
<%= form_for(post, :as => :post, :url => admin_post_path(post), :html => {:class => 'delete-item', :method => :delete}) do |form| -%>
- <%= image_submit_tag("silk/delete.png", :alt => 'Delete Comment') %>
+ <%= image_submit_tag("silk/delete.png", :alt => 'Delete Post') %>
<% end -%>
</td>
</tr>
View
7 app/views/admin/posts/index.html.erb
@@ -1,9 +1,6 @@
-<% content_for(:head) do -%>
- <%= javascript_include_tag('admin/posts.js') %>
-<% end -%>
-
<h1><%= t('admin.posts.index.title') %></h1>
-<table>
+
+<table id='posts'>
<thead>
<tr>
<th><%= t('admin.posts.index.published_at') %></th>
View
4 app/views/admin/posts/new.html.erb
@@ -2,7 +2,7 @@
<%= semantic_form_for([:admin, @post]) do |form| -%>
<%= render :partial => 'form', :locals => {:form => form} -%>
- <%= form.buttons do -%>
- <%= form.commit_button(t('admin.posts.form.save')) -%>
+ <%= form.actions do -%>
+ <%= form.action :submit, :as => :button, :label => t('admin.posts.form.save')-%>
<% end -%>
<% end -%>
View
6 app/views/admin/posts/show.html.erb
@@ -2,7 +2,7 @@
<%= semantic_form_for([:admin, @post]) do |form| -%>
<%= render :partial => 'form', :locals => {:form => form} %>
- <%= form.buttons do -%>
- <%= form.commit_button(t('admin.posts.form.save')) -%>
- <% end -%>
+ <%= form.actions do -%>
+ <%= form.action :submit, :as => :button, :label => t('admin.posts.form.save')-%>
+ <% end -%>
<% end -%>
View
10 app/views/admin/tags/edit.html.erb
@@ -1,10 +0,0 @@
-<h1><%= t('admin.tags.edit.title', :permalink => link_to(@tag.name, posts_path(:tag => @tag)) ).html_safe %></h1>
-
-<%= semantic_form_for([:admin, @tag]) do |form| -%>
- <%= form.inputs do -%>
- <%= form.input :name, :label => t('admin.tags.form.name') %>
- <% end -%>
- <%= form.buttons do -%>
- <%= form.commit_button(t('admin.tags.form.save')) -%>
- <% end -%>
-<% end -%>
View
38 app/views/admin/tags/index.html.erb
@@ -1,38 +0,0 @@
-<h1><%= t('admin.tags.index.title') %></h1>
-
-<table>
- <thead>
- <tr>
- <th><%= t('admin.tags.index.name') %></th>
- <th><%= t('admin.tags.index.posts_tagged') %></th>
- <th><%= t('admin.tags.index.actions') %></th>
- </tr>
- </thead>
-
- <tbody>
- <% if @tags.empty? -%>
- <tr><td colspan="3"><%= t('admin.tags.index.no_tags') %></td></tr>
- <% else -%>
- <% @tags.each do |tag| -%>
- <tr class="<%= cycle('', 'alt') %>">
- <td><%= link_to(tag.name, edit_admin_tag_path(tag)) %></td>
- <td><%= tag.taggings.size %></td>
- <td>
- <%= link_to(image_tag('silk/pencil.png', :alt => 'edit'), edit_admin_tag_path(tag)) %>
- <%= link_to(image_tag("silk/delete.png"), admin_tag_path(tag), :method => :delete, :confirm => "You are about to delete this tag. It will be removed from all posts. This is permanent.\n\nAre you ABSOLUTELY sure?") %>
- </td>
- </tr>
- <% end -%>
- <% end -%>
- </tbody>
-
- <tfoot>
- <% if @tags.total_pages > 1 -%>
- <tr class="pagination">
- <td colspan='3'>
- <%= will_paginate(@tags, :previous_label => '« newer', :next_label => 'older »') %>
- </td>
- </tr>
- <% end -%>
- </tfoot>
-</table>
View
5 app/views/admin/undo_items/index.html.erb
@@ -1,8 +1,5 @@
-<% content_for(:head) do -%>
- <%= javascript_include_tag('admin/actions.js') %>
-<% end -%>
-
<h1><%= t('admin.actions.index.title') %></h1>
+
<table>
<thead>
<th><%= t('admin.actions.index.date') %></th>
View
17 app/views/layouts/admin.html.erb
@@ -5,16 +5,10 @@
<title><%= enki_config[:title] %> - <%= t 'admin.title' %> </title>
- <%= javascript_include_tag 'jquery.js' %>
- <%= javascript_include_tag 'jquery.livequery.js' %>
- <%= javascript_include_tag 'jquery.form.js' %>
- <%= javascript_include_tag 'jquery.easing.1.3.js' %>
- <%= javascript_include_tag 'humanmsg' %>
- <%= javascript_include_tag 'admin/shortcut' %>
- <%= javascript_include_tag 'admin/common' %>
+ <%= csrf_meta_tag %>
+
+ <%= javascript_include_tag 'admin' %>
- <%= stylesheet_link_tag 'formtastic' %>
- <%= stylesheet_link_tag 'humanmsg' %>
<%= stylesheet_link_tag 'admin' %>
<%= yield(:head) %>
@@ -38,10 +32,9 @@
<li><%= nav_link_to(t('admin.navigation.posts'), admin_posts_path, :accesskey => '2') %> <%= nav_link_to("(+)", new_admin_post_path, :accesskey => 'n') %></li>
<li><%= nav_link_to(t('admin.navigation.pages'), admin_pages_path, :accesskey => '3') %> <%= nav_link_to("(+)", new_admin_page_path, :accesskey => 'p') %></li>
<li><%= nav_link_to(t('admin.navigation.comments'), admin_comments_path, :accesskey => '4') %></li>
- <li><%= nav_link_to(t('admin.navigation.tags'), admin_tags_path, :accesskey => '5') %></li>
- <li><%= nav_link_to(t('admin.navigation.actions'), admin_undo_items_path, :accesskey => '6') %></li>
+ <li><%= nav_link_to(t('admin.navigation.actions'), admin_undo_items_path, :accesskey => '5') %></li>
<li><%= nav_link_to(t('admin.navigation.health'), admin_health_path, :accesskey => '6') %></li>
- <li class="separator">&nbsp;</li>
+ <li class="separator">&nbsp;</li>
<li><%= link_to(t('admin.navigation.logout'), admin_session_path, :accesskey => 'l', :method => :delete) %></li>
<li><%= link_to(t('admin.navigation.view_site'), '/', :accesskey => 'v', :title => t('admin.navigation.view_site')) %></li>
</ul>
View
45 app/views/layouts/application.html.erb
@@ -2,19 +2,21 @@
<html dir="ltr" lang="en-US">
<head>
<meta charset="utf-8">
- <title><%= yield(:page_title) || enki_config[:title] %></title>
+ <title><%= html_title yield(:page_title) %></title>
+ <%= csrf_meta_tag %>
<%= stylesheet_link_tag 'application' %>
- <%= javascript_include_tag 'jquery' %>
+ <%= javascript_include_tag 'application' %>
<%= open_id_delegation_link_tags(enki_config[:open_id_delegation, :server], enki_config[:open_id_delegation, :delegate]) if enki_config[:open_id_delegation] %>
<%= yield(:head) %>
</head>
<body>
<div id="page_container">
- <h1 id="page_heading"><a href="<%= root_url %>"><%= enki_config[:title] %></a></h1>
+ <div id="content">
+ <h1 id="page_heading"><a href="<%= root_url %>"><%= enki_config[:title] %></a></h1>
- <div id="main">
- <%= yield %>
- </div>
+ <div id="main">
+ <%= yield %>
+ </div>
<div id="navigation">
<h2><%= t 'pages.menu.pages_title' %></h2>
@@ -25,23 +27,24 @@
</ul>
<% unless category_links_for_navigation.empty? -%>
<h2><%= t 'pages.menu.categories_title' %></h2>
- <ul>
- <% category_links_for_navigation.each do |link| -%>
- <li><%= link_to(link.name, link.url) %></li>
- <% end -%>
- </ul>
- <% end -%>
- <form method="get" id="sform" action="http://www.google.com/search">
- <div>
- <h2><label for="q"><%= t 'pages.menu.search_title' %></label></h2>
+ <ul>
+ <% category_links_for_navigation.each do |link| -%>
+ <li><%= link_to(link.name, link.url) %></li>
+ <% end -%>
+ </ul>
+ <% end -%>
+ <form method="get" id="sform" action="http://www.google.com/search">
+ <div>
+ <h2><label for="q"><%= t 'pages.menu.search_title' %></label></h2>
- <input type="text" id="q" value="" name="q">
- <input type="hidden" name="sitesearch" value="<%= enki_config[:url] %>">
- </div>
- </form>
- </div>
+ <input type="text" id="q" value="" name="q">
+ <input type="hidden" name="sitesearch" value="<%= enki_config[:url] %>">
+ </div>
+ </form>
+ </div>
- <div id="footer"><%= enki_config[:title] %> &#169; <%= enki_config[:author, :name] %>. Valid <a href="http://validator.w3.org/check?uri=referer">HTML5</a> and <%= link_to "ATOM", "http://feedvalidator.org/check.cgi?url=#{enki_config[:url]}/posts.atom" %>. Powered by <a href="http://www.enkiblog.com" title="A Ruby on Rails blogging app for the fashionable developer">Enki</a>.</div>
+ <div id="footer"><%= enki_config[:title] %> &#169; <%= enki_config[:author, :name] %>. Valid <a href="http://validator.w3.org/check?uri=referer">HTML5</a> and <%= link_to "ATOM", "http://feedvalidator.org/check.cgi?url=#{enki_config[:url]}/posts.atom" %>. Powered by <a href="http://www.enkiblog.com" title="A Ruby on Rails blogging app for the fashionable developer">Enki</a>.</div>
+ </div>
</div>
</body>
</html>
View
8 app/views/posts/index.atom.builder
@@ -1,5 +1,11 @@
+url = if @tag.nil?
+ formatted_posts_path(:format => 'atom', :only_path => false)
+else
+ posts_path(:tag => @tag, :format => 'atom', :only_path => false)
+end
+
atom_feed(
- :url => posts_path(:tag => @tag, :format => 'atom', :only_path => false),
+ :url => url,
:root_url => posts_path(:tag => @tag, :only_path => false),
:schema_date => '2008'
) do |feed|
View
4 app/views/posts/show.html.erb
@@ -1,7 +1,3 @@
-<% content_for(:head) do -%>
- <%= javascript_include_tag 'common' %>
- <%= javascript_include_tag 'live-comment-preview' %>
-<% end -%>
<% content_for(:page_title) do -%>
<%= post_title(@post) -%>
<% end -%>
View
BIN  config/.DS_Store
Binary file not shown
View
41 config/application.rb
@@ -1,10 +1,24 @@
require File.expand_path('../boot', __FILE__)
-require 'rails/all'
+# Pick the frameworks you want:
+require "active_record/railtie"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "active_resource/railtie"
+require "sprockets/railtie"
+# require "rails/test_unit/railtie"
-# If you have a Gemfile, require the gems listed there, including any gems
-# you've limited to :test, :development, or :production.
-Bundler.require(:default, Rails.env) if defined?(Bundler)
+# Bundler 1.0.10 incorrectly activates the new experimental Psych YAML parser
+# in 1.9.2, which breaks on RedCloth. This hack reverts it, but can be removed
+# once it is all sorted out. The const_defined check is required for 1.8.7 compat.
+YAML::ENGINE.yamler = "syck" if YAML.const_defined?("ENGINE")
+
+if defined?(Bundler)
+ # If you precompile assets before deploying to production, use this line
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
+ # If you want your assets lazily compiled in production, use this line
+ # Bundler.require(:default, :assets, Rails.env)
+end
module Enki
class Application < Rails::Application
@@ -30,9 +44,6 @@ class Application < Rails::Application
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
- # JavaScript files you want as :defaults (application.js is always included).
- config.action_view.javascript_expansions[:defaults] = %w()
-
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
@@ -40,5 +51,21 @@ class Application < Rails::Application
config.filter_parameters += [:password]
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
+ # Use SQL instead of Active Record's schema dumper when creating the database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Enforce whitelist mode for mass assignment.
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
+ # parameters by using an attr_accessible or attr_protected declaration.
+ # config.active_record.whitelist_attributes = true
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+
+ # Version of your assets, change this if you want to expire all your assets
+ config.assets.version = '1.0'
end
end
View
13 config/boot.rb
@@ -1,13 +1,6 @@
require 'rubygems'
# Set up gems listed in the Gemfile.
-gemfile = File.expand_path('../../Gemfile', __FILE__)
-begin
- ENV['BUNDLE_GEMFILE'] = gemfile
- require 'bundler'
- Bundler.setup
-rescue Bundler::GemNotFound => e
- STDERR.puts e.message
- STDERR.puts "Try running `bundle install`."
- exit!
-end if File.exist?(gemfile)
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
View
2  config/cucumber.yml
@@ -1,7 +1,7 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
-std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
+std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
View
1  config/database.example.yml
@@ -1,4 +1,5 @@
# SQLite version 3.x
+#
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
View
14 config/environments/development.rb
@@ -1,9 +1,9 @@
Enki::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
+ # Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
- # every request. This slows down response time but is perfect for development
- # since you don't have to restart the webserver when you make code changes.
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
@@ -11,7 +11,6 @@
# Show full error reports and disable caching
config.consider_all_requests_local = true
- config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
@@ -22,5 +21,12 @@
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
+
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
end
View
43 config/environments/production.rb
@@ -1,7 +1,6 @@
Enki::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
+ # Settings specified here will take precedence over those in config/application.rb
- # The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
@@ -9,31 +8,46 @@
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
- # Specifies the header that your server uses for sending files
- config.action_dispatch.x_sendfile_header = "X-Sendfile"
+ # Disable Rails's static asset server (Apache or nginx will already do this)
+ config.serve_static_assets = false
+
+ # Compress JavaScripts and CSS
+ config.assets.compress = true
+
+ # Don't fallback to assets pipeline if a precompiled asset is missed
+ config.assets.compile = false
+
+ # Generate digests for assets URLs
+ config.assets.digest = true
+
+ # Defaults to Rails.root.join("public/assets")
+ # config.assets.manifest = YOUR_PATH
- # For nginx:
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
+ # Specifies the header that your server uses for sending files
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
- # If you have no front-end server that supports something like X-Sendfile,
- # just comment this out and Rails will serve the files
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
+ # Prepend all log lines with the following tags
+ # config.log_tags = [ :subdomain, :uuid ]
+
# Use a different logger for distributed setups
- # config.logger = SyslogLogger.new
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
- # Disable Rails's static asset server
- # In production, Apache or nginx will already do this
- config.serve_static_assets = false
-
- # Enable serving of images, stylesheets, and javascripts from an asset server
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
+ config.assets.precompile += %w( admin.css admin.js login.css )
+
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
@@ -46,4 +60,5 @@
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify