crowdblog 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.rvmrc +1 -0
- data/.simplecov +13 -0
- data/Gemfile +35 -0
- data/Gemfile.lock +291 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +32 -0
- data/app/assets/images/crowdblog/.gitkeep +0 -0
- data/app/assets/images/crowdblog/logo.png +0 -0
- data/app/assets/javascripts/crowdblog/models/post.js.coffee +11 -0
- data/app/assets/javascripts/crowdblog/posts_main.js.coffee +42 -0
- data/app/assets/javascripts/crowdblog/templates/posts/attachment.jst.eco +1 -0
- data/app/assets/javascripts/crowdblog/templates/posts/edit.jst.eco +38 -0
- data/app/assets/javascripts/crowdblog/templates/posts/index.jst.eco +17 -0
- data/app/assets/javascripts/crowdblog/templates/posts/post.jst.eco +27 -0
- data/app/assets/javascripts/crowdblog/views/posts/attachment_view.js.coffee +8 -0
- data/app/assets/javascripts/crowdblog/views/posts/edit_post_view.js.coffee +41 -0
- data/app/assets/javascripts/crowdblog/views/posts/index.js.coffee +28 -0
- data/app/assets/javascripts/crowdblog/views/posts/post_view.js.coffee +40 -0
- data/app/assets/javascripts/crowdblog/xhr_fix.js.coffee +4 -0
- data/app/assets/javascripts/crowdblog.js +16 -0
- data/app/assets/stylesheets/crowdblog/posts.css.scss +3 -0
- data/app/assets/stylesheets/crowdblog.css +7 -0
- data/app/controllers/crowdblog/application_controller.rb +16 -0
- data/app/controllers/crowdblog/assets_controller.rb +14 -0
- data/app/controllers/crowdblog/authors_controller.rb +9 -0
- data/app/controllers/crowdblog/posts_controller.rb +48 -0
- data/app/controllers/crowdblog/sessions_controller.rb +25 -0
- data/app/controllers/crowdblog/users/omniauth_callbacks_controller.rb +21 -0
- data/app/helpers/crowdblog/application_helper.rb +4 -0
- data/app/models/crowdblog/asset.rb +8 -0
- data/app/models/crowdblog/post.rb +121 -0
- data/app/models/crowdblog/user.rb +32 -0
- data/app/sweepers/post_sweeper.rb +5 -0
- data/app/uploaders/attachment_uploader.rb +48 -0
- data/app/views/crowdblog/authors/index.html.slim +18 -0
- data/app/views/crowdblog/posts/index.html.slim +13 -0
- data/app/views/layouts/crowdblog/application.html.slim +25 -0
- data/config/cucumber.yml +8 -0
- data/config/routes.rb +14 -0
- data/crowdblog.gemspec +46 -0
- data/db/migrate/20120215232711_create_users.rb +10 -0
- data/db/migrate/20120216154516_add_devise_to_users.rb +56 -0
- data/db/migrate/20120217213920_create_posts.rb +13 -0
- data/db/migrate/20120219014520_add_author_to_posts.rb +6 -0
- data/db/migrate/20120219040607_add_state_to_post.rb +7 -0
- data/db/migrate/20120219071614_create_assets.rb +10 -0
- data/db/migrate/20120219234253_add_alias_to_users.rb +6 -0
- data/db/migrate/20120220033923_create_vestal_versions.rb +28 -0
- data/features/posts/manage_posts.feature +46 -0
- data/features/step_definitions/index_steps.rb +16 -0
- data/features/step_definitions/interaction_steps.rb +26 -0
- data/features/step_definitions/posts_steps.rb +35 -0
- data/features/step_definitions/session_steps.rb +15 -0
- data/features/support/env.rb +69 -0
- data/lib/crowdblog/engine.rb +5 -0
- data/lib/crowdblog/version.rb +3 -0
- data/lib/crowdblog.rb +4 -0
- data/lib/tasks/crowdblog_tasks.rake +4 -0
- data/script/build +29 -0
- data/script/cucumber +10 -0
- data/script/rails +8 -0
- data/spec/dummy/.rvmrc +1 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +62 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/carrierwave.rb +18 -0
- data/spec/dummy/config/initializers/devise.rb +230 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +6 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/schema.rb +76 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/lib/tasks/cucumber.rake +65 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/helpers/application_helper_spec.rb +4 -0
- data/spec/models/post_spec.rb +94 -0
- data/spec/spec_helper.rb +39 -0
- data/vendor/assets/javascripts/jquery.uploadify.js +296 -0
- data/vendor/assets/javascripts/swfobject.js +4 -0
- metadata +428 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.3@crowdblog --create --install
|
data/.simplecov
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# use RCov formatter for metric_fu: http://bit.ly/wQbrxB
|
2
|
+
require 'simplecov-rcov-text'
|
3
|
+
|
4
|
+
class SimpleCov::Formatter::MergedFormatter
|
5
|
+
def format(result)
|
6
|
+
SimpleCov::Formatter::HTMLFormatter.new.format(result)
|
7
|
+
SimpleCov::Formatter::RcovTextFormatter.new.format(result)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
|
11
|
+
|
12
|
+
SimpleCov.start 'rails' do
|
13
|
+
end
|
data/Gemfile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in crowdblog.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
|
+
# Gems used by the dummy application (needs to be here instead of the gemspec)
|
9
|
+
gem "jquery-rails"
|
10
|
+
gem 'backbone-rails'
|
11
|
+
gem 'carrierwave'
|
12
|
+
gem 'devise'
|
13
|
+
gem 'gravtastic'
|
14
|
+
gem 'less-rails-bootstrap'
|
15
|
+
gem 'omniauth-google-apps'
|
16
|
+
gem 'omniauth-google-oauth2'
|
17
|
+
gem 'state_machine'
|
18
|
+
gem 'slim_assets'
|
19
|
+
gem 'slim-rails'
|
20
|
+
gem 'eco'
|
21
|
+
|
22
|
+
group :assets do
|
23
|
+
gem 'coffee-rails'
|
24
|
+
gem 'sass-rails'
|
25
|
+
gem 'uglifier'
|
26
|
+
end
|
27
|
+
|
28
|
+
# Declare any dependencies that are still in development here instead of in
|
29
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
30
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
31
|
+
# your gem to rubygems.org.
|
32
|
+
gem 'vestal_versions', :git => 'https://github.com/jodosha/vestal_versions.git'
|
33
|
+
|
34
|
+
# To use debugger
|
35
|
+
# gem 'ruby-debug19', :require => 'ruby-debug'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,291 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/jodosha/vestal_versions.git
|
3
|
+
revision: ef4334ccadf1077f4fa0e72ae515ddf7d00a8ad7
|
4
|
+
specs:
|
5
|
+
vestal_versions (1.2.2)
|
6
|
+
activerecord (>= 3.1.0)
|
7
|
+
activesupport (>= 3.1.0)
|
8
|
+
|
9
|
+
PATH
|
10
|
+
remote: .
|
11
|
+
specs:
|
12
|
+
crowdblog (0.0.1)
|
13
|
+
backbone-rails
|
14
|
+
carrierwave
|
15
|
+
devise
|
16
|
+
eco
|
17
|
+
gravtastic
|
18
|
+
jquery-rails
|
19
|
+
less-rails-bootstrap
|
20
|
+
omniauth-google-apps
|
21
|
+
omniauth-google-oauth2
|
22
|
+
rails (~> 3.2)
|
23
|
+
slim-rails
|
24
|
+
slim_assets
|
25
|
+
state_machine
|
26
|
+
|
27
|
+
GEM
|
28
|
+
remote: http://rubygems.org/
|
29
|
+
specs:
|
30
|
+
actionmailer (3.2.1)
|
31
|
+
actionpack (= 3.2.1)
|
32
|
+
mail (~> 2.4.0)
|
33
|
+
actionpack (3.2.1)
|
34
|
+
activemodel (= 3.2.1)
|
35
|
+
activesupport (= 3.2.1)
|
36
|
+
builder (~> 3.0.0)
|
37
|
+
erubis (~> 2.7.0)
|
38
|
+
journey (~> 1.0.1)
|
39
|
+
rack (~> 1.4.0)
|
40
|
+
rack-cache (~> 1.1)
|
41
|
+
rack-test (~> 0.6.1)
|
42
|
+
sprockets (~> 2.1.2)
|
43
|
+
activemodel (3.2.1)
|
44
|
+
activesupport (= 3.2.1)
|
45
|
+
builder (~> 3.0.0)
|
46
|
+
activerecord (3.2.1)
|
47
|
+
activemodel (= 3.2.1)
|
48
|
+
activesupport (= 3.2.1)
|
49
|
+
arel (~> 3.0.0)
|
50
|
+
tzinfo (~> 0.3.29)
|
51
|
+
activeresource (3.2.1)
|
52
|
+
activemodel (= 3.2.1)
|
53
|
+
activesupport (= 3.2.1)
|
54
|
+
activesupport (3.2.1)
|
55
|
+
i18n (~> 0.6)
|
56
|
+
multi_json (~> 1.0)
|
57
|
+
addressable (2.2.7)
|
58
|
+
arel (3.0.2)
|
59
|
+
backbone-rails (0.9.0)
|
60
|
+
rails (>= 3.0.0)
|
61
|
+
bcrypt-ruby (3.0.1)
|
62
|
+
builder (3.0.0)
|
63
|
+
capybara (1.1.2)
|
64
|
+
mime-types (>= 1.16)
|
65
|
+
nokogiri (>= 1.3.3)
|
66
|
+
rack (>= 1.0.0)
|
67
|
+
rack-test (>= 0.5.4)
|
68
|
+
selenium-webdriver (~> 2.0)
|
69
|
+
xpath (~> 0.1.4)
|
70
|
+
carrierwave (0.5.8)
|
71
|
+
activesupport (~> 3.0)
|
72
|
+
childprocess (0.3.1)
|
73
|
+
ffi (~> 1.0.6)
|
74
|
+
coffee-rails (3.2.2)
|
75
|
+
coffee-script (>= 2.2.0)
|
76
|
+
railties (~> 3.2.0)
|
77
|
+
coffee-script (2.2.0)
|
78
|
+
coffee-script-source
|
79
|
+
execjs
|
80
|
+
coffee-script-source (1.2.0)
|
81
|
+
commonjs (0.2.0)
|
82
|
+
therubyracer (~> 0.9.9)
|
83
|
+
cucumber (1.1.9)
|
84
|
+
builder (>= 2.1.2)
|
85
|
+
diff-lcs (>= 1.1.2)
|
86
|
+
gherkin (~> 2.9.0)
|
87
|
+
json (>= 1.4.6)
|
88
|
+
term-ansicolor (>= 1.0.6)
|
89
|
+
cucumber-rails (1.3.0)
|
90
|
+
capybara (>= 1.1.2)
|
91
|
+
cucumber (>= 1.1.8)
|
92
|
+
nokogiri (>= 1.5.0)
|
93
|
+
database_cleaner (0.7.1)
|
94
|
+
devise (2.0.4)
|
95
|
+
bcrypt-ruby (~> 3.0)
|
96
|
+
orm_adapter (~> 0.0.3)
|
97
|
+
railties (~> 3.1)
|
98
|
+
warden (~> 1.1.1)
|
99
|
+
diff-lcs (1.1.3)
|
100
|
+
eco (1.0.0)
|
101
|
+
coffee-script
|
102
|
+
eco-source
|
103
|
+
execjs
|
104
|
+
eco-source (1.1.0.rc.1)
|
105
|
+
erubis (2.7.0)
|
106
|
+
execjs (1.3.0)
|
107
|
+
multi_json (~> 1.0)
|
108
|
+
faraday (0.7.6)
|
109
|
+
addressable (~> 2.2)
|
110
|
+
multipart-post (~> 1.1)
|
111
|
+
rack (~> 1.1)
|
112
|
+
ffi (1.0.11)
|
113
|
+
fuubar (1.0.0)
|
114
|
+
rspec (~> 2.0)
|
115
|
+
rspec-instafail (~> 0.2.0)
|
116
|
+
ruby-progressbar (~> 0.0.10)
|
117
|
+
gherkin (2.9.0)
|
118
|
+
json (>= 1.4.6)
|
119
|
+
gravtastic (3.2.6)
|
120
|
+
hashie (1.2.0)
|
121
|
+
hike (1.2.1)
|
122
|
+
i18n (0.6.0)
|
123
|
+
journey (1.0.2)
|
124
|
+
jquery-rails (2.0.0)
|
125
|
+
railties (>= 3.2.0.beta, < 5.0)
|
126
|
+
thor (~> 0.14)
|
127
|
+
json (1.6.5)
|
128
|
+
json_pure (1.6.5)
|
129
|
+
less (2.0.9)
|
130
|
+
commonjs (~> 0.2.0)
|
131
|
+
therubyracer (~> 0.9.9)
|
132
|
+
less-rails (2.1.6)
|
133
|
+
actionpack (>= 3.1)
|
134
|
+
less (~> 2.0.7)
|
135
|
+
less-rails-bootstrap (2.0.6)
|
136
|
+
less-rails (~> 2.1.0)
|
137
|
+
libv8 (3.3.10.4)
|
138
|
+
mail (2.4.1)
|
139
|
+
i18n (>= 0.4.0)
|
140
|
+
mime-types (~> 1.16)
|
141
|
+
treetop (~> 1.4.8)
|
142
|
+
mime-types (1.17.2)
|
143
|
+
multi_json (1.1.0)
|
144
|
+
multipart-post (1.1.5)
|
145
|
+
nokogiri (1.5.0)
|
146
|
+
oauth2 (0.5.2)
|
147
|
+
faraday (~> 0.7)
|
148
|
+
multi_json (~> 1.0)
|
149
|
+
omniauth (1.0.2)
|
150
|
+
hashie (~> 1.2)
|
151
|
+
rack
|
152
|
+
omniauth-google-apps (0.0.1)
|
153
|
+
omniauth (~> 1.0)
|
154
|
+
omniauth-openid (~> 1.0)
|
155
|
+
ruby-openid-apps-discovery (~> 1.2.0)
|
156
|
+
omniauth-google-oauth2 (0.1.9)
|
157
|
+
omniauth (~> 1.0)
|
158
|
+
omniauth-oauth2
|
159
|
+
omniauth-oauth2 (1.0.0)
|
160
|
+
oauth2 (~> 0.5.0)
|
161
|
+
omniauth (~> 1.0)
|
162
|
+
omniauth-openid (1.0.1)
|
163
|
+
omniauth (~> 1.0)
|
164
|
+
rack-openid (~> 1.3.1)
|
165
|
+
orm_adapter (0.0.6)
|
166
|
+
polyglot (0.3.3)
|
167
|
+
rack (1.4.1)
|
168
|
+
rack-cache (1.1)
|
169
|
+
rack (>= 0.4)
|
170
|
+
rack-openid (1.3.1)
|
171
|
+
rack (>= 1.1.0)
|
172
|
+
ruby-openid (>= 2.1.8)
|
173
|
+
rack-ssl (1.3.2)
|
174
|
+
rack
|
175
|
+
rack-test (0.6.1)
|
176
|
+
rack (>= 1.0)
|
177
|
+
rails (3.2.1)
|
178
|
+
actionmailer (= 3.2.1)
|
179
|
+
actionpack (= 3.2.1)
|
180
|
+
activerecord (= 3.2.1)
|
181
|
+
activeresource (= 3.2.1)
|
182
|
+
activesupport (= 3.2.1)
|
183
|
+
bundler (~> 1.0)
|
184
|
+
railties (= 3.2.1)
|
185
|
+
railties (3.2.1)
|
186
|
+
actionpack (= 3.2.1)
|
187
|
+
activesupport (= 3.2.1)
|
188
|
+
rack-ssl (~> 1.3.2)
|
189
|
+
rake (>= 0.8.7)
|
190
|
+
rdoc (~> 3.4)
|
191
|
+
thor (~> 0.14.6)
|
192
|
+
rake (0.9.2.2)
|
193
|
+
rdoc (3.12)
|
194
|
+
json (~> 1.4)
|
195
|
+
rspec (2.8.0)
|
196
|
+
rspec-core (~> 2.8.0)
|
197
|
+
rspec-expectations (~> 2.8.0)
|
198
|
+
rspec-mocks (~> 2.8.0)
|
199
|
+
rspec-core (2.8.0)
|
200
|
+
rspec-expectations (2.8.0)
|
201
|
+
diff-lcs (~> 1.1.2)
|
202
|
+
rspec-instafail (0.2.2)
|
203
|
+
rspec-mocks (2.8.0)
|
204
|
+
rspec-rails (2.8.1)
|
205
|
+
actionpack (>= 3.0)
|
206
|
+
activesupport (>= 3.0)
|
207
|
+
railties (>= 3.0)
|
208
|
+
rspec (~> 2.8.0)
|
209
|
+
ruby-openid (2.1.8)
|
210
|
+
ruby-openid-apps-discovery (1.2.0)
|
211
|
+
ruby-openid (>= 2.1.7)
|
212
|
+
ruby-progressbar (0.0.10)
|
213
|
+
rubyzip (0.9.6.1)
|
214
|
+
sass (3.1.15)
|
215
|
+
sass-rails (3.2.4)
|
216
|
+
railties (~> 3.2.0)
|
217
|
+
sass (>= 3.1.10)
|
218
|
+
tilt (~> 1.3)
|
219
|
+
selenium-webdriver (2.13.0)
|
220
|
+
childprocess (>= 0.2.1)
|
221
|
+
ffi (~> 1.0.9)
|
222
|
+
json_pure
|
223
|
+
rubyzip
|
224
|
+
simplecov (0.6.0)
|
225
|
+
multi_json (~> 1.0)
|
226
|
+
simplecov-html (~> 0.5.3)
|
227
|
+
simplecov-html (0.5.3)
|
228
|
+
simplecov-rcov-text (0.0.2)
|
229
|
+
slim (1.1.0)
|
230
|
+
temple (~> 0.3.5)
|
231
|
+
tilt (~> 1.3.2)
|
232
|
+
slim-rails (1.0.3)
|
233
|
+
actionpack (~> 3.0)
|
234
|
+
activesupport (~> 3.0)
|
235
|
+
railties (~> 3.0)
|
236
|
+
slim (~> 1.0)
|
237
|
+
slim_assets (0.0.2)
|
238
|
+
slim
|
239
|
+
tilt
|
240
|
+
sprockets (2.1.2)
|
241
|
+
hike (~> 1.2)
|
242
|
+
rack (~> 1.0)
|
243
|
+
tilt (~> 1.1, != 1.3.0)
|
244
|
+
sqlite3 (1.3.5)
|
245
|
+
state_machine (1.1.2)
|
246
|
+
temple (0.3.5)
|
247
|
+
term-ansicolor (1.0.7)
|
248
|
+
therubyracer (0.9.10)
|
249
|
+
libv8 (~> 3.3.10)
|
250
|
+
thor (0.14.6)
|
251
|
+
tilt (1.3.3)
|
252
|
+
treetop (1.4.10)
|
253
|
+
polyglot
|
254
|
+
polyglot (>= 0.3.1)
|
255
|
+
tzinfo (0.3.31)
|
256
|
+
uglifier (1.2.3)
|
257
|
+
execjs (>= 0.3.0)
|
258
|
+
multi_json (>= 1.0.2)
|
259
|
+
warden (1.1.1)
|
260
|
+
rack (>= 1.0)
|
261
|
+
xpath (0.1.4)
|
262
|
+
nokogiri (~> 1.3)
|
263
|
+
|
264
|
+
PLATFORMS
|
265
|
+
ruby
|
266
|
+
|
267
|
+
DEPENDENCIES
|
268
|
+
backbone-rails
|
269
|
+
carrierwave
|
270
|
+
coffee-rails
|
271
|
+
crowdblog!
|
272
|
+
cucumber-rails
|
273
|
+
database_cleaner
|
274
|
+
devise
|
275
|
+
eco
|
276
|
+
fuubar
|
277
|
+
gravtastic
|
278
|
+
jquery-rails
|
279
|
+
less-rails-bootstrap
|
280
|
+
omniauth-google-apps
|
281
|
+
omniauth-google-oauth2
|
282
|
+
rspec-rails
|
283
|
+
sass-rails
|
284
|
+
simplecov
|
285
|
+
simplecov-rcov-text
|
286
|
+
slim-rails
|
287
|
+
slim_assets
|
288
|
+
sqlite3
|
289
|
+
state_machine
|
290
|
+
uglifier
|
291
|
+
vestal_versions!
|
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
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
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 = 'Crowdblog'
|
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("../spec/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
28
|
+
require 'rspec/core/rake_task'
|
29
|
+
RSpec::Core::RakeTask.new(:spec)
|
30
|
+
|
31
|
+
# RSpec as default
|
32
|
+
task :default => :spec
|
File without changes
|
Binary file
|
@@ -0,0 +1,42 @@
|
|
1
|
+
$ ->
|
2
|
+
PostsApp.Router = Backbone.Router.extend
|
3
|
+
routes:
|
4
|
+
"": "index"
|
5
|
+
"new" : "newPost"
|
6
|
+
"edit/:id" : "editPost"
|
7
|
+
|
8
|
+
newPost: ->
|
9
|
+
new_posts = new PostsApp.EditPostView({model: new PostsApp.Post() })
|
10
|
+
$('#posts').html(new_posts.render().el)
|
11
|
+
|
12
|
+
index: ->
|
13
|
+
index_view = new PostsApp.PostsIndexView({posts: PostsApp.Posts.toJSON()})
|
14
|
+
$('#posts').html(index_view.render().el)
|
15
|
+
PostsApp.Posts.fetch()
|
16
|
+
|
17
|
+
editPost: (e) ->
|
18
|
+
post = PostsApp.Posts.get(e) || new PostsApp.Post({id: e, title: 'The title'})
|
19
|
+
post.fetch
|
20
|
+
success: (model) =>
|
21
|
+
edit_post_view = new PostsApp.EditPostView({model: post})
|
22
|
+
$('#posts').html(edit_post_view.render().el)
|
23
|
+
$('#uploader').uploadify
|
24
|
+
'uploader' : '/uploadify.swf'
|
25
|
+
'cancelImg' : '/assets/cancel.png'
|
26
|
+
'auto' : true
|
27
|
+
'script' : '/admin/posts/' + post.id + '/assets'
|
28
|
+
'onComplete' : this.uploadComplete
|
29
|
+
|
30
|
+
uploadComplete: (e, id, file, response, data) ->
|
31
|
+
attachment = new PostsApp.AttachmentView
|
32
|
+
url: $.parseJSON(response).attachment.url
|
33
|
+
|
34
|
+
$('.attachment-list').append(attachment.render().el)
|
35
|
+
|
36
|
+
true
|
37
|
+
|
38
|
+
PostsApp.Posts = new PostsApp.PostCollection()
|
39
|
+
|
40
|
+
PostsApp.PostsView = Backbone.View.extend
|
41
|
+
el: $('#posts')
|
42
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<div class="attachment"><%= @url %></div>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<h2><%= @isNew ? 'New' : 'Edit' %> Post</h2>
|
2
|
+
|
3
|
+
<form accept-charset="UTF-8" action="/" class="form-horizontal" method="post">
|
4
|
+
<fieldset>
|
5
|
+
<div class="control-group title">
|
6
|
+
<label class="control-label" for="post_title">Title</label>
|
7
|
+
<div class="controls">
|
8
|
+
<input class="input-xlarge span7" id="post_title" name="post_title" type="text" value="<%= @post.title %>">
|
9
|
+
<span class="help-inline title"></span>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="control-group body">
|
14
|
+
<label class="control-label" for="post_body">Body</label>
|
15
|
+
<div class="controls">
|
16
|
+
<textarea class="span9" id="post_body" name="post_body" rows="30"><%= @post.body %></textarea>
|
17
|
+
<span class="help-inline">
|
18
|
+
<a href="http://daringfireball.net/projects/markdown/syntax" target="_blank">Markdown syntax</a>
|
19
|
+
</span>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="form-actions">
|
24
|
+
<div class="row">
|
25
|
+
<div class="span1">
|
26
|
+
<button class="btn btn-primary update">Save</button>
|
27
|
+
</div>
|
28
|
+
<div class="span1">
|
29
|
+
<button class="btn btn-danger cancel">Cancel</button>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</fieldset>
|
34
|
+
|
35
|
+
<div style="margin:0;padding:0;display:inline">
|
36
|
+
<input name="utf8" type="hidden" value="✓">
|
37
|
+
</div>
|
38
|
+
</form>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<a href="#new" class="btn btn-primary new-post">New Post</a>
|
2
|
+
|
3
|
+
<div class="posts">
|
4
|
+
<table class="table table-striped">
|
5
|
+
<thead>
|
6
|
+
<tr>
|
7
|
+
<th>Title</th>
|
8
|
+
<th>Author</th>
|
9
|
+
<th>Published at</th>
|
10
|
+
<th></th>
|
11
|
+
<th></th>
|
12
|
+
<th></th>
|
13
|
+
</tr>
|
14
|
+
</thead>
|
15
|
+
<tbody></tbody>
|
16
|
+
</table>
|
17
|
+
</div>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<td>
|
2
|
+
<a href="/preview/<%= @post.id %>" target="_blank">
|
3
|
+
<%= @post.title %>
|
4
|
+
</a>
|
5
|
+
</td>
|
6
|
+
|
7
|
+
<td>
|
8
|
+
<%= @post.author_email %>
|
9
|
+
</td>
|
10
|
+
|
11
|
+
<td class="span2">
|
12
|
+
<%= @post.published_at %>
|
13
|
+
</td>
|
14
|
+
|
15
|
+
<td class="span1">
|
16
|
+
<% if @publisher: %>
|
17
|
+
<a href="#" class="publish btn span1">Publish</a>
|
18
|
+
<% end %>
|
19
|
+
</td>
|
20
|
+
|
21
|
+
<td class="span1">
|
22
|
+
<a href="#edit/<%= @post.id %>" class="edit btn span1">Edit</a>
|
23
|
+
</td>
|
24
|
+
|
25
|
+
<td class="span1">
|
26
|
+
<a href="#" class="delete btn span1">Delete</a>
|
27
|
+
</td>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
$ ->
|
2
|
+
PostsApp.EditPostView = Backbone.View.extend
|
3
|
+
events:
|
4
|
+
'click .cancel' : 'cancelPost'
|
5
|
+
'click .update' : 'updatePost'
|
6
|
+
|
7
|
+
template:
|
8
|
+
JST["crowdblog/templates/posts/edit"]
|
9
|
+
|
10
|
+
render: ->
|
11
|
+
this.model.fetch()
|
12
|
+
this.$el.html(this.template({post: this.model.toJSON(), isNew: this.model.isNew()}))
|
13
|
+
this
|
14
|
+
|
15
|
+
cancelPost: (e) ->
|
16
|
+
e.preventDefault()
|
17
|
+
this.goHome()
|
18
|
+
|
19
|
+
updatePost: (e) ->
|
20
|
+
e.preventDefault()
|
21
|
+
this.model.save this.extractData(),
|
22
|
+
success: =>
|
23
|
+
this.goHome()
|
24
|
+
|
25
|
+
error: (e) =>
|
26
|
+
errors = $.parseJSON(e.responseText).errors
|
27
|
+
console.log errors[0]
|
28
|
+
|
29
|
+
$.each errors, (key, value) =>
|
30
|
+
this.$('.control-group.' + key).addClass('error')
|
31
|
+
this.$('.' + key + '.help-inline').html(value.join(','))
|
32
|
+
|
33
|
+
extractData: ->
|
34
|
+
{
|
35
|
+
'body' : this.$('#post_body').val(),
|
36
|
+
'title' : this.$('#post_title').val()
|
37
|
+
}
|
38
|
+
|
39
|
+
goHome: ->
|
40
|
+
PostsApp.router.navigate '/'
|
41
|
+
trigger: true
|
@@ -0,0 +1,28 @@
|
|
1
|
+
$ ->
|
2
|
+
PostsApp.PostsIndexView = Backbone.View.extend
|
3
|
+
initialize: ->
|
4
|
+
_.bindAll(this, 'addPost', 'addAllPosts', 'removePost')
|
5
|
+
PostsApp.Posts.on('add', this.addPost, this)
|
6
|
+
PostsApp.Posts.on('remove', this.removePost, this)
|
7
|
+
PostsApp.Posts.on('reset', this.addAllPosts, this)
|
8
|
+
|
9
|
+
template:
|
10
|
+
JST["crowdblog/templates/posts/index"]
|
11
|
+
|
12
|
+
render: ->
|
13
|
+
this.$el.html(this.template())
|
14
|
+
this
|
15
|
+
|
16
|
+
addPost: (post) ->
|
17
|
+
elementId = 'post-' + post.id
|
18
|
+
post_view = new PostsApp.PostView
|
19
|
+
model: post
|
20
|
+
id: elementId
|
21
|
+
|
22
|
+
this.$el.find('tbody').append(post_view.render().el)
|
23
|
+
|
24
|
+
addAllPosts: ->
|
25
|
+
PostsApp.Posts.each(this.addPost)
|
26
|
+
|
27
|
+
removePost: (post) ->
|
28
|
+
this.$('#post-' + post.id).remove()
|
@@ -0,0 +1,40 @@
|
|
1
|
+
$ ->
|
2
|
+
PostsApp.PostView = Backbone.View.extend
|
3
|
+
tagName: 'tr'
|
4
|
+
|
5
|
+
events:
|
6
|
+
'click .delete' : 'deletePost'
|
7
|
+
'click .publish' : 'togglePublish'
|
8
|
+
|
9
|
+
template:
|
10
|
+
JST["crowdblog/templates/posts/post"]
|
11
|
+
|
12
|
+
render: ->
|
13
|
+
this.$el.html(this.template({post: this.model.toJSON(), publisher: PostsApp.publisher}))
|
14
|
+
this.paintButtons()
|
15
|
+
this
|
16
|
+
|
17
|
+
deletePost: (e) ->
|
18
|
+
e.preventDefault()
|
19
|
+
if confirm('Are you sure?')
|
20
|
+
this.model.destroy()
|
21
|
+
|
22
|
+
togglePublish: (e) ->
|
23
|
+
e.preventDefault()
|
24
|
+
|
25
|
+
if this.model.get('published?')
|
26
|
+
this.model.save
|
27
|
+
transition: 'draft'
|
28
|
+
this.model.set('published?', false)
|
29
|
+
else
|
30
|
+
this.model.save
|
31
|
+
transition: 'publish'
|
32
|
+
this.model.set('published?', true)
|
33
|
+
|
34
|
+
this.paintButtons()
|
35
|
+
|
36
|
+
paintButtons: ->
|
37
|
+
this.$el.find('.publish').removeClass('btn-success btn-danger')
|
38
|
+
this.$el.find('.publish').addClass('btn-success') if this.model.get('published?')
|
39
|
+
this.$el.find('.publish').addClass('btn-danger') unless this.model.get('published?')
|
40
|
+
|