inline_forms 1.3.43 → 1.3.44

Sign up to get free protection for your applications and to get access to all the features.
@@ -120,9 +120,13 @@ class InlineFormsController < ApplicationController
120
120
  @parent_id = params[:parent_id]
121
121
  @PER_PAGE = 5 unless @parent_class.nil?
122
122
  # for the logic behind the :conditions see the #index method.
123
- foreign_key = object.association(@parent_class.underscore.to_sym).reflection.options[:foreign_key] || @parent_class.foreign_key
124
- @parent_class.nil? ? conditions = [ @Klass.order_by_clause.to_s + " like ?", "%#{params[:search]}%" ] : conditions = [ "#{foreign_key} = ?", @parent_id ]
125
- object[foreign_key] = @parent_id unless @parent_class.nil?
123
+ if @parent_class.nil?
124
+ conditions = [ @Klass.order_by_clause.to_s + " like ?", "%#{params[:search]}%" ]
125
+ else
126
+ foreign_key = object.association(@parent_class.underscore.to_sym).reflection.options[:foreign_key] || @parent_class.foreign_key
127
+ conditions = [ "#{foreign_key} = ?", @parent_id ]
128
+ object[foreign_key] = @parent_id
129
+ end
126
130
  if object.save
127
131
  flash.now[:success] = t('success', :message => object.class.model_name.human)
128
132
  if cancan_enabled?
@@ -0,0 +1,14 @@
1
+ # -*- encoding : utf-8 -*-
2
+ InlineForms::SPECIAL_COLUMN_TYPES[:plain_text_area]=:text
3
+
4
+ def plain_text_area_show(object, attribute)
5
+ link_to_inline_edit object, attribute, object[attribute].empty? ? 'Click here to edit' : object[attribute]
6
+ end
7
+
8
+ def plain_text_area_edit(object, attribute)
9
+ text_area_tag attribute, object[attribute], :class => 'attribute_text_area'
10
+ end
11
+
12
+ def plain_text_area_update(object, attribute)
13
+ object[attribute.to_sym] = params[attribute.to_sym]
14
+ end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "1.3.43"
3
+ VERSION = "1.3.44"
4
4
  end
@@ -0,0 +1,16 @@
1
+ class InlineFormsCreateViewForTranslations < ActiveRecord::Migration
2
+
3
+ execute 'CREATE VIEW translations ( locale, thekey, value, interpolations, is_proc )
4
+ AS
5
+ SELECT L.name, K.name, T.value, T.interpolations, T.is_proc
6
+ FROM if_keys K, if_locales L, if_translations T
7
+ WHERE T.if_key_id = K.id AND T.i_locale_id = L.id '
8
+
9
+ end
10
+
11
+ def self.down
12
+ execute 'DROP VIEW translations'
13
+ end
14
+
15
+
16
+ end
@@ -0,0 +1,21 @@
1
+ #!/bin/bash
2
+ rails g inline_forms IFLocale \
3
+ name:string \
4
+ if_translations:belongs_to \
5
+ _enabled:yes _presentation:'#{name}' -f
6
+
7
+ rails g inline_forms IFKey \
8
+ name:string \
9
+ if_translations:has_many if_translations:associated \
10
+ _enabled:yes _presentation:'#{name}' -f
11
+
12
+ rails g inline_forms IFTranslation \
13
+ if_key:belongs_to \
14
+ if_locale:dropdown \
15
+ value:text \
16
+ interpolations:text \
17
+ is_proc:boolean \
18
+ _presentation:'#{value}' -f
19
+
20
+ bundle exec rake db:migrate
21
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.43
4
+ version: 1.3.44
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-02 00:00:00.000000000 Z
12
+ date: 2012-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rvm
@@ -187,6 +187,7 @@ files:
187
187
  - lib/app/helpers/form_elements/image_field.rb
188
188
  - lib/app/helpers/form_elements/info.rb
189
189
  - lib/app/helpers/form_elements/infoadmin.rb
190
+ - lib/app/helpers/form_elements/plain_text_area.rb
190
191
  - lib/app/helpers/form_elements/question_list.rb
191
192
  - lib/app/helpers/form_elements/radio_button.rb
192
193
  - lib/app/helpers/form_elements/scale_with_integers.rb
@@ -247,9 +248,11 @@ files:
247
248
  - lib/inline_forms/version.rb
248
249
  - lib/locales/inline_forms.en.yml
249
250
  - lib/locales/inline_forms.nl.yml
251
+ - lib/otherstuff/20120310065554_inline_forms_create_view_for_translations.rb
250
252
  - lib/otherstuff/add_roles.sql
251
253
  - lib/otherstuff/bump
252
254
  - lib/otherstuff/diffie
255
+ - lib/otherstuff/mkiftrans
253
256
  - lib/otherstuff/mkrole
254
257
  - lib/otherstuff/roles_users.sql
255
258
  - test/helper.rb