From b432f1930851c3b583b223d773341f5e208046a7 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 24 Jan 2013 12:47:00 +0100 Subject: Better user experience. One step setup. --- app/controllers/gemeinschaft_setups_controller.rb | 28 ++++++++++++++++++++++- app/models/gemeinschaft_setup.rb | 8 +++++++ app/views/gemeinschaft_setups/new.de.html.haml | 20 ++++++++-------- app/views/gemeinschaft_setups/new.html.haml | 22 ++++++++++-------- app/views/users/_form_core.html.haml | 3 ++- 5 files changed, 60 insertions(+), 21 deletions(-) (limited to 'app') diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index 347e043..a860653 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -20,6 +20,9 @@ class GemeinschaftSetupsController < ApplicationController ) @gemeinschaft_setup.country = Country.find_by_name('Germany') @gemeinschaft_setup.language = Language.find_by_name('Deutsch') + + @gemeinschaft_setup.default_company_name = generate_a_new_name(Tenant.new) + @gemeinschaft_setup.default_system_email = 'admin@localhost' end def create @@ -64,11 +67,34 @@ class GemeinschaftSetupsController < ApplicationController FreeswitchAPI.execute('fsctl', 'shutdown restart') end + # Create the tenant + tenant = Tenant.create({:name => @gemeinschaft_setup.default_company_name, + :sip_domain_id => SipDomain.last.id, + :country_id => @gemeinschaft_setup.country.id, + :language_id => @gemeinschaft_setup.language_id, + :from_field_voicemail_email => @gemeinschaft_setup.default_system_email, + :from_field_pin_change_email => @gemeinschaft_setup.default_system_email, + }) + + # Become a member of this tenant. + # + tenant.tenant_memberships.create(:user_id => user.id) + + # Groups + # + admin_group = tenant.user_groups.create(:name => t('gemeinschaft_setups.initial_setup.admin_group_name')) + admin_group.users << user + + user_group = tenant.user_groups.create(:name => t('gemeinschaft_setups.initial_setup.user_group_name')) + user_group.users << user + + user.update_attributes!(:current_tenant_id => tenant.id) + # Auto-Login: session[:user_id] = user.id # Redirect to the user - redirect_to new_tenant_url, :notice => t('gemeinschaft_setups.initial_setup.successful_setup') + redirect_to page_beginners_intro_path, :notice => t('gemeinschaft_setups.initial_setup.successful_setup') else render :new end diff --git a/app/models/gemeinschaft_setup.rb b/app/models/gemeinschaft_setup.rb index 6056236..4b4dd37 100644 --- a/app/models/gemeinschaft_setup.rb +++ b/app/models/gemeinschaft_setup.rb @@ -6,6 +6,14 @@ class GemeinschaftSetup < ActiveRecord::Base belongs_to :country belongs_to :language + validates :default_company_name, + :presence => true, + :uniqueness => true + + validates :default_system_email, + :presence => true, + :uniqueness => true + # Remove the cache which was created by the heater rake task. # after_create :expire_cache diff --git a/app/views/gemeinschaft_setups/new.de.html.haml b/app/views/gemeinschaft_setups/new.de.html.haml index 3d9b173..cf1f207 100644 --- a/app/views/gemeinschaft_setups/new.de.html.haml +++ b/app/views/gemeinschaft_setups/new.de.html.haml @@ -5,23 +5,25 @@ = f.error_notification %h2 Admin-Konto - %p - Dieser erste Benutzer des Systems hat automatisch Admin-Rechte. = f.simple_fields_for :user, @user do |u| = render "users/form_core", :f => u - %h2 SIP-Domain - %p In den meisten Fällen sollten Sie den gleichen Wert für SIP-Realm und SIP-Domain benutzen. Wenn Sie mit diesen Begriffen nichts anfangen können, dann geben Sie hier bitte die IP-Adresse dieses Servers ein. - - = f.simple_fields_for :sip_domain, @sip_domain do |s| - = render "sip_domains/form_core", :f => s - - %h2 Allgemeine Informationen + %h2 Konfiguration der Telefonanlage = f.association :country, :label => t('gemeinschaft_setups.form.country_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.country_id.hint'), :include_blank => false = f.association :language, :label => t('gemeinschaft_setups.form.language_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.language_id.hint'), :include_blank => false = f.input :default_area_code, :label => t('gemeinschaft_setups.form.default_area_code.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_area_code.hint') + = f.input :default_company_name, :label => t('gemeinschaft_setups.form.default_company_name.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_company_name.hint') + + = f.input :default_system_email, :label => t('gemeinschaft_setups.form.default_system_email.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_system_email.hint') + + %h3 SIP-Domain + %p In den meisten Fällen sollten Sie den gleichen Wert für SIP-Realm und SIP-Domain benutzen. Wenn Sie mit diesen Begriffen nichts anfangen können, dann geben Sie hier bitte die IP-Adresse dieses Servers ein. + + = f.simple_fields_for :sip_domain, @sip_domain do |s| + = render "sip_domains/form_core", :f => s + .actions = f.button :submit, conditional_t('gemeinschaft_setups.form.submit') \ No newline at end of file diff --git a/app/views/gemeinschaft_setups/new.html.haml b/app/views/gemeinschaft_setups/new.html.haml index ff9c812..5e2434e 100644 --- a/app/views/gemeinschaft_setups/new.html.haml +++ b/app/views/gemeinschaft_setups/new.html.haml @@ -4,24 +4,26 @@ = simple_form_for(@gemeinschaft_setup) do |f| = f.error_notification - %h3 Admin user account - %p - This is the first user of this system who has admin rights by default. + %h2 Admin user account = f.simple_fields_for :user, @user do |u| = render "users/form_core", :f => u - %h3 SIP domain - %p You should use the same value for the SIP realm as for the SIP domain to ensure compatibility with different phone models. In case you have no clue what we are talking about: Just enter the IP address of this server. - - = f.simple_fields_for :sip_domain, @sip_domain do |s| - = render "sip_domains/form_core", :f => s - - %h3 General information + %h2 Configuration of this PBX = f.association :country, :label => t('gemeinschaft_setups.form.country_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.country_id.hint'), :include_blank => false = f.association :language, :label => t('gemeinschaft_setups.form.language_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.language_id.hint'), :include_blank => false = f.input :default_area_code, :label => t('gemeinschaft_setups.form.default_area_code.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_area_code.hint') + = f.input :default_company_name, :label => t('gemeinschaft_setups.form.default_company_name.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_company_name.hint') + + = f.input :default_system_email, :label => t('gemeinschaft_setups.form.default_system_email.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_system_email.hint') + + %h3 SIP-Domain + %p You should use the same value for the SIP realm as for the SIP domain to ensure compatibility with different phone models. In case you have no clue what we are talking about: Just enter the IP address of this server. + + = f.simple_fields_for :sip_domain, @sip_domain do |s| + = render "sip_domains/form_core", :f => s + .actions = f.button :submit, conditional_t('gemeinschaft_setups.form.submit') \ No newline at end of file diff --git a/app/views/users/_form_core.html.haml b/app/views/users/_form_core.html.haml index 24b15f5..980976d 100644 --- a/app/views/users/_form_core.html.haml +++ b/app/views/users/_form_core.html.haml @@ -2,7 +2,8 @@ - if GuiFunction.display?('name_data_fields_in_user_edit_form', current_user) = f.input :male, :collection => [[true, t('users.form.gender.male')], [false, t('users.form.gender.female')]], :label_method => :last, :value_method => :first, :label => t('users.form.male.label'), :hint => conditional_hint('users.form.gender.hint'), :label => t('users.form.gender.label'), :as => :radio_buttons = f.input :first_name, :label => t('users.form.first_name.label'), :hint => conditional_hint('users.form.first_name.hint'), :autofocus => true - = f.input :middle_name, :label => t('users.form.middle_name.label'), :hint => conditional_hint('users.form.middle_name.hint') + - if User.any? + = f.input :middle_name, :label => t('users.form.middle_name.label'), :hint => conditional_hint('users.form.middle_name.hint') = f.input :last_name, :label => t('users.form.last_name.label'), :hint => conditional_hint('users.form.last_name.hint') - if GuiFunction.display?('user_name_field_in_user_edit_form', current_user) = f.input :user_name, :label => t('users.form.user_name.label'), :hint => conditional_hint('users.form.user_name.hint') -- cgit v1.2.3 From 5c9968de4770ef2383ce62a3f9e21054aa9e1db7 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 24 Jan 2013 13:02:08 +0100 Subject: Better user experience for SipAccount#new. --- app/views/sip_accounts/_form_core.html.haml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/sip_accounts/_form_core.html.haml b/app/views/sip_accounts/_form_core.html.haml index 495ae84..1b96d27 100644 --- a/app/views/sip_accounts/_form_core.html.haml +++ b/app/views/sip_accounts/_form_core.html.haml @@ -1,7 +1,11 @@ .inputs - = f.input :auth_name, :as => :string, :label => t('sip_accounts.form.auth_name.label'), :hint => conditional_hint('sip_accounts.form.auth_name.hint') - = f.input :password, :as => :string, :label => t('sip_accounts.form.password.label'), :hint => conditional_hint('sip_accounts.form.password.hint') = f.input :caller_name, :as => :string, :label => t('sip_accounts.form.caller_name.label'), :hint => conditional_hint('sip_accounts.form.caller_name.hint'), :autofocus => true + - if @sip_account && @sip_account.new_record? + = f.hidden_field :auth_name + = f.hidden_field :password + - else + = f.input :auth_name, :as => :string, :label => t('sip_accounts.form.auth_name.label'), :hint => conditional_hint('sip_accounts.form.auth_name.hint') + = f.input :password, :as => :string, :label => t('sip_accounts.form.password.label'), :hint => conditional_hint('sip_accounts.form.password.hint') = f.input :voicemail_pin, :as => :string, :label => t('sip_accounts.form.voicemail_pin.label'), :hint => conditional_hint('sip_accounts.form.voicemail_pin.hint') = f.input :call_waiting, :label => t('sip_accounts.form.call_waiting.label'), :hint => conditional_hint('sip_accounts.form.call_waiting.hint') = f.input :clir, :label => t('sip_accounts.form.clir.label'), :hint => conditional_hint('sip_accounts.form.clir.hint') -- cgit v1.2.3 From 517dbc54c595adca221249545d0e7c0815df3195 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 24 Jan 2013 13:19:29 +0100 Subject: UI --- app/views/tenants/_admin_area.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index 92614c8..28a8273 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -11,11 +11,11 @@ = render :partial => 'tenants/table_of_hunt_groups', :locals => {:tenant => tenant} = render :partial => 'tenants/table_of_automatic_call_distributors', :locals => {:tenant => tenant} - = render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => tenant} - = render :partial => 'tenants/users_table', :locals => {:tenant => tenant} = render :partial => 'tenants/user_groups_table', :locals => {:tenant => tenant} + = render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => tenant} + .well %h2 Gemeinschaft Konfiguration = render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => tenant} -- cgit v1.2.3 From bcc26106d74a301df09e02d07572ffe90dfb429b Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 24 Jan 2013 13:23:24 +0100 Subject: Don't let the admin pull out the rug for his/her own account. --- app/models/ability.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app') diff --git a/app/models/ability.rb b/app/models/ability.rb index b846af0..0d13dab 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -82,6 +82,10 @@ class Ability # cannot [:create, :destroy], GsParameter cannot [:create, :destroy], GuiFunction + + # An admin can not destroy his/her account + # + cannot [:destroy], User, :id => user.id else # Any user can do the following stuff. # -- cgit v1.2.3 From b792c8eb19fba97a7dab5cd2be8e6bd74617e7d2 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 24 Jan 2013 13:38:24 +0100 Subject: Housekeeping. --- app/views/shared/_header.de.html.haml | 41 ----------------------------------- app/views/shared/_header.html.haml | 41 ----------------------------------- 2 files changed, 82 deletions(-) delete mode 100644 app/views/shared/_header.de.html.haml delete mode 100644 app/views/shared/_header.html.haml (limited to 'app') diff --git a/app/views/shared/_header.de.html.haml b/app/views/shared/_header.de.html.haml deleted file mode 100644 index 10ad2a0..0000000 --- a/app/views/shared/_header.de.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -%header#main - .light - %h1.gemeinschaft-logo - - if @current_user && @current_user.current_tenant - = link_to "Gemeinschaft", tenant_path(@current_user.current_tenant) - - else - = link_to "Gemeinschaft", root_url - - - if current_user - = form_tag '/search' do - %div.search-box - - if GuiFunction.display?('search_field_in_top_navigation_bar', current_user) - %input.text{:value => 'Suchen ...', :name => 'q'} - %input{:type => 'submit', :value => ''} - - / Adjustable Navigation. - - if current_user - - if navigation_items.size > 0 - - navigation_items.each do |item| - - if GuiFunction.display?('navigation_items_in_top_navigation_bar', current_user) - %span - = link_to item[:title], item[:url] - - - if current_user - .user-context - %a.user{:href => tenant_user_path(current_user.current_tenant.id, current_user.id)} - - if GuiFunction.display?('user_avatar_in_top_navigation_bar', current_user) - - if current_user.image? && current_user.image_url(:mini) - = image_tag current_user.image_url(:mini).to_s, :class => 'display' - - else - - if current_user.male? - = image_tag 'icons/user-male-16x.png', :class => 'display logged-out' - - else - = image_tag 'icons/user-female-16x.png', :class => 'display logged-out' - = current_user - = link_to( "[x]", log_out_path, :class => 'logout', :title => "Abmelden" ) # Temporary way of logging out. - - else - .user-context - = link_to "Registrieren", sign_up_path - or - = link_to "Anmelden", log_in_path diff --git a/app/views/shared/_header.html.haml b/app/views/shared/_header.html.haml deleted file mode 100644 index 377d8e0..0000000 --- a/app/views/shared/_header.html.haml +++ /dev/null @@ -1,41 +0,0 @@ -%header#main - .light - %h1.gemeinschaft-logo - - if @current_user && @current_user.current_tenant - = link_to "Gemeinschaft", tenant_path(@current_user.current_tenant) - - else - = link_to "Gemeinschaft", root_url - - - if current_user - = form_tag '/search' do - %div.search-box - - if GuiFunction.display?('search_field_in_top_navigation_bar', current_user) - %input.text{:value => 'Search ...', :name => 'q'} - %input{:type => 'submit', :value => ''} - - / Adjustable Navigation. - - if current_user - - if navigation_items.size > 0 - - navigation_items.each do |item| - - if GuiFunction.display?('navigation_items_in_top_navigation_bar', current_user) - %span - = link_to item[:title], item[:url] - - - if current_user - .user-context - %a.user{:href => tenant_user_path(current_user.current_tenant.id, current_user.id)} - - if GuiFunction.display?('user_avatar_in_top_navigation_bar', current_user) - - if current_user.image? && current_user.image_url(:mini) - = image_tag current_user.image_url(:mini).to_s, :class => 'display' - - else - - if current_user.male? - = image_tag 'icons/user-male-16x.png', :class => 'display logged-out' - - else - = image_tag 'icons/user-female-16x.png', :class => 'display logged-out' - = current_user - = link_to( "[x]", log_out_path, :class => 'logout', :title => "Log out" ) # Temporary way of logging out. - - else - .user-context - = link_to "Sign up", sign_up_path - or - = link_to "Log in", log_in_path -- cgit v1.2.3 From ea3df5a7eb079982a8fcda3df572a0d1433b7f52 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 24 Jan 2013 13:49:44 +0100 Subject: Better UI on mobile phones. --- app/views/gs_parameters/_index_core.html.haml | 12 +++++-- app/views/gs_parameters/show.html.haml | 46 +++++++++++++++++---------- 2 files changed, 39 insertions(+), 19 deletions(-) (limited to 'app') diff --git a/app/views/gs_parameters/_index_core.html.haml b/app/views/gs_parameters/_index_core.html.haml index 9628feb..11d60db 100644 --- a/app/views/gs_parameters/_index_core.html.haml +++ b/app/views/gs_parameters/_index_core.html.haml @@ -10,8 +10,16 @@ - for gs_parameter in gs_parameters - cache(['gs_parameters_table_single_row', gs_parameter]) do %tr - %td= gs_parameter.name + %td + %span.hidden-phone + = truncate(gs_parameter.name, :length => GsParameter.get('DESKTOP_MAX_STRING_LENGTH')) + %span.visible-phone + = truncate(gs_parameter.name, :length => GsParameter.get('MOBILE_MAX_STRING_LENGTH')) - if !@sections %td= gs_parameter.section - %td= truncate(gs_parameter.value, :length => 50) + %td + %span.hidden-phone + = truncate(gs_parameter.value, :length => GsParameter.get('DESKTOP_MAX_STRING_LENGTH')) + %span.visible-phone + = truncate(gs_parameter.value, :length => GsParameter.get('MOBILE_MAX_STRING_LENGTH')) =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => gs_parameter} \ No newline at end of file diff --git a/app/views/gs_parameters/show.html.haml b/app/views/gs_parameters/show.html.haml index 795d09c..d04949b 100644 --- a/app/views/gs_parameters/show.html.haml +++ b/app/views/gs_parameters/show.html.haml @@ -1,20 +1,32 @@ -- cache(@gs_parameter) do - - content_for :title, t("gs_parameters.show.page_title") +- content_for :title, t("gs_parameters.show.page_title") - %p - %strong= t('gs_parameters.show.name') + ":" - = @gs_parameter.name - %p - %strong= t('gs_parameters.show.section') + ":" - = @gs_parameter.section - %p - %strong= t('gs_parameters.show.value') + ":" - = @gs_parameter.value - %p - %strong= t('gs_parameters.show.class_type') + ":" - = @gs_parameter.class_type - %p - %strong= t('gs_parameters.show.description') + ":" - = @gs_parameter.description +- cache(@gs_parameter) do + %table{:class => 'table table-striped'} + %tbody + %tr + %td + %strong= t('gs_parameters.show.name') + ":" + %td + = @gs_parameter.name + %tr + %td + %strong= t('gs_parameters.show.section') + ":" + %td + = @gs_parameter.section + %tr + %td + %strong= t('gs_parameters.show.value') + ":" + %td + = @gs_parameter.value + %tr + %td + %strong= t('gs_parameters.show.class_type') + ":" + %td + = @gs_parameter.class_type + %tr + %td + %strong= t('gs_parameters.show.description') + ":" + %td + = @gs_parameter.description = render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @gs_parameter } \ No newline at end of file -- cgit v1.2.3 From e024c99b6ffeb725cf73ebf8b7b55957f36772f5 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 24 Jan 2013 14:09:31 +0100 Subject: A new user becomes a member of default UserGroups. --- app/models/user.rb | 10 ++++++++++ app/views/user_groups/_index_core.html.haml | 4 ---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/models/user.rb b/app/models/user.rb index b902b99..9e8cbc0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -95,6 +95,8 @@ class User < ActiveRecord::Base before_destroy :destroy_or_logout_phones + after_save :become_a_member_of_default_user_groups + def destroy clean_whitelist_entries super @@ -207,4 +209,12 @@ class User < ActiveRecord::Base end end + # Normaly a new user should become a member of default user groups. + # + def become_a_member_of_default_user_groups + UserGroup.where(:id => GsParameter.get('DEFAULT_USER_GROUPS_IDS')).each do |user_group| + user_group.user_group_memberships.create(:user_id => self.id) + end + end + end diff --git a/app/views/user_groups/_index_core.html.haml b/app/views/user_groups/_index_core.html.haml index c481a18..aa1497e 100644 --- a/app/views/user_groups/_index_core.html.haml +++ b/app/views/user_groups/_index_core.html.haml @@ -29,9 +29,5 @@ - else %td =render 'users/listing', :users => user_group.users - - if user_group.users.any? - %br - - if (user_group.tenant.user_ids - user_group.user_ids).any? - = render :partial => 'shared/create_link', :locals => {:parent => user_group, :child_class => UserGroupMembership} =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => user_group.tenant, :child => user_group} -- cgit v1.2.3 From 2d6ebf19e5cea45dd714f92a64b1b81e1200a811 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 24 Jan 2013 14:45:43 +0100 Subject: Create a central docu page which gets a link in the navbar. --- app/controllers/gemeinschaft_setups_controller.rb | 2 +- app/controllers/page_controller.rb | 5 ++-- app/controllers/tenants_controller.rb | 4 +-- app/models/user.rb | 3 +++ app/views/layouts/_navbar.html.haml | 13 ++++++--- app/views/page/beginners_intro.de.html.haml | 33 ----------------------- app/views/page/beginners_intro.html.haml | 33 ----------------------- app/views/page/help.de.html.haml | 33 +++++++++++++++++++++++ app/views/page/help.html.haml | 33 +++++++++++++++++++++++ 9 files changed, 85 insertions(+), 74 deletions(-) delete mode 100644 app/views/page/beginners_intro.de.html.haml delete mode 100644 app/views/page/beginners_intro.html.haml create mode 100644 app/views/page/help.de.html.haml create mode 100644 app/views/page/help.html.haml (limited to 'app') diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index a860653..4f4a72a 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -94,7 +94,7 @@ class GemeinschaftSetupsController < ApplicationController session[:user_id] = user.id # Redirect to the user - redirect_to page_beginners_intro_path, :notice => t('gemeinschaft_setups.initial_setup.successful_setup') + redirect_to page_help_path, :notice => t('gemeinschaft_setups.initial_setup.successful_setup') else render :new end diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index dc5f57b..8f4fa88 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -11,8 +11,9 @@ class PageController < ApplicationController end end - def conference;end - def beginners_intro;end + def help + + end private def if_fresh_system_then_go_to_wizard diff --git a/app/controllers/tenants_controller.rb b/app/controllers/tenants_controller.rb index cb67e5f..37874b2 100644 --- a/app/controllers/tenants_controller.rb +++ b/app/controllers/tenants_controller.rb @@ -70,7 +70,7 @@ class TenantsController < ApplicationController :amount_of_numbers => @tenant.array_of_internal_extension_numbers.count + @tenant.array_of_dids.count ) else - redirect_to page_beginners_intro_path, :notice => t('tenants.controller.successfuly_created_plus_delayed_jobs', + redirect_to page_help_path, :notice => t('tenants.controller.successfuly_created_plus_delayed_jobs', :resource => @tenant, :amount_of_numbers => @tenant.array_of_internal_extension_numbers.count + @tenant.array_of_dids.count ) @@ -81,7 +81,7 @@ class TenantsController < ApplicationController :resource => @tenant ) else - redirect_to page_beginners_intro_path, :notice => t('tenants.controller.successfuly_created', + redirect_to page_help_path, :notice => t('tenants.controller.successfuly_created', :resource => @tenant ) end diff --git a/app/models/user.rb b/app/models/user.rb index 9e8cbc0..afb3f04 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -144,6 +144,9 @@ class User < ActiveRecord::Base self.pin_hash == Digest::SHA2.hexdigest( "#{self.pin_salt}#{entered_pin}" ) end + def admin? + self.user_groups.include?(UserGroup.find(2)) + end private diff --git a/app/views/layouts/_navbar.html.haml b/app/views/layouts/_navbar.html.haml index 7ef6523..c2d9946 100644 --- a/app/views/layouts/_navbar.html.haml +++ b/app/views/layouts/_navbar.html.haml @@ -9,9 +9,16 @@ %span.icon-bar %span.icon-bar - - if current_user && current_user.sip_accounts.any? - .nav-collapse.collapse - %ul.nav + .nav-collapse.collapse + %ul.nav + - if current_user && GemeinschaftSetup.any? && current_user.admin? + - if current_page?(page_help_path) + %li.active + =link_to 'Admin-Doku', page_help_path + - else + %li + =link_to 'Admin-Doku', page_help_path + - 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 diff --git a/app/views/page/beginners_intro.de.html.haml b/app/views/page/beginners_intro.de.html.haml deleted file mode 100644 index 5eef135..0000000 --- a/app/views/page/beginners_intro.de.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -- content_for :title, "Erste Schritte mit Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}!" - -%p - Sie müssen als erstes mindestens zwei neue SIP-Accounts anlegen. Dabei haben Sie die Wahl zwischen folgenden Varianten: - -%ul - %li - %strong - Personalisierter SIP-Accounts - %br - Dieser wird einer bestimmten Person zugeordnet. In einer normalen Gemeinschaft-Installation sind die meisten SIP-Accounts personalisiert. - %br - =link_to "SIP-Account für #{current_user} anlegen.", new_user_sip_account_path(current_user) - %li - %strong - Firmen SIP-Accounts - %br - Es gibt bestimmte SIP-Account, die keiner bestimmten Person zugeordnet werden können (z.B. für Telefone in einem Konferenzraum). Dafür gibt es Firmen SIP-Accounts. - %br - =link_to "SIP-Account für #{current_user.current_tenant} anlegen.", new_tenant_sip_account_path(current_user.current_tenant) - -%h2 Rufnummern - -%p - Mit denen von Ihnen angelegten SIP-Accounts können Sie schon intern telefonieren. Dazu müssen Sie den SIP-Accounts jeweils eine interne Telefonnummer zuweisen (z.B. 20 und 21) und ein SIP Soft- oder Hardphone mit den Account-Daten konfigurieren. - -%h2 Telefone - -%p - Komfortabler ist der Betrieb von im Provisioning unterstützen Telefone. Diese können Sie beim Anlegen direkt mit einem bestimmten SIP-Account verknüpfen. Danach müssen Sie nur noch die Provisioningdaten per Hand ins Telefon eintragen oder ein paar Einstellungen in Ihrem DHCP-Server vornehmen. Hilfe dazu finden Sie im #{link_to 'Wiki', 'https://github.com/amooma/GS5/wiki'} und der #{link_to 'Mailingliste', 'https://groups.google.com/group/gs5-users/'}. -%p - Folgende Telefone werden in der Version #{GsParameter.get('GEMEINSCHAFT_VERSION')} vom automatischen Provisioning unterstützt: - = nicely_joined_with_commata(PhoneModel.order(:name).map{|phone_model| "#{phone_model.to_s}"}) \ No newline at end of file diff --git a/app/views/page/beginners_intro.html.haml b/app/views/page/beginners_intro.html.haml deleted file mode 100644 index dadd99f..0000000 --- a/app/views/page/beginners_intro.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -- content_for :title, "First steps with Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}!" - -%p - You have to create at least two new SIP accounts. You have the choice of two different versions: - -%ul - %li - %strong - Personalized SIP accounts - %br - They are linked to a user. In a normal Gemeinschaft installation the majority of accounts are personlized. - %br - =link_to "Create a SIP account for #{current_user}.", new_user_sip_account_path(current_user) - %li - %strong - Company SIP accounts - %br - These are for phones which are not linked to a specific person (e.g. phones in conference rooms). - %br - =link_to "Create a SIP account for #{current_user.current_tenant}.", new_tenant_sip_account_path(current_user.current_tenant) - -%h2 Phone numbers - -%p - You can use your SIP accounts to make internal calls. But before that you have to add phone numbers to each SIP account (e.g. 20 and 21). After you did that you can configure any SIP phone with the SIP account configuration and start using your new PBX. - -%h2 Phones - -%p - More comfortable is the use of auto provisioned phones. They can be linked to SIP accounts. After creating them in the WebGUI you have to set the Provisioning URL in the phone or setup your DHCP server to give them this data. You'll find help in our #{link_to 'Wiki', 'https://github.com/amooma/GS5/wiki'} or in our #{link_to 'mailinglist', 'https://groups.google.com/group/gs5-users/'}. -%p - In version #{GsParameter.get('GEMEINSCHAFT_VERSION')} the following phones can be used for provisioning: - = nicely_joined_with_commata(PhoneModel.order(:name).map{|phone_model| "#{phone_model.to_s}"}) \ No newline at end of file diff --git a/app/views/page/help.de.html.haml b/app/views/page/help.de.html.haml new file mode 100644 index 0000000..5eef135 --- /dev/null +++ b/app/views/page/help.de.html.haml @@ -0,0 +1,33 @@ +- content_for :title, "Erste Schritte mit Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}!" + +%p + Sie müssen als erstes mindestens zwei neue SIP-Accounts anlegen. Dabei haben Sie die Wahl zwischen folgenden Varianten: + +%ul + %li + %strong + Personalisierter SIP-Accounts + %br + Dieser wird einer bestimmten Person zugeordnet. In einer normalen Gemeinschaft-Installation sind die meisten SIP-Accounts personalisiert. + %br + =link_to "SIP-Account für #{current_user} anlegen.", new_user_sip_account_path(current_user) + %li + %strong + Firmen SIP-Accounts + %br + Es gibt bestimmte SIP-Account, die keiner bestimmten Person zugeordnet werden können (z.B. für Telefone in einem Konferenzraum). Dafür gibt es Firmen SIP-Accounts. + %br + =link_to "SIP-Account für #{current_user.current_tenant} anlegen.", new_tenant_sip_account_path(current_user.current_tenant) + +%h2 Rufnummern + +%p + Mit denen von Ihnen angelegten SIP-Accounts können Sie schon intern telefonieren. Dazu müssen Sie den SIP-Accounts jeweils eine interne Telefonnummer zuweisen (z.B. 20 und 21) und ein SIP Soft- oder Hardphone mit den Account-Daten konfigurieren. + +%h2 Telefone + +%p + Komfortabler ist der Betrieb von im Provisioning unterstützen Telefone. Diese können Sie beim Anlegen direkt mit einem bestimmten SIP-Account verknüpfen. Danach müssen Sie nur noch die Provisioningdaten per Hand ins Telefon eintragen oder ein paar Einstellungen in Ihrem DHCP-Server vornehmen. Hilfe dazu finden Sie im #{link_to 'Wiki', 'https://github.com/amooma/GS5/wiki'} und der #{link_to 'Mailingliste', 'https://groups.google.com/group/gs5-users/'}. +%p + Folgende Telefone werden in der Version #{GsParameter.get('GEMEINSCHAFT_VERSION')} vom automatischen Provisioning unterstützt: + = nicely_joined_with_commata(PhoneModel.order(:name).map{|phone_model| "#{phone_model.to_s}"}) \ No newline at end of file diff --git a/app/views/page/help.html.haml b/app/views/page/help.html.haml new file mode 100644 index 0000000..dadd99f --- /dev/null +++ b/app/views/page/help.html.haml @@ -0,0 +1,33 @@ +- content_for :title, "First steps with Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}!" + +%p + You have to create at least two new SIP accounts. You have the choice of two different versions: + +%ul + %li + %strong + Personalized SIP accounts + %br + They are linked to a user. In a normal Gemeinschaft installation the majority of accounts are personlized. + %br + =link_to "Create a SIP account for #{current_user}.", new_user_sip_account_path(current_user) + %li + %strong + Company SIP accounts + %br + These are for phones which are not linked to a specific person (e.g. phones in conference rooms). + %br + =link_to "Create a SIP account for #{current_user.current_tenant}.", new_tenant_sip_account_path(current_user.current_tenant) + +%h2 Phone numbers + +%p + You can use your SIP accounts to make internal calls. But before that you have to add phone numbers to each SIP account (e.g. 20 and 21). After you did that you can configure any SIP phone with the SIP account configuration and start using your new PBX. + +%h2 Phones + +%p + More comfortable is the use of auto provisioned phones. They can be linked to SIP accounts. After creating them in the WebGUI you have to set the Provisioning URL in the phone or setup your DHCP server to give them this data. You'll find help in our #{link_to 'Wiki', 'https://github.com/amooma/GS5/wiki'} or in our #{link_to 'mailinglist', 'https://groups.google.com/group/gs5-users/'}. +%p + In version #{GsParameter.get('GEMEINSCHAFT_VERSION')} the following phones can be used for provisioning: + = nicely_joined_with_commata(PhoneModel.order(:name).map{|phone_model| "#{phone_model.to_s}"}) \ No newline at end of file -- cgit v1.2.3