crowdblog 0.0.16 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/.gitignore +2 -0
  2. data/Gemfile +0 -10
  3. data/README.md +94 -3
  4. data/Rakefile +1 -7
  5. data/app/assets/images/crowdblog/logo.png +0 -0
  6. data/app/assets/javascripts/crowdblog/models/post.js.coffee +4 -9
  7. data/app/assets/javascripts/crowdblog/views/attachment_view.js.coffee +12 -0
  8. data/app/assets/javascripts/crowdblog/views/post_form_view.js.coffee +21 -0
  9. data/app/assets/javascripts/crowdblog/views/post_view.js.coffee +52 -0
  10. data/app/assets/javascripts/crowdblog.js +7 -11
  11. data/app/assets/stylesheets/crowdblog/posts.css.scss +26 -5
  12. data/app/assets/stylesheets/crowdblog.css +0 -1
  13. data/app/controllers/crowdblog/application_controller.rb +13 -0
  14. data/app/controllers/crowdblog/assets_controller.rb +2 -2
  15. data/app/controllers/crowdblog/authors_controller.rb +2 -2
  16. data/app/controllers/crowdblog/devise/sessions_controller.rb +3 -0
  17. data/app/controllers/crowdblog/posts_controller.rb +37 -16
  18. data/app/models/crowdblog/asset.rb +0 -1
  19. data/app/models/crowdblog/post.rb +15 -5
  20. data/app/models/crowdblog/user.rb +9 -1
  21. data/app/views/crowdblog/application/_navbar.html.slim +11 -0
  22. data/app/views/crowdblog/application/_notices.html.slim +6 -0
  23. data/app/views/crowdblog/authors/index.html.slim +2 -2
  24. data/app/views/crowdblog/devise/_links.erb +25 -0
  25. data/app/views/crowdblog/devise/sessions/new.html.erb +21 -0
  26. data/app/views/crowdblog/posts/_form.html.slim +31 -0
  27. data/app/views/crowdblog/posts/_post.html.slim +13 -0
  28. data/app/views/crowdblog/posts/edit.html.slim +14 -0
  29. data/app/views/crowdblog/posts/index.html.slim +12 -10
  30. data/app/views/crowdblog/posts/new.html.slim +12 -0
  31. data/app/views/crowdblog/posts/update.json.jbuilder +2 -0
  32. data/app/views/layouts/crowdblog/application.html.slim +20 -0
  33. data/config/initializers/date_formats.rb +1 -0
  34. data/config/initializers/devise.rb +16 -0
  35. data/config/locales/devise.en.yml +57 -0
  36. data/config/routes.rb +1 -0
  37. data/crowdblog.gemspec +4 -12
  38. data/db/migrate/20120215232711_create_crowdblog_users.rb +23 -0
  39. data/db/migrate/20120217213920_create_crowdblog_posts.rb +17 -0
  40. data/db/migrate/20120219071614_create_crowdblog_assets.rb +10 -0
  41. data/lib/crowdblog/devise/failure_app.rb +9 -0
  42. data/lib/crowdblog/rspec/crowdblog_shared_examples.rb +108 -0
  43. data/lib/crowdblog/rspec.rb +1 -0
  44. data/lib/crowdblog/version.rb +1 -1
  45. data/lib/crowdblog.rb +10 -0
  46. data/spec/dummy/app/controllers/application_controller.rb +0 -16
  47. data/spec/dummy/app/views/home/show.html.slim +1 -1
  48. data/spec/dummy/config/application.rb +0 -10
  49. data/spec/dummy/config/initializers/devise.rb +0 -7
  50. data/spec/dummy/config/routes.rb +1 -8
  51. data/spec/dummy/db/schema.rb +11 -11
  52. data/spec/dummy/db/seed.rb +6 -0
  53. data/spec/integration/crowdblog_spec.rb +5 -0
  54. data/spec/models/post_spec.rb +3 -3
  55. data/spec/models/user_spec.rb +25 -1
  56. data/spec/spec_helper.rb +17 -1
  57. data/vendor/assets/javascripts/backbone_rails_sync.js +69 -0
  58. data/vendor/assets/javascripts/uploader/jquery.html5uploader.js +148 -0
  59. metadata +40 -183
  60. data/Gemfile.lock +0 -280
  61. data/app/assets/javascripts/crowdblog/posts_main.js.coffee +0 -42
  62. data/app/assets/javascripts/crowdblog/templates/posts/attachment.jst.eco.slim +0 -1
  63. data/app/assets/javascripts/crowdblog/templates/posts/edit.jst.eco.slim +0 -36
  64. data/app/assets/javascripts/crowdblog/templates/posts/index.jst.eco.slim +0 -14
  65. data/app/assets/javascripts/crowdblog/templates/posts/post.jst.eco.slim +0 -14
  66. data/app/assets/javascripts/crowdblog/views/posts/attachment_view.js.coffee +0 -8
  67. data/app/assets/javascripts/crowdblog/views/posts/edit_post_view.js.coffee +0 -46
  68. data/app/assets/javascripts/crowdblog/views/posts/index.js.coffee +0 -28
  69. data/app/assets/javascripts/crowdblog/views/posts/post_view.js.coffee +0 -57
  70. data/app/assets/javascripts/crowdblog/xhr_fix.js.coffee +0 -4
  71. data/app/controllers/crowdblog/controller.rb +0 -10
  72. data/app/views/layouts/crowdblog/crowdblog.html.slim +0 -26
  73. data/db/migrate/20120215232711_create_users.rb +0 -10
  74. data/db/migrate/20120216154516_add_devise_to_users.rb +0 -56
  75. data/db/migrate/20120217213920_create_posts.rb +0 -13
  76. data/db/migrate/20120219014520_add_author_to_posts.rb +0 -6
  77. data/db/migrate/20120219040607_add_state_to_post.rb +0 -7
  78. data/db/migrate/20120219071614_create_assets.rb +0 -10
  79. data/db/migrate/20120219234253_add_alias_to_users.rb +0 -6
  80. data/db/migrate/20120229160314_add_review_fields_to_post.rb +0 -6
  81. data/features/posts/listing.feature +0 -32
  82. data/features/posts/manage.feature +0 -36
  83. data/features/posts/publish.feature +0 -17
  84. data/features/step_definitions/global_steps.rb +0 -23
  85. data/features/step_definitions/navigation_steps.rb +0 -45
  86. data/features/step_definitions/posts_steps.rb +0 -138
  87. data/features/step_definitions/review_steps.rb +0 -27
  88. data/features/support/env.rb +0 -76
  89. data/spec/dummy/app/models/user.rb +0 -17
  90. data/spec/fabricators/posts_fabricator.rb +0 -21
  91. data/spec/fabricators/users_fabricator.rb +0 -19
  92. data/vendor/assets/javascripts/swfobject.js +0 -4
  93. data/vendor/assets/swf/uploadify.swf +0 -0
data/Gemfile.lock DELETED
@@ -1,280 +0,0 @@
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.16)
13
- backbone-rails
14
- carrierwave
15
- devise
16
- eco
17
- gravtastic
18
- jquery-rails
19
- less-rails-bootstrap
20
- rails (~> 3.2)
21
- redcarpet
22
- slim-rails
23
- slim_assets
24
- state_machine
25
-
26
- GEM
27
- remote: http://rubygems.org/
28
- specs:
29
- actionmailer (3.2.2)
30
- actionpack (= 3.2.2)
31
- mail (~> 2.4.0)
32
- actionpack (3.2.2)
33
- activemodel (= 3.2.2)
34
- activesupport (= 3.2.2)
35
- builder (~> 3.0.0)
36
- erubis (~> 2.7.0)
37
- journey (~> 1.0.1)
38
- rack (~> 1.4.0)
39
- rack-cache (~> 1.1)
40
- rack-test (~> 0.6.1)
41
- sprockets (~> 2.1.2)
42
- activemodel (3.2.2)
43
- activesupport (= 3.2.2)
44
- builder (~> 3.0.0)
45
- activerecord (3.2.2)
46
- activemodel (= 3.2.2)
47
- activesupport (= 3.2.2)
48
- arel (~> 3.0.2)
49
- tzinfo (~> 0.3.29)
50
- activeresource (3.2.2)
51
- activemodel (= 3.2.2)
52
- activesupport (= 3.2.2)
53
- activesupport (3.2.2)
54
- i18n (~> 0.6)
55
- multi_json (~> 1.0)
56
- addressable (2.3.2)
57
- arel (3.0.2)
58
- backbone-rails (0.9.1)
59
- rails (>= 3.0.0)
60
- bcrypt-ruby (3.0.1)
61
- builder (3.0.0)
62
- capybara (1.1.2)
63
- mime-types (>= 1.16)
64
- nokogiri (>= 1.3.3)
65
- rack (>= 1.0.0)
66
- rack-test (>= 0.5.4)
67
- selenium-webdriver (~> 2.0)
68
- xpath (~> 0.1.4)
69
- capybara-webkit (0.11.0)
70
- capybara (>= 1.0.0, < 1.2)
71
- json
72
- carrierwave (0.6.0)
73
- activemodel (>= 3.2.0)
74
- activesupport (>= 3.2.0)
75
- childprocess (0.3.1)
76
- ffi (~> 1.0.6)
77
- coffee-rails (3.2.2)
78
- coffee-script (>= 2.2.0)
79
- railties (~> 3.2.0)
80
- coffee-script (2.2.0)
81
- coffee-script-source
82
- execjs
83
- coffee-script-source (1.2.0)
84
- commonjs (0.2.5)
85
- cucumber (1.1.9)
86
- builder (>= 2.1.2)
87
- diff-lcs (>= 1.1.2)
88
- gherkin (~> 2.9.0)
89
- json (>= 1.4.6)
90
- term-ansicolor (>= 1.0.6)
91
- cucumber-ajaxer (0.0.4)
92
- cucumber
93
- cucumber-rails (1.3.0)
94
- capybara (>= 1.1.2)
95
- cucumber (>= 1.1.8)
96
- nokogiri (>= 1.5.0)
97
- database_cleaner (0.7.2)
98
- devise (2.0.4)
99
- bcrypt-ruby (~> 3.0)
100
- orm_adapter (~> 0.0.3)
101
- railties (~> 3.1)
102
- warden (~> 1.1.1)
103
- diff-lcs (1.1.3)
104
- eco (1.0.0)
105
- coffee-script
106
- eco-source
107
- execjs
108
- eco-source (1.1.0.rc.1)
109
- erubis (2.7.0)
110
- execjs (1.3.0)
111
- multi_json (~> 1.0)
112
- fabrication (1.3.2)
113
- faker (1.0.1)
114
- i18n (~> 0.4)
115
- ffi (1.0.11)
116
- fuubar (1.0.0)
117
- rspec (~> 2.0)
118
- rspec-instafail (~> 0.2.0)
119
- ruby-progressbar (~> 0.0.10)
120
- fuubar-cucumber (0.0.15)
121
- cucumber (>= 1.0.2)
122
- ruby-progressbar (~> 0.0.10)
123
- gherkin (2.9.3)
124
- json (>= 1.4.6)
125
- gravtastic (3.2.6)
126
- headless (0.3.1)
127
- hike (1.2.1)
128
- i18n (0.6.0)
129
- journey (1.0.3)
130
- jquery-rails (2.0.1)
131
- railties (>= 3.2.0, < 5.0)
132
- thor (~> 0.14)
133
- json (1.6.6)
134
- launchy (2.1.2)
135
- addressable (~> 2.3)
136
- less (2.0.12)
137
- commonjs (~> 0.2.0)
138
- therubyracer (~> 0.9.9)
139
- less-rails (2.1.8)
140
- actionpack (>= 3.1)
141
- less (~> 2.0.7)
142
- less-rails-bootstrap (2.0.8)
143
- less-rails (~> 2.1.0)
144
- libv8 (3.3.10.4)
145
- mail (2.4.4)
146
- i18n (>= 0.4.0)
147
- mime-types (~> 1.16)
148
- treetop (~> 1.4.8)
149
- mime-types (1.18)
150
- multi_json (1.2.0)
151
- nokogiri (1.5.2)
152
- orm_adapter (0.0.7)
153
- polyglot (0.3.3)
154
- rack (1.4.1)
155
- rack-cache (1.2)
156
- rack (>= 0.4)
157
- rack-ssl (1.3.2)
158
- rack
159
- rack-test (0.6.1)
160
- rack (>= 1.0)
161
- rails (3.2.2)
162
- actionmailer (= 3.2.2)
163
- actionpack (= 3.2.2)
164
- activerecord (= 3.2.2)
165
- activeresource (= 3.2.2)
166
- activesupport (= 3.2.2)
167
- bundler (~> 1.0)
168
- railties (= 3.2.2)
169
- railties (3.2.2)
170
- actionpack (= 3.2.2)
171
- activesupport (= 3.2.2)
172
- rack-ssl (~> 1.3.2)
173
- rake (>= 0.8.7)
174
- rdoc (~> 3.4)
175
- thor (~> 0.14.6)
176
- rake (0.9.2.2)
177
- rdoc (3.12)
178
- json (~> 1.4)
179
- redcarpet (2.1.1)
180
- rspec (2.9.0)
181
- rspec-core (~> 2.9.0)
182
- rspec-expectations (~> 2.9.0)
183
- rspec-mocks (~> 2.9.0)
184
- rspec-core (2.9.0)
185
- rspec-expectations (2.9.0)
186
- diff-lcs (~> 1.1.3)
187
- rspec-instafail (0.2.4)
188
- rspec-mocks (2.9.0)
189
- rspec-rails (2.9.0)
190
- actionpack (>= 3.0)
191
- activesupport (>= 3.0)
192
- railties (>= 3.0)
193
- rspec (~> 2.9.0)
194
- ruby-progressbar (0.0.10)
195
- rubyzip (0.9.6.1)
196
- sass (3.1.15)
197
- sass-rails (3.2.5)
198
- railties (~> 3.2.0)
199
- sass (>= 3.1.10)
200
- tilt (~> 1.3)
201
- selenium-webdriver (2.20.0)
202
- childprocess (>= 0.2.5)
203
- ffi (~> 1.0)
204
- multi_json (~> 1.0)
205
- rubyzip
206
- simplecov (0.6.1)
207
- multi_json (~> 1.0)
208
- simplecov-html (~> 0.5.3)
209
- simplecov-html (0.5.3)
210
- simplecov-rcov-text (0.0.2)
211
- slim (1.2.0)
212
- temple (~> 0.4.0)
213
- tilt (~> 1.3.3)
214
- slim-rails (1.0.3)
215
- actionpack (~> 3.0)
216
- activesupport (~> 3.0)
217
- railties (~> 3.0)
218
- slim (~> 1.0)
219
- slim_assets (0.0.2)
220
- slim
221
- tilt
222
- sprockets (2.1.2)
223
- hike (~> 1.2)
224
- rack (~> 1.0)
225
- tilt (~> 1.1, != 1.3.0)
226
- sqlite3 (1.3.5)
227
- state_machine (1.1.2)
228
- temple (0.4.0)
229
- term-ansicolor (1.0.7)
230
- therubyracer (0.9.10)
231
- libv8 (~> 3.3.10)
232
- thor (0.14.6)
233
- tilt (1.3.3)
234
- treetop (1.4.10)
235
- polyglot
236
- polyglot (>= 0.3.1)
237
- tzinfo (0.3.32)
238
- uglifier (1.2.4)
239
- execjs (>= 0.3.0)
240
- multi_json (>= 1.0.2)
241
- warden (1.1.1)
242
- rack (>= 1.0)
243
- xpath (0.1.4)
244
- nokogiri (~> 1.3)
245
-
246
- PLATFORMS
247
- ruby
248
-
249
- DEPENDENCIES
250
- backbone-rails
251
- capybara-webkit
252
- carrierwave
253
- coffee-rails
254
- crowdblog!
255
- cucumber-ajaxer
256
- cucumber-rails
257
- database_cleaner
258
- devise
259
- eco
260
- fabrication
261
- faker
262
- fuubar
263
- fuubar-cucumber
264
- gravtastic
265
- headless
266
- jquery-rails
267
- launchy
268
- less-rails-bootstrap
269
- rake
270
- redcarpet
271
- rspec-rails
272
- sass-rails
273
- simplecov
274
- simplecov-rcov-text
275
- slim-rails
276
- slim_assets
277
- sqlite3
278
- state_machine
279
- uglifier
280
- vestal_versions!
@@ -1,42 +0,0 @@
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' : '/assets/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
-
@@ -1 +0,0 @@
1
- .attachment <%= @url %>
@@ -1,36 +0,0 @@
1
- h2 <%= (if @isNew then 'New' else 'Edit') %> Post
2
-
3
- = form_tag '/' do
4
- fieldset
5
- .fields.span5
6
- .control-group.title
7
- = label_tag 'post_title', 'Title', class: 'control-label'
8
- .controls
9
- = text_field_tag 'post_title', "<%= @post.title %>".html_safe, class: 'input-xlarge span5'
10
- span.help-inline.title
11
-
12
- .control-group.body
13
- = label_tag 'post_body', 'Body', class: 'control-label'
14
- .controls
15
- = text_area_tag 'post_body', "<%= @post.body %>".html_safe, class: 'span5', rows: 30
16
- span.help-inline= link_to 'Markdown syntax', 'http://daringfireball.net/projects/markdown/syntax', target: '_BLANK'
17
-
18
- #post_preview.span6
19
-
20
- | <% unless @isNew: %>
21
- #attachments.row-fluid.clear
22
- h2 Attachments
23
- .span8.attachment-list
24
- | <% for asset in @post.assets: %>
25
- .attachment <%= asset.attachment.url %>
26
- | <% end %>
27
- .span4
28
- #uploader
29
-
30
- | <% end %>
31
- .form-actions.clear
32
- .row
33
- .span1
34
- button.btn.btn-primary.update Save
35
- .span1
36
- button.btn.btn-danger.cancel Cancel
@@ -1,14 +0,0 @@
1
- = link_to 'New Post', '#new', class: 'btn btn-primary new-post'
2
-
3
- .posts
4
- table.table.table-striped
5
- thead
6
- tr
7
- th Title
8
- th Author
9
- th Published at
10
- th
11
- th
12
- th
13
- th
14
- tbody
@@ -1,14 +0,0 @@
1
- td
2
- a href="/preview/<%= @post.id %>" target="_BLANK" <%= @post.title %>
3
- td <%= @post.author_email %>
4
- td.span2 <%= @post.published_at %>
5
- td.span1
6
- | <% if @publisher: %>
7
- a.btn.publish.span1 href="#" Publish
8
- | <% end %>
9
- td.span1
10
- a.btn.review.span1 href="#" Review
11
- td.span1
12
- a.btn.delete.span1 href="#" Delete
13
- td.span1
14
- a.btn.edit.span1 href="#edit/<%= @post.id %>" Edit
@@ -1,8 +0,0 @@
1
- $ ->
2
- PostsApp.AttachmentView = Backbone.View.extend
3
- template:
4
- JST["crowdblog/templates/posts/attachment"]
5
-
6
- render: ->
7
- this.$el.html(this.template(this.options))
8
- this
@@ -1,46 +0,0 @@
1
- $ ->
2
- PostsApp.EditPostView = Backbone.View.extend
3
- events:
4
- 'keyup #post_body' : 'updatePreview'
5
- 'click .cancel' : 'cancelPost'
6
- 'click .update' : 'updatePost'
7
-
8
- template:
9
- JST["crowdblog/templates/posts/edit"]
10
-
11
- render: ->
12
- this.model.fetch()
13
- this.$el.html(this.template({post: this.model.toJSON(), isNew: this.model.isNew()}))
14
- @updatePreview()
15
- this
16
-
17
- cancelPost: (e) ->
18
- e.preventDefault()
19
- this.goHome()
20
-
21
- updatePost: (e) ->
22
- e.preventDefault()
23
- this.model.save this.extractData(),
24
- success: =>
25
- this.goHome()
26
-
27
- error: (e) =>
28
- errors = $.parseJSON(e.responseText).errors
29
- console.log errors[0]
30
-
31
- $.each errors, (key, value) =>
32
- this.$('.control-group.' + key).addClass('error')
33
- this.$('.' + key + '.help-inline').html(value.join(','))
34
-
35
- updatePreview: ->
36
- @.$('#post_preview').html markdown.toHTML(@.$('#post_body').val())
37
-
38
- extractData: ->
39
- {
40
- 'body' : this.$('#post_body').val(),
41
- 'title' : this.$('#post_title').val()
42
- }
43
-
44
- goHome: ->
45
- PostsApp.router.navigate '/'
46
- trigger: true
@@ -1,28 +0,0 @@
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()
@@ -1,57 +0,0 @@
1
- $ ->
2
- PostsApp.PostView = Backbone.View.extend
3
- tagName: 'tr'
4
-
5
- events:
6
- 'click .delete' : 'deletePost'
7
- 'click .publish' : 'togglePublish'
8
- 'click .review' : 'toggleReview'
9
-
10
- template:
11
- JST["crowdblog/templates/posts/post"]
12
-
13
- render: ->
14
- this.$el.html(this.template({post: this.model.toJSON(), publisher: PostsApp.publisher}))
15
- this.paintButtons()
16
- this
17
-
18
- deletePost: (e) ->
19
- e.preventDefault()
20
- if confirm('Are you sure?')
21
- this.model.destroy()
22
-
23
- togglePublish: (e) ->
24
- e.preventDefault()
25
-
26
- if this.model.get('published?')
27
- this.model.save
28
- transition: 'draft'
29
- this.model.set('published?', false)
30
- else
31
- this.model.save
32
- transition: 'publish'
33
- this.model.set('published?', true)
34
-
35
- this.paintButtons()
36
-
37
- toggleReview: (e) ->
38
- e.preventDefault()
39
- if this.model.get('ready_for_review')
40
- this.model.save
41
- ready_for_review: false
42
- this.model.set 'ready_for_review', false
43
- else
44
- this.model.save
45
- ready_for_review: true
46
- this.model.set 'ready_for_review', true
47
-
48
- this.paintButtons()
49
-
50
- paintButtons: ->
51
- this.$el.find('.publish').removeClass('btn-success btn-danger')
52
- this.$el.find('.publish').addClass('btn-success') if this.model.get('published?')
53
- this.$el.find('.publish').addClass('btn-danger') unless this.model.get('published?')
54
-
55
- this.$el.find('.review').removeClass('btn-warning')
56
- this.$el.find('.review').addClass('btn-warning') if this.model.get 'ready_for_review'
57
-
@@ -1,4 +0,0 @@
1
- $.ajaxSetup
2
- beforeSend: (xhr) ->
3
- xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))
4
-
@@ -1,10 +0,0 @@
1
- module Crowdblog
2
- class Controller < ActionController::Base
3
- layout 'crowdblog/crowdblog'
4
- before_filter :authorize!
5
-
6
- def authorize!
7
- redirect_to main_app.crowdblog_sign_in_url unless current_user
8
- end
9
- end
10
- end
@@ -1,26 +0,0 @@
1
- doctype html
2
- html
3
- head
4
- title Crowd Blog
5
-
6
- = stylesheet_link_tag :crowdblog, media: 'all'
7
- = javascript_include_tag :crowdblog
8
- = csrf_meta_tags
9
-
10
- = yield :scripts
11
-
12
- body
13
- .navbar
14
- .navbar-inner
15
- .container
16
- .row
17
- .span9
18
- = image_tag 'crowdblog/logo.png'
19
- .span3
20
- ul.nav
21
- li.brand= current_user.email
22
- li= link_to 'Posts', posts_path
23
- li= link_to 'Authors', authors_path
24
- li= link_to 'Sign out', main_app.destroy_user_session_path
25
-
26
- .container= yield
@@ -1,10 +0,0 @@
1
- class CreateUsers < ActiveRecord::Migration
2
- def change
3
- create_table :users do |t|
4
- t.string :name
5
- t.boolean :is_publisher
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,56 +0,0 @@
1
- class AddDeviseToUsers < ActiveRecord::Migration
2
- def self.up
3
- change_table(:users) do |t|
4
- ## Database authenticatable
5
- t.string :email, :null => false, :default => ""
6
- t.string :encrypted_password, :null => false, :default => ""
7
-
8
- ## Recoverable
9
- #t.string :reset_password_token
10
- #t.datetime :reset_password_sent_at
11
-
12
- ## Rememberable
13
- t.datetime :remember_created_at
14
-
15
- ## Trackable
16
- t.integer :sign_in_count, :default => 0
17
- t.datetime :current_sign_in_at
18
- t.datetime :last_sign_in_at
19
- t.string :current_sign_in_ip
20
- t.string :last_sign_in_ip
21
-
22
- ## Encryptable
23
- # t.string :password_salt
24
-
25
- ## Confirmable
26
- # t.string :confirmation_token
27
- # t.datetime :confirmed_at
28
- # t.datetime :confirmation_sent_at
29
- # t.string :unconfirmed_email # Only if using reconfirmable
30
-
31
- ## Lockable
32
- # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
33
- # t.string :unlock_token # Only if unlock strategy is :email or :both
34
- # t.datetime :locked_at
35
-
36
- ## Token authenticatable
37
- t.string :authentication_token
38
-
39
-
40
- # Uncomment below if timestamps were not included in your original model.
41
- # t.timestamps
42
- end
43
-
44
- add_index :users, :email, :unique => true
45
- #add_index :users, :reset_password_token, :unique => true
46
- # add_index :users, :confirmation_token, :unique => true
47
- # add_index :users, :unlock_token, :unique => true
48
- add_index :users, :authentication_token, :unique => true
49
- end
50
-
51
- def self.down
52
- # By default, we don't want to make any assumption about how to roll back a migration when your
53
- # model already existed. Please edit below which fields you would like to remove in this migration.
54
- raise ActiveRecord::IrreversibleMigration
55
- end
56
- end
@@ -1,13 +0,0 @@
1
- class CreatePosts < ActiveRecord::Migration
2
- def change
3
- create_table :posts do |t|
4
- t.string :title
5
- t.text :body
6
- t.boolean :published
7
- t.string :permalink
8
- t.date :published_at
9
-
10
- t.timestamps
11
- end
12
- end
13
- end
@@ -1,6 +0,0 @@
1
- class AddAuthorToPosts < ActiveRecord::Migration
2
- def change
3
- add_column :posts, :author_id, :integer
4
-
5
- end
6
- end
@@ -1,7 +0,0 @@
1
- class AddStateToPost < ActiveRecord::Migration
2
- def change
3
- add_column :posts, :state, :string
4
- add_column :posts, :publisher_id, :integer
5
- remove_column :posts, :published
6
- end
7
- end
@@ -1,10 +0,0 @@
1
- class CreateAssets < ActiveRecord::Migration
2
- def change
3
- create_table :assets do |t|
4
- t.integer :post_id
5
- t.string :attachment
6
-
7
- t.timestamps
8
- end
9
- end
10
- end