Skip to content

Commit

Permalink
#20 index improved
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdilek committed Sep 5, 2013
1 parent 453767f commit 28ec222
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
en:
hello: "Hello world"
cancel: Cancel
tooltips:
zoom: Zoom
4 changes: 3 additions & 1 deletion config/locales/tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@

tr:
hello: "Merhaba Dünya"
cancel: İptal
cancel: İptal
tooltips:
zoom: Detay
48 changes: 48 additions & 0 deletions lib/templates/haml/scaffold/index.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.panel.tables
.panel-heading
%i.icon-table.icon-large
Default Table
.panel-tools
.btn-group
%a.btn{href: '#'}
%i.icon-wrench
Settings
%a.btn{href: '#'}
%i.icon-filter
Filters
%a.btn{href: '#', data: {toggle: 'toolbar-tooltip'}, title: 'Reload'}
%i.icon-refresh
.badge 3 record
.panel-body.no-padding
.table-header.row
.col-lg-9
TODO: Add filters here
.col-lg-3
.input-group
%input.form-control{placeholder: 'Quick search...', type: 'text'}/
%span.input-group-btn
%button.btn{type: 'button'}
%i.icon-search
%table.table
%thead
%tr
%th #
<% for attribute in attributes -%>
%th= sort_link(@search, :<%= attribute.name %>, t('activerecord.attributes.<%= singular_table_name %>.<%= attribute.name %>'))
<% end -%>
%th.actions
Actions
%tbody
- @<%= plural_table_name %>.each do |<%= singular_table_name %>|
%tr
%td= <%= singular_table_name %>.id
<% for attribute in attributes -%>
%td= <%= singular_table_name %>.<%= attribute.name %>
<% end -%>
%td.action
= link_to(<%= singular_table_name %>, class: 'btn btn-success', toogle: 'tooltip', title: t('tooltips.zoom')) do
%i.icon-zoom-in
= link_to(edit_<%= singular_table_name %>_path(<%= singular_table_name %>) , class: 'btn btn-info') do
%i.icon-edit
= link_to(<%= singular_table_name %>, class: 'btn btn-danger', method: :delete) do
%i.icon-trash
5 changes: 3 additions & 2 deletions lib/templates/rails/responders_controller/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ class <%= controller_class_name %>Controller < ApplicationController
<% unless options[:singleton] -%>
def index
@<%= table_name %> = <%= class_name %>.all.page(params[:page])
respond_with(@<%= table_name %>)
@search = <%= class_name %>.search(params[:q])
@<%= table_name %> = @search.result(:distinct => true).paginate(:page => params[:page])
respond_with(@<%= table_name %>)
end
<% end -%>

Expand Down

0 comments on commit 28ec222

Please sign in to comment.