summaryrefslogtreecommitdiff
path: root/app
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
parentd1145ad9d4f495d7416ed97e0dd3c17365990323 (diff)
parent3d817bef265f70b147455db4b0fb5e1ca3c0d379 (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'app')
-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
-rw-r--r--app/helpers/system_messages_helper.rb2
-rw-r--r--app/models/ability.rb8
-rw-r--r--app/models/system_message.rb7
-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/gs_parameters/_index_core.html.haml14
-rw-r--r--app/views/gs_parameters/index.html.haml12
-rw-r--r--app/views/layouts/_footer.html.haml2
-rw-r--r--app/views/layouts/_navbar.html.haml2
-rw-r--r--app/views/system_messages/_form.html.haml7
-rw-r--r--app/views/system_messages/_form_core.html.haml2
-rw-r--r--app/views/system_messages/_index_core.html.haml12
-rw-r--r--app/views/system_messages/index.html.haml3
-rw-r--r--app/views/system_messages/new.html.haml3
-rw-r--r--app/views/system_messages/show.html.haml8
-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
22 files changed, 76 insertions, 111 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
diff --git a/app/helpers/system_messages_helper.rb b/app/helpers/system_messages_helper.rb
deleted file mode 100644
index fef2386..0000000
--- a/app/helpers/system_messages_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module SystemMessagesHelper
-end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 01f26aa..4c0844c 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -56,10 +56,6 @@ class Ability
can :read, PhoneBookEntry, :phone_book => { :id => user_group.phone_book_ids }
end
- # SystemMessages
- #
- cannot [:destroy, :edit, :update], SystemMessage
-
# A FacDocument can't be changed
#
cannot [:edit, :update], FaxDocument
@@ -160,10 +156,6 @@ class Ability
#
can :manage, CallForward, :phone_number_id => user.phone_number_ids
- # SystemMessages
- #
- can :read, SystemMessage, :user_id => user.id
-
# SoftkeyFunctions
#
can :read, SoftkeyFunction
diff --git a/app/models/system_message.rb b/app/models/system_message.rb
deleted file mode 100644
index 0d9e862..0000000
--- a/app/models/system_message.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class SystemMessage < ActiveRecord::Base
- attr_accessible :content
-
- belongs_to :user
-
- validates_presence_of :content
-end
diff --git a/app/views/backup_jobs/_index_core.html.haml b/app/views/backup_jobs/_index_core.html.haml
index 9eebefd..0102546 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.url}
+ %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..6fcb1dc 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.url}
+ %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/gs_parameters/_index_core.html.haml b/app/views/gs_parameters/_index_core.html.haml
index 11d60db..2105126 100644
--- a/app/views/gs_parameters/_index_core.html.haml
+++ b/app/views/gs_parameters/_index_core.html.haml
@@ -1,6 +1,9 @@
-- cache(['gs_parameters_table_section', gs_parameters.first.section, gs_parameters.reorder(:updated_at).last, gs_parameters.pluck(:id)]) do
+- cache(['gs_parameter_sub_table', I18n.locale, gs_parameters.count, gs_parameters.reorder(:updated_at).first, gs_parameters.reorder(:updated_at).last]) do
%thead
%tr
+ %th
+ %span.hidden-phone
+ = t('gs_parameters.index.entity')
%th= t('gs_parameters.index.name')
- if !@sections
%th= t('gs_parameters.index.section')
@@ -8,9 +11,16 @@
%tbody
- for gs_parameter in gs_parameters
- - cache(['gs_parameters_table_single_row', gs_parameter]) do
+ - cache(['gs_parameters_table_single_row', I18n.locale, gs_parameter]) do
%tr
%td
+ - if gs_parameter.entity.blank?
+ %span.hidden-phone
+ = '-'
+ - else
+ %span.hidden-phone
+ = truncate(gs_parameter.entity, :length => GsParameter.get('DESKTOP_MAX_STRING_LENGTH'))
+ %td
%span.hidden-phone
= truncate(gs_parameter.name, :length => GsParameter.get('DESKTOP_MAX_STRING_LENGTH'))
%span.visible-phone
diff --git a/app/views/gs_parameters/index.html.haml b/app/views/gs_parameters/index.html.haml
index 1189a45..8df2bb3 100644
--- a/app/views/gs_parameters/index.html.haml
+++ b/app/views/gs_parameters/index.html.haml
@@ -1,13 +1,11 @@
- content_for :title, t("gs_parameters.index.page_title")
-- if @gs_parameters && @gs_parameters.count > 0
- - cache(['gs_parameters_table', I18n.locale, @gs_parameters_unordered.reorder(:updated_at).last, @gs_parameters_unordered.count]) do
+- cache(['gs_parameter_all_tables', I18n.locale, @gs_parameters.count, @gs_parameters.reorder(:updated_at).first, @gs_parameters.reorder(:updated_at).last]) do
+ - if @gs_parameters && @gs_parameters.count > 0
- if @sections
- %table.table.table-striped
- - @sections.each do |section|
- %tr
- %td{:colspan => 3}
- %h3= section
+ - @sections.each do |section|
+ %h3= section
+ %table.table.table-striped
-# Template Dependency: gs_parameters/_index_core
= render "index_core", :gs_parameters => @gs_parameters.where(:section => section)
- else
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/layouts/_navbar.html.haml b/app/views/layouts/_navbar.html.haml
index 335dd3d..7084090 100644
--- a/app/views/layouts/_navbar.html.haml
+++ b/app/views/layouts/_navbar.html.haml
@@ -21,11 +21,9 @@
- if current_user && current_user.sip_accounts.any?
%li
%a{:href => sip_account_call_histories_path(current_user.sip_accounts.first)}
- %i.icon-list-alt.icon-white
=t("call_histories.index.page_title")
%li
%a{:href => sip_account_voicemail_messages_path(current_user.sip_accounts.first)}
- %i.icon-volume-up.icon-white
=t("voicemail_messages.index.page_title")
- if current_user
diff --git a/app/views/system_messages/_form.html.haml b/app/views/system_messages/_form.html.haml
deleted file mode 100644
index 036ee00..0000000
--- a/app/views/system_messages/_form.html.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-= simple_form_for([@user, @system_message]) do |f|
- = f.error_notification
-
- = render "form_core", :f => f
-
- .actions
- = f.button :submit, conditional_t('system_messages.form.submit') \ No newline at end of file
diff --git a/app/views/system_messages/_form_core.html.haml b/app/views/system_messages/_form_core.html.haml
deleted file mode 100644
index a85db28..0000000
--- a/app/views/system_messages/_form_core.html.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-.inputs
- = f.input :content, :label => t('system_messages.form.content.label'), :hint => conditional_hint('system_messages.form.content.hint')
diff --git a/app/views/system_messages/_index_core.html.haml b/app/views/system_messages/_index_core.html.haml
deleted file mode 100644
index 7c9dab5..0000000
--- a/app/views/system_messages/_index_core.html.haml
+++ /dev/null
@@ -1,12 +0,0 @@
-%table.table.table-striped
- %thead
- %tr
- %th= t('system_messages.index.created_at')
- %th= t('system_messages.index.content')
-
- %tbody
- - for system_message in system_messages
- %tr
- %td= system_message.created_at
- %td= system_message.content
- =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => system_message} \ No newline at end of file
diff --git a/app/views/system_messages/index.html.haml b/app/views/system_messages/index.html.haml
deleted file mode 100644
index ffd3fc3..0000000
--- a/app/views/system_messages/index.html.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-- content_for :title, t("system_messages.index.page_title")
-
-= render "index_core", :system_messages => @system_messages \ No newline at end of file
diff --git a/app/views/system_messages/new.html.haml b/app/views/system_messages/new.html.haml
deleted file mode 100644
index 565f5c5..0000000
--- a/app/views/system_messages/new.html.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-- content_for :title, t("system_messages.new.page_title")
-
-= render "form"
diff --git a/app/views/system_messages/show.html.haml b/app/views/system_messages/show.html.haml
deleted file mode 100644
index 70be6f2..0000000
--- a/app/views/system_messages/show.html.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-- content_for :title, t("system_messages.show.page_title")
-
-%p
- %strong= t('system_messages.show.created_at') + ":"
- = @system_message.created_at
-%p
- %strong= t('system_messages.show.content') + ":"
- = @system_message.content
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