crowdblog 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,9 @@ module Crowdblog
15
15
  end
16
16
 
17
17
  def index
18
+ @state = params[:state]
18
19
  @posts = Post.scoped_for(current_user).for_admin_index
20
+ @posts = @posts.with_state(@state) if @state
19
21
  respond_with @posts
20
22
  end
21
23
 
@@ -72,7 +72,7 @@ module Crowdblog
72
72
  end
73
73
 
74
74
  def for_admin_index
75
- ordered_by_state.order_by_publish_date
75
+ includes(:author).ordered_by_state.order_by_publish_date
76
76
  end
77
77
 
78
78
  def ordered_by_state
@@ -1,8 +1,17 @@
1
1
  .span12
2
2
  h1 Posts
3
3
 
4
- .new-link
5
- = link_to 'New Post', crowdblog.new_post_path, :class => "btn btn-primary btn-small"
4
+ .row
5
+ .span3.new-link
6
+ = link_to 'New Post', crowdblog.new_post_path, :class => "btn btn-primary btn-small"
7
+ .span3.offset6
8
+ ul.nav.nav-pills
9
+ li class="#{@state ? '' : 'active'}"
10
+ = link_to 'All', posts_path
11
+ li class="#{@state == 'published' ? 'active' : ''}"
12
+ = link_to 'Published', posts_by_state_path('published')
13
+ li class="#{@state == 'drafted' ? 'active' : ''}"
14
+ = link_to 'Drafted', posts_by_state_path('drafted')
6
15
 
7
16
  #posts.container
8
17
  table.table.table-striped= render @posts
data/config/routes.rb CHANGED
@@ -2,6 +2,11 @@ Crowdblog::Engine.routes.draw do
2
2
 
3
3
  resources :authors, only: :index
4
4
 
5
+ match 'posts/:state', :to => 'posts#index',
6
+ :constraints => { :state => /(published|drafted)/ },
7
+ :as => 'posts_by_state',
8
+ :via => :get
9
+
5
10
  resources :posts do
6
11
  resources :assets
7
12
  end
@@ -1,5 +1,9 @@
1
1
  module Crowdblog
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Crowdblog
4
+
5
+ initializer :assets do |config|
6
+ Rails.application.config.assets.precompile += %w( crowdblog.css crowdblog.js )
7
+ end
4
8
  end
5
9
  end
@@ -1,3 +1,3 @@
1
1
  module Crowdblog
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  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.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -427,7 +427,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
427
427
  version: '0'
428
428
  segments:
429
429
  - 0
430
- hash: 3472939247291806375
430
+ hash: 2103497571545624421
431
431
  required_rubygems_version: !ruby/object:Gem::Requirement
432
432
  none: false
433
433
  requirements:
@@ -436,7 +436,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
436
436
  version: '0'
437
437
  segments:
438
438
  - 0
439
- hash: 3472939247291806375
439
+ hash: 2103497571545624421
440
440
  requirements: []
441
441
  rubyforge_project:
442
442
  rubygems_version: 1.8.23