nweintraut-forem 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 (195) hide show
  1. data/.gitignore +7 -0
  2. data/Gemfile +17 -0
  3. data/Gemfile.lock +136 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.rdoc +3 -0
  6. data/Rakefile +45 -0
  7. data/app/assets/images/forem/.gitkeep +0 -0
  8. data/app/assets/javascripts/forem/application.js +15 -0
  9. data/app/assets/javascripts/forem/forem/goofy.js +2 -0
  10. data/app/assets/javascripts/forem/goofy.js +2 -0
  11. data/app/assets/javascripts/forem/placeholder.js +2 -0
  12. data/app/assets/javascripts/forem/posts.js +2 -0
  13. data/app/assets/javascripts/forem/topics.js +2 -0
  14. data/app/assets/stylesheets/forem/application.css +13 -0
  15. data/app/assets/stylesheets/forem/forem/goofy.css +4 -0
  16. data/app/assets/stylesheets/forem/goofy.css +4 -0
  17. data/app/assets/stylesheets/forem/placeholder.css +4 -0
  18. data/app/assets/stylesheets/forem/posts.css +4 -0
  19. data/app/assets/stylesheets/forem/topics.css +4 -0
  20. data/app/controllers/forem/application_controller.rb +4 -0
  21. data/app/controllers/forem/placeholder_controller.rb +2 -0
  22. data/app/controllers/forem/posts_controller.rb +25 -0
  23. data/app/controllers/forem/topics_controller.rb +35 -0
  24. data/app/helpers/forem/application_helper.rb +4 -0
  25. data/app/helpers/forem/placeholder_helper.rb +2 -0
  26. data/app/helpers/forem/posts_helper.rb +2 -0
  27. data/app/helpers/forem/topics_helper.rb +2 -0
  28. data/app/models/forem/post.rb +5 -0
  29. data/app/models/forem/topic.rb +14 -0
  30. data/app/models/forem.rb +5 -0
  31. data/app/views/forem/posts/_form.html.erb +4 -0
  32. data/app/views/forem/posts/_post.html.erb +11 -0
  33. data/app/views/forem/posts/new.html.erb +5 -0
  34. data/app/views/forem/topics/_form.html.erb +10 -0
  35. data/app/views/forem/topics/index.html.erb +27 -0
  36. data/app/views/forem/topics/new.html.erb +2 -0
  37. data/app/views/forem/topics/show.html.erb +6 -0
  38. data/app/views/layouts/forem/_application.html.erb +13 -0
  39. data/bin/autospec +16 -0
  40. data/bin/erubis +16 -0
  41. data/bin/htmldiff +16 -0
  42. data/bin/ldiff +16 -0
  43. data/bin/nokogiri +16 -0
  44. data/bin/rackup +16 -0
  45. data/bin/rails +16 -0
  46. data/bin/rake +16 -0
  47. data/bin/rake2thor +16 -0
  48. data/bin/rdoc +16 -0
  49. data/bin/ri +16 -0
  50. data/bin/rspec +16 -0
  51. data/bin/thor +16 -0
  52. data/bin/tilt +16 -0
  53. data/bin/tt +16 -0
  54. data/config/routes.rb +6 -0
  55. data/db/migrate/20120501042813_create_forem_topics.rb +10 -0
  56. data/db/migrate/20120501050428_create_forem_posts.rb +11 -0
  57. data/db/migrate/20120501064638_add_posts_count_to_forem_topics.rb +5 -0
  58. data/db/migrate/20120520151511_add_user_id_to_forem_topics.rb +5 -0
  59. data/lib/forem/engine.rb +14 -0
  60. data/lib/forem/version.rb +3 -0
  61. data/lib/forem.rb +6 -0
  62. data/lib/tasks/forem_tasks.rake +4 -0
  63. data/nweintraut-forem.gemspec +28 -0
  64. data/script/rails +9 -0
  65. data/spec/configuration_spec.rb +17 -0
  66. data/spec/dummy/README.rdoc +261 -0
  67. data/spec/dummy/Rakefile +7 -0
  68. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  69. data/spec/dummy/app/assets/javascripts/forem/goofy.js +2 -0
  70. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  71. data/spec/dummy/app/assets/stylesheets/forem/goofy.css +4 -0
  72. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  73. data/spec/dummy/app/controllers/fake_controller.rb +5 -0
  74. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  75. data/spec/dummy/app/mailers/.gitkeep +0 -0
  76. data/spec/dummy/app/models/.gitkeep +0 -0
  77. data/spec/dummy/app/models/user.rb +6 -0
  78. data/spec/dummy/app/views/layouts/application.html.erb +16 -0
  79. data/spec/dummy/config/application.rb +56 -0
  80. data/spec/dummy/config/boot.rb +10 -0
  81. data/spec/dummy/config/database.yml +56 -0
  82. data/spec/dummy/config/environment.rb +5 -0
  83. data/spec/dummy/config/environments/development.rb +37 -0
  84. data/spec/dummy/config/environments/production.rb +67 -0
  85. data/spec/dummy/config/environments/test.rb +37 -0
  86. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  87. data/spec/dummy/config/initializers/forem.rb +1 -0
  88. data/spec/dummy/config/initializers/inflections.rb +15 -0
  89. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  90. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  91. data/spec/dummy/config/initializers/session_store.rb +8 -0
  92. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  93. data/spec/dummy/config/locales/en.yml +5 -0
  94. data/spec/dummy/config/routes.rb +5 -0
  95. data/spec/dummy/config.ru +4 -0
  96. data/spec/dummy/db/migrate/20120501050517_create_forem_topics.forem.rb_ +11 -0
  97. data/spec/dummy/db/migrate/20120501050518_create_forem_posts.forem.rb_ +12 -0
  98. data/spec/dummy/db/migrate/20120501064803_add_posts_count_to_forem_topics.forem.rb +6 -0
  99. data/spec/dummy/db/migrate/20120520055828_create_users.rb +9 -0
  100. data/spec/dummy/db/schema.rb +38 -0
  101. data/spec/dummy/lib/assets/.gitkeep +0 -0
  102. data/spec/dummy/log/.gitkeep +0 -0
  103. data/spec/dummy/log/development.log +1745 -0
  104. data/spec/dummy/log/test.log +8320 -0
  105. data/spec/dummy/public/404.html +26 -0
  106. data/spec/dummy/public/422.html +26 -0
  107. data/spec/dummy/public/500.html +25 -0
  108. data/spec/dummy/public/favicon.ico +0 -0
  109. data/spec/dummy/script/rails +6 -0
  110. data/spec/dummy/test/fixtures/users.yml +7 -0
  111. data/spec/dummy/test/functional/forem/goofy_controller_test.rb +7 -0
  112. data/spec/dummy/test/unit/helpers/forem/goofy_helper_test.rb +4 -0
  113. data/spec/dummy/test/unit/user_test.rb +7 -0
  114. data/spec/dummy/tmp/cache/assets/C83/890/sprockets%2F04b7712512f728c84bb2dd94742c5909 +0 -0
  115. data/spec/dummy/tmp/cache/assets/CC8/790/sprockets%2Fce93eb9b88e2d7904b44649437f51169 +0 -0
  116. data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  117. data/spec/dummy/tmp/cache/assets/CE7/8B0/sprockets%2F077815b5af9649318a9a2fc603e184bf +0 -0
  118. data/spec/dummy/tmp/cache/assets/D0D/490/sprockets%2F314449a2a810fe259b55ceae428f0c87 +0 -0
  119. data/spec/dummy/tmp/cache/assets/D28/030/sprockets%2Ffd60a7a8345f40bfb0264ac5085c23a0 +0 -0
  120. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  121. data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  122. data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  123. data/spec/dummy/tmp/cache/assets/DA2/6B0/sprockets%2F8f1fcf792b440d9cb2ad3f9b1836e4a3 +0 -0
  124. data/spec/dummy/tmp/cache/assets/DC0/120/sprockets%2F8eb27b4d88f6595dc5ee7eb679cc367c +0 -0
  125. data/spec/dummy/tmp/cache/assets/DD5/5A0/sprockets%2F82bc4ebce47cb9dc9e38557bda8c0092 +0 -0
  126. data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  127. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  128. data/spec/integration/posts_spec.rb +51 -0
  129. data/spec/integration/topics_spec.rb +40 -0
  130. data/spec/spec_helper.rb +20 -0
  131. data/spec/support/capybara.rb +7 -0
  132. data/spec/support/dummy_login.rb +17 -0
  133. data/spec/support/load_routes.rb +3 -0
  134. data/test/dummy/README.rdoc +261 -0
  135. data/test/dummy/Rakefile +7 -0
  136. data/test/dummy/app/assets/javascripts/application.js +15 -0
  137. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  138. data/test/dummy/app/controllers/application_controller.rb +3 -0
  139. data/test/dummy/app/helpers/application_helper.rb +2 -0
  140. data/test/dummy/app/mailers/.gitkeep +0 -0
  141. data/test/dummy/app/models/.gitkeep +0 -0
  142. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  143. data/test/dummy/config/application.rb +56 -0
  144. data/test/dummy/config/boot.rb +10 -0
  145. data/test/dummy/config/database.yml +55 -0
  146. data/test/dummy/config/environment.rb +5 -0
  147. data/test/dummy/config/environments/development.rb +37 -0
  148. data/test/dummy/config/environments/production.rb +67 -0
  149. data/test/dummy/config/environments/test.rb +37 -0
  150. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  151. data/test/dummy/config/initializers/inflections.rb +15 -0
  152. data/test/dummy/config/initializers/mime_types.rb +5 -0
  153. data/test/dummy/config/initializers/secret_token.rb +7 -0
  154. data/test/dummy/config/initializers/session_store.rb +8 -0
  155. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  156. data/test/dummy/config/locales/en.yml +5 -0
  157. data/test/dummy/config/routes.rb +4 -0
  158. data/test/dummy/config.ru +4 -0
  159. data/test/dummy/db/migrate/20120501044219_create_forem_topics.forem.rb +11 -0
  160. data/test/dummy/db/schema.rb +23 -0
  161. data/test/dummy/lib/assets/.gitkeep +0 -0
  162. data/test/dummy/log/.gitkeep +0 -0
  163. data/test/dummy/log/development.log +3588 -0
  164. data/test/dummy/public/404.html +26 -0
  165. data/test/dummy/public/422.html +26 -0
  166. data/test/dummy/public/500.html +25 -0
  167. data/test/dummy/public/favicon.ico +0 -0
  168. data/test/dummy/script/rails +6 -0
  169. data/test/dummy/tmp/cache/assets/CC8/790/sprockets%2Fce93eb9b88e2d7904b44649437f51169 +0 -0
  170. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  171. data/test/dummy/tmp/cache/assets/D0D/490/sprockets%2F314449a2a810fe259b55ceae428f0c87 +0 -0
  172. data/test/dummy/tmp/cache/assets/D28/030/sprockets%2Ffd60a7a8345f40bfb0264ac5085c23a0 +0 -0
  173. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  174. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  175. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  176. data/test/dummy/tmp/cache/assets/DA2/6B0/sprockets%2F8f1fcf792b440d9cb2ad3f9b1836e4a3 +0 -0
  177. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  178. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  179. data/test/fixtures/forem/posts.yml +11 -0
  180. data/test/fixtures/forem/topics.yml +9 -0
  181. data/test/fixtures/topics.yml +9 -0
  182. data/test/forem_test.rb +7 -0
  183. data/test/functional/forem/placeholder_controller_test.rb +7 -0
  184. data/test/functional/forem/posts_controller_test.rb +7 -0
  185. data/test/functional/forem/topics_controller_test.rb +7 -0
  186. data/test/integration/navigation_test.rb +10 -0
  187. data/test/test_helper.rb +15 -0
  188. data/test/unit/forem/post_test.rb +7 -0
  189. data/test/unit/forem/topic_test.rb +7 -0
  190. data/test/unit/helpers/forem/goofy_helper_test.rb +4 -0
  191. data/test/unit/helpers/forem/placeholder_helper_test.rb +4 -0
  192. data/test/unit/helpers/forem/posts_helper_test.rb +4 -0
  193. data/test/unit/helpers/forem/topics_helper_test.rb +4 -0
  194. data/test/unit/topic_test.rb +7 -0
  195. metadata +357 -0
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/log/*.log
6
+ test/dummy/tmp/
7
+ test/dummy/.sass-cache
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in forem.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # jquery-rails is used by the dummy application
9
+ gem "jquery-rails"
10
+
11
+ # Declare any dependencies that are still in development here instead of in
12
+ # your gemspec. These might include edge Rails or gems from your path or
13
+ # Git. Remember to move these dependencies to your gemspec before releasing
14
+ # your gem to rubygems.org.
15
+
16
+ # To use debugger
17
+ # gem 'ruby-debug19', :require => 'ruby-debug'
data/Gemfile.lock ADDED
@@ -0,0 +1,136 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nweintraut-forem (0.0.1)
5
+ rails (~> 3.2.3)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.3)
11
+ actionpack (= 3.2.3)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.2.3)
14
+ activemodel (= 3.2.3)
15
+ activesupport (= 3.2.3)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.1)
19
+ rack (~> 1.4.0)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.1.2)
23
+ activemodel (3.2.3)
24
+ activesupport (= 3.2.3)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.3)
27
+ activemodel (= 3.2.3)
28
+ activesupport (= 3.2.3)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.3)
32
+ activemodel (= 3.2.3)
33
+ activesupport (= 3.2.3)
34
+ activesupport (3.2.3)
35
+ i18n (~> 0.6)
36
+ multi_json (~> 1.0)
37
+ addressable (2.2.7)
38
+ arel (3.0.2)
39
+ builder (3.0.0)
40
+ capybara (1.1.2)
41
+ mime-types (>= 1.16)
42
+ nokogiri (>= 1.3.3)
43
+ rack (>= 1.0.0)
44
+ rack-test (>= 0.5.4)
45
+ selenium-webdriver (~> 2.0)
46
+ xpath (~> 0.1.4)
47
+ childprocess (0.3.2)
48
+ ffi (~> 1.0.6)
49
+ diff-lcs (1.1.3)
50
+ erubis (2.7.0)
51
+ ffi (1.0.11)
52
+ hike (1.2.1)
53
+ i18n (0.6.0)
54
+ journey (1.0.3)
55
+ jquery-rails (2.0.2)
56
+ railties (>= 3.2.0, < 5.0)
57
+ thor (~> 0.14)
58
+ json (1.7.0)
59
+ libwebsocket (0.1.3)
60
+ addressable
61
+ mail (2.4.4)
62
+ i18n (>= 0.4.0)
63
+ mime-types (~> 1.16)
64
+ treetop (~> 1.4.8)
65
+ mime-types (1.18)
66
+ multi_json (1.3.4)
67
+ nokogiri (1.5.2)
68
+ pg (0.13.2)
69
+ polyglot (0.3.3)
70
+ rack (1.4.1)
71
+ rack-cache (1.2)
72
+ rack (>= 0.4)
73
+ rack-ssl (1.3.2)
74
+ rack
75
+ rack-test (0.6.1)
76
+ rack (>= 1.0)
77
+ rails (3.2.3)
78
+ actionmailer (= 3.2.3)
79
+ actionpack (= 3.2.3)
80
+ activerecord (= 3.2.3)
81
+ activeresource (= 3.2.3)
82
+ activesupport (= 3.2.3)
83
+ bundler (~> 1.0)
84
+ railties (= 3.2.3)
85
+ railties (3.2.3)
86
+ actionpack (= 3.2.3)
87
+ activesupport (= 3.2.3)
88
+ rack-ssl (~> 1.3.2)
89
+ rake (>= 0.8.7)
90
+ rdoc (~> 3.4)
91
+ thor (~> 0.14.6)
92
+ rake (0.9.2.2)
93
+ rdoc (3.12)
94
+ json (~> 1.4)
95
+ rspec (2.9.0)
96
+ rspec-core (~> 2.9.0)
97
+ rspec-expectations (~> 2.9.0)
98
+ rspec-mocks (~> 2.9.0)
99
+ rspec-core (2.9.0)
100
+ rspec-expectations (2.9.1)
101
+ diff-lcs (~> 1.1.3)
102
+ rspec-mocks (2.9.0)
103
+ rspec-rails (2.9.0)
104
+ actionpack (>= 3.0)
105
+ activesupport (>= 3.0)
106
+ railties (>= 3.0)
107
+ rspec (~> 2.9.0)
108
+ rubyzip (0.9.8)
109
+ selenium-webdriver (2.21.2)
110
+ childprocess (>= 0.2.5)
111
+ ffi (~> 1.0)
112
+ libwebsocket (~> 0.1.3)
113
+ multi_json (~> 1.0)
114
+ rubyzip
115
+ sprockets (2.1.3)
116
+ hike (~> 1.2)
117
+ rack (~> 1.0)
118
+ tilt (~> 1.1, != 1.3.0)
119
+ thor (0.14.6)
120
+ tilt (1.3.3)
121
+ treetop (1.4.10)
122
+ polyglot
123
+ polyglot (>= 0.3.1)
124
+ tzinfo (0.3.33)
125
+ xpath (0.1.4)
126
+ nokogiri (~> 1.3)
127
+
128
+ PLATFORMS
129
+ ruby
130
+
131
+ DEPENDENCIES
132
+ capybara
133
+ jquery-rails
134
+ nweintraut-forem!
135
+ pg
136
+ rspec-rails
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
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.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = Forem
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,45 @@
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 = 'Forem'
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
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
25
+ load 'rails/tasks/engine.rake'
26
+
27
+
28
+
29
+ Bundler::GemHelper.install_tasks
30
+
31
+ require 'rake/testtask'
32
+
33
+ # Rake::TestTask.new(:test) do |t|
34
+ # t.libs << 'lib'
35
+ # t.libs << 'test'
36
+ # t.pattern = 'test/**/*_test.rb'
37
+ # t.verbose = false
38
+ # end
39
+
40
+
41
+ # task :default => :test
42
+ require 'rspec/core/rake_task'
43
+ RSpec::Core::RakeTask.new(:spec)
44
+ task default: :spec
45
+ Bundler::GemHelper.install_tasks
File without changes
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ module Forem
2
+ class ApplicationController < ::ApplicationController
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class Forem::PlaceholderController < ApplicationController
2
+ end
@@ -0,0 +1,25 @@
1
+ module Forem
2
+ class PostsController < ApplicationController
3
+ before_filter :find_topic
4
+ before_filter :authenticate_forem_user!, only: [:new, :create]
5
+ def new
6
+ @post = @topic.posts.build
7
+ end
8
+ def create
9
+ @post = @topic.posts.create(params[:post].merge!(user_id: current_user.id))
10
+ flash[:notice] = "Post has been created!"
11
+ redirect_to topic_path(@topic)
12
+ end
13
+ private
14
+ def find_topic
15
+ @topic = Forem::Topic.find(params[:topic_id])
16
+ end
17
+ def authenticate_forem_user!
18
+
19
+ if !current_user
20
+ flash[:notice] = "You must be authenticated before you can do that."
21
+ redirect_to main_app.sign_in_url
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,35 @@
1
+ class Forem::TopicsController < ApplicationController
2
+ before_filter :authenticate_forem_user!, only: [:new, :create]
3
+
4
+ helper_method :current_user
5
+ def index
6
+ @topics = Forem::Topic.all
7
+ end
8
+
9
+ def new
10
+ @topic = Forem::Topic.new
11
+ @topic.posts.build
12
+ end
13
+ def create
14
+ rawtopic = params[:topic][:subject]
15
+ @topic = Forem::Topic.create({user_id: current_user.id, subject: rawtopic})
16
+ rawposts = params[:topic][:posts_attributes]
17
+ rawposts.each do |raw|
18
+ @topic.posts.create(text: raw[1][:text])
19
+ end
20
+ @topic.save!
21
+ flash[:notice] = "Topic has been created!"
22
+ redirect_to @topic
23
+ end
24
+ def show
25
+ @topic = Forem::Topic.find(params[:id])
26
+ end
27
+ private
28
+ def authenticate_forem_user!
29
+
30
+ if !current_user
31
+ flash[:notice] = "You must be authenticated before you can do that."
32
+ redirect_to main_app.sign_in_url
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,4 @@
1
+ module Forem
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ module Forem::PlaceholderHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module Forem::PostsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module Forem::TopicsHelper
2
+ end
@@ -0,0 +1,5 @@
1
+ class Forem::Post < ActiveRecord::Base
2
+ belongs_to :topic, counter_cache: true
3
+ attr_accessible :text, :topic_id, :user_id
4
+ belongs_to :user, class_name: Forem::Engine.user_class.to_s
5
+ end
@@ -0,0 +1,14 @@
1
+ class Forem::Topic < ActiveRecord::Base
2
+ has_many :posts, order: "created_at ASC"
3
+ accepts_nested_attributes_for :posts
4
+ attr_accessible :subject, :user_id
5
+ belongs_to :user, :class_name => Forem::Engine.user_class.to_s
6
+ before_save :set_post_user
7
+ has_one :last_post, class_name: "Forem::Post", order: "created_at DESC"
8
+ private
9
+ def set_post_user
10
+ if self.posts.first != nil then
11
+ self.posts.first.user = self.user
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ module Forem
2
+ def self.table_name_prefix
3
+ 'forem_'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ <p>
2
+ <%= post.label :text %>
3
+ <%= post.text_area :text %>
4
+ </p>
@@ -0,0 +1,11 @@
1
+ <%= div_for(post) do %>
2
+ <small>Written at <%= post.created_at %></small>
3
+ <small class='user'>By <%= post.user %></small>
4
+ <p>
5
+ <%= "Post: [Text: #{post.text}, "%>
6
+ <%= "post_id: #{post.topic_id}, "%>
7
+ <%= "user_id: #{[post.user_id]}]" %>
8
+ </p>
9
+ <%= simple_format(post.text) %>
10
+ <%= link_to "Reply", new_topic_post_path(@topic)%>
11
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <h2>New Post</h2>
2
+ <%= form_for [@topic, @post] do |post| %>
3
+ <%= render partial: "form", locals: {post: post} %>
4
+ <%= post.submit %>
5
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <%= form_for @topic do |f| %>
2
+ <p>
3
+ <%= f.label :subject%>
4
+ <%= f.text_field :subject %>
5
+ </p>
6
+ <%= f.fields_for :posts do |post| %>
7
+ <%= render partial: "forem/posts/form", locals: {post: post} %>
8
+ <% end %>
9
+ <%= f.submit %>
10
+ <% end %>
@@ -0,0 +1,27 @@
1
+ <h1>Topics</h1>
2
+
3
+ <% if current_user %>
4
+ <%= link_to "New Topic", new_topic_path %>
5
+ <% end %>
6
+ <% if @topics.empty? %>
7
+ There are currently no topics
8
+ <% else %>
9
+ <table id='topics'>
10
+ <thead>
11
+ <tr>
12
+ <td>Subject</td><td>Posts</td><td>Last post at</td>
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ <% @topics.each do |topic| %>
17
+ <tr>
18
+ <td id='topic_subject'><%= link_to topic.subject, topic %></td>
19
+ <td id='posts_count'><%= topic.posts_count %></td>
20
+ <td id='last_post'>
21
+ last post was <%= time_ago_in_words(topic.last_post.created_at) %> ago by <%= topic.last_post.user %>
22
+ </td>
23
+ </tr>
24
+ <% end %>
25
+ </tbody>
26
+ </table>
27
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <h1>New Topic</h1>
2
+ <%= render "form" %>
@@ -0,0 +1,6 @@
1
+ <%= div_for @topic do %>
2
+ <h1><%= @topic.subject %></h1>
3
+ <div id='posts'>
4
+ <%= render partial: "forem/posts/post", collection: @topic.posts %>
5
+ </div>
6
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Forem</title>
5
+ <%= stylesheet_link_tag "forem/application", :media => "all" %>
6
+ <%= javascript_include_tag "forem/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+ <%= yield %>
11
+
12
+ </body>
13
+ </html>
data/bin/autospec ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'autospec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'autospec')
data/bin/erubis ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'erubis' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('erubis', 'erubis')
data/bin/htmldiff ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'htmldiff' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('diff-lcs', 'htmldiff')
data/bin/ldiff ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'ldiff' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('diff-lcs', 'ldiff')
data/bin/nokogiri ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'nokogiri' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('nokogiri', 'nokogiri')
data/bin/rackup ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rackup' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rack', 'rackup')
data/bin/rails ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rails' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('railties', 'rails')