Skip to content

Commit

Permalink
Merge branch 'development' of github.com:SpeciesFileGroup/taxonworks …
Browse files Browse the repository at this point in the history
…into development
  • Loading branch information
mjy committed Sep 24, 2018
2 parents 68e097b + 36b38ab commit b52fd6c
Show file tree
Hide file tree
Showing 8 changed files with 454 additions and 15 deletions.
16 changes: 16 additions & 0 deletions app/assets/images/w_citation.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/stylesheets/base/buttons.scss
Expand Up @@ -132,6 +132,11 @@
background-image: image-url("w_pencil.svg");
}

.btn-citation {
background-size: 12px;
background-image: image-url("w_citation.svg");
}

.btn-row-coder {
background-size: 16px;
background-color: $color-secondary-2-4;
Expand Down
Expand Up @@ -71,7 +71,11 @@
</button>
</div>
</template>
<display-list :label="['confidence_level', 'object_tag']" :list="list" @delete="removeItem" class="list"/>
<list-items
:label="['confidence_level', 'object_tag']"
:list="list" @delete="removeItem"
target-citations="confidences"
class="list"/>
</div>
</template>
<script>
Expand All @@ -80,14 +84,14 @@
import annotatorExtend from '../components/annotatorExtend.js'
import autocomplete from '../../autocomplete.vue'
import modal from '../../modal.vue'
import displayList from './displayList.vue'
import ListItems from './shared/listItems.vue'
export default {
mixins: [CRUD, annotatorExtend],
components: {
autocomplete,
modal,
displayList
ListItems
},
computed: {
validateFields() {
Expand Down
Expand Up @@ -43,23 +43,30 @@
<button @click="updateData()" :disabled="!validateFields" class="button button-submit normal-input separate-bottom" type="button">Update</button>
<button @click="data_attribute = newData()" :disabled="!validateFields" class="button button-default normal-input separate-bottom" type="button">New</button>
</div>
<table-list :list="list" :header="['Name', 'Value', '']" :attributes="['predicate_name', 'value']" :edit="true" @edit="data_attribute = $event" @delete="removeItem"/>
<table-list
:list="list"
:header="['Name', 'Value', '']"
:attributes="['predicate_name', 'value']"
:edit="true"
target-citations="data_attributes"
@edit="data_attribute = $event"
@delete="removeItem"/>
</div>
</template>
<script>
import CRUD from '../request/crud.js'
import annotatorExtend from '../components/annotatorExtend.js'
import autocomplete from '../../autocomplete.vue'
import tableList from '../../table_list.vue'
import displayList from './displayList.vue'
import AnnotatorExtend from '../components/annotatorExtend.js'
import Autocomplete from '../../autocomplete.vue'
import TableList from './shared/tableList'
import ListItems from './shared/listItems'
export default {
mixins: [CRUD, annotatorExtend],
mixins: [CRUD, AnnotatorExtend],
components: {
autocomplete,
tableList,
displayList
Autocomplete,
TableList,
ListItems
},
computed: {
validateFields () {
Expand Down
Expand Up @@ -8,20 +8,26 @@
@getItem="createNew($event.id)"
class="separate-bottom"
param="term"/>
<display-list label="object_tag" :list="list" @delete="removeItem" class="list"/>
<list-items
target="protocols"
label="object_tag"
target-citations="protocols"
:list="list"
@delete="removeItem"
class="list"/>
</div>
</template>
<script>
import CRUD from '../request/crud.js'
import annotatorExtend from '../components/annotatorExtend.js'
import autocomplete from '../../autocomplete.vue'
import displayList from './displayList.vue'
import ListItems from './shared/listItems'
export default {
mixins: [CRUD, annotatorExtend],
components: {
displayList,
ListItems,
autocomplete
},
computed: {
Expand Down
@@ -0,0 +1,93 @@
<template>
<div
class="citation-count"
@mouseover="showCitations = true"
@mouseout="showCitations = false">
<span class="button-data circle-button btn-citation">
<span class="circle-count button-default middle">{{ citations.length }} </span>
</span>
<div
v-show="showCitations"
class="citation-tooltip-list panel">
<display-list
:list="citations"
:label="['citation_source_body']"
@delete="removeCitation"
:edit="false"/>
</div>
</div>
</template>

<script>
import CRUD from '../../request/crud.js'
import DisplayList from '../../../displayList'
export default {
mixins: [CRUD],
components: {
DisplayList
},
props: {
object: {
type: Object,
required: true
},
target: {
type: String,
required: true
}
},
data() {
return {
showCitations: false,
citations: []
}
},
mounted() {
this.getList(`/${this.target}/${this.object.id}/citations.json`).then(response => {
this.citations = response.body
})
},
methods: {
removeCitation(cite) {
this.destroy(`/citations/${cite.id}.json`).then(response => {
this.citations.splice(this.citations.findIndex(item => { return item.id == cite.id }), 1)
})
}
}
}
</script>

<style lang="scss" module>
.citation-count {
position: relative;
}
.citation-count-text {
position: relative;
font-size: 100%;
justify-content: center
}
.citation-tooltip-list {
position: fixed;
min-width: 300px;
transform: translateX(-50%);
z-index: 30;
}
.circle-count {
right:-2px;
bottom: -2px;
justify-content: center;
position: absolute;
border-radius: 50%;
display: flex;
width: 12px;
height: 12px;
min-width: 12px;
min-height: 12px;
font-size: 8px;
box-shadow: 0px 1px 2px 0px #EBEBEB;
margin: 5px;
cursor: pointer;
}
</style>
@@ -0,0 +1,161 @@
<template>
<transition-group
class="table-entrys-list"
name="list-complete"
tag="ul">
<li
v-for="item in list"
:key="item.id"
class="list-complete-item flex-separate middle"
:class="{ 'highlight': checkHighlight(item) }">
<span
class="list-item"
v-html="displayName(item)"/>
<div class="list-controls">
<citations-count
:target="targetCitations"
:object="item"/>
<radial-annotator
v-if="true"
:global-id="item.global_id"/>
<span
v-if="edit"
class="circle-button btn-edit"
@click="$emit('edit', Object.assign({}, item))">Edit
</span>
<span
v-if="remove"
class="circle-button btn-delete"
@click="deleteItem(item)">Remove
</span>
</div>
</li>
</transition-group>
</template>
<script>
import RadialAnnotator from '../../annotator'
import CitationsCount from './citationsCount'
export default {
components: {
RadialAnnotator,
CitationsCount
},
props: {
list: {
type: Array,
default: () => []
},
targetCitations: {
type: String,
required: true
},
label: {
type: [String, Array],
required: true
},
edit: {
type: Boolean,
default: false
},
remove: {
type: Boolean,
default: true
},
annotator: {
type: Boolean,
default: false
},
highlight: {
type: Object,
default: undefined
}
},
mounted() {
this.$options.components['RadialAnnotator'] = RadialAnnotator
},
methods: {
displayName (item) {
if (typeof this.label === 'string') {
return item[this.label]
} else {
let tmp = item
this.label.forEach(function (label) {
tmp = tmp[label]
})
return tmp
}
},
checkHighlight (item) {
if (this.highlight) {
if (this.highlight.key) {
return item[this.highlight.key] == this.highlight.value
} else {
return item == this.highlight.value
}
}
return false
},
deleteItem(item) {
if(window.confirm(`You're trying to delete this record. Are you sure want to proceed?`)) {
this.$emit('delete', item)
}
}
}
}
</script>
<style lang="scss" scoped>
.list-controls {
display: flex;
align-items: center;
flex-direction: row;
justify-content: flex-end;
.circle-button {
margin-left: 4px !important;
}
}
.highlight {
background-color: #E3E8E3;
}
.list-item {
white-space: normal;
a {
padding-left: 4px;
padding-right: 4px;
}
}
.table-entrys-list {
overflow-y: scroll;
padding: 0px;
position: relative;
li {
margin: 0px;
padding: 6px;
border: 0px;
border-top: 1px solid #f5f5f5;
}
}
.list-complete-item {
justify-content: space-between;
transition: all 0.5s, opacity 0.2s;
}
.list-complete-enter, .list-complete-leave-to {
opacity: 0;
font-size: 0px;
border: none;
transform: scale(0.0);
}
.list-complete-leave-active {
width: 100%;
position: absolute;
}
</style>

0 comments on commit b52fd6c

Please sign in to comment.