summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--config/locales/views/backup_jobs/de.yml51
-rw-r--r--config/locales/views/backup_jobs/en.yml19
11 files changed, 95 insertions, 52 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
diff --git a/config/locales/views/backup_jobs/de.yml b/config/locales/views/backup_jobs/de.yml
index b81b532..8e23feb 100644
--- a/config/locales/views/backup_jobs/de.yml
+++ b/config/locales/views/backup_jobs/de.yml
@@ -1,60 +1,61 @@
de:
backup_jobs:
- name: 'Backup job'
+ name: 'Backup-Auftrag'
controller:
- successfuly_created: 'Backup job wurde angelegt.'
- successfuly_updated: 'Backup job wurde aktualisiert.'
- successfuly_destroyed: 'Backup job wurde gelöscht.'
+ successfuly_created: 'Backup-Auftrag wurde angelegt.'
+ successfuly_updated: 'Backup-Auftrag wurde aktualisiert.'
+ successfuly_destroyed: 'Backup-Auftrag wurde gelöscht.'
index:
- page_title: 'Übersicht von Backup job'
- started_at: 'Started at'
- finished_at: 'Finished at'
- state: 'State'
- directory: 'Directory'
- size_of_the_backup: 'Size of the backup'
+ page_title: 'Liste aller Backup-Aufträge'
+ page_title_with_limit: 'Liste der letzten %{limit} Backup-Aufträge'
+ started_at: 'Start'
+ finished_at: 'Ende'
+ state: 'Status'
+ directory: 'Verzeichnis'
+ size_of_the_backup: 'Größe'
actions:
- confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Backup job'
+ confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Backup-Auftrag'
destroy: 'Löschen'
edit: 'Bearbeiten'
show: 'Anzeigen'
create: 'Neu anlegen'
- create_for: 'Backup job neu anlegen für %{resource}'
+ create_for: 'Backup-Auftrag neu anlegen für %{resource}'
show:
- page_title: 'Backup job bearbeiten'
- started_at: 'Started at'
- finished_at: 'Finished at'
- state: 'State'
- directory: 'Directory'
- size_of_the_backup: 'Size of the backup'
+ page_title: 'Backup-Auftrag bearbeiten'
+ started_at: 'Start'
+ finished_at: 'Ende'
+ state: 'Status'
+ directory: 'Verzeichnis'
+ size_of_the_backup: 'Größe'
actions:
confirm_destroy: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
destroy: 'Löschen'
edit: 'Bearbeiten'
view_all: 'Alle anzeigen'
new:
- page_title: 'Backup job neu anlegen'
+ page_title: 'Backup-Auftrag neu anlegen'
actions:
back_to_list: 'Zurück zur Übersicht'
edit:
- page_title: 'Backup job bearbeiten'
+ page_title: 'Backup-Auftrag bearbeiten'
actions:
back_to_list: 'Zurück zur Übersicht'
edit: 'Bearbeiten'
view_all: 'Alle anzeigen'
form:
started_at:
- label: 'Started at'
+ label: 'Start'
hint: ''
finished_at:
- label: 'Finished at'
+ label: 'Ende'
hint: ''
state:
- label: 'State'
+ label: 'Status'
hint: ''
directory:
- label: 'Directory'
+ label: 'Verzeichnis'
hint: ''
size_of_the_backup:
- label: 'Size of the backup'
+ label: 'Größe'
hint: ''
submit: 'Absenden' \ No newline at end of file
diff --git a/config/locales/views/backup_jobs/en.yml b/config/locales/views/backup_jobs/en.yml
index 83f4388..74d14c2 100644
--- a/config/locales/views/backup_jobs/en.yml
+++ b/config/locales/views/backup_jobs/en.yml
@@ -2,25 +2,26 @@ en:
backup_jobs:
name: 'Backup job'
controller:
- successfuly_created: 'Successfully created Backup job.'
- successfuly_updated: 'Successfully updated Backup job.'
- successfuly_destroyed: 'Successfully destroyed Backup job.'
+ successfuly_created: 'Successfully created backup job.'
+ successfuly_updated: 'Successfully updated backup job.'
+ successfuly_destroyed: 'Successfully destroyed backup job.'
index:
- page_title: 'Listing Backup job'
+ page_title: 'Listing backup jobs'
+ page_title_with_limit: 'Listing of the last %{limit} backup jobs'
started_at: 'Started at'
finished_at: 'Finished at'
state: 'State'
directory: 'Directory'
size_of_the_backup: 'Size of the backup'
actions:
- confirm_destroy: 'Are you sure you want to delete this Backup job?'
+ confirm_destroy: 'Are you sure you want to delete this backup job?'
destroy: 'Delete'
edit: 'Edit'
show: 'View'
create: 'New'
- create_for: 'New Backup job for %{resource}'
+ create_for: 'New backup job for %{resource}'
show:
- page_title: 'Show Backup job'
+ page_title: 'Show backup job'
started_at: 'Started at'
finished_at: 'Finished at'
state: 'State'
@@ -32,11 +33,11 @@ en:
edit: 'Edit'
view_all: 'View All'
new:
- page_title: 'New Backup job'
+ page_title: 'New backup job'
actions:
back_to_list: 'Back to Index'
edit:
- page_title: 'Editing Backup job'
+ page_title: 'Editing backup job'
actions:
back_to_list: 'Back to Index'
edit: 'Edit'