rows_controller 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ class RowsController < ApplicationController
|
|
11
11
|
|
12
12
|
helper_method :resource, :resources, :columns,
|
13
13
|
:model_class, :model_name, :model_symbol, :model_symbol_plural,
|
14
|
-
:
|
14
|
+
:resource_format
|
15
15
|
|
16
16
|
def resource
|
17
17
|
return @_resource if @_resource
|
@@ -68,16 +68,16 @@ class RowsController < ApplicationController
|
|
68
68
|
['id'] + model_class.content_columns.collect{|c| c.name }
|
69
69
|
end
|
70
70
|
|
71
|
-
def
|
72
|
-
x = '' if x.nil?
|
71
|
+
def resource_format(x)
|
72
|
+
x = ''.html_safe if x.nil?
|
73
73
|
bool = x.class == Time || x.class == Date || x.class == DateTime ||
|
74
74
|
x.class == ActiveSupport::TimeWithZone
|
75
|
-
return x.strftime(DATE_FORMAT) if bool
|
76
|
-
return x.to_s
|
77
|
-
return 'X'
|
78
|
-
return ' '
|
75
|
+
return x.strftime(DATE_FORMAT).html_safe if bool
|
76
|
+
return x.to_s.html_safe if x.class == Fixnum
|
77
|
+
return 'X'.html_safe if x.class == TrueClass
|
78
|
+
return ' '.html_safe if x.class == FalseClass
|
79
79
|
return x.call if x.class == Proc
|
80
|
-
return '---'
|
80
|
+
return '---'.html_safe if x.empty?
|
81
81
|
str = x.to_s
|
82
82
|
## str = UTF8FY.iconv(x.to_s) if APPLICATION_OPTIONS[:customization] == :dk
|
83
83
|
return str.gsub(/\r*\n/, '<br/>')
|
@@ -16,7 +16,7 @@
|
|
16
16
|
%>
|
17
17
|
<tr id="row_<%= resource.id%>" class="<%= %w{odd even}.at(cnt % 2) %>" >
|
18
18
|
<% columns.each do |column| %>
|
19
|
-
<td> <%=
|
19
|
+
<td> <%= resource_format(resource.send(column)) %> </td>
|
20
20
|
<% end %>
|
21
21
|
<td>
|
22
22
|
<%= link_to t('button.show', :default => 'Show'), url %>
|
@@ -7,7 +7,7 @@ describe RowsController do
|
|
7
7
|
specify { should respond_to(:model_name) }
|
8
8
|
specify { should respond_to(:model_symbol) }
|
9
9
|
specify { should respond_to(:model_symbol_plural) }
|
10
|
-
specify { should respond_to(:
|
10
|
+
specify { should respond_to(:resource_format) }
|
11
11
|
|
12
12
|
specify { should respond_to(:index) }
|
13
13
|
specify { should respond_to(:show) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rows_controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sqlite3
|
16
|
-
requirement: &
|
16
|
+
requirement: &81766660 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *81766660
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &81765120 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *81765120
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: capybara
|
38
|
-
requirement: &
|
38
|
+
requirement: &81764180 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *81764180
|
47
47
|
description: YourController < RowsController ( < ApplicationController).
|
48
48
|
email:
|
49
49
|
- dittmar.krall@matique.de
|
@@ -120,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
segments:
|
122
122
|
- 0
|
123
|
-
hash:
|
123
|
+
hash: -51311327
|
124
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
125
|
none: false
|
126
126
|
requirements:
|