<def tag="table-plus" attrs="sort-field, sort-direction, sort-columns" > <% sort_field ||= @sort_field; sort_direction ||= @sort_direction; sort_columns ||= {} %> <% sort_columns['this'] ||= this.member_class.name_attribute %> <div class="table-plus" merge-attrs="&attributes - attrs_for(:with_fields) - attrs_for(:table)"> <div class="header" param="header"> <div class="search"> <form param="search-form" method="get" action=""> <hidden-fields for-query-string skip="page, search_form"/> <span>Search</span> <input class="search" type="search" name="search" value="¶ms[:search]"/> <submit label="Go" class="search-button" param="search-submit"/> </form> </div> </div> <table merge-attrs="&attributes & (attrs_for(:table) + attrs_for(:with_fields))" empty merge-params> <field-heading-row:> <with-field-names merge-attrs="&all_attributes & attrs_for(:with_fields)"> <% col = sort_columns[scope.field_path] || scope.field_path sort = sort_field == col && sort_direction == 'asc' ? "-#{col}" : col sort_url = url_for(params.merge(:sort => sort) - [:page]) %> <th param="#{scope.field-name}-heading"> <a href="&sort_url" class="column-sort" param="#{scope.field-name}-heading-link"><%= scope.field_name.titleize %></a> <if test="&col == sort_field"> <do param="up-arrow" if="&sort_direction == 'desc'">↑</do> <do param="down-arrow" if="&sort_direction == 'asc'">↓</do> </if> </th> </with-field-names> <th if="&all_parameters[:controls]" class="controls"></th> </field-heading-row> </table> <do param="empty-message" if="empty?">No <collection-name lowercase/> to display</do> <page-nav param if="&this.respond_to? :page_count"/> </div> </def> <def tag="change-password-form"> <form class="change-password" param> <field-list fields="current_password, password, password_confirmation" param> <password-label:>New Password</password-label:> <password-confirmation-label:>Confirm New Password</password-confirmation-label:> </field-list> <div class="actions" param="actions"> <submit label="Change Password" param/> </div> </form> </def> <def tag="sortable-collection" attrs="sortable-options"><% singular_name = this.member_class.name.underscore attributes[:id] ||= "#{singular_name}_ordering" reorder_url = send("reorder_#{singular_name.pluralize}_url") %> <collection class="sortable" merge> <item: id="#{singular_name}_#{this.id}" param> <div class="ordering-handle" param="handle">↑<br/>↓</div> <card param/> </item:> </collection> <%= if Hobo::Dryml.last_if opts = { :url => reorder_url, :constraint => :vertical, :overlap => :vertical, :scroll => :window, :handle => 'ordering-handle', :complete => [visual_effect(:highlight, attributes[:id])] } opts.update(sortable_options) if sortable_options sortable_element attributes[:id], opts end # FIXME: Make unobstrusive %> </def>