Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of github.com:SpeciesFileGroup/taxonworks …
…into development
- Loading branch information
Showing
8 changed files
with
454 additions
and
15 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
app/javascript/vue/components/annotator/components/shared/citationsCount.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
161 changes: 161 additions & 0 deletions
161
app/javascript/vue/components/annotator/components/shared/listItems.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
Oops, something went wrong.