Reimplement personal profile index

This commit is contained in:
Petko Bordjukov 2016-10-09 03:56:41 +03:00
parent 0911ce5a71
commit 72a2057673
4 changed files with 75 additions and 38 deletions

View File

@ -2,9 +2,7 @@ module Management
class PersonalProfilesController < ManagementController class PersonalProfilesController < ManagementController
def index def index
@conference = find_conference @conference = find_conference
@users = current_conference.participants
# TODO @conference.participants
@users = User.all
end end
def toggle_admin def toggle_admin

View File

@ -0,0 +1,18 @@
<%- csv_headers = %w{id private_email public_email first_name last_name organisation picture mobile_phone biography github twitter language} -%>
<%= CSV.generate_line(csv_headers).html_safe -%>
<%- @users.each do |user| -%>
<%- profile = user.personal_profile(@conference) -%>
<%= CSV.generate_line([user.id,
user.email,
profile.try(:public_email),
profile.try(:first_name),
profile.try(:last_name),
profile.try(:organisation),
profile.try(:picture).try(:thumb).try(:url),
profile.try(:mobile_phone),
profile.try(:biography),
profile.try(:github),
profile.try(:twitter),
user.language
]).html_safe -%>
<%- end -%>

View File

@ -1,41 +1,57 @@
- content_for :title
= Conference.human_attribute_name(:participants).mb_chars.capitalize
.row
.col-lg-12
h1.page-header
= Conference.human_attribute_name(:participants).mb_chars.capitalize
small<
| (
= t '.total', current: @users.count, total: current_conference.participants.count
=< User.model_name.human(count: current_conference.participants.count).mb_chars.downcase
| )
.row .row
.col-lg-12 .col-lg-12
.panel.panel-default .panel.panel-default
.panel-heading table.table.table-striped.table-hover.record-table#profiles
h2.panel-title= User.model_name.human(count: 2).mb_chars.capitalize
.panel-body
table.table.table-striped.table-hover.record-table#conferences
thead thead
tr tr
th = User.human_attribute_name :picture th = PersonalProfile.model_name.human
th = User.human_attribute_name :title
th = User.human_attribute_name :admin
th.actions th.actions
tbody tbody
- @users.each do |user| - @users.each do |user|
- profile = user.personal_profile(@conference) - profile = user.personal_profile(@conference)
- if profile.present?
tr tr
td= image_tag(profile.picture.thumb.url)
td= profile.name
td.boolean-col
= link_to [:toggle_admin, :management, @conference, profile], method: :put do
- if user.admin?
.btn.btn-primary= icon('circle-o')
- else
.btn.btn-success= icon('dot-circle-o')
td.actions
div.btn-group.btn-group-sm
= action_buttons(@conference, profile, [:show, :edit, :destroy])
- else
tr
td= image_tag(PictureUploader.new.thumb.url)
td= user.email
td td
.media
.media-left
- if profile.present?
= image_tag(profile.picture.thumb.url)
- else
= image_tag(PictureUploader.new.thumb.url)
.media-body
h4.media-heading
- if profile.try(:name).present?
= profile.name
- else
= user.email
p
- if profile.present?
- if profile.public_email.present?
= icon :envelope, "#{profile.public_email} (#{PersonalProfile.human_attribute_name(:public_email).mb_chars.downcase})"
br
= icon :envelope, "#{user.email} (#{User.human_attribute_name(:email).mb_chars.downcase})"
- else
= t '.no_profile'
td.actions td.actions
div.btn-group.btn-group-sm div.btn-group.btn-group-sm
= link_to [:new, :management, @conference, :personal_profile, {user_id: user.id}] do - if profile.present?
=> t('actions.create.title', model: User.model_name.human) = action_buttons(@conference, profile, [:show, :edit, :destroy])
- else
= link_to [:new, :management, @conference, :personal_profile, {user_id: user.id}], class: ['btn', 'btn-primary'], title: t('actions.create.title', model: PersonalProfile.model_name.human) do
=> icon('user-plus')
.panel-footer.text-right
= link_to management_conference_personal_profiles_path(current_conference, format: 'csv'), class: 'btn btn-info'
= icon :download, t('.export')

View File

@ -1,5 +1,9 @@
bg: bg:
management: management:
personal_profiles:
index:
no_profile: 'Този потребител няма въведени профили в системата.'
total: "%{current} от общо %{total}"
conferences: conferences:
show: show:
summary: 'Обобщение' summary: 'Обобщение'
@ -64,6 +68,7 @@ bg:
rejected: Отхвърлено rejected: Отхвърлено
backup: Резерва backup: Резерва
conference: conference:
participants: "Участници"
description: "Описание" description: "Описание"
email: E-mail email: E-mail
end_date: "Крайна дата" end_date: "Крайна дата"