Skip to content

Commit

Permalink
コンフリクトを修正する
Browse files Browse the repository at this point in the history
  • Loading branch information
nga20167304 committed Dec 3, 2021
2 parents 87a6881 + b859471 commit bf4d559
Show file tree
Hide file tree
Showing 24 changed files with 204 additions and 54 deletions.
3 changes: 2 additions & 1 deletion app/assets/stylesheets/blocks/form/_form-tabs.sass
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
display: flex
margin-bottom: 1rem
border-bottom: solid 1px $border
.a-card > &:first-child
.a-card > &:first-child,
.a-card__inner > &:first-child
margin-top: 1rem

.form-tabs__tab
Expand Down
2 changes: 2 additions & 0 deletions app/assets/stylesheets/blocks/side/_side-tabs-contents.sass
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
border-top-left-radius: 0
max-height: calc(100vh - 100px)
overflow-y: auto
.card-header
display: none

#side-tabs-1:checked ~ .side-tabs-contents #side-tabs-content-1
display: block
Expand Down
5 changes: 2 additions & 3 deletions app/assets/stylesheets/blocks/side/_side-tabs-nav.sass
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.side-tabs-nav__items
display: flex
+position(relative, 2)
margin-bottom: -1px
+margin(horizontal, auto)
max-width: 50rem

Expand All @@ -18,10 +17,10 @@
color: $default-text

.side-tabs-nav__item-link
+text-block(.875rem 1.4, flex)
+text-block(.8125rem 1.4, flex 600)
cursor: pointer
padding: .75em 1.25em
border: solid 1px $border-shade
border: solid 1px $border-more-shade
border-bottom: none
+position(relative, bottom -1px)
+border-radius(top, .25rem)
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/blocks/thread/_thread-list-item.sass
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
padding-left: 3.75rem
+media-breakpoint-up(md)
min-height: 2.75rem
.has-no-author-image &
padding-left: 0
+media-breakpoint-down(sm)
padding-left: 3rem

Expand Down Expand Up @@ -113,6 +115,8 @@

.thread-list-item__user
+position(absolute, left 0, top 0)
.has-no-author-image &
display: none

.thread-list-item__user-icon
+size(2.75rem)
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/api/users/recent_reports_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

class API::Users::RecentReportsController < API::BaseController
def index
@user = User.find(params[:user_id])
@reports = @user.reports.limit(10).order(reported_on: :DESC)
end
end
4 changes: 1 addition & 3 deletions app/javascript/comments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
.thread-comments-more(v-show='!loadedComment')
.thread-comments-more__inner
.thread-comments-more__action
button#js-shortcut-post-comment.a-button.is-lg.is-text.is-block(
@click='showComments'
)
button.a-button.is-lg.is-text.is-block(@click='showComments')
| コメント({{ commentLimit }})をもっと見る
comment(
v-for='(comment, index) in comments',
Expand Down
1 change: 1 addition & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ require('../practice-select.js')
require('../companies.js')
require('../worried-users.js')
require('../report_template.js')
require('../user-recent-reports.js')
2 changes: 1 addition & 1 deletion app/javascript/question-edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.thread-header-metas__start
.thread-header-metas__meta
a.a-user-name(:href='`/users/${question.user.id}`')
| {{ question.user.login_name }}
| {{ question.user.long_name }}
.thread-header-metas__meta
.a-meta
time.thread_header_date-value(
Expand Down
6 changes: 6 additions & 0 deletions app/javascript/reports.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<template lang="pug">
.reports.is-md(v-if='reports === null')
loadingListPlaceholder
.reports(v-else-if='reports.length === 0')
.o-empty-message
.o-empty-message__icon
i.far.fa-sad-tear
.o-empty-message__text
| 日報はまだありません。
.reports(v-else-if='reports.length > 0 || !isUncheckedReportsPage')
nav.pagination(v-if='totalPages > 1')
pager(v-bind='pagerProps')
Expand Down
18 changes: 18 additions & 0 deletions app/javascript/user-recent-reports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Vue from 'vue'
import UserReports from './user-recent-reports.vue'

document.addEventListener('DOMContentLoaded', () => {
const selector = '#js-user-recent-reports'
const reports = document.querySelector(selector)
if (reports) {
const userID = reports.getAttribute('user-id')
new Vue({
render: (h) =>
h(UserReports, {
props: {
userID: userID
}
})
}).$mount(selector)
}
})
62 changes: 62 additions & 0 deletions app/javascript/user-recent-reports.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template lang="pug">
.thread-list.a-card
.card-header.is-sm
h2.card-header__title
| 直近の日報
.thread-list__items.has-no-author-image
report(
v-for='report in reports',
:key='report.id',
:report='report',
:current-user-id='currentUserId'
)
</template>

<script>
import Report from './report.vue'
export default {
components: {
report: Report
},
props: {
userID: { type: String, required: true }
},
data: function () {
return {
reports: null,
currentUserId: null
}
},
computed: {
reportsAPI() {
return `/api/users/${this.userID}/recent_reports.json`
}
},
created() {
window.onpopstate = () => {
this.getReports()
}
this.getReports()
},
methods: {
getReports() {
fetch(this.reportsAPI, {
method: 'GET',
headers: { 'X-Requested-With': 'XMLHttpRequest' },
credentials: 'same-origin',
redirect: 'manual'
})
.then((response) => {
return response.json()
})
.then((json) => {
this.reports = json.reports
this.currentUserId = json.currentUserId
})
.catch((error) => {
console.warn('Failed to parsing', error)
})
}
}
}
</script>
17 changes: 6 additions & 11 deletions app/javascript/user_mentor_memo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,15 @@ section.a-card.is-memo.is-only-mentor
)
i.fas.fa-pen
| 編集
div(
:class='{ "a-card": productsMode, "thread-comment-form__form": !productsMode }',
v-show='editing'
)
div(
:class='[{ "form-tabs": productsMode, "a-form-tabs": !productsMode }, "js-tabs"]'
)
div(
:class='[{ "is-active": isActive("memo"), "form-tabs__tab": productsMode, "a-form-tabs__tab": !productsMode }, "js-tabs__tab"]',
.a-card__inner(v-show='editing')
.form-tabs.js-tabs
.form-tabs__tab.js-tabs__tab(
:class='{ "is-active": isActive("memo") }',
@click='changeActiveTab("memo")'
)
| メモ
div(
:class='[{ "is-active": isActive("preview"), "form-tabs__tab": productsMode, "a-form-tabs__tab": !productsMode }, "js-tabs__tab"]',
.form-tabs__tab.js-tabs__tab(
:class='{ "is-active": isActive("preview") }',
@click='changeActiveTab("preview")'
)
| プレビュー
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/reports/_report.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
json.id report.id
json.title truncate(raw(report.title), length: 46)
json.title truncate(report.title, {length: 46, escape: false})
json.reportedOn l(report.reported_on)
json.url report_url(report)
json.editURL edit_report_path(report)
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/reports/recents/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
json.array! @reports do |report|
json.id report.id
json.title truncate(raw(report.title), length: 46)
json.title truncate(report.title, {length: 46, escape: false})
json.reported_on l(report.reported_on)
json.url report_url(report)
json.check report.checks.present?
Expand Down
7 changes: 7 additions & 0 deletions app/views/api/users/recent_reports/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
json.reports @reports do |report|
json.partial! "api/reports/report", report: report
json.partial! "api/comments/user_icons", comments: report.comments
json.user do
json.partial! "api/users/user", user: report.user
end
end
6 changes: 6 additions & 0 deletions app/views/notification_mailer/_mailer_style.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,10 @@
word-wrap: break-word;
white-space: pre-wrap;
}

.a-long-text p img[data-emoji] {
display: inline;
border: none;
vertical-align: text-bottom;
}
</style>
2 changes: 1 addition & 1 deletion app/views/questions/_question.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.thread-list-item-meta
.thread-list-item-meta__items
.thread-list-item-meta__item
= link_to question.user.login_name, question.user, class: 'a-user-name'
= link_to question.user.long_name, question.user, class: 'a-user-name'
.thread-list-item-meta__item
time.a-meta(datetime="#{question.updated_at.to_datetime}" pubdate='pubdate')
= l question.updated_at
Expand Down
2 changes: 1 addition & 1 deletion app/views/questions/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ header.page-header
h1.page-main-header__title
| タグ「#{params[:tag]}」のQ&A(#{@questions.total_count}
.page-body
.container.is-lg
.container.is-xl
= paginate @questions
.two-columns
.two-columns__inner
Expand Down
5 changes: 3 additions & 2 deletions app/views/reports/_report.html.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.thread-list-item(class="#{report.wip? ? 'is-wip' : ''}")
.thread-list-item__inner
label.thread-list-item-actions__trigger(for="#{report.id}")
i.fas.fa-ellipsis-h
- if current_user == report.user
label.thread-list-item-actions__trigger(for="#{report.id}")
i.fas.fa-ellipsis-h
.thread-list-item__user
= render 'users/icon', user: report.user, link_class: 'a-user-name', image_class: 'thread-list-item__user-icon'
.thread-list-item__rows
Expand Down
57 changes: 39 additions & 18 deletions app/views/reports/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ header.page-header

.page-body
.container.is-xxxl
div(class="#{current_user.mentor? || current_user.admin? ? 'row is-jc:c' : ''}")
div(class="#{current_user.mentor? || current_user.admin? ? 'col-md-7 col-xs-12' : ''}")
.row.is-jc:c
.col-md-7.col-xs-12
.thread
.thread__inner.a-card
header.thread-header
Expand All @@ -32,7 +32,7 @@ header.page-header
| WIP
.thread-header-metas__meta
= link_to @report.user, class: 'a-user-name', title: @report.user.name do
= @report.user.long_name
= @report.user.login_name
.thread-header-metas__meta
.a-meta
= l @report.reported_on
Expand Down Expand Up @@ -93,18 +93,19 @@ header.page-header
.thread__description.js-target-blank.is-long-text.js-markdown-view
= @report.description
= render 'reactions/reactions', reactionable: @report
- if @report.user_id == current_user.id
.card-footer
.card-main-actions
ul.card-main-actions__items
li.card-main-actions__item
= link_to edit_report_path(@report), class: 'card-main-actions__action a-button is-md is-secondary is-block', id: 'js-shortcut-edit' do
i.fas.fa-pen#new
| 内容修正
li.card-main-actions__item.is-sub
= link_to report_path(@report), data: { confirm: '本当によろしいですか?' }, method: :delete, class: 'card-main-actions__delete' do
span#delete
| 削除する

- if @report.user_id == current_user.id
.card-footer
.card-main-actions
ul.card-main-actions__items
li.card-main-actions__item
= link_to edit_report_path(@report), class: 'card-main-actions__action a-button is-md is-secondary is-block', id: 'js-shortcut-edit' do
i.fas.fa-pen#new
| 内容修正
li.card-main-actions__item.is-sub
= link_to report_path(@report), data: { confirm: '本当によろしいですか?' }, method: :delete, class: 'card-main-actions__delete' do
span#delete
| 削除する

- if (@report.user.daimyo? && staff_login?) || admin_or_mentor_login?
#js-check(data-checkable-id="#{@report.id}" data-checkable-type='Report' data-checkable-label="#{Report.model_name.human}")
Expand All @@ -124,8 +125,28 @@ header.page-header
| 次の日報
i.fas.fa-angle-right
= render 'users/icon', user: @report.user, link_class: 'thread__user-link', image_class: 'thread__user-icon'

#js-comments(data-commentable-id="#{@report.id}" data-commentable-type='Report' data-current-user-id="#{current_user.id}")

= render 'footprints/footprints', footprints: @footprints
.is-only-mentor(class="#{admin_or_mentor_login? ? 'col-md-5 col-xs-12 is-hidden-sm-down' : ''}")
- if admin_or_mentor_login?
#js-user-mentor-memo(data-user-id='#{@report.user_id}')

.col-md-5.col-xs-12
- if current_user.mentor? || current_user.admin?
.side-tabs
input.a-toggle-checkbox#side-tabs-1 type='radio' name='side-tabs-contents' checked='checked'
input.a-toggle-checkbox#side-tabs-2 type='radio' name='side-tabs-contents'
.side-tabs-nav.is-only-mentor
.side-tabs-nav__items
.side-tabs-nav__item
label.side-tabs-nav__item-link#side-tabs-nav-1 for='side-tabs-1'
| 直近の日報
.side-tabs-nav__item
label.side-tabs-nav__item-link#side-tabs-nav-2 for='side-tabs-2'
| ユーザーメモ
.side-tabs-contents
.side-tabs-contents__item#side-tabs-content-1
#js-user-recent-reports(user-id="#{@report.user.id}")
.side-tabs-contents__item#side-tabs-content-2.is-only-mentor
#js-user-mentor-memo(data-user-id='#{@report.user_id}')
- else
#js-user-recent-reports(user-id="#{@report.user.id}")
4 changes: 3 additions & 1 deletion config/routes/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
resources :companies, only: %i(index)
resources :worried, only: %i(index)
end
resources :users, only: %i(index show update)
resources :users, only: %i(index show update) do
resources :recent_reports, only: %i(index), controller: "users/recent_reports"
end
resources :user_icon_urls, only: %i(index)
get "users/tags/:tag", to: "users#index", as: :users_tag, tag: /.+/
resources :practices, only: %i(index show update) do
Expand Down
Loading

0 comments on commit bf4d559

Please sign in to comment.