localized_scaffold 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -239,6 +239,9 @@ application above:
239
239
 
240
240
  rake db:migrate
241
241
 
242
+ vi config/environments/development.rb
243
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
244
+
242
245
  vi app/controllers/application_controller.rb
243
246
  before_filter :authenticate_user!, :except => [ :show, :index]
244
247
 
@@ -70,7 +70,7 @@ module <%= class_name %>Helper
70
70
  #
71
71
  # Parameters:
72
72
  #
73
- # [chars] Array with chars the <%= shell.base.searchbar %> of existing <%= plural_name %> start with
73
+ # [chars] Array with <%= shell.base.searchbar %> chars of existing <%= plural_name %> start with
74
74
  # [term] Search term to render with
75
75
  # [:options] Options to customize
76
76
  #
@@ -79,12 +79,16 @@ module <%= class_name %>Helper
79
79
  # [:type] What to render (:abc, :form or :both)
80
80
  # [:default] Default search term to show in input field (localized value)
81
81
  # [:size] Size of input field (defaults to 12)
82
+ # [:format] Type of HTML to generate (:table or :ul defaulting to :table)
82
83
 
83
84
  def <%= shell.base.file_name %>_searchbar(chars, term, options = {})
84
85
  type = options[:type] || 'both'
85
86
  default = options[:default] || t('standard.cmds.search')
86
87
  size = options[:size] || 12
87
88
 
89
+ format = options[:format] || :table
90
+ inner_tag = (format == :ul ? 'li' : 'td')
91
+
88
92
  if type == :form
89
93
  cols = []
90
94
  else
@@ -97,18 +101,25 @@ module <%= class_name %>Helper
97
101
  inner = c.upcase
98
102
  end
99
103
 
100
- content_tag(:td, inner, :class => (same ? 'selected' : nil))
104
+ content_tag(inner_tag, inner, :class => (same ? 'selected' : nil))
101
105
  end
102
106
  end
103
107
 
104
108
  if type != :abc
105
109
  value = (term.blank? or term.length > 1) ? term : default
106
- form = content_tag(:form, tag(:input, :type => :text,
110
+ form = content_tag(:form, tag(:input, :type => :search,
107
111
  :id => 'searchbar-term', :name => 'q', :size => size,
108
112
  :value => value), :method => 'get', :id => 'searchbar-form',
109
113
  :action => <%= shell.base.path_of_with_belongsto_if_any %>)
110
114
 
111
- cols << content_tag(:td, form)
115
+ return form if type == :form
116
+
117
+ cols << content_tag(inner_tag, form)
118
+ end
119
+
120
+ if format == :ul
121
+ return content_tag(:ul, ActiveSupport::SafeBuffer.new(cols.join),
122
+ :class => 'searchbar')
112
123
  end
113
124
 
114
125
  return content_tag(:table, content_tag(:tr,
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 3
9
- version: 0.9.3
8
+ - 4
9
+ version: 0.9.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Ulbrich
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-15 00:00:00 +02:00
17
+ date: 2010-06-25 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -117,6 +117,5 @@ rubygems_version: 1.3.6
117
117
  signing_key:
118
118
  specification_version: 3
119
119
  summary: Localized Rails scaffolding with style...
120
- test_files:
121
- - test/localized_scaffold_test.rb
122
- - test/test_helper.rb
120
+ test_files: []
121
+