inline_forms 0.9.20 → 0.9.21

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.20
1
+ 0.9.21
@@ -57,7 +57,7 @@ class InlineFormsController < ApplicationController
57
57
  @PER_PAGE = 5 unless @parent_class.nil?
58
58
  # if the parent_class is not nill, we are in associated list and we don't search there.
59
59
  # also, make sure the Model that you want to do a search on has a :name attribute. TODO
60
- @parent_class.nil? ? conditions = ["name like ?", "%#{params[:search]}%" ] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
60
+ @parent_class.nil? ? conditions = [ @Klass.order_by_clause.to_s + " like ?", "%#{params[:search]}%" ] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
61
61
  if cancan_enabled?
62
62
  @objects = @Klass.accessible_by(current_ability).order(@Klass.order_by_clause).paginate :page => params[:page], :per_page => @PER_PAGE || 12, :conditions => conditions
63
63
  else
@@ -121,7 +121,7 @@ class InlineFormsController < ApplicationController
121
121
  @parent_id = params[:parent_id]
122
122
  @PER_PAGE = 5 unless @parent_class.nil?
123
123
  # for the logic behind the :conditions see the #index method.
124
- @parent_class.nil? ? conditions = ["name like ?", "%#{params[:search]}%" ] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
124
+ @parent_class.nil? ? conditions = [ @Klass.order_by_clause.to_s + " like ?", "%#{params[:search]}%" ] : conditions = [ "#{@parent_class.foreign_key} = ?", @parent_id ]
125
125
  object[@parent_class.foreign_key] = @parent_id unless @parent_class.nil?
126
126
  if object.save
127
127
  flash.now[:success] = "Successfully created #{object.class.to_s.underscore}."
@@ -2,12 +2,12 @@ InlineForms::SPECIAL_COLUMN_TYPES[:date_select]=:date
2
2
 
3
3
  # date
4
4
  def date_select_show(object, attribute)
5
- link_to_inline_edit object, attribute, object.send(attribute)
5
+ link_to_inline_edit object, attribute, object.send(attribute).strftime("%m-%d-%Y")
6
6
  end
7
7
 
8
8
  def date_select_edit(object, attribute)
9
9
  css_id = 'datepicker_' + object.class.to_s.underscore + '_' + object.id.to_s + '_' + attribute.to_s
10
- out = text_field_tag attribute, object[attribute], :id => css_id
10
+ out = text_field_tag attribute, object[attribute].strftime("%m-%d-%Y"), :id => css_id
11
11
  out << '<SCRIPT>'.html_safe
12
12
  out << "$(function() { ".html_safe
13
13
  out << '$("#'.html_safe + css_id.html_safe + '").datepicker();'.html_safe
@@ -65,6 +65,8 @@ module InlineFormsHelper
65
65
  raw out if can?(:update, parent_class.find(parent_id))
66
66
  end
67
67
  end
68
+ else
69
+ raw out
68
70
  end
69
71
  end
70
72
 
@@ -9,7 +9,7 @@
9
9
  <%= yield(:head) %>
10
10
  <script>
11
11
  $.datepicker.setDefaults({
12
- dateFormat: 'yy-mm-dd',
12
+ dateFormat: 'dd-mm-yy',
13
13
  changeMonth: true,
14
14
  changeYear: true,
15
15
  showOtherMonths: true,
data/inline_forms.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{inline_forms}
8
- s.version = "0.9.20"
8
+ s.version = "0.9.21"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ace Suares"]
12
- s.date = %q{2011-06-28}
12
+ s.date = %q{2011-07-17}
13
13
  s.description = %q{Inline Forms aims to ease the setup of forms that provide inline editing. The field list can be specified in the model.}
14
14
  s.email = %q{ace@suares.an}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 20
10
- version: 0.9.20
9
+ - 21
10
+ version: 0.9.21
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ace Suares
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-28 00:00:00 -04:00
18
+ date: 2011-07-17 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency