Skip to content

Commit

Permalink
Merge pull request #2990 from fjordllc/main
Browse files Browse the repository at this point in the history
Release 2021-07-26 07:03:46
  • Loading branch information
komagata authored Jul 26, 2021
2 parents 75f0d30 + 21ef509 commit 0cd4c0d
Show file tree
Hide file tree
Showing 90 changed files with 691 additions and 232 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
uses: ruby/setup-ruby@0c7e9c4d53d534e2c72b5b06535a3817d6d39fe1
with:
ruby-version: 2.6.6
ruby-version: 2.6.8
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.6
2.6.8
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM ruby:2.6.6-alpine
FROM ruby:2.6.8-alpine

ENV RAILS_ENV production
WORKDIR /app

# Update rubygems
RUN gem update --system
RUN printf "install: --no-rdoc --no-ri\nupdate: --no-rdoc --no-ri" > ~/.gemrc
RUN gem install --no-document --force bundler -v 2.1.4
RUN gem install --no-document --force bundler -v 2.2.24
RUN bundle config set without development:test

# Install packages
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ GEM
omniauth (>= 1.9, < 3)
os (1.1.1)
parallel (1.20.1)
parser (3.0.0.0)
parser (3.0.2.0)
ast (~> 2.4.1)
pastel (0.8.0)
tty-color (~> 0.5)
Expand Down Expand Up @@ -349,17 +349,17 @@ GEM
chunky_png (~> 1.0)
rqrcode_core (~> 0.2)
rqrcode_core (0.2.0)
rubocop (1.12.0)
rubocop (1.18.3)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
rubocop-ast (>= 1.7.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-ast (1.8.0)
parser (>= 3.0.1.1)
rubocop-fjord (0.1.4)
rubocop (>= 1.0)
rubocop-performance
Expand Down Expand Up @@ -557,7 +557,7 @@ DEPENDENCIES
webpacker (~> 5.0)

RUBY VERSION
ruby 2.6.6p146
ruby 2.6.8p205

BUNDLED WITH
2.2.19
2.2.24
9 changes: 9 additions & 0 deletions app/assets/stylesheets/atoms/_a-bookmark-button.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.a-bookmark-button
border: none
&:hover
border: none
&.is-inactive
color: $semi-muted-text
&:hover
color: $default-text
background-color: $background-shade
22 changes: 18 additions & 4 deletions app/assets/stylesheets/blocks/thread/_thread-header-actions.sass
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
.thread-header-actions
padding-top: .25rem
display: flex
justify-content: space-between
padding-top: .25rem

.thread-header-actions__start,
.thread-header-actions__end
display: flex
flex: 1
+media-breakpoint-up(md)
+margin(horizontal, -.25rem)
+media-breakpoint-down(sm)
+margin(horizontal, -.125rem)

.thread-header-actions__start
justify-content: flex-start

.thread-header-actions__end
justify-content: flex-end

.thread-header-actions__action
+media-breakpoint-up(md)
+padding(horizontal, .25rem)
min-width: 6rem
+media-breakpoint-down(sm)
+padding(horizontal, .125rem)
width: 50%
.a-button
min-width: 5.25rem
+padding(horizontal, 0)
&:not(:last-child)
margin-right: .5rem
18 changes: 13 additions & 5 deletions app/assets/stylesheets/blocks/thread/_thread-list-item.sass
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,23 @@
+media-breakpoint-down(sm)
margin-top: .75rem

.thread-list-item__assignee-name.a-button
.thread-list-item__assignee-button.a-button
border: dashed 1px $muted-text
pointer-events: none
color: $muted-text
background-color: #f6f6f6
span
display: block
overflow: hidden
text-overflow: ellipsis

.thread-list-item__assignee-image
flex: 0 0 1.25rem
.a-user-icon
+size(1.25rem)

.thread-list-item__assignee-name
display: block
overflow: hidden
text-overflow: ellipsis
flex: 1
text-align: center

.thread-list-item__label
+position(absolute, left 0, top 0)
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ def user_params
params.require(:user).permit(
:adviser, :login_name, :name,
:name_kana, :email, :course_id,
:description, :slack_account, :discord_account, :github_account,
:description, :discord_account, :github_account,
:twitter_account, :facebook_url, :blog_url,
:password, :password_confirmation, :job,
:organization, :os, :study_place,
:experience, :prefecture_code, :company_id,
:trainee, :job_seeking, :nda,
:graduated_on, :retired_on, :free,
:job_seeker, :slack_participation, :github_collaborator,
:job_seeker, :github_collaborator,
:officekey_permission, :tag_list
)
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/courses/practices_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class API::Courses::PracticesController < API::BaseController
before_action :require_login
before_action :require_login_for_api

def index
@course = Course.find(params[:course_id])
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/products/checker_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class API::Products::CheckerController < API::BaseController
before_action :require_mentor_login
before_action :require_mentor_login_for_api
before_action :set_product, only: %i[update]

def update
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/products/not_responded_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class API::Products::NotRespondedController < API::BaseController
before_action :require_staff_login
before_action :require_staff_login_for_api
def index
@products = Product
.not_responded_products
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/products/self_assigned_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class API::Products::SelfAssignedController < API::BaseController
before_action :require_staff_login
before_action :require_staff_login_for_api
def index
@products = Product.self_assigned_product(current_user.id).unchecked.list.page(params[:page])
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/products/unchecked_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class API::Products::UncheckedController < API::BaseController
before_action :require_staff_login
before_action :require_staff_login_for_api
def index
@products = Product.unchecked.not_wip.list.page(params[:page])
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/api/products_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# frozen_string_literal: true

class API::ProductsController < API::BaseController
before_action :require_login
before_action :require_staff_login, only: :index
before_action :require_staff_login_for_api, only: :index

def index
@products = Product
Expand Down
7 changes: 1 addition & 6 deletions app/controllers/api/questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ def show
end

def update
question =
if current_user.admin? || current_user.mentor?
Question.find(params[:id])
else
current_user.questions.find_by(id: params[:id])
end
question = Question.find(params[:id])

if !question.nil? && question.update(question_params)
head :ok
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/reports/unchecked_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class API::Reports::UncheckedController < API::BaseController
before_action :require_staff_login
before_action :require_staff_login_for_api
def index
@reports = Report.unchecked.not_wip.list.page(params[:page])
end
Expand Down
6 changes: 4 additions & 2 deletions app/controllers/api/session_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ class API::SessionController < API::BaseController
skip_before_action :require_login_for_api, only: %i[create]

def create
token = login_and_issue_token(params[:login_name], params[:password])
if token
logout if current_user
user = User.authenticate(params[:login_name], params[:password])
if user
token = User.issue_token(id: user.id, email: user.email)
render json: { token: token }
else
head :bad_request
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/api/user_icon_urls_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class API::UserIconUrlsController < API::BaseController
def index
@users = User.with_attached_avatar
end
end
1 change: 0 additions & 1 deletion app/controllers/api/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

class API::UsersController < API::BaseController
before_action :require_login, only: %i[index]
before_action :set_user, only: %i[show update]
before_action :require_mentor_login_for_api, only: %i[update]
PAGER_NUMBER = 20
Expand Down
1 change: 0 additions & 1 deletion app/controllers/api/watches_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

class API::WatchesController < API::BaseController
before_action :require_login
include Rails.application.routes.url_helpers

def index
Expand Down
26 changes: 26 additions & 0 deletions app/controllers/current_user/products/index.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- title "#{@user.login_name}の提出物"
header.page-header
.container
.page-header__inner
h2.page-header__title
= title
.page-header-actions
ul.page-header-actions__items
li.page-header-actions__item
= link_to users_path, class: 'a-button is-md is-secondary is-block is-back' do
| ユーザー一覧

.page-tools
= render 'home/page_tabs', user: @current_user

.page-body
.container
- if @products.present?
.thread-list.a-card
= render partial: 'products/product', collection: @products, as: :product
- else
.o-empty-message
.o-empty-message__icon
i.far.fa-sad-tear
p.o-empty-message__text
| 提出物はまだありません。
23 changes: 23 additions & 0 deletions app/controllers/current_user/products_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

class CurrentUser::ProductsController < ApplicationController
before_action :require_login
before_action :set_user
before_action :set_products

def index; end

private

def set_user
@user = current_user
end

def set_products
@products = user.products.list
end

def user
@user ||= current_user
end
end
23 changes: 23 additions & 0 deletions app/controllers/current_user/watches_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

class CurrentUser::WatchesController < ApplicationController
before_action :require_login
before_action :set_user
before_action :set_watches

def index; end

private

def set_user
@user = current_user
end

def set_watches
@watches = user.watches
end

def user
@user ||= current_user
end
end
2 changes: 1 addition & 1 deletion app/controllers/current_user_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def user_params
params.require(:user).permit(
:adviser, :login_name, :name,
:name_kana, :email, :course_id,
:description, :job_seeking, :slack_account, :discord_account,
:description, :job_seeking, :discord_account,
:github_account, :twitter_account, :facebook_url,
:blog_url, :password, :password_confirmation,
:job, :organization, :os,
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ def index
redirect_to retire_path
else
@announcements = Announcement.with_avatar
.where(wip: false)
.order(published_at: :desc)
.limit(5)
.order(created_at: :desc)
@completed_learnings = current_user.learnings.where(status: 3).order(updated_at: :desc)
@my_seat_today = current_user.reservations.find_by(date: Date.current)&.seat&.name
@reservations_for_today = Reservation.where(date: Date.current).to_a
Expand All @@ -31,7 +32,6 @@ def set_required_fields
@required_fields = RequiredField.new(
description: current_user.description,
github_account: current_user.github_account,
slack_account: current_user.slack_account,
discord_account: current_user.discord_account
)
end
Expand Down
Loading

0 comments on commit 0cd4c0d

Please sign in to comment.