cornerstone 0.0.1 → 0.0.5

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 (177) hide show
  1. data/.gitignore +6 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +23 -0
  4. data/Gemfile.lock +168 -0
  5. data/Guardfile +22 -0
  6. data/README.rdoc +4 -1
  7. data/Rakefile +11 -1
  8. data/TODO +11 -0
  9. data/VERSION +1 -0
  10. data/app/assets/images/.gitkeep +0 -0
  11. data/app/assets/javascripts/.gitkeep +0 -0
  12. data/app/assets/javascripts/cornerstone.js +11 -0
  13. data/app/assets/javascripts/cornerstone/discussions.js +2 -0
  14. data/app/assets/javascripts/cornerstone/help.js +2 -0
  15. data/app/assets/stylesheets/.gitkeep +0 -0
  16. data/app/assets/stylesheets/cornerstone.css +8 -0
  17. data/app/assets/stylesheets/cornerstone/discussions.css +4 -0
  18. data/app/assets/stylesheets/cornerstone/help.css +4 -0
  19. data/app/controllers/.gitkeep +0 -0
  20. data/app/controllers/cornerstone/admin/application_controller.rb +7 -0
  21. data/app/controllers/cornerstone/admin/articles_controller.rb +61 -0
  22. data/app/controllers/cornerstone/admin/categories_controller.rb +46 -0
  23. data/app/controllers/cornerstone/admin/discussions_controller.rb +32 -0
  24. data/app/controllers/cornerstone/application_controller.rb +6 -0
  25. data/app/controllers/cornerstone/discussions_controller.rb +58 -0
  26. data/app/controllers/cornerstone/help_controller.rb +11 -0
  27. data/app/controllers/cornerstone/posts_controller.rb +66 -0
  28. data/app/helpers/.gitkeep +0 -0
  29. data/app/helpers/cornerstone/application_helper.rb +5 -0
  30. data/app/helpers/cornerstone/discussions_helper.rb +16 -0
  31. data/app/helpers/cornerstone/help_helper.rb +4 -0
  32. data/app/mailers/cornerstone/cornerstone_mailer.rb +31 -0
  33. data/app/models/.gitkeep +0 -0
  34. data/app/models/cornerstone/article.rb +20 -0
  35. data/app/models/cornerstone/category.rb +45 -0
  36. data/app/models/cornerstone/discussion.rb +90 -0
  37. data/app/models/cornerstone/post.rb +103 -0
  38. data/app/models/cornerstone/post_observer.rb +23 -0
  39. data/app/views/.gitkeep +0 -0
  40. data/app/views/cornerstone/admin/articles/_article.html.erb +9 -0
  41. data/app/views/cornerstone/admin/articles/_form.html.erb +22 -0
  42. data/app/views/cornerstone/admin/articles/edit.html.erb +7 -0
  43. data/app/views/cornerstone/admin/articles/index.html.erb +25 -0
  44. data/app/views/cornerstone/admin/articles/new.html.erb +6 -0
  45. data/app/views/cornerstone/admin/articles/show.html.erb +4 -0
  46. data/app/views/cornerstone/admin/categories/_category.html.erb +12 -0
  47. data/app/views/cornerstone/admin/categories/_form.html.erb +17 -0
  48. data/app/views/cornerstone/admin/categories/edit.html.erb +6 -0
  49. data/app/views/cornerstone/admin/categories/index.html.erb +11 -0
  50. data/app/views/cornerstone/admin/categories/new.html.erb +6 -0
  51. data/app/views/cornerstone/admin/discussions/edit.html.erb +7 -0
  52. data/app/views/cornerstone/cornerstone_mailer/new_discussion.html.erb +14 -0
  53. data/app/views/cornerstone/cornerstone_mailer/new_discussion.text.erb +5 -0
  54. data/app/views/cornerstone/cornerstone_mailer/new_discussion_user.html.erb +7 -0
  55. data/app/views/cornerstone/cornerstone_mailer/new_post.html.erb +7 -0
  56. data/app/views/cornerstone/cornerstone_mailer/new_post.text.erb +8 -0
  57. data/app/views/cornerstone/discussions/_discussion.html.erb +12 -0
  58. data/app/views/cornerstone/discussions/_discussion_category.html.erb +14 -0
  59. data/app/views/cornerstone/discussions/_form.html.erb +33 -0
  60. data/app/views/cornerstone/discussions/_latest_discussion.html.erb +4 -0
  61. data/app/views/cornerstone/discussions/categorical_index.html.erb +27 -0
  62. data/app/views/cornerstone/discussions/index.html.erb +25 -0
  63. data/app/views/cornerstone/discussions/new.html.erb +6 -0
  64. data/app/views/cornerstone/discussions/show.html.erb +19 -0
  65. data/app/views/cornerstone/help/index.html.erb +7 -0
  66. data/app/views/cornerstone/posts/_fields.html.erb +44 -0
  67. data/app/views/cornerstone/posts/_form.html.erb +19 -0
  68. data/app/views/cornerstone/posts/_post.html.erb +17 -0
  69. data/app/views/cornerstone/posts/edit.html.erb +9 -0
  70. data/app/views/cornerstone/shared/_errors.html.erb +11 -0
  71. data/app/views/cornerstone/shared/_flash_messages.html.erb +15 -0
  72. data/app/views/layouts/cornerstone/application.html.erb +16 -0
  73. data/config/cucumber.yml +8 -0
  74. data/config/locales/cornerstone.action_mailer.en.yml +9 -0
  75. data/config/routes.rb +24 -0
  76. data/cornerstone-0.0.1.gem +0 -0
  77. data/cornerstone.gemspec +33 -0
  78. data/db/migrate/20110723004024_create_cornerstone_discussions.rb +17 -0
  79. data/db/migrate/20110804190853_create_cornerstone_categories.rb +15 -0
  80. data/db/migrate/20110809233551_create_cornerstone_posts.rb +13 -0
  81. data/db/migrate/20111006172857_create_cornerstone_articles.rb +12 -0
  82. data/lib/cornerstone.rb +6 -0
  83. data/lib/cornerstone/acts_as_cornerstone_user.rb +79 -0
  84. data/lib/cornerstone/config.rb +33 -0
  85. data/lib/cornerstone/controller_additions.rb +25 -0
  86. data/lib/cornerstone/engine.rb +8 -1
  87. data/lib/cornerstone/exceptions.rb +16 -0
  88. data/lib/cornerstone/helpers.rb +35 -0
  89. data/lib/tasks/cucumber.rake +65 -0
  90. data/lib/templates/cornerstone_config.rb +31 -0
  91. data/script/cucumber +10 -0
  92. data/script/rails +7 -0
  93. data/spec/controllers/cornerstone/admin/articles_controller_spec.rb +250 -0
  94. data/spec/controllers/cornerstone/admin/categories_controller_spec.rb +205 -0
  95. data/spec/controllers/cornerstone/admin/discussions_controller_spec.rb +95 -0
  96. data/spec/controllers/cornerstone/application_controller_spec.rb +34 -0
  97. data/spec/controllers/cornerstone/discussions_controller_spec.rb +157 -0
  98. data/spec/controllers/cornerstone/help_controller_spec.rb +20 -0
  99. data/spec/controllers/cornerstone/posts_controller_spec.rb +212 -0
  100. data/spec/dummy/Rakefile +7 -0
  101. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  102. data/spec/dummy/app/assets/javascripts/tester.js +2 -0
  103. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  104. data/spec/dummy/app/assets/stylesheets/tester.css +4 -0
  105. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  106. data/spec/dummy/app/controllers/tester_controller.rb +7 -0
  107. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  108. data/spec/dummy/app/helpers/tester_helper.rb +6 -0
  109. data/spec/dummy/app/mailers/.gitkeep +0 -0
  110. data/spec/dummy/app/models/.gitkeep +0 -0
  111. data/spec/dummy/app/models/user.rb +23 -0
  112. data/spec/dummy/app/views/devise/confirmations/new.html.erb +12 -0
  113. data/spec/dummy/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  114. data/spec/dummy/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  115. data/spec/dummy/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  116. data/spec/dummy/app/views/devise/passwords/edit.html.erb +16 -0
  117. data/spec/dummy/app/views/devise/passwords/new.html.erb +12 -0
  118. data/spec/dummy/app/views/devise/registrations/edit.html.erb +29 -0
  119. data/spec/dummy/app/views/devise/registrations/new.html.erb +22 -0
  120. data/spec/dummy/app/views/devise/sessions/new.html.erb +19 -0
  121. data/spec/dummy/app/views/devise/shared/_links.erb +25 -0
  122. data/spec/dummy/app/views/devise/unlocks/new.html.erb +12 -0
  123. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  124. data/spec/dummy/app/views/tester/index.html.erb +14 -0
  125. data/spec/dummy/config.ru +4 -0
  126. data/spec/dummy/config/application.rb +42 -0
  127. data/spec/dummy/config/boot.rb +10 -0
  128. data/spec/dummy/config/database.yml +28 -0
  129. data/spec/dummy/config/environment.rb +5 -0
  130. data/spec/dummy/config/environments/development.rb +31 -0
  131. data/spec/dummy/config/environments/production.rb +54 -0
  132. data/spec/dummy/config/environments/test.rb +39 -0
  133. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  134. data/spec/dummy/config/initializers/cornerstone_config.rb +30 -0
  135. data/spec/dummy/config/initializers/devise.rb +204 -0
  136. data/spec/dummy/config/initializers/inflections.rb +10 -0
  137. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  138. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  139. data/spec/dummy/config/initializers/session_store.rb +8 -0
  140. data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
  141. data/spec/dummy/config/locales/devise.en.yml +53 -0
  142. data/spec/dummy/config/locales/en.yml +5 -0
  143. data/spec/dummy/config/routes.rb +65 -0
  144. data/spec/dummy/db/migrate/20110724011421_create_user.rb +11 -0
  145. data/spec/dummy/db/migrate/20110724194307_devise_create_users.rb +41 -0
  146. data/spec/dummy/db/migrate/20110804174004_add_name_to_user.rb +5 -0
  147. data/spec/dummy/db/schema.rb +76 -0
  148. data/spec/dummy/log/.gitkeep +0 -0
  149. data/spec/dummy/public/404.html +26 -0
  150. data/spec/dummy/public/422.html +26 -0
  151. data/spec/dummy/public/500.html +26 -0
  152. data/spec/dummy/public/favicon.ico +0 -0
  153. data/spec/dummy/script/rails +6 -0
  154. data/spec/dummy/test/functional/tester_controller_test.rb +9 -0
  155. data/spec/dummy/test/unit/helpers/tester_helper_test.rb +4 -0
  156. data/spec/fixtures/cornerstone/cornerstone_mailer/new_discussion +3 -0
  157. data/spec/lib/cornerstone/acts_as_cornerstone_user_spec.rb +56 -0
  158. data/spec/lib/cornerstone/helpers_spec.rb +32 -0
  159. data/spec/mailers/cornerstone/cornerstone_mailer_spec.rb +55 -0
  160. data/spec/models/cornerstone/article_spec.rb +25 -0
  161. data/spec/models/cornerstone/category_spec.rb +97 -0
  162. data/spec/models/cornerstone/discussion_spec.rb +243 -0
  163. data/spec/models/cornerstone/post_observer_spec.rb +65 -0
  164. data/spec/models/cornerstone/post_spec.rb +210 -0
  165. data/spec/requests/emails_spec.rb +51 -0
  166. data/spec/requests/interact_discussions_spec.rb +103 -0
  167. data/spec/requests/manage_articles_spec.rb +59 -0
  168. data/spec/requests/manage_categories_spec.rb +64 -0
  169. data/spec/requests/view_home_spec.rb +26 -0
  170. data/spec/spec_helper.rb +40 -0
  171. data/spec/support/devise.rb +4 -0
  172. data/spec/support/factories.rb +62 -0
  173. data/spec/support/general_helper_methods.rb +20 -0
  174. data/spec/support/mailer_macros.rb +15 -0
  175. data/spec/support/mass_assignment.rb +46 -0
  176. data/tmp/log/development.log +0 -0
  177. metadata +301 -20
@@ -0,0 +1,6 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/log/*.log
6
+ spec/dummy/tmp/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ #gem 'rails', '3.1.0.rc4'
6
+
7
+ # Bundle edge Rails instead:
8
+ #gem 'rails', :git => 'git://github.com/rails/rails.git',
9
+ # :branch => '3-1-stable'
10
+
11
+
12
+ # must be stated here for dummy app
13
+ # can not state in dev. group or as dev_dependency in gemspec
14
+ gem "jquery-rails"
15
+
16
+
17
+ if RUBY_VERSION < '1.9'
18
+ gem "ruby-debug", ">= 0.10.3"
19
+ end
20
+
21
+ group :development, :test do
22
+ end
23
+
@@ -0,0 +1,168 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cornerstone (0.0.1)
5
+ i18n
6
+ rails (>= 3.1.0)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actionmailer (3.1.0)
12
+ actionpack (= 3.1.0)
13
+ mail (~> 2.3.0)
14
+ actionpack (3.1.0)
15
+ activemodel (= 3.1.0)
16
+ activesupport (= 3.1.0)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ i18n (~> 0.6)
20
+ rack (~> 1.3.2)
21
+ rack-cache (~> 1.0.3)
22
+ rack-mount (~> 0.8.2)
23
+ rack-test (~> 0.6.1)
24
+ sprockets (~> 2.0.0)
25
+ activemodel (3.1.0)
26
+ activesupport (= 3.1.0)
27
+ bcrypt-ruby (~> 3.0.0)
28
+ builder (~> 3.0.0)
29
+ i18n (~> 0.6)
30
+ activerecord (3.1.0)
31
+ activemodel (= 3.1.0)
32
+ activesupport (= 3.1.0)
33
+ arel (~> 2.2.1)
34
+ tzinfo (~> 0.3.29)
35
+ activeresource (3.1.0)
36
+ activemodel (= 3.1.0)
37
+ activesupport (= 3.1.0)
38
+ activesupport (3.1.0)
39
+ multi_json (~> 1.0)
40
+ addressable (2.2.6)
41
+ arel (2.2.1)
42
+ bcrypt-ruby (3.0.1)
43
+ builder (3.0.0)
44
+ capybara (1.1.1)
45
+ mime-types (>= 1.16)
46
+ nokogiri (>= 1.3.3)
47
+ rack (>= 1.0.0)
48
+ rack-test (>= 0.5.4)
49
+ selenium-webdriver (~> 2.0)
50
+ xpath (~> 0.1.4)
51
+ childprocess (0.2.2)
52
+ ffi (~> 1.0.6)
53
+ database_cleaner (0.6.7)
54
+ devise (1.4.7)
55
+ bcrypt-ruby (~> 3.0)
56
+ orm_adapter (~> 0.0.3)
57
+ warden (~> 1.0.3)
58
+ diff-lcs (1.1.3)
59
+ erubis (2.7.0)
60
+ factory_girl (2.1.2)
61
+ activesupport
62
+ factory_girl_rails (1.2.0)
63
+ factory_girl (~> 2.1.0)
64
+ railties (>= 3.0.0)
65
+ ffi (1.0.9)
66
+ guard (0.8.8)
67
+ thor (~> 0.14.6)
68
+ guard-rspec (0.5.5)
69
+ guard (>= 0.8.4)
70
+ hike (1.2.1)
71
+ i18n (0.6.0)
72
+ jquery-rails (1.0.14)
73
+ railties (~> 3.0)
74
+ thor (~> 0.14)
75
+ json_pure (1.6.1)
76
+ launchy (2.0.5)
77
+ addressable (~> 2.2.6)
78
+ libnotify (0.5.9)
79
+ ffi (~> 1.0.0)
80
+ mail (2.3.0)
81
+ i18n (>= 0.4.0)
82
+ mime-types (~> 1.16)
83
+ treetop (~> 1.4.8)
84
+ mime-types (1.16)
85
+ multi_json (1.0.3)
86
+ nokogiri (1.5.0)
87
+ orm_adapter (0.0.5)
88
+ polyglot (0.3.2)
89
+ rack (1.3.4)
90
+ rack-cache (1.0.3)
91
+ rack (>= 0.4)
92
+ rack-mount (0.8.3)
93
+ rack (>= 1.0.0)
94
+ rack-ssl (1.3.2)
95
+ rack
96
+ rack-test (0.6.1)
97
+ rack (>= 1.0)
98
+ rails (3.1.0)
99
+ actionmailer (= 3.1.0)
100
+ actionpack (= 3.1.0)
101
+ activerecord (= 3.1.0)
102
+ activeresource (= 3.1.0)
103
+ activesupport (= 3.1.0)
104
+ bundler (~> 1.0)
105
+ railties (= 3.1.0)
106
+ railties (3.1.0)
107
+ actionpack (= 3.1.0)
108
+ activesupport (= 3.1.0)
109
+ rack-ssl (~> 1.3.2)
110
+ rake (>= 0.8.7)
111
+ rdoc (~> 3.4)
112
+ thor (~> 0.14.6)
113
+ rake (0.9.2)
114
+ rb-inotify (0.8.8)
115
+ ffi (>= 0.5.0)
116
+ rdoc (3.9.4)
117
+ rspec (2.6.0)
118
+ rspec-core (~> 2.6.0)
119
+ rspec-expectations (~> 2.6.0)
120
+ rspec-mocks (~> 2.6.0)
121
+ rspec-core (2.6.4)
122
+ rspec-expectations (2.6.0)
123
+ diff-lcs (~> 1.1.2)
124
+ rspec-mocks (2.6.0)
125
+ rspec-rails (2.6.1)
126
+ actionpack (~> 3.0)
127
+ activesupport (~> 3.0)
128
+ railties (~> 3.0)
129
+ rspec (~> 2.6.0)
130
+ rubyzip (0.9.4)
131
+ selenium-webdriver (2.8.0)
132
+ childprocess (>= 0.2.1)
133
+ ffi (>= 1.0.7)
134
+ json_pure
135
+ rubyzip
136
+ sprockets (2.0.2)
137
+ hike (~> 1.2)
138
+ rack (~> 1.0)
139
+ tilt (~> 1.1, != 1.3.0)
140
+ sqlite3 (1.3.4)
141
+ thor (0.14.6)
142
+ tilt (1.3.3)
143
+ treetop (1.4.10)
144
+ polyglot
145
+ polyglot (>= 0.3.1)
146
+ tzinfo (0.3.30)
147
+ warden (1.0.5)
148
+ rack (>= 1.0)
149
+ xpath (0.1.4)
150
+ nokogiri (~> 1.3)
151
+
152
+ PLATFORMS
153
+ ruby
154
+
155
+ DEPENDENCIES
156
+ bundler (~> 1.0.0)
157
+ capybara
158
+ cornerstone!
159
+ database_cleaner
160
+ devise
161
+ factory_girl_rails
162
+ guard-rspec
163
+ jquery-rails
164
+ launchy
165
+ libnotify
166
+ rb-inotify
167
+ rspec-rails
168
+ sqlite3
@@ -0,0 +1,22 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :version => 2 do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^spec/.+_spec\.rb$})
11
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
12
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
13
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
14
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
15
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
16
+ watch('spec/spec_helper.rb') { "spec" }
17
+ watch('config/routes.rb') { "spec/routing" }
18
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
19
+ # Capybara request specs
20
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
21
+ end
22
+
@@ -1,3 +1,6 @@
1
1
  = Cornerstone
2
2
 
3
- This project rocks and uses MIT-LICENSE.
3
+ This project is not suitable for use just yet. Initial migrations will be changing.
4
+
5
+ This project rocks and uses MIT-LICENSE.
6
+
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
23
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
24
  load 'rails/tasks/engine.rake'
25
25
 
26
26
  require 'rake/testtask'
@@ -34,3 +34,13 @@ end
34
34
 
35
35
 
36
36
  task :default => :test
37
+
38
+ # Display routes
39
+ task :routes => 'app:environment' do
40
+ Rails.application.reload_routes!
41
+ puts Cornerstone::Engine.routes.routes
42
+ # all_routes = Cornerstone::Engine.routes.routes
43
+ end
44
+
45
+ Bundler::GemHelper.install_tasks
46
+
data/TODO ADDED
@@ -0,0 +1,11 @@
1
+ TODO:
2
+
3
+ * Admin dashboard
4
+ * Admin discussion list - sort by date and status, includes private discussions
5
+ * Footers
6
+ * General styling
7
+ * Flash messages not working in admin namespace
8
+ -- perhaps switch to responder gem with locales
9
+ * Spec coverage
10
+ * Generater for views, javascript, stylesheets, locales, etc...
11
+ * README
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.5
File without changes
File without changes
@@ -0,0 +1,11 @@
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
+
8
+ //= require jquery
9
+ //= require jquery_ujs
10
+ //= require_tree .
11
+
@@ -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.
File without changes
@@ -0,0 +1,8 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require_tree .
7
+ */
8
+
@@ -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
+ */
File without changes
@@ -0,0 +1,7 @@
1
+ module Cornerstone
2
+ class Admin::ApplicationController < ::ApplicationController
3
+ authorize_cornerstone_admin!
4
+
5
+ end
6
+ end
7
+
@@ -0,0 +1,61 @@
1
+ module Cornerstone
2
+ class Admin::ArticlesController < Admin::ApplicationController
3
+
4
+ respond_to :html
5
+
6
+ def index
7
+ @articles = Article.all
8
+ respond_with(:admin, @articles)
9
+ end
10
+
11
+ def show
12
+ @article = Article.find(params[:id])
13
+ respond_with(:admin, @article)
14
+ end
15
+
16
+ # GET /cornerstone/admin/articles/new
17
+ def new
18
+ @article = Article.new
19
+ @categories = Category.articles
20
+ respond_with(:admin, @articles)
21
+ end
22
+
23
+ # POST /cornerstone/admin/articles/
24
+ def create
25
+ @article = Article.new(params[:article])
26
+ if @article.save
27
+ flash[:notice] = 'Article was successfully created.'
28
+ else
29
+ @categories = Category.articles
30
+ end
31
+ respond_with(:admin, @article)
32
+ end
33
+
34
+ # GET /cornerstone/admin/articles/:id/edit
35
+ def edit
36
+ @article = Article.find(params[:id])
37
+ @categories = Category.articles
38
+ respond_with(:admin, @article)
39
+ end
40
+
41
+ # PUT /cornerstone/admin/articles/:id
42
+ def update
43
+ @article = Article.find(params[:id])
44
+ if @article.update_attributes(params[:article])
45
+ flash[:notice] = 'Article was successfully updated.'
46
+ else
47
+ @categories = Category.articles
48
+ end
49
+ respond_with(:admin, @article)
50
+ end
51
+
52
+ # DELETE /cornerstone/admin/articles/:id
53
+ def destroy
54
+ @article = Article.find(params[:id])
55
+ flash[:notice] = 'Article was successfully destroyed.' if @article.destroy
56
+ respond_with(:admin, @article, :location => admin_articles_path)
57
+ end
58
+
59
+ end
60
+ end
61
+
@@ -0,0 +1,46 @@
1
+ module Cornerstone
2
+ class Admin::CategoriesController < Admin::ApplicationController
3
+
4
+ respond_to :html
5
+
6
+ def index
7
+ @discussion_categories = Category.discussions
8
+ @article_categories = Category.articles
9
+ end
10
+
11
+ # GET /cornerstone/admin/categories/new
12
+ def new
13
+ @category = Category.new
14
+ respond_with(:admin, @category)
15
+ end
16
+
17
+ # POST /cornerstone/admin/categories/
18
+ def create
19
+ @category = Category.new(params[:category])
20
+ flash[:notice] = 'Category was successfully created.' if @category.save
21
+ respond_with(:admin, @category, :location => admin_categories_path)
22
+ end
23
+
24
+ # GET /cornerstone/admin/categories/:id/edit
25
+ def edit
26
+ @category = Category.find(params[:id])
27
+ respond_with(:admin, @category)
28
+ end
29
+
30
+ # PUT /cornerstone/admin/categories/:id
31
+ def update
32
+ @category = Category.find(params[:id])
33
+ flash[:notice] = 'Category was successfully updated.' if @category.update_attributes(params[:category])
34
+ respond_with(:admin, @category, :location => admin_categories_path)
35
+ end
36
+
37
+ # DELETE /cornerstone/admin/categories/:id
38
+ def destroy
39
+ @category = Category.find(params[:id])
40
+ flash[:notice] = 'Category was successfully destroyed.' if @category.destroy
41
+ respond_with([:admin, @category], :location => admin_categories_path)
42
+ end
43
+
44
+ end
45
+ end
46
+
@@ -0,0 +1,32 @@
1
+ module Cornerstone
2
+ class Admin::DiscussionsController < Admin::ApplicationController
3
+
4
+ respond_to :html
5
+
6
+ # GET /cornerstone/admin/discussions/:id/edit
7
+ def edit
8
+ @discussion = Discussion.includes(:posts => :user).find(params[:id])
9
+ @categories = Category.discussions
10
+ respond_with(:admin, @discussion)
11
+ end
12
+
13
+ # PUT /cornersone/admin/discussions/:id
14
+ def update
15
+ @discussion = Discussion.includes(:posts => :user).find(params[:id])
16
+
17
+ respond_with(@discussion.category, @discussion) do |format|
18
+ if @discussion.update_attributes(params[:discussion])
19
+ flash[:notice] = "Discussion was successfully updated."
20
+ format.html {redirect_to category_discussion_path(@discussion.category, @discussion)}
21
+ else
22
+ @categories = Category.discussions
23
+ format.html {render :edit}
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+
30
+ end
31
+ end
32
+