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 thead
.panel-body tr
table.table.table-striped.table-hover.record-table#conferences th = PersonalProfile.model_name.human
thead th.actions
tbody
- @users.each do |user|
- profile = user.personal_profile(@conference)
tr tr
th = User.human_attribute_name :picture td
th = User.human_attribute_name :title .media
th = User.human_attribute_name :admin .media-left
th.actions - if profile.present?
tbody = image_tag(profile.picture.thumb.url)
- @users.each do |user| - else
- profile = user.personal_profile(@conference) = image_tag(PictureUploader.new.thumb.url)
- if profile.present? .media-body
tr h4.media-heading
td= image_tag(profile.picture.thumb.url) - if profile.try(:name).present?
td= profile.name = 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 - else
.btn.btn-success= icon('dot-circle-o') = user.email
p
td.actions - if profile.present?
div.btn-group.btn-group-sm - if profile.public_email.present?
= action_buttons(@conference, profile, [:show, :edit, :destroy]) = icon :envelope, "#{profile.public_email} (#{PersonalProfile.human_attribute_name(:public_email).mb_chars.downcase})"
br
- else = icon :envelope, "#{user.email} (#{User.human_attribute_name(:email).mb_chars.downcase})"
tr - else
td= image_tag(PictureUploader.new.thumb.url) = t '.no_profile'
td= user.email td.actions
td div.btn-group.btn-group-sm
td.actions - if profile.present?
div.btn-group.btn-group-sm = action_buttons(@conference, profile, [:show, :edit, :destroy])
= link_to [:new, :management, @conference, :personal_profile, {user_id: user.id}] do - else
=> t('actions.create.title', model: User.model_name.human) = 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: "Крайна дата"