Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add facility to render datagrid partials from custom path:
* :partials options is added to all helpers which may render partials
- Loading branch information
Showing
9 changed files
with
125 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<%= form_for grid, options do |f| -%> | ||
<p>Namespaced form partial.</p> | ||
<% grid.filters.each do |filter| %> | ||
<div class="datagrid-filter filter"> | ||
<%= f.datagrid_label filter %> | ||
<%= f.datagrid_filter filter %> | ||
</div> | ||
<% end %> | ||
<div class="datagrid-actions"> | ||
<%= f.submit I18n.t("datagrid.form.search").html_safe, :class => "datagrid-submit" %> | ||
<%= link_to I18n.t('datagrid.form.reset').html_safe, url_for(grid.to_param => {}), :class => "datagrid-reset" %> | ||
</div> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<tr> | ||
<p>Namespaced head partial.</p> | ||
<% grid.html_columns(*options[:columns]).each do |column| %> | ||
<th class="<%= datagrid_column_classes(grid, column) %>"> | ||
<%= column.header %> | ||
<%= datagrid_order_for(grid, column, options) if column.order && options[:order]%> | ||
</th> | ||
<% end %> | ||
</tr> |
11 changes: 11 additions & 0 deletions
11
spec/support/test_partials/client/datagrid/_order_for.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="order"> | ||
<p>Namespaced order_for partial.</p> | ||
<%= link_to( | ||
I18n.t("datagrid.table.order.asc").html_safe, | ||
url_for(grid.param_name => grid.as_query.merge(:order => column.name, :descending => false)), | ||
:class => "asc") %> | ||
<%= link_to( | ||
I18n.t("datagrid.table.order.desc").html_safe, | ||
url_for(grid.param_name => grid.as_query.merge(:order => column.name, :descending => true )), | ||
:class => "desc") %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<tr class="<%= options[:cycle] && cycle(*options[:cycle]) %>"> | ||
<p>Namespaced row partial.</p> | ||
<% grid.html_columns(*options[:columns]).each do |column| %> | ||
<td class="<%= datagrid_column_classes(grid, column) %>"><%= datagrid_format_value(grid, column, asset) %></td> | ||
<% end %> | ||
</tr> |
19 changes: 19 additions & 0 deletions
19
spec/support/test_partials/client/datagrid/_table.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<%# | ||
Local variables: | ||
* grid - instance of Datagrid | ||
* assets - Array of database Entities | ||
* options - passed options Hash | ||
%> | ||
<p>Namespaced table partial.</p> | ||
<%= content_tag :table, options[:html] do %> | ||
<thead> | ||
<%= datagrid_header(grid, options) %> | ||
</thead> | ||
<tbody> | ||
<% if assets.empty? %> | ||
<tr><td class="noresults" colspan="100%"><%= I18n.t('datagrid.no_results').html_safe %></td></tr> | ||
<% else %> | ||
<%= datagrid_rows(grid, assets, options) %> | ||
<% end %> | ||
</tbody> | ||
<% end %> |