From df0bc9db9cdbf9bfbc92a5f1f00e57fc0e7d7792 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 26 Feb 2013 16:17:06 +0100 Subject: Search box in the top navigation bar. --- app/controllers/page_controller.rb | 2 ++ app/views/layouts/_navbar.html.haml | 27 ++++++++++++++------------- app/views/layouts/application.html.haml | 2 +- app/views/phone_books/_index_core.html.haml | 7 +++++-- app/views/sessions/new.html.haml | 16 ++++++++++------ 5 files changed, 32 insertions(+), 22 deletions(-) (limited to 'app') 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/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' -- cgit v1.2.3 From 16c8605ad879bf0ac0c46bc24f2e9cd5c62e3a7d Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 26 Feb 2013 16:25:05 +0100 Subject: Bugfix #204 --- app/views/backup_jobs/show.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') 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 -- cgit v1.2.3 From fc535da83c53f37fbc03caf72f61c01494ba6048 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 26 Feb 2013 17:31:13 +0100 Subject: load_resource :sip_account, :only => [:call] --- app/controllers/sip_accounts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') 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 -- cgit v1.2.3 From 774bb634d17190a30ed0e22183368ab46f74fe5d Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 26 Feb 2013 18:18:12 +0100 Subject: after_create :queue_the_restore_rake_task --- app/models/restore_job.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/restore_job.rb b/app/models/restore_job.rb index 2c2da54..571d967 100644 --- a/app/models/restore_job.rb +++ b/app/models/restore_job.rb @@ -3,11 +3,24 @@ 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 -- cgit v1.2.3 From 23fdaceefb8854756e42ac190f603b0ae73e8d61 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 26 Feb 2013 18:19:47 +0100 Subject: Deleted white space. --- app/models/restore_job.rb | 2 -- 1 file changed, 2 deletions(-) (limited to 'app') diff --git a/app/models/restore_job.rb b/app/models/restore_job.rb index 571d967..80741ac 100644 --- a/app/models/restore_job.rb +++ b/app/models/restore_job.rb @@ -21,6 +21,4 @@ class RestoreJob < ActiveRecord::Base def run_the_restore_rake_task system "cd #{Rails.root} && rake backup:restore" end - - end -- cgit v1.2.3 From 9dd3fa175bb7fd18f81f8e32468a842babe63e7f Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Tue, 26 Feb 2013 18:40:06 +0100 Subject: run tar commands via sudo --- app/models/backup_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/backup_job.rb b/app/models/backup_job.rb index 96574a7..91345e5 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 /usr/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") -- cgit v1.2.3 From 177a2c037468e222191b6668eb8e64a94833b18c Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Tue, 26 Feb 2013 21:34:33 +0100 Subject: correct path for tar --- app/models/backup_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/backup_job.rb b/app/models/backup_job.rb index 91345e5..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} && sudo /usr/bin/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") -- cgit v1.2.3