summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-07 15:07:31 +0100
committerspag <spag@golwen.net>2013-02-07 15:07:31 +0100
commit55e89ec3146e9a910b8001fd586fd46103709f68 (patch)
treeda8f8c26f41ef821749e6d4e963e97d9ba4a5492
parent9890298bbdfd909ab1fe5f35e53c9652d1371acd (diff)
parent515dcaf96c05e4b5d6aaaf4ff1e438ebf9a3c56a (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
-rw-r--r--app/controllers/backup_jobs_controller.rb32
-rw-r--r--app/models/backup_job.rb4
2 files changed, 19 insertions, 17 deletions
diff --git a/app/controllers/backup_jobs_controller.rb b/app/controllers/backup_jobs_controller.rb
index e500f4c..4f242ba 100644
--- a/app/controllers/backup_jobs_controller.rb
+++ b/app/controllers/backup_jobs_controller.rb
@@ -1,10 +1,14 @@
class BackupJobsController < ApplicationController
+ load_and_authorize_resource :backup_job
+
+ before_filter :spread_breadcrumbs
+
def index
- @backup_jobs = BackupJob.all
+ # @backup_jobs = BackupJob.all
end
def show
- @backup_job = BackupJob.find(params[:id])
+ # @backup_job = BackupJob.find(params[:id])
end
def new
@@ -12,7 +16,6 @@ class BackupJobsController < ApplicationController
end
def create
-# @backup_job = BackupJob.new(params[:backup_job])
@backup_job = BackupJob.new(:started_at => Time.now)
if @backup_job.save
@@ -22,22 +25,17 @@ class BackupJobsController < ApplicationController
end
end
- # def edit
- # @backup_job = BackupJob.find(params[:id])
- # end
-
- # def update
- # @backup_job = BackupJob.find(params[:id])
- # if @backup_job.update_attributes(params[:backup_job])
- # redirect_to @backup_job, :notice => t('backup_jobs.controller.successfuly_updated')
- # else
- # render :edit
- # end
- # end
-
def destroy
- @backup_job = BackupJob.find(params[:id])
+ # @backup_job = BackupJob.find(params[:id])
@backup_job.destroy
redirect_to backup_jobs_url, :notice => t('backup_jobs.controller.successfuly_destroyed')
end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("backup_jobs.index.page_title"), backup_jobs_path
+ if @backup_job && !@backup_job.new_record?
+ add_breadcrumb @backup_job, @backup_job
+ end
+ end
end
diff --git a/app/models/backup_job.rb b/app/models/backup_job.rb
index 8bb7959..96574a7 100644
--- a/app/models/backup_job.rb
+++ b/app/models/backup_job.rb
@@ -6,6 +6,10 @@ class BackupJob < ActiveRecord::Base
before_create :set_state_to_queued
after_create :initiate_backup
+ def to_s
+ self.started_at.to_s
+ end
+
private
def set_state_to_queued
self.state = 'queued'