summaryrefslogtreecommitdiff
path: root/app/views/users
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/users')
-rw-r--r--app/views/users/_form.html.haml16
-rw-r--r--app/views/users/_form_core.html.haml27
-rw-r--r--app/views/users/_index_core.html.haml18
-rw-r--r--app/views/users/_listing.html.haml8
-rw-r--r--app/views/users/edit.html.haml3
-rw-r--r--app/views/users/index.html.haml6
-rw-r--r--app/views/users/new.html.haml3
-rw-r--r--app/views/users/show.html.haml96
8 files changed, 177 insertions, 0 deletions
diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml
new file mode 100644
index 0000000..9a75677
--- /dev/null
+++ b/app/views/users/_form.html.haml
@@ -0,0 +1,16 @@
+- if @parent && @parent.class == Tenant
+ = simple_form_for([@parent, @user]) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .actions
+ = f.button :submit, conditional_t('users.form.submit')
+- else
+ = simple_form_for(@user) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .actions
+ = f.button :submit, conditional_t('users.form.submit')
diff --git a/app/views/users/_form_core.html.haml b/app/views/users/_form_core.html.haml
new file mode 100644
index 0000000..8e18d12
--- /dev/null
+++ b/app/views/users/_form_core.html.haml
@@ -0,0 +1,27 @@
+.inputs
+ - 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
+ = 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')
+ = 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')
+ - if GuiFunction.display?('email_field_in_user_edit_form', current_user)
+ = f.input :email, :label => t('users.form.email.label'), :hint => conditional_hint('users.form.email.hint')
+
+ - if GuiFunction.display?('password_fields_in_user_edit_form', current_user)
+ = f.input :password, :label => t('users.form.password.label'), :hint => conditional_hint('users.form.password.hint'), :as => :password
+ = f.input :password_confirmation, :label => t('users.form.password_confirmation.label'), :hint => conditional_hint('users.form.password_confirmation.hint'), :as => :password
+
+ - if GuiFunction.display?('pin_fields_in_user_edit_form', current_user)
+ = f.input :new_pin, :label => t('users.form.new_pin.label'), :hint => conditional_hint('users.form.new_pin.hint'), :as => :password
+ = f.input :new_pin_confirmation, :label => t('users.form.new_pin_confirmation.label'), :hint => conditional_hint('users.form.new_pin_confirmation.hint'), :as => :password
+
+ = f.input :image, { :as => :file, :label => t('users.form.image.label'), :hint => conditional_hint('users.form.image.hint') }
+ - if @user && @user.image?
+ %p
+ =link_to 'Destroy avatar', tenant_user_destroy_avatar_path(@tenant, @user)
+
+ = f.input :language_id, :collection => Language.all, :label => t('users.form.language_id.label'), :hint => conditional_hint('users.form.language_id.hint'), :include_blank => false
+
+ /= f.input :send_voicemail_as_email_attachment, :label => t('users.form.send_voicemail_as_email_attachment.label'), :hint => conditional_hint('users.form.send_voicemail_as_email_attachment.hint')
diff --git a/app/views/users/_index_core.html.haml b/app/views/users/_index_core.html.haml
new file mode 100644
index 0000000..51c15de
--- /dev/null
+++ b/app/views/users/_index_core.html.haml
@@ -0,0 +1,18 @@
+%table
+ %tr
+ %th
+ %th= t('users.index.user_name')
+ %th= t('users.index.email')
+ %th= t('users.index.first_name')
+ %th= t('users.index.last_name')
+
+ - reset_cycle
+ - for user in users
+ %tr{:class => cycle('odd', 'even')}
+ %td
+ = image_tag user.image_url(:mini).to_s if user.image_url(:mini)
+ %td= user.user_name
+ %td= user.email
+ %td= user.first_name
+ %td= user.last_name
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => @tenant, :child => user} \ No newline at end of file
diff --git a/app/views/users/_listing.html.haml b/app/views/users/_listing.html.haml
new file mode 100644
index 0000000..0a97ad1
--- /dev/null
+++ b/app/views/users/_listing.html.haml
@@ -0,0 +1,8 @@
+- amount_of_users = users.count
+- if amount_of_users > 0
+ - if amount_of_users < 30
+ = users.map{|user| user}.join(', ')
+ - else
+ = users.limit(15).map{|user| user}.join(', ') + ', '
+ = '[...]'
+ = users.offset(amount_of_users - 15).map{|user| user}.join(', ') \ No newline at end of file
diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml
new file mode 100644
index 0000000..96272f5
--- /dev/null
+++ b/app/views/users/edit.html.haml
@@ -0,0 +1,3 @@
+- title t("users.edit.page_title", :resource => @user)
+
+= render "form"
diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml
new file mode 100644
index 0000000..892e035
--- /dev/null
+++ b/app/views/users/index.html.haml
@@ -0,0 +1,6 @@
+- title t("users.index.page_title")
+
+- if @users.count > 0
+ = render "index_core", :users => @users
+
+= render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => User} \ No newline at end of file
diff --git a/app/views/users/new.html.haml b/app/views/users/new.html.haml
new file mode 100644
index 0000000..a014611
--- /dev/null
+++ b/app/views/users/new.html.haml
@@ -0,0 +1,3 @@
+- title t("users.new.page_title")
+
+= render "form"
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
new file mode 100644
index 0000000..7730447
--- /dev/null
+++ b/app/views/users/show.html.haml
@@ -0,0 +1,96 @@
+- title "User: #{@user}"
+
+#user-show
+ %aside
+ = image_tag @user.image_url(:small).to_s, class: 'display' if @user.image? && @user.image_url(:small)
+ %p
+ %strong= t('users.show.user_name') + ":"
+ = @user.user_name
+ %p
+ %strong= t('users.show.email') + ":"
+ = @user.email
+
+ %p.controls
+ = render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @tenant, :child => @user }
+
+ - @user.sip_accounts.each do |sip_account|
+ - phone_number = sip_account.phone_numbers.order(:number).last
+ - if phone_number && !phone_number.number.blank? && phone_number.number[0] != '+'
+ %p
+ %strong= sip_account.phone_numbers.order(:number).last.number
+ %p
+ =link_to t("call_histories.index.page_title"), sip_account_call_histories_path(sip_account)
+ %br
+ =link_to t("voicemail_messages.index.page_title"), sip_account_voicemail_messages_path(sip_account)
+ %br
+ =link_to t("call_forwards.index.page_title"), phone_number_call_forwards_path(phone_number)
+ %br
+ =link_to t("voicemail_settings.index.page_title"), sip_account_voicemail_settings_path(sip_account)
+ %br
+ =link_to t("softkeys.index.page_title"), sip_account_softkeys_path(sip_account)
+ %br
+ =link_to t("ringtones.show.page_title"), phone_number_ringtones_path(phone_number)
+
+ - if @user.conferences.any?
+ %p
+ %strong= t("conferences.index.page_title")
+ - @user.conferences.each do |conference|
+ %p
+ =link_to conference, edit_user_conference_path(@user, conference)
+
+
+ %section
+ -# Phone books
+ -#
+ - if GuiFunction.display?('show_phone_books_in_user_show_view', current_user)
+ - if can?( :index, PhoneBook )
+ %h2=t("phone_books.index.page_title")
+ = render "phone_books/index_core", :phone_books => @phone_books
+ = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => PhoneBook}
+
+ -# User groups (only if the current user can edit or destroy them)
+ -#
+ - if @user.user_groups.map{ |x| can?( :edit, x ) || can?( :destroy, x ) }.include?(true)
+ - if can?( :index, UserGroup )
+ %h2=t("user_groups.index.page_title")
+ - if @user.user_groups.count > 0
+ = render "user_groups/index_core", :user_groups => @user.user_groups.where(:tenant_id => @tenant.id).order(:name)
+ = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => UserGroup}
+
+ -# SIP accounts
+ -#
+ - if (can?( :index, SipAccount ) && @user.sip_accounts.count > 0 ) || can?( :create, SipAccount )
+ %h2= t('sip_accounts.index.page_title')
+ - if can?( :index, SipAccount ) && @user.sip_accounts.count > 0
+ = render "sip_accounts/index_core", :sip_accounts => @user.sip_accounts
+ = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => SipAccount}
+
+ -# Phones
+ -#
+ - if (can?( :index, Phone, :phoneable => @user ) && @user.phones.count > 0 ) || can?( :create, Phone, :phoneable => @user )
+ %h2= t('phones.index.page_title')
+ - if can?( :index, Phone, :phoneable => @user ) && @user.phones.count > 0
+ = render "phones/index_core", :phones => @user.phones
+ = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => Phone}
+
+ -# FaxAccount
+ -#
+ - if (can?( :index, FaxAccount ) && @user.fax_accounts.count > 0 ) || can?( :create, FaxAccount )
+ %h2= t('fax_accounts.index.page_title')
+ - if can?( :index, FaxAccount ) && @user.fax_accounts.count > 0
+ = render "fax_accounts/index_core", {:fax_accounts => @user.fax_accounts, :fax_accountable => @user}
+ = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => FaxAccount}
+
+ -# Conferences
+ -#
+ - if (can?( :index, Conference ) && @user.conferences.count > 0 ) || can?( :create, Conference )
+ %h2= t('conferences.index.page_title')
+ - if can?( :index, Conference ) && @user.conferences.count > 0
+ = render "conferences/index_core", :conferences => @user.conferences
+ = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => Conference}
+
+ -# Tenants
+ -#
+ - if can?( :index, Tenant ) && @user.tenants.count > 1
+ %h2=t("tenants.index.page_title")
+ = render "tenants/index_core", :tenants => @user.tenants \ No newline at end of file