g_already_grid 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +10 -1
- data/VERSION +1 -1
- data/g_already_grid.gemspec +2 -2
- data/lib/g_already_grid/templates/guilded.already_grid.html.erb +1 -1
- data/lib/g_already_grid/view_helpers.rb +12 -4
- data/lib/g_already_grid.rb +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -53,7 +53,7 @@ Generate:
|
|
53
53
|
|
54
54
|
Simplest case:
|
55
55
|
|
56
|
-
|
56
|
+
<%= raw g_already_grid( @items, :id => "items-grid", :cols => [:name, :is_active] ) %> # Rails 3
|
57
57
|
<%= g_already_grid @items, :id => "items-grid", :cols => [:name, :is_active] %> # Rails 2
|
58
58
|
|
59
59
|
Add sorting (by name column only):
|
@@ -101,6 +101,15 @@ clickable:: Set to false in order to avoid rows linking to show action. Default
|
|
101
101
|
adaptable_url:: True in order to make the index url automagically adapt to :get collection routes, otherwise false.
|
102
102
|
|
103
103
|
|
104
|
+
== Overriding HTML generation
|
105
|
+
|
106
|
+
You can override the following methods in your application_helper.rb file:
|
107
|
+
|
108
|
+
* g_already_grid_empty_message( options={} )
|
109
|
+
* g_already_grid_non_sortable_column_title( title )
|
110
|
+
* g_already_grid_sortable_column_title( name, method, path, scoping_args, controller, already_grid_options, options={} )
|
111
|
+
* g_already_grid_footer_contents( ar_col, options={} )
|
112
|
+
|
104
113
|
== REQUIREMENTS:
|
105
114
|
|
106
115
|
* Rails >= 2.2.0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.10
|
data/g_already_grid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{g_already_grid}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["C. Jason Harrelson (midas)"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-06-08}
|
13
13
|
s.description = %q{A Guilded Rails component that generates a rich grid control from an ActiveRecord.}
|
14
14
|
s.email = %q{jason@lookforwardenterprises.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<th class="chkBox"><input type="checkbox" class="<%= options[:check_all_class] %>" /></th>
|
7
7
|
<% end %>
|
8
8
|
<% options[:col_titles].each_with_index do |col, i| %>
|
9
|
-
<th><%= sort_by.include?( options[:cols][i].to_sym ) ?
|
9
|
+
<th><%= sort_by.include?( options[:cols][i].to_sym ) ? g_already_grid_sortable_column_title( col, options[:cols][i], path_helpers[:index_rest_helper], path_helpers[:index_rest_args], controller, options ) : g_already_grid_non_sortable_column_title( col ) %></th>
|
10
10
|
<% end %>
|
11
11
|
<th class="right"></th>
|
12
12
|
</tr>
|
@@ -36,7 +36,7 @@ module GAlreadyGrid
|
|
36
36
|
|
37
37
|
Guilded::Guilder.instance.add( :already_grid, options, [ 'jquery/jquery-already_grid-0.1.min.js' ] )
|
38
38
|
|
39
|
-
return
|
39
|
+
return g_already_grid_empty_message( options ) if ar_col.nil? || ar_col.empty?
|
40
40
|
|
41
41
|
options[:grid_class] ||= 'already-grid'
|
42
42
|
options[:checkbox_class] ||= "chk"
|
@@ -110,6 +110,12 @@ module GAlreadyGrid
|
|
110
110
|
full_path = "#{path}/templates/guilded.already_grid.html.erb"
|
111
111
|
self.render( :file => full_path, :use_full_path => false, :locals => vars )
|
112
112
|
end
|
113
|
+
|
114
|
+
private
|
115
|
+
|
116
|
+
def g_already_grid_empty_message( options={} )
|
117
|
+
raw( "<span class=\"list-empty-msg\">#{options[:empty_msg] || 'No matching records'}</span>" )
|
118
|
+
end
|
113
119
|
|
114
120
|
def g_already_grid_footer_contents( ar_col, options={} )
|
115
121
|
footer = "<tr><td colspan=\"#{options[:total_columns].to_s}\">"
|
@@ -119,8 +125,10 @@ module GAlreadyGrid
|
|
119
125
|
footer << "</td></tr>"
|
120
126
|
raw footer
|
121
127
|
end
|
122
|
-
|
123
|
-
|
128
|
+
|
129
|
+
def g_already_grid_non_sortable_column_title( title )
|
130
|
+
raw( "<span>#{title}</span>" )
|
131
|
+
end
|
124
132
|
|
125
133
|
# Creates a link to sort this column of a table. Utilizes the link_to helper,
|
126
134
|
# but resolves sort by, direction and adds correct CSS classes for UI elements to
|
@@ -133,7 +141,7 @@ module GAlreadyGrid
|
|
133
141
|
# +already_grid_options+ The options hash from the already grid view helper.
|
134
142
|
# +options+ see link_to helper.
|
135
143
|
#
|
136
|
-
def
|
144
|
+
def g_already_grid_sortable_column_title( name, method, path, scoping_args, controller, already_grid_options, options={} )
|
137
145
|
is_sorted_link = ( method.to_s == params[:order].to_s )
|
138
146
|
|
139
147
|
if is_sorted_link
|
data/lib/g_already_grid.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 10
|
9
|
+
version: 1.0.10
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- C. Jason Harrelson (midas)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-08 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|