summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-11 16:52:52 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-11 16:52:52 +0100
commitee80c0eb8b5e10fab0a41ee123b4f6f0ed689c4c (patch)
treebe39a26515c5219ee038c1f21e22f88bc005e054 /app
parentc5b10519dd1ade04a25c43b100c15deb7e39b6d0 (diff)
parentda362f73cf417aa2eda9124d17c66850087ea0f6 (diff)
Merge branch 'backup' into develop
Diffstat (limited to 'app')
-rw-r--r--app/controllers/backup_jobs_controller.rb15
-rw-r--r--app/controllers/tenants_controller.rb1
-rw-r--r--app/views/backup_jobs/_index_core.html.haml34
-rw-r--r--app/views/backup_jobs/show.html.haml4
-rw-r--r--app/views/layouts/_footer.html.haml2
-rw-r--r--app/views/tenants/_admin_area.de.html.haml4
-rw-r--r--app/views/tenants/_admin_area.en.html.haml4
-rw-r--r--app/views/tenants/_table_of_backup_jobs.html.haml11
-rw-r--r--app/views/tenants/show.html.haml2
9 files changed, 59 insertions, 18 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/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
diff --git a/app/views/backup_jobs/_index_core.html.haml b/app/views/backup_jobs/_index_core.html.haml
index 9eebefd..9dc0e92 100644
--- a/app/views/backup_jobs/_index_core.html.haml
+++ b/app/views/backup_jobs/_index_core.html.haml
@@ -1,12 +1,15 @@
%table.table.table-striped
%tr
%th= t('backup_jobs.index.started_at')
- %th= t('backup_jobs.index.finished_at')
+ %th
+ %span.hidden-phone
+ = t('backup_jobs.index.finished_at')
%th= t('backup_jobs.index.state')
- %th= t('backup_jobs.index.size_of_the_backup')
+ %th
+ %span.hidden-phone
+ = t('backup_jobs.index.size_of_the_backup')
%th{:colspan => '2'}
-
- for backup_job in backup_jobs
- if backup_job.state == 'queued'
- row_marker = 'warning'
@@ -18,14 +21,29 @@
%tr{:class => row_marker}
- if backup_job.finished_at.blank?
%td{:colspan => '2'}
- = time_ago_in_words(backup_job.started_at)
+ - if (Time.now - 1.day) > backup_job.started_at
+ = l backup_job.started_at, :format => :short
+ - else
+ - case I18n.locale
+ - when :de
+ = "vor #{time_ago_in_words(backup_job.started_at)}"
+ - when :en
+ = "#{time_ago_in_words(backup_job.started_at)} ago"
+ - else
+ = l backup_job.started_at, :format => :short
- else
%td
= l backup_job.started_at, :format => :short
%td
- = l backup_job.finished_at, :format => :short
+ %span.hidden-phone
+ = l backup_job.finished_at, :format => :short
%td= backup_job.state
%td
- - if backup_job.backup_file?
- = number_to_human_size(backup_job.backup_file.size, :precision => 2)
- =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => backup_job} \ No newline at end of file
+ %span.hidden-phone
+ - if backup_job.backup_file?
+ %a{:href => backup_job.backup_file.current_path}
+ %i{:class => 'icon-download'}
+ = number_to_human_size(backup_job.backup_file.size, :precision => 2)
+ - else
+ = '-'
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => backup_job}
diff --git a/app/views/backup_jobs/show.html.haml b/app/views/backup_jobs/show.html.haml
index 5d85bbc..6c55320 100644
--- a/app/views/backup_jobs/show.html.haml
+++ b/app/views/backup_jobs/show.html.haml
@@ -15,6 +15,8 @@
%p
%strong= t('backup_jobs.show.size_of_the_backup') + ":"
- if @backup_job.backup_file?
- = number_to_human_size(@backup_job.backup_file.size, :precision => 2)
+ %a{:href => backup_job.backup_file.current_path}
+ %i{:class => 'icon-download'}
+ = number_to_human_size(backup_job.backup_file.size, :precision => 2)
= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @backup_job } \ No newline at end of file
diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml
index 3d4658b..2703844 100644
--- a/app/views/layouts/_footer.html.haml
+++ b/app/views/layouts/_footer.html.haml
@@ -16,4 +16,4 @@
%li
=link_to t('misc.send_a_bugreport'), URI::escape("https://github.com/amooma/GS5/issues/new?title=Bugreport&body=URL which triggered the bugreport is: #{request.fullpath}\nGS5 buildname: #{(GsParameter.get('GEMEINSCHAFT_BUILDNAME').blank? ? 'unknown' : GsParameter.get('GEMEINSCHAFT_BUILDNAME'))} (#{GsParameter.get('GEMEINSCHAFT_VERSION')})\n\nPlease provide your bugreport below this line and update the title of this issue to a more specific one.")
%li{:class => 'pull-right'}
- = link_to 'brought to you by AMOOMA GmbH', 'http://amooma.de' \ No newline at end of file
+ = link_to '© AMOOMA GmbH', 'http://amooma.de' \ No newline at end of file
diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml
index 98809d1..2aed4e1 100644
--- a/app/views/tenants/_admin_area.de.html.haml
+++ b/app/views/tenants/_admin_area.de.html.haml
@@ -37,4 +37,6 @@
= render :partial => 'call_routes', :locals => {:tenant => tenant}
- = render :partial => 'gateways', :locals => {:tenant => tenant, :gateways => gateways} \ No newline at end of file
+ = render :partial => 'gateways', :locals => {:tenant => tenant, :gateways => gateways}
+
+ = render :partial => 'table_of_backup_jobs', :locals => {:tenant => tenant, :backup_jobs => backup_jobs}
diff --git a/app/views/tenants/_admin_area.en.html.haml b/app/views/tenants/_admin_area.en.html.haml
index 4f0032c..8e7bfea 100644
--- a/app/views/tenants/_admin_area.en.html.haml
+++ b/app/views/tenants/_admin_area.en.html.haml
@@ -37,4 +37,6 @@
= render :partial => 'call_routes', :locals => {:tenant => tenant}
- = render :partial => 'gateways', :locals => {:tenant => tenant, :gateways => gateways} \ No newline at end of file
+ = render :partial => 'gateways', :locals => {:tenant => tenant, :gateways => gateways}
+
+ = render :partial => 'table_of_backup_jobs', :locals => {:tenant => tenant, :backup_jobs => backup_jobs} \ No newline at end of file
diff --git a/app/views/tenants/_table_of_backup_jobs.html.haml b/app/views/tenants/_table_of_backup_jobs.html.haml
new file mode 100644
index 0000000..a585010
--- /dev/null
+++ b/app/views/tenants/_table_of_backup_jobs.html.haml
@@ -0,0 +1,11 @@
+-# BackupJobs
+-#
+- if (can?( :index, BackupJob ) && backup_jobs.count > 0 ) || can?( :create, BackupJob )
+ - if backup_jobs.count == BackupJob.count
+ %h2= t('backup_jobs.index.page_title')
+ - else
+ %h2= t('backup_jobs.index.page_title_with_limit', :limit => '5')
+
+ - if can?( :index, BackupJob ) && backup_jobs.count > 0
+ = render "backup_jobs/index_core", :backup_jobs => backup_jobs
+ = render :partial => 'shared/create_link', :locals => {:child_class => BackupJob} \ No newline at end of file
diff --git a/app/views/tenants/show.html.haml b/app/views/tenants/show.html.haml
index 818e584..23ec81a 100644
--- a/app/views/tenants/show.html.haml
+++ b/app/views/tenants/show.html.haml
@@ -15,4 +15,4 @@
= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @tenant }
- if @tenant.user_groups.where(:name => 'Admins').any? && @tenant.user_groups.where(:name => 'Admins').first.users.include?(current_user)
- = render :partial => 'admin_area', :locals => { :tenant => @tenant, :gateways => @gateways} \ No newline at end of file
+ = render :partial => 'admin_area', :locals => { :tenant => @tenant, :gateways => @gateways, :backup_jobs => @backup_jobs} \ No newline at end of file