Project

General

Profile

« Previous | Next » 

Revision d995ecb4

Added by Paul Kelly almost 14 years ago

  • ID d995ecb41af4d4cb394e89a12983dc168fcf97a3

Ensure that all index views and controllers are consistent

Ensures that all controllers use @search in the index method
Ensure that all index views use pagination

View differences:

app/controllers/architectures_controller.rb
class ArchitecturesController < ApplicationController
def index
@architectures = Architecture.all(:include => :operatingsystems)
@search = Architecture.search(params[:search])
@architectures = @search.paginate(:page => params[:page], :include => :operatingsystems)
end
def new
app/controllers/common_parameters_controller.rb
class CommonParametersController < ApplicationController
def index
@common_parameters = CommonParameter.all
@search = CommonParameter.search(params[:search])
@common_parameters = @search.paginate(:page => params[:page])
end
def new
app/controllers/domains_controller.rb
class DomainsController < ApplicationController
def index
@domains = Domain.all
@search = Domain.search params[:search]
@domains = @search.paginate :page => params[:page], :include => 'hosts'
end
def new
app/controllers/hostgroups_controller.rb
class HostgroupsController < ApplicationController
def index
@hostgroups = Hostgroup.all
@search = Hostgroup.search params[:search]
@hostgroups = @search.paginate :page => params[:page]
end
def new
app/controllers/medias_controller.rb
class MediasController < ApplicationController
def index
@medias = Media.all(:include => [:operatingsystem])
@search = Media.search params[:search]
@medias = @search.paginate(:page => params[:page], :include => [:operatingsystem])
end
def new
app/controllers/models_controller.rb
class ModelsController < ApplicationController
def index
@models = Model.all
@search = Model.search params[:search]
@models = @search.paginate :page => params[:page]
end
def new
app/controllers/ptables_controller.rb
class PtablesController < ApplicationController
def index
@ptables = Ptable.all(:include => [:operatingsystems])
@search = Ptable.search params[:search]
@ptables = @search.paginate(:page => params[:page], :include => [:operatingsystems])
end
def show
app/models/architecture.rb
def to_s
name
end
def self.per_page
25
end
end
app/views/architectures/index.html.erb
<tr class="<%= cycle("even", "odd") -%>">
<td><%= link_to h(architecture.name), edit_architecture_path(architecture) %></td>
<td><%=h architecture.operatingsystems.to_sentence %></td>
<td><%= link_to "Destroy", architecture, :confirm => 'Are you sure?', :method => :delete %></td>
<td anign="right">
<%= link_to "Destroy", architecture, :confirm => "Delete #{architecture.name}?", :method => :delete %>
</td>
</tr>
<% end %>
</table>
<%= page_entries_info @architectures %>
<%= will_paginate @architectures %>
<p><%= link_to "New Architecture", new_architecture_path %></p>
app/views/common_parameters/index.html.erb
<tr>
<td><%= link_to h(common_parameter), edit_common_parameter_path(common_parameter)%></td>
<td><%=h common_parameter.value %></td>
<td><%= link_to "Destroy", common_parameter, :confirm => 'Are you sure?', :method => :delete %></td>
<td align=""right>
<%= link_to "Destroy", common_parameter, :confirm => "Delete #{common_parameter.name}?", :method => :delete %>
</td>
</tr>
<% end %>
</table>
<%= page_entries_info @common_parameters %>
<%= will_paginate @common_parameters %>
<p><%= link_to "New Common Parameter", new_common_parameter_path %></p>
app/views/domains/index.html.erb
<tr class="<%= cycle("even", "odd") -%>">
<td><%= link_to h(domain.fullname.empty? ? domain.name : domain.fullname), edit_domain_path(domain)%></td>
<td><%= domain.hosts.size %>
<td><%= link_to "Destroy", domain, :confirm => 'Are you sure?', :method => :delete %></td>
<td align="right"> <%= link_to "Destroy", domain, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<%= page_entries_info @domains %>
<%= will_paginate @domains %>
<p><%= link_to "New Domain", new_domain_path %></p>
app/views/hostgroups/index.html.erb
<table class="list">
<tr>
<th>Name</th>
<th></th>
</tr>
<% for hostgroup in @hostgroups %>
<tr class="<%= cycle("even", "odd") -%>">
<td><%=link_to h(hostgroup.name), edit_hostgroup_path(hostgroup) %></td>
<td><%= link_to "Destroy", hostgroup, :confirm => 'Are you sure?', :method => :delete %></td>
<td align="right">
<%= link_to "Destroy", hostgroup, :confirm => 'Are you sure?', :method => :delete %>
</td>
</tr>
<% end %>
</table>
<%= page_entries_info @hostgroups %>
<%= will_paginate @hostgroups %>
<p><%= link_to "New Hostgroup", new_hostgroup_path %></p>
app/views/medias/index.html.erb
<th>Name</th>
<th>Path</th>
<th>Operatingsystem</th>
<th></th>
</tr>
<% for media in @medias %>
<tr>
<td><%= link_to h(media), edit_media_path(media) %></td>
<td><%=h media.path %></td>
<td><%=h media.operatingsystem %></td>
<td><%= link_to "Destroy", media, :confirm => 'Are you sure?', :method => :delete %></td>
<td align="right">
<%= link_to "Destroy", media, :confirm => "Delete #{media.name}?", :method => :delete %>
</td>
</tr>
<% end %>
</table>
<%= page_entries_info @medias %>
<%= will_paginate @medias %>
<p><%= link_to "New Media", new_media_path %></p>
app/views/models/index.html.erb
<tr class="<%= cycle("even", "odd") -%>">
<td><%=link_to h(model.name), edit_model_path(model)%></td>
<td><%= model.hosts.count %></td>
<td><%= link_to "Destroy", model, :confirm => 'Are you sure?', :method => :delete %></td>
<td align="right">
<%= link_to "Destroy", model, :confirm => "Delete #{model.name}?", :method => :delete %>
</td>
</tr>
<% end %>
</table>
Found <%= @models.size %> models
<%= page_entries_info @models %>
<%= will_paginate @models %>
<p><%= link_to "New Model", new_model_path %></p>
app/views/operatingsystems/index.html.erb
<tr class="<%= cycle("even", "odd") -%>">
<td><%= link_to h(operatingsystem.to_label), edit_operatingsystem_path(operatingsystem) %></td>
<td><%= h operatingsystem.family %></td>
<td><%= link_to "Destroy", operatingsystem, :confirm => "Delete #{operatingsystem.fullname}?", :method => :delete %></td>
<td align="right">
<%= link_to "Destroy", operatingsystem, :confirm => "Delete #{operatingsystem.fullname}?", :method => :delete %>
</td>
</tr>
<% end %>
</table>
app/views/ptables/index.html.erb
<tr>
<th>Name</th>
<th>Operatingsystems</th>
<th></th><th></th><th></th>
<th></th>
</tr>
<% for ptable in @ptables %>
<tr class="<%= cycle("even", "odd") -%>">
<td><%=h ptable.name %></td>
<td><%=link_to h(ptable.name), edit_ptable_path(ptable) %></td>
<td><%=h ptable.operatingsystems.to_sentence %></td>
<td><%= link_to "Show", ptable %></td>
<td><%= link_to "Edit", edit_ptable_path(ptable) %></td>
<td><%= link_to "Destroy", ptable, :confirm => 'Are you sure?', :method => :delete %></td>
<td align="right">
<%= link_to "Destroy", ptable, :confirm => "Delete #{ptable.name}?", :method => :delete %>
</td>
</tr>
<% end %>
</table>
<%= page_entries_info @ptables %>
<%= will_paginate @ptables %>
<p><%= link_to "New Partition table layout", new_ptable_path %></p>
app/views/puppetclasses/index.html.erb
<th>Operatingsystems</th>
<th>Environments</th>
<th>Host Groups</th>
<th></th>
</tr>
<% for puppetclass in @puppetclasses %>
<tr class="<%= cycle("even", "odd") -%>">
......
<td><%=h puppetclass.operatingsystems.to_sentence %></td>
<td><%=h puppetclass.environments.to_sentence %></td>
<td><%=h puppetclass.hostgroups.to_sentence %></td>
<td><%= link_to "Destroy", puppetclass, :confirm => 'Are you sure?', :method => :delete %></td>
<td align="right">
<%= link_to "Destroy", puppetclass, :confirm => "Delete #{puppetclass.name}?", :method => :delete %>
</td>
</tr>
<% end %>
</table>

Also available in: Unified diff