Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions app/controllers/api/users/companies_controller.rb

This file was deleted.

8 changes: 8 additions & 0 deletions app/controllers/users/companies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@ class Users::CompaniesController < ApplicationController

def index
@target = ALLOWED_TARGETS.include?(params[:target]) ? params[:target] : ALLOWED_TARGETS.first
@allowed_targets = ALLOWED_TARGETS
@companies = Company.with_attached_logo.order(created_at: :desc)
@company_users = User
.with_attached_avatar
.where(company_id: @companies.map(&:id))
.users_role(@target, allowed_targets: @allowed_targets)
.order(:id)
.group_by(&:company_id)
end
end
37 changes: 0 additions & 37 deletions app/javascript/components/Companies.jsx

This file was deleted.

71 changes: 0 additions & 71 deletions app/javascript/components/Company.jsx

This file was deleted.

11 changes: 0 additions & 11 deletions app/javascript/components/LoadingUserIconPlaceholder.jsx

This file was deleted.

14 changes: 0 additions & 14 deletions app/javascript/components/LoadingUsersPageCompaniesPlaceholder.jsx

This file was deleted.

31 changes: 0 additions & 31 deletions app/javascript/components/LoadingUsersPageCompanyPlaceholder.jsx

This file was deleted.

11 changes: 0 additions & 11 deletions app/views/api/users/companies/_company.json.jbuilder

This file was deleted.

3 changes: 0 additions & 3 deletions app/views/api/users/companies/index.json.jbuilder

This file was deleted.

6 changes: 6 additions & 0 deletions app/views/users/companies/_companies.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.page-body
.container.is-lg
.card-list
- companies.each do |company|
- next if company_users[company.id].blank?
= render 'company', company: company, company_users: company_users[company.id]
15 changes: 15 additions & 0 deletions app/views/users/companies/_company.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.a-card.user-group
header.user-group__header
h2.group-company-name
a.group-company-name__link href=company_users_url(company)
span.group-company-name__icon
img.group-company-name__icon-image title=company.name alt=company.name src=company.logo_url
span.group-company-name__name
span.group-company-name__label
= company.name
span.group-company-name__label-option
= company.description
.a-user-icons
.a-user-icons__items
- company_users.each do |company_user|
= render 'user_icon', company_user: company_user
7 changes: 7 additions & 0 deletions app/views/users/companies/_user_icon.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a.a-user-icons__item-link href=company_user.url
span class=['a-user-role', "is-#{company_user.primary_role}", ('is-new-user' if company_user.joining_status == 'new-user')]
img.a-user-icons__item-icon.a-user-icon(
title="#{company_user.icon_title}"
alt="#{company_user.icon_title}"
src="#{company_user.avatar_url}"
data-login-name="#{company_user.login_name}")
6 changes: 4 additions & 2 deletions app/views/users/companies/_users_tabs.html.slim
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
nav.tab-nav
.container
ul.tab-nav__items
- Users::CompaniesController::ALLOWED_TARGETS.each do |target|
- allowed_targets.each do |allowed_target|
li.tab-nav__item
= link_to t("target.#{target}"), users_companies_path(target:), class: (@target == target ? ['is-active'] : []) << 'tab-nav__item-link'
= link_to t("target.#{allowed_target}"),
users_companies_path(target: allowed_target),
class: (allowed_target == target ? ['is-active'] : []) << 'tab-nav__item-link'
4 changes: 2 additions & 2 deletions app/views/users/companies/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ header.page-header
ul.page-header-actions__items

= users_page_tabs(active_tab: '企業別')
= render 'users_tabs'
= render 'users_tabs', target: @target, allowed_targets: @allowed_targets

main.page-main
header.page-main-header
Expand All @@ -21,4 +21,4 @@ main.page-main
= '企業別'
| (#{t("target.#{@target}")})
hr.a-border
= react_component('Companies', target: @target)
= render 'companies', companies: @companies, company_users: @company_users, target: @target, allowed_targets: @allowed_targets
3 changes: 0 additions & 3 deletions config/routes/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
resources :reactions, only: %i(create destroy)
resources :checks, only: %i(index create destroy)
resources :mention_users, only: %i(index)
namespace :users do
resources :companies, only: %i(index)
end
resources :users, only: %i(index show update)
resources :user_icon_urls, only: %i(index)
get "users/tags/:tag", to: "users#index", as: :users_tag, tag: /.+/
Expand Down
5 changes: 5 additions & 0 deletions db/fixtures/discord_profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,8 @@ discord_profile_kensyu-invoice:
user: kensyu-invoice
account_name:
times_url:

discord_profile_new-mentor:
user: new-mentor
account_name: new-mentor
times_url:
4 changes: 4 additions & 0 deletions db/fixtures/talks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,7 @@ talk_kensyu-not-setting-end-date:
talk_pjord:
user: pjord
action_completed: true

talk_new-mentor:
user: new-mentor
action_completed: true
23 changes: 23 additions & 0 deletions db/fixtures/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1532,3 +1532,26 @@ kensyu-invoice:
last_activity_at: "2014-01-01 00:00:11"
sent_student_followup_message: true
training_ends_on: <%= Time.current.next_year %>

new-mentor:
login_name: new-mentor
email: [email protected]
crypted_password: $2a$10$n/xv4/1luueN6plzm2OyDezWlZFyGHjQEf4hwAW1r3k.lCm0frPK. # testtest
salt: zW3kQ9ubsxQQtzzzs4ap
name: ニューメンター
name_kana: ニューメンター
github_account: new-mentor
twitter_account: new-mentor
facebook_url: https://www.facebook.com/fjordllc/new-mentor
blog_url: http://new-mentor.com
company: company1
description: "新しいメンターです。"
course: course1
job: office_worker
os: mac
experiences: 30
mentor: true
updated_at: <%= Time.current %>
created_at: <%= Time.current %>
sent_student_followup_message: true
last_activity_at: <%= Time.current %>
40 changes: 0 additions & 40 deletions test/integration/api/users/companies_test.rb

This file was deleted.