blog_logic 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
1
+ 1.1.3
@@ -7,13 +7,14 @@ class Admin::PostsController < ApplicationController
7
7
  # CRUD ===========================================================================================
8
8
  def index
9
9
  params[:labels] = {
10
- :humanize_path => 'URL',
10
+ :slug => 'URL',
11
11
  :state => 'Status',
12
12
  :updated_at => 'Last Modified'
13
13
  }
14
- params[:by] ||= 'humanize_path'; params[:dir] ||= 'ASC'
15
- @posts = @blog.posts.sort{|a,b| a.send(params[:by]) <=> b.send(params[:by])}
16
- @posts.reverse! if params[:dir] == 'DESC'
14
+ params[:by] ||= 'slug'
15
+ params[:dir] ||= 'asc'
16
+ @posts = @blog.posts.sort_by{ |p| p[params[:by]] || p[params[:by]].to_s }
17
+ @posts.reverse! if params[:dir] == 'desc'
17
18
  end
18
19
 
19
20
  def show
@@ -5,7 +5,7 @@
5
5
  <%- else -%>
6
6
  <table class="standard">
7
7
  <tr>
8
- <th style="width: 20%;"><%= sort_link("admin/blogs/#{@blog.id}/posts", 'humanize_path', params) -%></th>
8
+ <th style="width: 20%;"><%= sort_link("admin/blogs/#{@blog.id}/posts", 'slug', params) -%></th>
9
9
  <th style="width: 20%;"><%= sort_link("admin/blogs/#{@blog.id}/posts", 'title', params) -%></th>
10
10
  <th style="width: 10%;"><%= sort_link("admin/blogs/#{@blog.id}/posts", 'state', params) -%></th>
11
11
  <th style="width: 10%;"><%= sort_link("admin/blogs/#{@blog.id}/posts", 'publication_date', params) -%></th>
data/blog_logic.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "blog_logic"
8
- s.version = "1.1.2"
8
+ s.version = "1.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bantik"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blog_logic
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 2
10
- version: 1.1.2
9
+ - 3
10
+ version: 1.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bantik