Skip to content

Commit

Permalink
Merge pull request #31 from kaishuu0123/master
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
kaishuu0123 authored Nov 13, 2019
2 parents e069295 + b3f18d7 commit 67e4756
Show file tree
Hide file tree
Showing 15 changed files with 389 additions and 92 deletions.
40 changes: 29 additions & 11 deletions app/javascript/components/backlogs/StoryListItem.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<template>
<li class="list-group-item px-3 py-2" >
<li class="list-group-item p-2" :style="backgroundColor">
<div v-if="!isEdit">
<div class="d-flex justify-content-between align-items-center">
<router-link :id="`popover-story-${story.id}`" :to="createStoryPath" class="badge badge-info p-1 mr-2" :style="badgeColor">
<div
class="d-flex justify-content-between align-items-center rb-story-list-font"
:style="idealTextColorForItem">
<router-link :id="`popover-story-${story.id}`" :to="createStoryPath" class="badge badge-secondary bg-white badge-outlined rb-badge-radius p-1 mr-2">
{{story.ticket_number_with_ticket_prefix}}
</router-link>
<span class="text-gray-700 d-block text-truncate w-100 mr-2" :title="story.title">
<div class="d-block text-truncate w-100 mr-2" :title="story.title">
<s v-if="story.is_done" @click="onClickTitle">{{story.title}}</s>
<span v-else @click="onClickTitle">{{story.title}}</span>
</span>
</div>
<span @click="onClickPoint">
{{ story.point | numeral('0.0') }}
</span>
</div>
</div>
<div v-else>
<b-form @submit.stop.prevent="editDone(true)">
<div class="d-flex justify-content-between align-items-center mb-2">
<router-link :to="createStoryPath" class="badge badge-info p-1 mr-2" :style="badgeColor">
<div class="d-flex justify-content-between align-items-center mb-2 rb-story-list-font">
<router-link :to="createStoryPath" class="badge badge-secondary bg-white badge-outlined rb-badge-radius p-1 mr-2">
{{story.ticket_number_with_ticket_prefix}}
</router-link>
<span class="text-monospace d-block text-truncate w-100 mr-2">
Expand All @@ -38,7 +40,7 @@
</b-form>
</div>

<b-popover :target="`popover-story-${story.id}`" triggers="hover" placement="right" delay="300">
<b-popover :target="`popover-story-${story.id}`" triggers="hover" placement="right" delay="500">
<dl>
<dt>{{ $t('ticket.title') }}</dt>
<dd>{{ story.title }}</dd>
Expand All @@ -54,6 +56,7 @@ import Vue from 'vue'
import vueNumeralFilter from 'vue-numeral-filter'
import MarkdownText from '../MarkdownText'
import { mapMutations, mapActions } from 'vuex';
import ColorUtils from '../../mixins/colorUtils'
Vue.use(vueNumeralFilter)
Expand All @@ -62,6 +65,9 @@ export default {
components: {
MarkdownText
},
mixins: [
ColorUtils
],
props: {
story: Object
},
Expand All @@ -74,15 +80,25 @@ export default {
createStoryPath() {
return `/stories/${this.story.id}`
},
badgeColor() {
let color = '#858796'
backgroundColor() {
let color = '#ffffff'
if (this.story.project_ticket_category) {
color = this.story.project_ticket_category.color
}
return {
"background-color": color
}
},
idealTextColorForItem() {
let color = '#ffffff'
if (this.story.project_ticket_category) {
color = this.story.project_ticket_category.color;
}
return {
color: this.idealTextColor(color)
}
}
},
methods: {
Expand Down Expand Up @@ -117,5 +133,7 @@ export default {
</script>

<style>
.rb-story-list-font {
font-weight: 500 !important;
}
</style>
57 changes: 35 additions & 22 deletions app/javascript/components/backlogs/StoryModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,25 @@
</div>
</div>
<div class="d-flex align-items-center mb-2" v-if="story.id">
<h2 class="h5 m-0">
<span class="badge badge-info mr-2" :style="badgeColor">
<h2 class="h6 m-0 mr-2">
<span class="badge badge-secondary badge-outlined rb-badge-radius mr-1">
{{story.ticket_number_with_ticket_prefix}}
</span>
</h2>
<div class="mr-2">
<span v-if="story.created_user">
{{ $t('ticket.createdBy') }} {{ story.created_user.username }} <span :title="toMoment(story.created_at)">{{ fromNow(story.created_at) }}</span>
</span>
</div>
<div>
<span v-if="story.last_updated_user">
{{ $t('ticket.lastUpdatedBy') }} {{ story.last_updated_user.username }} <span :title="toMoment(story.updated_at)">{{ fromNow(story.updated_at) }}</span>
<span v-if="story.projectTicketCategory" class="badge badge-secondary rb-badge-radius" :style="categoryBadgeStyle">
{{ story.projectTicketCategory.title }}
</span>
</h2>
<div class="d-flex ml-auto">
<div class="mr-2">
<span v-if="story.created_user">
{{ $t('ticket.createdBy') }} {{ story.created_user.username }} <span :title="toMoment(story.created_at)">{{ fromNow(story.created_at) }}</span>
</span>
</div>
<div>
<span v-if="story.last_updated_user">
{{ $t('ticket.lastUpdatedBy') }} {{ story.last_updated_user.username }} <span :title="toMoment(story.updated_at)">{{ fromNow(story.updated_at) }}</span>
</span>
</div>
</div>
</div>
<div class="mb-2">
Expand All @@ -97,7 +102,7 @@
<div>
<p class="text-gray-600 mb-2">{{ $t('title.relatedTasks')}}</p>
<div class="d-flex w-100 align-items-center ml-1 mb-1" v-for="task in story.tasks" :key="task.id">
<div class="badge badge-secondary mr-2">
<div class="badge badge-secondary badge-outlined rb-badge-radius mr-2">
{{ task.ticket_number_with_ticket_prefix }}
</div>
<div>
Expand Down Expand Up @@ -164,6 +169,7 @@ import HistoryList from '../commons/HistoryList'
import CustomMoment from '../../commons/custom-moment'
import urlparse from 'url-parse'
import VueClipboard2 from 'vue-clipboard2'
import ColorUtils from '../../mixins/colorUtils'
Vue.use(VueClipboard2)
Expand All @@ -179,6 +185,9 @@ export default {
HistoryList,
VueClipboard2
},
mixins: [
ColorUtils
],
name: 'StoryModal',
props: {
projectId: String,
Expand All @@ -203,16 +212,6 @@ export default {
}
},
computed: {
badgeColor() {
let color = '#858796'
if (this.story.project_ticket_category) {
color = this.story.project_ticket_category.color
}
return {
"background-color": color
}
},
storyTitle() {
return `${this.story.ticket_number_with_ticket_prefix} ${this.story.title}`
},
Expand All @@ -223,6 +222,20 @@ export default {
return `${this.storyTitle}\n` +
`${this.storyURL}`
},
categoryBadgeStyle() {
let Color = require('color');
let color = '#E2E3E5'
if (this.story.projectTicketCategory) {
color = this.story.projectTicketCategory.color
}
return {
"background-color": color,
color: this.idealTextColor(color),
border: `1px solid ${Color(color).darken(0.1)}`
}
},
...mapState('Stories', {
selectedStory: 'selectedStory'
})
Expand Down
123 changes: 123 additions & 0 deletions app/javascript/components/commons/ColorPicker.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<template>
<div ref="colorpicker" class="input-group">
<input v-model="colorValue" type="text" class="form-control" @focus="showPicker()" @input="updateFromInput">
<sketch-picker
v-if="displayPicker"
:value="colors"
:presetColors="presetColors"
@input="updateFromPicker" />
</div>
</template>

<script>
import { Sketch } from 'vue-color'
export default {
name: 'ColorPicker',
components: {
'sketch-picker': Sketch
},
props: {
color: {
type: String
},
},
data() {
return {
colors: {
hex: "#6e707e"
},
colorValue: "",
displayPicker: false,
presetColors: [
'#cce5ff', '#e2e3e5', '#d4edda', '#f8d7da', '#fff3cd', '#d1ecf1', '#fefefe', '#d6d8d9',
'#1C89FF', '#86878A', '#1FE950', '#F51228', '#FDC512', '#1DD0F1', '#070707', '#707475',
]
};
},
watch: {
colorValue(val) {
if (val) {
this.updateColors(val);
this.$emit("input", val);
}
},
color(val) {
this.setColor(this.color || "#000000");
}
},
mounted() {
this.$nextTick(() => {
this.setColor(this.color || "#000000");
})
},
destroyed() {
this.hidePicker();
},
methods: {
setColor(color) {
this.updateColors(color);
this.colorValue = color;
},
updateColors(val) {
this.colors = val;
},
showPicker() {
document.addEventListener("click", this.documentClick);
this.displayPicker = true;
},
hidePicker() {
document.removeEventListener("click", this.documentClick);
this.displayPicker = false;
},
togglePicker() {
this.displayPicker ? this.hidePicker() : this.showPicker();
},
updateFromInput() {
this.updateColors(this.colorValue);
},
updateFromPicker(color) {
this.colors = color;
if (color.rgba.a === 1) {
this.colorValue = color.hex;
} else {
// eslint-disable-next-line
this.colorValue =
"rgba(" +
color.rgba.r +
", " +
color.rgba.g +
", " +
color.rgba.b +
", " +
color.rgba.a +
")";
}
},
documentClick(e) {
const el = this.$refs.colorpicker;
const target = e.target;
if (el !== target && !el.contains(target)) {
this.hidePicker();
}
}
}
}
</script>

<style>
.vc-sketch {
position: absolute !important;
top: 50px;
left: 0;
z-index: 9;
}
.current-color {
display: inline-block;
width: 16px;
height: 16px;
background-color: #000;
cursor: pointer;
}
</style>
2 changes: 1 addition & 1 deletion app/javascript/components/kanban/TaskCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="card shadow-sm mb-2" :class="assignedUserClass(task)">
<div class="card-body px-2 py-2">
<div class="card-body px-2 py-1">
<div class="d-flex align-items-center">
<router-link :to="createSelectTaskPath(storyId, task.id)">
<span class="text-gray-500 text-xs mr-1">{{ task.ticket_number_with_ticket_prefix }}</span>
Expand Down
Loading

0 comments on commit 67e4756

Please sign in to comment.