blocks 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/views/blocks/_table.html.erb +11 -4
- metadata +1 -1
@@ -24,7 +24,14 @@
|
|
24
24
|
|
25
25
|
<%= table.define :header_columns do |options| %>
|
26
26
|
<% table.columns.each do |column| %>
|
27
|
-
|
27
|
+
<% header_html = options.merge(column.options)[:header_html] %>
|
28
|
+
<% if options.merge(column.options)[:sortable] %>
|
29
|
+
<% sort_class = params[:order] != column.options[:order].to_s ? "sorting" : (params[:sort_mode] == "desc" ? "sorting_desc" : "sorting_asc") %>
|
30
|
+
<% header_html[:class] ||= "" %>
|
31
|
+
<% header_html[:class] += " #{sort_class}" %>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<%= content_tag :th, header_html do %>
|
28
35
|
<%= table.use "#{column.name.to_s}_header", options.merge(column.options) %>
|
29
36
|
<% end %>
|
30
37
|
<% end %>
|
@@ -47,11 +54,11 @@
|
|
47
54
|
<%= table.define :header_sortable_link do |options| %>
|
48
55
|
<% label = (options[:label] ? options[:label] : options[:column].name.to_s.titleize) %>
|
49
56
|
<% sort_mode = ((params[:order] != options[:order].to_s or params[:sort_mode] == "desc") ? "asc" : "desc") %>
|
50
|
-
<% ui_icon = sort_mode == "desc" ? "ui-icon-triangle-1-s" : "ui-icon-triangle-1-n" %>
|
51
57
|
<% parameters = params.merge({:order => (options[:order] ? options[:order] : options[:column].name), :sort_mode => sort_mode}) %>
|
58
|
+
<% parameters.delete(:action); parameters.delete(:controller) %>
|
59
|
+
<% url = options[:sort_url] ? options[:sort_url] : "" %>
|
52
60
|
|
53
|
-
<%= link_to label, parameters %>
|
54
|
-
<span class="ui-icon <%= ui_icon %>" style="display:<%= params[:order] == options[:order].to_s ? "inline-block" : "none" %>; float:none"></span>
|
61
|
+
<%= link_to label, "#{url}?#{parameters.to_query}" %>
|
55
62
|
<% end %>
|
56
63
|
|
57
64
|
<%= table.define :tbody do %>
|