summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-12 08:19:10 +0100
committerspag <spag@golwen.net>2013-02-12 08:19:10 +0100
commit8e55bf891a0520ba241585d8295ccc37ed57b09e (patch)
treedf823d812586612de3a285e22a4cca52170a9b60 /app/controllers
parentd1145ad9d4f495d7416ed97e0dd3c17365990323 (diff)
parent3d817bef265f70b147455db4b0fb5e1ca3c0d379 (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/backup_jobs_controller.rb15
-rw-r--r--app/controllers/system_messages_controller.rb30
-rw-r--r--app/controllers/tenants_controller.rb1
3 files changed, 11 insertions, 35 deletions
diff --git a/app/controllers/backup_jobs_controller.rb b/app/controllers/backup_jobs_controller.rb
index 4f242ba..31b9c21 100644
--- a/app/controllers/backup_jobs_controller.rb
+++ b/app/controllers/backup_jobs_controller.rb
@@ -4,29 +4,34 @@ class BackupJobsController < ApplicationController
before_filter :spread_breadcrumbs
def index
- # @backup_jobs = BackupJob.all
end
def show
- # @backup_job = BackupJob.find(params[:id])
end
def new
- @backup_job = BackupJob.new
+ # Do the same as create.
+ #
+ @backup_job = BackupJob.new(:started_at => Time.now)
+
+ if @backup_job.save
+ redirect_to backup_jobs_path, :notice => t('backup_jobs.controller.successfuly_created')
+ else
+ render :new
+ end
end
def create
@backup_job = BackupJob.new(:started_at => Time.now)
if @backup_job.save
- redirect_to @backup_job, :notice => t('backup_jobs.controller.successfuly_created')
+ redirect_to backup_jobs_path, :notice => t('backup_jobs.controller.successfuly_created')
else
render :new
end
end
def destroy
- # @backup_job = BackupJob.find(params[:id])
@backup_job.destroy
redirect_to backup_jobs_url, :notice => t('backup_jobs.controller.successfuly_destroyed')
end
diff --git a/app/controllers/system_messages_controller.rb b/app/controllers/system_messages_controller.rb
deleted file mode 100644
index d7fe515..0000000
--- a/app/controllers/system_messages_controller.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-class SystemMessagesController < ApplicationController
- load_and_authorize_resource :user
- load_and_authorize_resource :system_message, :through => [:user]
-
- def index
- @system_messages = @system_messages.where(:created_at => Time.now - 6.hours .. Time.now)
- end
-
- def show
- end
-
- def new
- @system_message = @user.system_messages.build
- end
-
- def create
- @system_message = @user.system_messages.build(params[:system_message])
- if @system_message.save
- # Push the new message via AJAX to the browser.
- #
- # PrivatePub.publish_to("/users/#{@system_message.user.id}/system_messages",
- # "$('#system_message').empty();$('#system_message').append('<span class=\"created_at\">#{(I18n.l @system_message.created_at, :format => :short )}</span> #{@system_message.content}');$('#system_message_display').fadeIn();"
- # )
-
- redirect_to user_system_message_path(@user, @system_message), :notice => t('system_messages.controller.successfuly_created')
- else
- render :new
- end
- end
-end
diff --git a/app/controllers/tenants_controller.rb b/app/controllers/tenants_controller.rb
index f30246b..b6a96b7 100644
--- a/app/controllers/tenants_controller.rb
+++ b/app/controllers/tenants_controller.rb
@@ -8,6 +8,7 @@ class TenantsController < ApplicationController
def show
@tenant = Tenant.find(params[:id])
@gateways = Gateway.order(:updated_at)
+ @backup_jobs = BackupJob.order(:finished_at).last(5)
end
def new