crowdblog 0.2.0 → 0.3.0

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.
data/.gitignore CHANGED
@@ -13,3 +13,5 @@ spec/dummy/.sass-cache
13
13
 
14
14
  Gemfile.lock
15
15
  tmp
16
+
17
+ .idea/
@@ -1,4 +1,4 @@
1
- Copyright 2012 YOURNAME
1
+ Copyright 2012 Crowd Interactive
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,28 @@
1
+ class Crowdblog.Models.Post extends Backbone.Model
2
+ paramRoot: 'post'
3
+
4
+ url: ->
5
+ Crowdblog.adminPostsPath + '/' + @id
6
+
7
+ publish: ->
8
+ @performTransition 'publish', =>
9
+ @trigger 'post-published'
10
+
11
+ finish: ->
12
+ @performTransition 'finish', =>
13
+ @trigger 'post-finished'
14
+
15
+ review: ->
16
+ @performTransition 'review', =>
17
+ @trigger 'post-reviewed'
18
+
19
+ draft: ->
20
+ @performTransition 'draft', =>
21
+ @trigger 'post-drafted'
22
+
23
+ performTransition: (transition, success)->
24
+ $.ajax
25
+ type: 'POST'
26
+ url: "/admin/posts/#{@id}/#{transition}"
27
+ dataType: 'json'
28
+ success: success
@@ -1,52 +1,87 @@
1
1
  class Crowdblog.Views.PostView extends Backbone.View
2
2
  events:
3
- 'click a.publish' : 'publishPost'
4
- 'click a.review' : 'markForReview'
3
+ 'click .publish': 'publish'
4
+ 'click .finish' : 'finish'
5
+ 'click .review' : 'review'
6
+ 'click .draft' : 'draft'
5
7
 
6
8
  initialize: ->
7
- @model = new Crowdblog.Models.Post
8
- ready_for_review: (@$el.attr('data-ready-for-review') == 'true')
9
+ @model = new Crowdblog.Models.Post
10
+ @model.id = @postId()
11
+ @publishIndicator = @$el.find '.publish-status'
12
+ @observePost()
13
+ @model.trigger "post-#{@initialState()}"
9
14
 
10
- @model.id = @postId()
11
- @model.bind('change:ready_for_review', @paintReviewButton)
12
-
13
- publishPost: (e) ->
14
- e.preventDefault()
15
- if @postIsPublished()
16
- @model.save 'transition', 'draft', { success: @paintPostRow }
17
- else
18
- @model.save 'transition', 'publish', { success: @paintPostRow }
15
+ observePost: ->
16
+ @model.on 'post-published', @markPublished, @
17
+ @model.on 'post-finished', @markFinished, @
18
+ @model.on 'post-reviewed', @markReviewed, @
19
+ @model.on 'post-drafted', @markDrafted, @
19
20
 
20
21
  postId: ->
21
- @$el.attr('data-post-id')
22
-
23
- paintPostRow: =>
24
- if @model.get('transition') == 'publish'
25
- @$el.find('a.publish').removeClass('btn-danger')
26
- @$el.find('a.publish').addClass('btn-success')
27
- @$el.attr('data-state', 'published')
28
- else
29
- @$el.find('a.publish').removeClass('btn-success')
30
- @$el.find('a.publish').addClass('btn-danger')
31
- @$el.attr('data-state', 'drafted')
32
-
33
- @$el.find('td.published-at').html(@model.get('published_at'))
34
-
35
- postIsPublished: ->
36
- @$el.attr('data-state') == 'published'
37
-
38
- markForReview: (e) ->
39
- e.preventDefault()
40
- ready_for_review = @model.get('ready_for_review')
41
- if ready_for_review
42
- ready_for_review = false
43
- else
44
- ready_for_review = true
45
-
46
- @model.save 'ready_for_review', ready_for_review
47
-
48
- paintReviewButton: (post) =>
49
- if post.get('ready_for_review')
50
- @$el.find('a.review').addClass('btn-warning')
51
- else
52
- @$el.find('a.review').removeClass('btn-warning')
22
+ @$el.data 'post-id'
23
+
24
+ initialState: ->
25
+ @$el.data 'state'
26
+
27
+ publish: (e)->
28
+ @model.publish()
29
+
30
+ finish: (e)->
31
+ @model.finish()
32
+
33
+ review: (e)->
34
+ @model.review()
35
+
36
+ draft: (e) ->
37
+ @model.draft()
38
+
39
+ markPublished: ->
40
+ publish_button = @$el.find '.publish-btn'
41
+ review_button = @$el.find '.states .review'
42
+ publish_button.addClass 'btn-success'
43
+ publish_button.removeClass 'btn-danger'
44
+ publish_button.addClass 'draft'
45
+ publish_button.removeClass 'publish'
46
+ @setAsActive review_button
47
+ @setPublishIndicator 'published'
48
+
49
+ markFinished: ->
50
+ button = @$el.find '.states .finish'
51
+ @setAsActive button
52
+ @setPublishIndicator 'not_published'
53
+
54
+ markReviewed: ->
55
+ button = @$el.find '.states .review'
56
+ @setAsActive button
57
+ @setPublishIndicator 'reviewed'
58
+
59
+ markDrafted: ->
60
+ publish_button = @$el.find '.publish-btn'
61
+ button = @$el.find '.states .draft'
62
+ publish_button.addClass 'btn-danger'
63
+ publish_button.removeClass 'btn-success'
64
+ publish_button.addClass 'publish'
65
+ publish_button.removeClass 'draft'
66
+ @setAsActive button
67
+ @setPublishIndicator 'not_published'
68
+
69
+ setAsActive: (button)->
70
+ last_active = @$el.find '.states button'
71
+ last_active.removeClass 'active'
72
+ last_active.removeClass 'btn-primary'
73
+ button.addClass 'active btn-primary'
74
+
75
+ setPublishIndicator: (status)->
76
+ @publishIndicator.removeClass 'btn-warning btn-success btn-danger'
77
+ switch status
78
+ when 'reviewed'
79
+ @publishIndicator.addClass 'btn-warning'
80
+ @publishIndicator.html 'Reviewed'
81
+ when 'published'
82
+ @publishIndicator.addClass 'btn-success'
83
+ @publishIndicator.html 'Published'
84
+ else
85
+ @publishIndicator.addClass 'btn-danger'
86
+ @publishIndicator.html 'Not Published'
87
+
@@ -51,8 +51,6 @@ module Crowdblog
51
51
  @post.save!
52
52
  end
53
53
 
54
- @post.publish_if_allowed(post_params[:transition], current_user) if post_params[:transition]
55
-
56
54
  respond_with @post do |format|
57
55
  format.html { redirect_to crowdblog.admin_posts_path }
58
56
  end
@@ -0,0 +1,21 @@
1
+ module Crowdblog
2
+ module Admin
3
+ class TransitionsController < Crowdblog::Admin::BaseController
4
+ respond_to :json
5
+ before_filter :load_post, only: [:create]
6
+
7
+ def create
8
+ namespace = '_as_publisher' if current_user.is_publisher?
9
+ @post.send "#{params[:transition]}#{namespace}"
10
+ respond_with @post, location: admin_post_url(@post)
11
+ end
12
+
13
+ private
14
+
15
+ def load_post
16
+ post = Post.scoped_for(current_user).find(params[:id])
17
+ @post = PostPresenter.new(post, current_user)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Crowdblog
2
- class ApplicationController < ActionController::Base
2
+ class ApplicationController < ::ApplicationController
3
3
  def method_missing(method_name)
4
4
  if method_name == :current_user
5
5
  Rails.logger.warn("current_user in Crowdblog::ApplicationController should be overriden")
@@ -1,7 +1,7 @@
1
1
  module Crowdblog
2
2
  class Post < ActiveRecord::Base
3
- belongs_to :author, class_name: 'User'
4
- belongs_to :publisher, class_name: 'User'
3
+ belongs_to :author, :class_name => Crowdblog.author_user_class_name
4
+ belongs_to :publisher, :class_name => Crowdblog.publisher_user_class_name
5
5
  has_many :assets
6
6
 
7
7
  delegate :name, to: :author, prefix: true, allow_nil: true
@@ -17,10 +17,26 @@ module Crowdblog
17
17
 
18
18
  state_machine initial: :drafted do
19
19
  state :drafted
20
+ state :finished
21
+ state :reviewed
22
+ state :published
23
+
24
+ event :finish do
25
+ transition drafted: :finished
26
+ end
27
+
28
+ event :draft do
29
+ transition finished: :drafted
30
+ end
31
+ end
32
+
33
+ state_machine :publisher, attribute: :state, initial: :drafted, namespace: :as_publisher do
34
+ state :drafted
35
+ state :finished
36
+ state :reviewed
20
37
  state :published
21
38
 
22
39
  before_transition on: :publish do |post, transition|
23
- #post.update_attribute(:published_at, Time.now)
24
40
  post.published_at ||= Time.now
25
41
  end
26
42
 
@@ -32,8 +48,16 @@ module Crowdblog
32
48
  transition published: :drafted
33
49
  end
34
50
 
51
+ event :finish do
52
+ transition drafted: :finished
53
+ end
54
+
55
+ event :review do
56
+ transition finished: :reviewed
57
+ end
58
+
35
59
  event :publish do
36
- transition drafted: :published
60
+ transition all => :published
37
61
  end
38
62
  end
39
63
 
@@ -1,30 +1,24 @@
1
1
  module Crowdblog
2
- class User
3
- attr_accessor :email
4
- attr_accessor :name
5
- attr_accessor :id
2
+ class User < ActiveRecord::Base
3
+ has_many :authored_posts, inverse_of: :author,
4
+ foreign_key: 'author_id', class_name: 'Post'
5
+ has_many :published_posts, inverse_of: :author,
6
+ foreign_key: 'author_id', class_name: 'Post',
7
+ conditions: ['state = ?', 'published'], order: 'published_at DESC'
8
+ has_one :last_post, class_name: 'Post',
9
+ foreign_key: :author_id, conditions: ['state = ?', 'published'],
10
+ order: 'published_at DESC, created_at DESC, id DESC'
6
11
 
7
12
  def is_publisher?
8
13
  true
9
14
  end
10
15
 
11
- def self.primary_key
12
- "id"
16
+ def last_post_at
17
+ last_post.try(:published_at)
13
18
  end
14
19
 
15
- def [](value)
16
- []
17
- end
18
-
19
- def destroyed?
20
- false
21
- end
22
-
23
- def new_record?
24
- true
25
- end
26
-
27
- def save(*)
20
+ def last_published_at
21
+ published_posts.first ? published_posts.first.published_at : nil
28
22
  end
29
23
  end
30
24
  end
@@ -0,0 +1,13 @@
1
+ module Crowdblog
2
+ class PostPresenter < SimpleDelegator
3
+ def initialize(object, user)
4
+ @user = user
5
+ super(object)
6
+ end
7
+
8
+ def publish_as_publisher
9
+ self.publisher = @user
10
+ super
11
+ end
12
+ end
13
+ end
@@ -4,9 +4,15 @@
4
4
  td.span2.published-at = post.published_at.try(:to_s, :crowdblog_short)
5
5
  td.span1
6
6
  - if current_user.is_publisher?
7
- = link_to 'Publish', '#', :class => "btn btn-small publish #{(post.published? ? 'btn-success' : 'btn-danger')}"
7
+ = link_to 'Publish', '#', :class => "btn btn-small publish-btn btn-danger #{(post.published? ? 'draft' : 'publish')}"
8
8
  td.span1
9
- = link_to 'Review', '#', :class => "btn btn-small review #{(post.ready_for_review ? 'btn-warning' : '')}"
9
+ .btn-group.states
10
+ button.btn.btn-small.draft Drafted
11
+ button.btn.btn-small.finish Finished
12
+ - if !current_user.is_publisher?
13
+ button.btn.btn-small.disabled.publish-status
14
+ - if current_user.is_publisher?
15
+ button.btn.btn-small.review Reviewed
10
16
  td.span1
11
17
  = link_to 'Delete', crowdblog.admin_post_path(post), :method => :delete, :confirm => 'Are you sure?', :class => "btn btn-small"
12
18
  td.span1
@@ -17,8 +17,12 @@
17
17
  table.table.table-striped= render :partial => 'post', :collection => @posts
18
18
 
19
19
  - content_for :scripts do
20
- coffee:
21
- $ ->
22
- $('tr.post').each (index, el) ->
23
- new Crowdblog.Views.PostView
24
- el: el
20
+ javascript:
21
+ $(function() {
22
+ return $('tr.post').each(function(index, el) {
23
+ Crowdblog.adminPostsPath = '#{crowdblog.admin_posts_path}';
24
+ return new Crowdblog.Views.PostView({
25
+ el: el
26
+ });
27
+ });
28
+ });
@@ -5,5 +5,4 @@
5
5
  ul.nav
6
6
  li.brand= current_user.email
7
7
  li= link_to 'Posts', crowdblog.admin_posts_path
8
- li= link_to 'Authors', crowdblog.admin_authors_path
9
8
  li= link_to 'Sign out', '#'
@@ -7,6 +7,7 @@ html
7
7
  = javascript_include_tag "//code.jquery.com/jquery.min.js"
8
8
  = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.1/underscore-min.js"
9
9
  = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js"
10
+ = javascript_include_tag "//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/js/bootstrap.min.js"
10
11
  = javascript_include_tag :crowdblog
11
12
  meta name="viewport" content="width=device-width, initial-scale=1.0"
12
13
  = csrf_meta_tags
@@ -9,6 +9,11 @@ Crowdblog::Engine.routes.draw do
9
9
  :as => 'posts_by_state',
10
10
  :via => :get
11
11
 
12
+ match 'posts/:id/:transition', :to => 'transitions#create',
13
+ :constraints => { :transition => /(draft|finish|review|publish)/ },
14
+ :as => 'post_transitions',
15
+ :via => :post
16
+
12
17
  resources :posts do
13
18
  resources :assets
14
19
  end
@@ -1,9 +1,7 @@
1
1
  $:.push File.expand_path('../lib', __FILE__)
2
2
 
3
- # Maintain your gem's version:
4
3
  require 'crowdblog/version'
5
4
 
6
- # Describe your gem and declare its dependencies:
7
5
  Gem::Specification.new do |s|
8
6
  s.name = 'crowdblog'
9
7
  s.version = Crowdblog::VERSION
@@ -20,8 +18,6 @@ Gem::Specification.new do |s|
20
18
 
21
19
  s.add_dependency 'rails', '~> 3.2'
22
20
 
23
- # Added in the Gemfile, so they can be accessed in the dummy app
24
- # leave the dependencies here so our engine require those gems when added on base apps
25
21
  s.add_dependency 'carrierwave'
26
22
  s.add_dependency 'gravtastic'
27
23
  s.add_dependency 'jquery-rails'
@@ -0,0 +1,8 @@
1
+ class CreateCrowdblogUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :crowdblog_users do |t|
4
+ t.string :email
5
+ t.string :name
6
+ end
7
+ end
8
+ end
@@ -9,3 +9,11 @@ require "state_machine"
9
9
  require "strong_parameters"
10
10
 
11
11
  require "generators/crowdblog/views_generator"
12
+
13
+ module Crowdblog
14
+ @@author_user_class_name = 'User'
15
+ @@publisher_user_class_name = 'User'
16
+
17
+ mattr_accessor :author_user_class_name
18
+ mattr_accessor :publisher_user_class_name
19
+ end
@@ -1,4 +1,4 @@
1
- shared_examples_for "a crowdblog", :type => :integration do
1
+ shared_examples_for "a crowdblog", :type => :feature do
2
2
 
3
3
  let(:post) do
4
4
  Crowdblog::Post.create :title => 'A post title', :body => 'A post body'
@@ -7,7 +7,7 @@ shared_examples_for "a crowdblog", :type => :integration do
7
7
  describe "Home" do
8
8
  it "shows published posts" do
9
9
  post.save!
10
- post.publish
10
+ post.publish_as_publisher
11
11
 
12
12
  visit crowdblog.root_path
13
13
 
@@ -69,13 +69,14 @@ shared_examples_for "a crowdblog", :type => :integration do
69
69
  button = find_link 'Publish'
70
70
  button.click
71
71
 
72
- page.should have_css 'a.btn-success'
72
+ page.should have_css '.publish-btn.btn-success'
73
+ page.should have_css '.review.active'
73
74
  post.reload.state.should eq 'published'
74
75
  end
75
76
  end
76
77
 
77
78
  it "draftes a post", :js => true do
78
- post.publish!
79
+ post.publish_as_publisher!
79
80
 
80
81
  visit crowdblog.admin_posts_path
81
82
 
@@ -83,23 +84,37 @@ shared_examples_for "a crowdblog", :type => :integration do
83
84
  button = find_link 'Publish'
84
85
  button.click
85
86
 
86
- page.should have_css 'a.btn-danger'
87
+ page.should have_css '.publish-btn.btn-danger'
88
+ page.should have_css '.draft.active'
87
89
  post.reload.state.should eq 'drafted'
88
90
  end
89
91
  end
90
92
 
91
- it "marks the post for review", :js => true do
93
+ it "marks the post as reviewed", :js => true do
94
+ post.finish!
92
95
  visit crowdblog.admin_posts_path
93
96
 
94
97
  within "#post_#{post.id}" do
95
- button = find_link 'Review'
98
+ button = find_button 'Reviewed'
96
99
  button.click
97
100
 
98
- page.should have_css 'a.btn-warning'
99
- post.reload.ready_for_review.should be_true
101
+ page.should have_css '.review.active'
102
+ post.reload.state.should eq 'reviewed'
100
103
  end
101
104
  end
102
- end
105
+
106
+ it "marks the post as finished", :js => true do
107
+ visit crowdblog.admin_posts_path
108
+
109
+ within "#post_#{post.id}" do
110
+ button = find_button 'Finished'
111
+ button.click
112
+
113
+ page.should have_css '.finish.active'
114
+ post.reload.state.should eq 'finished'
115
+ end
116
+ end
117
+ end
103
118
  end
104
119
  end
105
120
  end
@@ -1,3 +1,3 @@
1
1
  module Crowdblog
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20120219071614) do
14
+ ActiveRecord::Schema.define(:version => 20121016063750) do
15
15
 
16
16
  create_table "crowdblog_assets", :force => true do |t|
17
17
  t.integer "post_id"
@@ -34,4 +34,9 @@ ActiveRecord::Schema.define(:version => 20120219071614) do
34
34
  t.datetime "updated_at", :null => false
35
35
  end
36
36
 
37
+ create_table "crowdblog_users", :force => true do |t|
38
+ t.string "email"
39
+ t.string "name"
40
+ end
41
+
37
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crowdblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2012-10-12 00:00:00.000000000 Z
16
+ date: 2013-01-24 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rails
@@ -316,7 +316,6 @@ extra_rdoc_files: []
316
316
  files:
317
317
  - .autotest
318
318
  - .gitignore
319
- - .rbenv-version
320
319
  - .rspec
321
320
  - .rvmrc
322
321
  - .simplecov
@@ -327,7 +326,7 @@ files:
327
326
  - Rakefile
328
327
  - app/assets/images/crowdblog/.gitkeep
329
328
  - app/assets/javascripts/crowdblog.js
330
- - app/assets/javascripts/crowdblog/models/post.js.coffee.erb
329
+ - app/assets/javascripts/crowdblog/models/post.js.coffee
331
330
  - app/assets/javascripts/crowdblog/views/attachment_view.js.coffee
332
331
  - app/assets/javascripts/crowdblog/views/post_form_view.js.coffee
333
332
  - app/assets/javascripts/crowdblog/views/post_view.js.coffee
@@ -335,18 +334,18 @@ files:
335
334
  - app/assets/stylesheets/crowdblog.css
336
335
  - app/assets/stylesheets/crowdblog/posts.css.scss
337
336
  - app/controllers/crowdblog/admin/assets_controller.rb
338
- - app/controllers/crowdblog/admin/authors_controller.rb
339
337
  - app/controllers/crowdblog/admin/base_controller.rb
340
338
  - app/controllers/crowdblog/admin/posts_controller.rb
339
+ - app/controllers/crowdblog/admin/transitions_controller.rb
341
340
  - app/controllers/crowdblog/application_controller.rb
342
341
  - app/controllers/crowdblog/posts_controller.rb
343
342
  - app/helpers/crowdblog/application_helper.rb
344
343
  - app/models/crowdblog/asset.rb
345
344
  - app/models/crowdblog/post.rb
346
345
  - app/models/crowdblog/user.rb
346
+ - app/presenters/crowdblog/post_presenter.rb
347
347
  - app/sweepers/post_sweeper.rb
348
348
  - app/uploaders/attachment_uploader.rb
349
- - app/views/crowdblog/admin/authors/index.html.slim
350
349
  - app/views/crowdblog/admin/posts/_form.html.slim
351
350
  - app/views/crowdblog/admin/posts/_post.html.slim
352
351
  - app/views/crowdblog/admin/posts/edit.html.slim
@@ -368,6 +367,7 @@ files:
368
367
  - crowdblog.gemspec
369
368
  - db/migrate/20120217213920_create_crowdblog_posts.rb
370
369
  - db/migrate/20120219071614_create_crowdblog_assets.rb
370
+ - db/migrate/20121016063750_create_crowdblog_users.rb
371
371
  - lib/crowdblog.rb
372
372
  - lib/crowdblog/devise/failure_app.rb
373
373
  - lib/crowdblog/engine.rb
@@ -418,9 +418,9 @@ files:
418
418
  - spec/dummy/public/500.html
419
419
  - spec/dummy/public/favicon.ico
420
420
  - spec/dummy/script/rails
421
+ - spec/features/crowdblog_spec.rb
421
422
  - spec/generators/crowdblog/views_generator_spec.rb
422
423
  - spec/helpers/application_helper_spec.rb
423
- - spec/integration/crowdblog_spec.rb
424
424
  - spec/models/post_spec.rb
425
425
  - spec/spec_helper.rb
426
426
  - vendor/assets/javascripts/backbone_rails_sync.js
@@ -442,7 +442,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
442
442
  version: '0'
443
443
  segments:
444
444
  - 0
445
- hash: 4035348149856330059
445
+ hash: 4143603944779799739
446
446
  required_rubygems_version: !ruby/object:Gem::Requirement
447
447
  none: false
448
448
  requirements:
@@ -451,7 +451,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
451
451
  version: '0'
452
452
  segments:
453
453
  - 0
454
- hash: 4035348149856330059
454
+ hash: 4143603944779799739
455
455
  requirements: []
456
456
  rubyforge_project:
457
457
  rubygems_version: 1.8.23
@@ -498,8 +498,8 @@ test_files:
498
498
  - spec/dummy/public/500.html
499
499
  - spec/dummy/public/favicon.ico
500
500
  - spec/dummy/script/rails
501
+ - spec/features/crowdblog_spec.rb
501
502
  - spec/generators/crowdblog/views_generator_spec.rb
502
503
  - spec/helpers/application_helper_spec.rb
503
- - spec/integration/crowdblog_spec.rb
504
504
  - spec/models/post_spec.rb
505
505
  - spec/spec_helper.rb
@@ -1 +0,0 @@
1
- 1.9.3-p194
@@ -1,8 +0,0 @@
1
- <% crowdblog = Crowdblog::Engine.routes.url_helpers %>
2
-
3
- class Crowdblog.Models.Post extends Backbone.Model
4
- paramRoot: 'post'
5
-
6
- url: ->
7
- '<%= crowdblog.admin_posts_path %>/' + @id
8
-
@@ -1,11 +0,0 @@
1
- module Crowdblog
2
- module Admin
3
- class AuthorsController < Crowdblog::Admin::BaseController
4
-
5
- def index
6
- @authors = User.includes(:published_posts).sort {|a,b| b.published_posts.size <=> a.published_posts.size}
7
- end
8
-
9
- end
10
- end
11
- end
@@ -1,18 +0,0 @@
1
- h1 Authors
2
-
3
- table.table.table-striped
4
- thead
5
- tr
6
- th
7
- th Name
8
- th Email
9
- th Posts
10
- th Last Post
11
- tbody
12
- - @authors.each do |author|
13
- tr
14
- th= image_tag author.gravatar_url
15
- td= author.name
16
- td= author.email
17
- td= author.published_posts.size
18
- td= author.last_published_at