summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-12 23:29:55 +0100
committerspag <spag@golwen.net>2013-02-12 23:29:55 +0100
commit6891b0e62712c5c2772ef205b8393b7ed5e72495 (patch)
tree5db75b9047bcc32c174f90a5014e21e962c03a4d
parent62f3f7373844185e763e1430926ebf880b0d5cb5 (diff)
breadcrumbs
-rw-r--r--app/controllers/intruders_controller.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/app/controllers/intruders_controller.rb b/app/controllers/intruders_controller.rb
index 708e11a..147e06d 100644
--- a/app/controllers/intruders_controller.rb
+++ b/app/controllers/intruders_controller.rb
@@ -1,24 +1,25 @@
class IntrudersController < ApplicationController
def index
@intruders = Intruder.all
+ spread_breadcrumbs
end
def show
@intruder = Intruder.find(params[:id])
if ! params[:whois].blank?
@whois = @intruder.whois(params[:whois])
- if @whois.blank?
- @whois = 'no information'
- end
end
+ spread_breadcrumbs
end
def new
@intruder = Intruder.new
+ spread_breadcrumbs
end
def create
@intruder = Intruder.new(params[:intruder])
+ spread_breadcrumbs
if @intruder.save
redirect_to @intruder, :notice => t('intruders.controller.successfuly_created')
else
@@ -28,10 +29,12 @@ class IntrudersController < ApplicationController
def edit
@intruder = Intruder.find(params[:id])
+ spread_breadcrumbs
end
def update
@intruder = Intruder.find(params[:id])
+ spread_breadcrumbs
if @intruder.update_attributes(params[:intruder])
redirect_to @intruder, :notice => t('intruders.controller.successfuly_updated')
else
@@ -41,7 +44,16 @@ class IntrudersController < ApplicationController
def destroy
@intruder = Intruder.find(params[:id])
+ spread_breadcrumbs
@intruder.destroy
redirect_to intruders_url, :notice => t('intruders.controller.successfuly_destroyed')
end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("intruders.index.page_title"), intruders_path
+ if @intruder && !@intruder.new_record?
+ add_breadcrumb @intruder, @intruder
+ end
+ end
end