app/views/rademade_admin/abstract/index.html.erb in rademade_admin-0.0.3 vs app/views/rademade_admin/abstract/index.html.erb in rademade_admin-0.1.0
- old
+ new
@@ -1,78 +1,49 @@
-<% content_for :last_crumbs do %>
- <span><%= admin_list_name(@model_info) %></span>
-<% end %>
-
<% content_for :page_header do %>
- <h3><%= admin_list_name(@model_info) %></h3>
+ <h3><%= @model_info.item_name %></h3>
<% end %>
<% content_for :nav_buttons do %><%
new_uri = admin_new_uri(@model_info)
if new_uri
- concat link_to admin_add_name(@model_info) + '+', new_uri, :class => 'btn-flat success new-product'
+ concat link_to t('rademade_admin.new_record') + '+', new_uri, :class => 'btn yellow-btn fl-l'
end
-%><% end %>
+end %>
-<% content_for :content do %>
- <% if @sortable_service.can_reset? %>
- <a href="<%= request.path %>">Reset sorting</a>
- <% end %>
- <table class="table table-hover">
-
- <thead>
- <tr>
- <% @list_fields.each_with_index do |name, index|
- list_field_name = field_name(name)
- %><th class="col-md-3 sort-button" data-column="<%= list_field_name %>">
- <% unless index == 0 %>
- <span class="line"></span>
- <% end %>
- <span><%= field_to_label(name) + @sortable_service.sorting_sign(list_field_name) %></span>
- </th>
- <% end %>
-
- <th class="col-md-3 align-right">
- <span class="line"></span>
- <span>Management</span>
- </th>
- </tr>
- </thead>
-
- <% has_position = @sortable_service.has_position? %>
- <tbody class="table-sortable" data-position='<%= has_position %>'>
- <% @items.each_with_index do |item| %>
- <tr<%
+<% content_for :content do %><%
+ concat render @template_service.on_page_select_block
+ if @sortable_service.can_reset?
+ %><a href="<%= request.path %>"><%= t('rademade_admin.reset_sort') %></a><%
+ end
+ %><table class="table-box"><%
+ concat render @template_service.table_head_block, {
+ :list_fields => @list_fields
+ }
+ has_position = @sortable_service.has_position?
+ %><tbody class="table-content" data-sortable="<%= has_position %>"><%
+ @items.each do |item|
+ %><tr id="item_<%= item.id %>" class="table-line" data-id="<%= item.id %>"<%
if has_position
- %> id='<%= item.position %>'<%
+ %> data-position="<%= item.position %>"<%
end
- %> data-id='<%= item.id %>'>
- <% @list_fields.each do |name|
- %><td><%
- value = field_value(name, item)
- # todo remove hard code, extract helper (data adapter)
- if value.respond_to? :id
- concat link_to value.to_s, admin_edit_uri(value)
- else
- concat value
- end
- %></td>
- <% end %>
- <td>
- <ul class="actions">
- <li><%= link_to 'Edit', admin_edit_uri(item) %></li>
- <li><%= button_to 'Destroy', admin_delete_uri(item), {
- :method => :delete,
- :form => {:class => 'delete-item-form'}
- } %></li>
- </ul>
+ %>><%
+ @list_fields.each do |field|
+ %><td class="table-item"><%= display_item_value(item, field) %></td><%
+ end
+ %><td class="table-item">
+ <span class="table-actions"><%
+ concat link_to t('rademade_admin.edit'), admin_edit_uri(item), :class => 'glyphicon glyphicon-pencil fl-l'
+ %><div class="glyphicon glyphicon-remove fl-l"><%
+ concat button_to t('rademade_admin.destroy'), admin_delete_uri(item), {
+ :method => :delete,
+ :form => { :class => 'delete-item-form' }
+ }
+ %></div>
+ </span>
</td>
- </tr>
- <% end %>
- </tbody>
- </table>
-
- <%= render 'rademade_admin/_blocks/pagination' %>
-
-<% end %>
-
-<%= render :template => 'rademade_admin/_layouts/inner' %>
+ </tr><%
+ end
+ %></tbody>
+ </table><%
+ concat render @template_service.pagination_block
+end
+concat render :template => @template_service.inner_layout %>
\ No newline at end of file