summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/page_controller.rb2
-rw-r--r--app/controllers/sip_accounts_controller.rb2
-rw-r--r--app/models/backup_job.rb2
-rw-r--r--app/models/restore_job.rb13
-rw-r--r--app/views/backup_jobs/show.html.haml4
-rw-r--r--app/views/layouts/_navbar.html.haml27
-rw-r--r--app/views/layouts/application.html.haml2
-rw-r--r--app/views/phone_books/_index_core.html.haml7
-rw-r--r--app/views/sessions/new.html.haml16
-rw-r--r--config/initializers/simple_form.rb1
-rw-r--r--config/locales/views/fax_accounts/de.yml22
-rw-r--r--config/locales/views/phone_book_entries/de.yml2
-rw-r--r--config/locales/views/phone_books/de.yml2
-rw-r--r--config/schedule.rb2
-rw-r--r--lib/tasks/backup.rake11
-rwxr-xr-xscript/logout_phones.sh3
16 files changed, 72 insertions, 46 deletions
diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb
index ed48e3c..10ecf2c 100644
--- a/app/controllers/page_controller.rb
+++ b/app/controllers/page_controller.rb
@@ -7,6 +7,8 @@ class PageController < ApplicationController
def index
if current_user
redirect_to [current_user.current_tenant, current_user]
+ else
+ redirect_to log_in_path
end
end
diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb
index 022858c..ef1aab8 100644
--- a/app/controllers/sip_accounts_controller.rb
+++ b/app/controllers/sip_accounts_controller.rb
@@ -1,7 +1,7 @@
class SipAccountsController < ApplicationController
load_resource :user
load_resource :tenant
- #load_resource :sip_account
+ load_resource :sip_account, :only => [:call]
load_and_authorize_resource :sip_account, :through => [:user, :tenant ]
before_filter :set_and_authorize_parent
diff --git a/app/models/backup_job.rb b/app/models/backup_job.rb
index 96574a7..a04f6c0 100644
--- a/app/models/backup_job.rb
+++ b/app/models/backup_job.rb
@@ -32,7 +32,7 @@ class BackupJob < ActiveRecord::Base
if tmp_backup_directory.blank?
self.state = 'failed'
else
- system "cd #{backup_directory} && tar czf #{backup_name_prefix}#{File.basename(tmp_backup_directory)}.tar.gz #{File.basename(tmp_backup_directory)}"
+ system "cd #{backup_directory} && sudo /bin/tar czf #{backup_name_prefix}#{File.basename(tmp_backup_directory)}.tar.gz #{File.basename(tmp_backup_directory)}"
require 'fileutils'
FileUtils.rm_rf tmp_backup_directory
file = File::Stat.new("#{backup_directory}/#{backup_name_prefix}#{File.basename(tmp_backup_directory)}.tar.gz")
diff --git a/app/models/restore_job.rb b/app/models/restore_job.rb
index 2c2da54..80741ac 100644
--- a/app/models/restore_job.rb
+++ b/app/models/restore_job.rb
@@ -3,11 +3,22 @@ class RestoreJob < ActiveRecord::Base
mount_uploader :backup_file, BackupFileUploader
+ after_create :queue_the_restore_rake_task
+
def to_s
if self.backup_file?
File.basename(self.backup_file.to_s)
else
"RestoreJob ID #{self.id}"
end
- end
+ end
+
+ private
+ def queue_the_restore_rake_task
+ self.delay.run_the_restore_rake_task
+ end
+
+ def run_the_restore_rake_task
+ system "cd #{Rails.root} && rake backup:restore"
+ end
end
diff --git a/app/views/backup_jobs/show.html.haml b/app/views/backup_jobs/show.html.haml
index ddc4766..8bb270f 100644
--- a/app/views/backup_jobs/show.html.haml
+++ b/app/views/backup_jobs/show.html.haml
@@ -27,8 +27,8 @@
%strong= t('backup_jobs.show.size_of_the_backup') + ":"
%td
- if @backup_job.backup_file?
- %a{:href => backup_job.backup_file.url}
+ %a{:href => @backup_job.backup_file.url}
%i{:class => 'icon-download'}
- = number_to_human_size(backup_job.backup_file.size, :precision => 2)
+ = 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/_navbar.html.haml b/app/views/layouts/_navbar.html.haml
index 8e09859..a7f47cf 100644
--- a/app/views/layouts/_navbar.html.haml
+++ b/app/views/layouts/_navbar.html.haml
@@ -1,13 +1,9 @@
.navbar.navbar-inverse.navbar-fixed-top
.navbar-inner
.container
- %a.brand{:href => (current_user.nil? ? '/' : tenant_path(current_user.current_tenant))}
- Gemeinschaft 5
-
- %a.btn.btn-navbar{"data-target" => ".nav-collapse", "data-toggle" => "collapse"}
- %span.icon-bar
- %span.icon-bar
- %span.icon-bar
+ %span.hidden-phone
+ %a.brand{:href => (current_user.nil? ? '/' : tenant_path(current_user.current_tenant))}
+ Gemeinschaft 5
.nav-collapse.collapse
%ul.nav
@@ -29,13 +25,14 @@
- if current_user
%ul.nav.pull-right
%li.display
- - if current_user.image?
- = image_tag(current_user.image_url(:mini).to_s, :class => 'img-rounded')
- - else
- - if current_user.male?
- = image_tag 'icons/user-male-16x.png', :class => 'img-rounded'
+ %span.hidden-phone
+ - if current_user.image?
+ = image_tag(current_user.image_url(:mini).to_s, :class => 'img-rounded')
- else
- = image_tag 'icons/user-female-16x.png', :class => 'img-rounded'
+ - if current_user.male?
+ = image_tag 'icons/user-male-16x.png', :class => 'img-rounded'
+ - else
+ = image_tag 'icons/user-female-16x.png', :class => 'img-rounded'
- if current_page?(tenant_user_path(current_user.current_tenant, current_user))
%li.active
@@ -51,3 +48,7 @@
%a.navbar-link{:href => log_out_path}
%i.icon-off.icon-white
+ - if GuiFunction.display?('search_field_in_top_navigation_bar', current_user)
+ = form_tag search_path, :method => :post, :class => 'navbar-search pull-right' do
+ %input.text{:placeholder => 'Suchen ...', :name => 'q', :class => 'search-query span2'}
+
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 33a730f..eab6096 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -3,7 +3,7 @@
%head
%meta{:charset => "utf-8"}/
%title
- = content_for?(:title) ? yield(:title) : "Gemeinschaft 5"
+ = content_for?(:title) ? yield(:title) : "Gemeinschaft 5.1"
%meta{:name => 'viewport', :content => "width=device-width, initial-scale=1.0"}
- if content_for?(:meta_description)
%meta{:description => yield(:meta_description)}/
diff --git a/app/views/phone_books/_index_core.html.haml b/app/views/phone_books/_index_core.html.haml
index 09ce3a3..290a12e 100644
--- a/app/views/phone_books/_index_core.html.haml
+++ b/app/views/phone_books/_index_core.html.haml
@@ -5,7 +5,9 @@
%th
%span.visible-desktop
= t('phone_books.index.description')
- %th= t('phone_books.index.count')
+ %th
+ %span.visible-desktop
+ = t('phone_books.index.count')
%tbody
- for phone_book in phone_books
@@ -16,6 +18,7 @@
%span.visible-desktop
= phone_book.description
%td
- = number_with_delimiter( phone_book.phone_book_entries.count )
+ %span.visible-desktop
+ = number_with_delimiter( phone_book.phone_book_entries.count )
=render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => phone_book.phone_bookable, :child => phone_book} \ No newline at end of file
diff --git a/app/views/sessions/new.html.haml b/app/views/sessions/new.html.haml
index 75dd3de..0c5c96d 100644
--- a/app/views/sessions/new.html.haml
+++ b/app/views/sessions/new.html.haml
@@ -1,8 +1,12 @@
- content_for :title, t("sessions.new.page_title")
-= simple_form_for :sessions, :url => sessions_path do |t|
- = t.input :login_data, :label => t('sessions.form.email'), :autofocus => true
- = t.input :password, :label => t('sessions.form.password'), :required => false
- = t.input :reset_password, :label => t('sessions.form.reset_password'), :as => :boolean
- .form-actions
- = t.button :submit, :value => 'Login'
+.row
+ .span12
+ %h1=t("sessions.new.page_title")
+
+ = simple_form_for :sessions, :url => sessions_path do |t|
+ = t.input :login_data, :label => t('sessions.form.email'), :autofocus => true
+ = t.input :password, :label => t('sessions.form.password'), :required => false
+ = t.input :reset_password, :label => t('sessions.form.reset_password'), :as => :boolean
+ .form-actions
+ = t.button :submit, :value => 'Login'
diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb
index 062f823..06dc271 100644
--- a/config/initializers/simple_form.rb
+++ b/config/initializers/simple_form.rb
@@ -145,6 +145,7 @@ SimpleForm.setup do |config|
# How the label text should be generated altogether with the required text.
# config.label_text = lambda { |label, required| "#{required} #{label}" }
+ config.label_text = lambda { |label, required| "#{label}" }
# You can define the class to use on all labels. Default is nil.
config.label_class = 'control-label'
diff --git a/config/locales/views/fax_accounts/de.yml b/config/locales/views/fax_accounts/de.yml
index cc93a24..8e6f954 100644
--- a/config/locales/views/fax_accounts/de.yml
+++ b/config/locales/views/fax_accounts/de.yml
@@ -1,12 +1,12 @@
de:
fax_accounts:
- name: 'Software-Fax-Konto'
+ name: 'Software-Fax'
controller:
- successfuly_created: 'Eine neues Software-Fax-Konto wurde erstellt.'
- successfuly_updated: 'Das Software-Fax-Konto wurde aktualisiert.'
- successfuly_destroyed: 'Das Software-Fax-Konto wurde gelöscht.'
+ successfuly_created: 'Eine neues Software-Fax wurde erstellt.'
+ successfuly_updated: 'Das Software-Fax wurde aktualisiert.'
+ successfuly_destroyed: 'Das Software-Fax wurde gelöscht.'
index:
- page_title: 'Software-Fax-Konten'
+ page_title: 'Software-Faxe'
name: 'Name'
station_id: 'Stations-ID'
email: 'E-Mail'
@@ -17,30 +17,30 @@ de:
sent: 'Gesendet'
retries: 'Max. Anzahl von Sendeversuchen'
last_update: 'Letzter Eintrag'
- send_a_fax: 'Fax versenden'
+ send_a_fax: 'versenden'
actions:
- confirm_destroy: 'Sind Sie sicher, dass Sie dieses Software-Fax-Konto löschen möchten?'
+ confirm_destroy: 'Sind Sie sicher, dass Sie dieses Software-Fax löschen möchten?'
destroy: 'Löschen'
edit: 'Bearbeiten'
show: 'Anzeigen'
create: 'Neu anlegen'
create_for: 'Neues Fax-Konto für %{resource} anlegen'
show:
- page_title: 'Software-Fax-Konto anzeigen'
+ page_title: 'Software-Fax anzeigen'
name: 'Name'
station_id: 'Stations-ID'
email: 'E-Mail'
days_till_auto_delete: 'Anzahl der Tage bis Faxe gelöscht werden'
retries: 'Max. Anzahl von Sendeversuchen'
actions:
- confirm_destroy: 'Sind Sie sicher, dass Sie dieses Software-Fax-Konto löschen möchten?'
+ confirm_destroy: 'Sind Sie sicher, dass Sie dieses Software-Fax löschen möchten?'
destroy: 'Löschen'
edit: 'Bearbeiten'
view_all: 'Alle anzeigen'
new:
- page_title: 'Neues Software-Fax-Konto'
+ page_title: 'Neues Software-Fax'
edit:
- page_title: 'Software-Fax-Konto bearbeiten'
+ page_title: 'Software-Fax bearbeiten'
form:
name:
label: 'Name'
diff --git a/config/locales/views/phone_book_entries/de.yml b/config/locales/views/phone_book_entries/de.yml
index 2c77aa5..bdd0d67 100644
--- a/config/locales/views/phone_book_entries/de.yml
+++ b/config/locales/views/phone_book_entries/de.yml
@@ -6,7 +6,7 @@ de:
successfuly_updated: 'Der Telefonbucheintrag "%{resource}" wurde aktualisiert.'
successfuly_destroyed: 'Der Telefonbucheintrag wurde gelöscht.'
index:
- page_title: 'Anzahl Telefonbucheinträge'
+ page_title: 'Telefonbucheinträge'
phone_book_id: 'Telefonbuch'
first_name: 'Vorname'
middle_name: 'Zweiter Vorname'
diff --git a/config/locales/views/phone_books/de.yml b/config/locales/views/phone_books/de.yml
index fa93945..c7ba5c7 100644
--- a/config/locales/views/phone_books/de.yml
+++ b/config/locales/views/phone_books/de.yml
@@ -5,7 +5,7 @@ de:
name: 'Firmentelefonbuch'
description: 'Ein für alle Benutzer von %{resource} lesbares Telefonbuch.'
private_phone_book:
- name: 'Privates Telefonbuch von %{resource}'
+ name: 'Privates Telefonbuch'
description: 'Ein privates Telefonbuch.'
controller:
successfuly_created: 'Ein neues Telefonbuch wurde erstellt.'
diff --git a/config/schedule.rb b/config/schedule.rb
index 94603f1..f2c1a09 100644
--- a/config/schedule.rb
+++ b/config/schedule.rb
@@ -7,7 +7,7 @@ end
# Auto-Reboot of Phones which should be rebootet
#
every 1.day, :at => '2:30 am' do
- command "/opt/GS5/script/logout_phones.sh"
+ command "/opt/GS5/script/logout_phones"
end
# Learn more: http://github.com/javan/whenever
diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake
index d12bf5e..8e55be2 100644
--- a/lib/tasks/backup.rake
+++ b/lib/tasks/backup.rake
@@ -13,16 +13,17 @@ namespace :backup do
tmp_dir = "/tmp/gs5_restore_directory"
FileUtils.rm_rf tmp_dir
FileUtils.mkdir_p tmp_dir
- system "cd #{tmp_dir} && tar xzf #{restore_job.backup_file.path}"
- system "cd /tmp/gs5_restore_directory/*/ && tar xf GS5.tar && rm GS5.tar"
+ system "cd #{tmp_dir} && sudo /bin/tar xzf #{restore_job.backup_file.path}"
+ restore_directory = Dir.glob("/tmp/gs5_restore_directory/*").first
+ system "cd #{restore_directory} && sudo /bin/tar xf GS5.tar && rm GS5.tar"
# Restore faxes
#
- system "cd / && tar xzfP /tmp/gs5_restore_directory/*/GS5/archives/faxes.tar.gz"
+ system "cd / && sudo /bin/tar xzfP #{restore_directory}/GS5/archives/faxes.tar.gz"
# Restore voicemails
#
- # system "cd / && tar xzfP /tmp/gs5_restore_directory/*/GS5/archives/voicemails.tar.gz"
+ # system "cd / && sudo /bin/tar xzfP #{restore_directory}/GS5/archives/voicemails.tar.gz"
# Restore the database
#
@@ -32,7 +33,7 @@ namespace :backup do
db_user = system_odbc_configuration['gemeinschaft']['USER']
db_password = system_odbc_configuration['gemeinschaft']['PASSWORD']
- system "gunzip < /tmp/gs5_restore_directory/*/GS5/databases/MySQL/gemeinschaft.sql.gz | mysql -u #{db_user} -p#{db_password} #{database}"
+ system "gunzip < #{restore_directory}/GS5/databases/MySQL/gemeinschaft.sql.gz | mysql -u #{db_user} -p#{db_password} #{database}"
FileUtils.rm_rf tmp_dir
diff --git a/script/logout_phones.sh b/script/logout_phones.sh
new file mode 100755
index 0000000..41e2a40
--- /dev/null
+++ b/script/logout_phones.sh
@@ -0,0 +1,3 @@
+#! /bin/bash
+cd /opt/GS5/script/
+/opt/GS5/script/logout_phones $@