Skip to content

Commit

Permalink
Fixed view error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Knight committed May 15, 2008
1 parent ad12a2b commit a65c036
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 101 deletions.
95 changes: 0 additions & 95 deletions install.rb
@@ -1,96 +1 @@
require File.dirname(__FILE__) + '/../../../config/environment'
puts IO.read(File.join(File.dirname(__FILE__), 'README'))
puts "\n\nAltering ApplicationController, this can be undone by editing that file..."
#install alter the app controller
app_controller = File.readlines(RAILS_ROOT + '/app/controllers/application.rb')
i = 0
new_app_controller = ''
app_controller.each do |line|
if line.include? 'class ApplicationController' then
i = i + 1
app_controller[i] = "\s\sinclude ExceptionLoggable #Automatically Added by install script\n" + app_controller[i]
end
i = i + 1
new_app_controller << line
end
app_controller_target = File.open(RAILS_ROOT + '/app/controllers/application.rb','w')
app_controller_target.write(new_app_controller)
app_controller_target.close
#app controller alter done
puts ".....Completed.\n"
puts "Altering routes.rb, this can be undone by editing that file..."
#modify the routes
routes = File.readlines(RAILS_ROOT + '/config/routes.rb')
i = 0
new_routes = ''
routes.each do |line|
if line.include? 'ActionController::Routing::Routes.draw' then
i = i + 1
routes[i] = "map.connect \"logged_exceptions/:action/:id\", :controller => \"logged_exceptions\" #Automatically Added by install script\n" + routes[i]
end
i = i + 1
new_routes << line
end
routes_target = File.open(RAILS_ROOT + '/config/routes.rb','w')
routes_target.write(new_routes)
routes_target.close
#altered routes file
puts ".....Completed.\n"
puts "Attempting to determine your pagination plugin..."
@pagination = 'none'
Dir.foreach(RAILS_ROOT + '/vendor/plugins') do |file|
if file.strip == 'will_paginate' then
@pagination = 'will_paginate'
elsif file.strip == 'paginating_find' then
@pagination = 'paginating_find'
end
end
puts @pagination
if @pagination == 'will_paginate' then
puts "You are using will_paginate, editing init.rb to reflect that..."
#set it to will_paginate
init_rb = File.readlines(File.join(File.dirname(__FILE__), 'init.rb'))
i = 0
new_init = ''
init_rb.each do |line|
if line.include? "$PAGINATION_TYPE = 'none'"
line = '#' + line
j = i + 1
init_rb[j] = init_rb[j].gsub('#','')
j = j + 1
init_rb[j] = init_rb[j].gsub('#','')
j = j + 1
init_rb[j] = init_rb[j].gsub('#','')
end
i = i + 1
new_init << line
end
target = File.open(File.join(File.dirname(__FILE__), 'init.rb'),'w')
target.write(new_init)
target.close
elsif @pagination == 'paginating_find' then
puts "You are using paginating_find, editing init.rb to reflect that..."
#set it to paginating_find
init_rb = File.readlines(File.join(File.dirname(__FILE__), 'init.rb'))
i = 0
new_init = ''
init_rb.each do |line|
if line.include? "$PAGINATION_TYPE = 'none'"
line = '#' + line
j = i + 4
init_rb[j] = init_rb[j].gsub('#','')
j = j + 1
init_rb[j] = init_rb[j].gsub('#','')
end
i = i + 1
new_init << line
end
target = File.open(File.join(File.dirname(__FILE__), 'init.rb'),'w')
target.write(new_init)
target.close
else
puts "Could not detect a pagination plugin, using home brewed pagination instead..."
end
#generate migration
puts "...Completed\n"
puts "Now use script/generate exception_migration\n Then run rake db:migrate\n\n"
9 changes: 3 additions & 6 deletions views/logged_exceptions/_exceptions.rhtml
@@ -1,9 +1,7 @@
<div id="exceptions">
<div class="pages">
<%= link_to_remote 'Delete Visible', :url => { :action => 'destroy_all' }, :with => "ExceptionLogger.deleteAll()" %>
<% if @exceptions.total_pages > 1 %>
:: Pages: <strong><%= pagination_remote_links @exceptions %></strong>
<% end %>
<%= pagination_remote_links @exceptions %>
</div>

<h1>Exceptions <%= "<span>(filtered)</span>" if filtered? %> </h1>
Expand Down Expand Up @@ -48,11 +46,10 @@ if Date.today == exc.created_at.to_date

</table>

<% if @exceptions.total_pages > 1 %>
<div class="pages pages-bottom">
Pages: <strong><%= pagination_remote_links @exceptions %></strong>
<%= pagination_remote_links @exceptions %>
</div>
<% end %>



</div> <!-- #exceptions -->

0 comments on commit a65c036

Please sign in to comment.