app/views/shared/index.html.erb in adminpanel-1.2.12 vs app/views/shared/index.html.erb in adminpanel-2.0.0

- old
+ new

@@ -1,90 +1,55 @@ -<% provide(:page_title, @model.display_name) -%> +<% provide(:page_title, @model.display_name.pluralize(I18n.default_locale)) -%> <div class="row-fluid"> - <%= - link_to( - content_tag(:div, - content_tag(:i, nil, :class => 'icon-plus-sign icon-2x') + content_tag(:span, I18n.t("action.create") + " #{@model.display_name}", nil), - :class => "btn btn-box span2"), - { - :controller => params[:controller], - :action => "new" - } - ) - %> + <%= render 'shared/new_resource_button' %> </div> <div class="row-fluid"> <div class="widget widget-padding span12"> <div class="widget-header"> - <%= content_tag(:i, nil, :class => @model.icon) %> + <%= content_tag(:i, nil, class: "fa fa-#{@model.icon}") %> <h5> - <%= pluralize_es(@model.display_name) %> + <%= @model.display_name.pluralize(I18n.default_locale) %> </h5> </div> <div class="widget-body"> <div class="dataTables_wrapper form-inline"> <table id="information-table" class="table table-striped table-bordered dataTable"> <thead><!-- model attributes --> <tr> <% @model.display_attributes('index').each do |fields| %> <% fields.each do |attribute, properties| %> - <% if properties["type"] != "adminpanel_file_field" && properties["type"] != "has_many" %> - <th><%= properties["label"] %></th> + <% if properties['type'] != 'adminpanel_file_field' && properties['type'] != 'has_many' %> + <th><%= properties['label'] %></th> <% end %> <% end %> <% end %> - <th><%= I18n.t("actions") %></th> + <th><%= I18n.t('actions') %></th> </tr> </thead><!-- Ends model attributes --> <tbody> <% collection.each do |member| %> <tr> <% @model.display_attributes('index').each do |fields| %> <% fields.each do |attribute, properties| %> <% if properties["type"] == "wysiwyg_field" %> <td><%= member.send(attribute).html_safe -%></td> - <% elsif properties["type"] == "belongs_to" %> + <% elsif properties['type'] == 'belongs_to' %> <td> - <%= parent_object_name(member, properties["model"]) %> + <%= parent_object_name(member, properties['model']) %> </td> - <% elsif properties["type"] == "boolean" %> + <% elsif properties['type'] == 'boolean' %> <td><%= member.send(attribute) ? I18n.t('action.is_true') : I18n.t('action.is_false') %></td> <% elsif properties["type"] != "adminpanel_file_field" && properties["type"] != "has_many" %> <td><%= member.send(attribute) -%></td> <% end %> <% end %> <% end %> <td> - <%= - link_to( - content_tag(:i, nil, :class => 'icon-zoom-in'), - [member], - :title => t("action.show") - ) - %> + <%= render 'shared/show_icon_button', resource: member %> - <%= - link_to( - content_tag(:i, nil, :class => 'icon-pencil'), - [:edit, member], - :title => t("action.update") + " #{@model.display_name}" - ) - %> + <%= render 'shared/edit_icon_button', resource: member %> - <%= - link_to( - content_tag( - :i, - nil, - :class => 'icon-remove' - ), - [member], - :title => I18n.t("action.delete"), - :id => "resource-delete", - :method => :delete, - :data => { :confirm => "Eliminar #{@model.display_name}?" } - ) - %> + <%= render 'shared/delete_icon_button', resource: member %> </td> </tr> <% end %> </tbody> </table>