Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
LocoDelAssembly committed Dec 4, 2021
2 parents dd94405 + 6f81135 commit 50d9d51
Show file tree
Hide file tree
Showing 26 changed files with 352 additions and 277 deletions.
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Changelog

All (hopefully) notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
Expand All @@ -9,6 +8,20 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv

\-

## [0.22.3] - 2021-12-03

### Added
- Ability to inject links into Content via hot-key searching [#1674]

### Changed
- Upgraded to Postgres 12 in Docker Compose development environment. Postgres 10 container and volume are still present to allow for automatic data migration.

### Fixed
- Identifier form elements on SQED breakdown [#2700]

[#2700]: https://github.com/SpeciesFileGroup/taxonworks/issues/2700
[#1674]: https://github.com/SpeciesFileGroup/taxonworks/issues/1674

## [0.22.2] - 2021-12-02

### Changed
Expand Down Expand Up @@ -2126,7 +2139,8 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv

[#1532]: https://github.com/SpeciesFileGroup/taxonworks/issues/1532

[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.22.2...development
[unreleased]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.22.3...development
[0.22.3]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.22.2...v0.22.3
[0.22.2]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.22.1...v0.22.2
[0.22.1]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.22.0...v0.22.1
[0.22.0]: https://github.com/SpeciesFileGroup/taxonworks/compare/v0.21.3...v0.22.0
Expand Down
10 changes: 7 additions & 3 deletions app/assets/stylesheets/views/tasks/content/editor/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,21 @@
height: 30px;
}
.figures-delete {
background-image: image-url("w_trash.svg");
position: absolute;
top: 12px;
right: 12px;
}
.figures-edit {
background-image: image-url("w_pencil.svg");
position: absolute;
bottom: -15px;
bottom: -12px;
right: 12px;
}

.figures-link {
position: absolute;
top: 12px;
left: 24px;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def todo_map
@sqed_depictions = SqedDepiction.where(project_id: sessions_current_project_id).order(:id).page(params[:page]).per(100)
end

# GET /tasks/accession/breakdown/depiction/:id # id is a collection_object_id
# GET /tasks/accession/breakdown/depiction/:id # id is a collection_object_id !!
def index
@result = SqedToTaxonworks::Result.new(
depiction_id: @sqed_depiction.depiction.id,
Expand Down
35 changes: 28 additions & 7 deletions app/javascript/vue/components/markdown-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export default {
}
},
created () {
TW.workbench.keyboard.createLegend(`${GetOSKey()}+shift+l`, 'Open data links modal', 'Markdown editor')
},
mounted () {
this.initialize()
},
Expand All @@ -66,12 +70,11 @@ export default {
},
toolbar: ['bold', 'italic', 'code', 'heading', '|', 'quote', 'unordered-list', 'ordered-list', '|', 'link', 'table', 'preview', {
name: 'width-auto',
action: (editor) => {
// this.openCustomLinks()
action: _ => {
this.openCustomLinks()
},
icon: '<span class="word-keep-all subtle">Data links</span>',
title: 'Data links',
disable: true
icon: '<span class="word-keep-all">Data links</span>',
title: 'Data links'
}]
}
Object.assign(configs, this.configs)
Expand All @@ -83,6 +86,7 @@ export default {
this.addPreviewClass(className)
this.bindingEvents()
},
bindingEvents () {
this.simplemde.codemirror.on('change', () => {
this.$emit('update:modelValue', this.simplemde.value())
Expand All @@ -107,22 +111,29 @@ export default {
}, 300)
})
},
addPreviewClass (className) {
const wrapper = this.simplemde.codemirror.getWrapperElement()
const preview = document.createElement('div')
wrapper.nextSibling.className += ` ${className}`
preview.className = `editor-preview ${className}`
wrapper.appendChild(preview)
},
setCustomLink (item) {
const cm = this.simplemde.codemirror
const output = ''
const selectedText = cm.getSelection()
const text = selectedText || item.label
const output = `[${text}](${item.link})`
output = `[${text}](${item.link})`
cm.replaceSelection(output)
setTimeout(() => {
cm.focus()
cm.setCursor(cm.getCursor(false))
}, 100)
},
customShortcuts () {
const codemirror = this.simplemde.codemirror
const keys = codemirror.getOption('extraKeys')
Expand All @@ -132,13 +143,23 @@ export default {
}
codemirror.setOption('extraKeys', keys)
},
openCustomLinks () {
this.showCustomLinks = true
},
setFocus () {
const codemirror = this.simplemde.codemirror
codemirror.focus()
codemirror.setCursor(codemirror.lineCount(), 0)
}
},
unmounted () {
this.simplemde = null
},
watch: {
modelValue (val) {
if (val === this.simplemde.value()) return
Expand Down
33 changes: 19 additions & 14 deletions app/javascript/vue/components/markdown/buttonLinks.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
export default () => [
{
label: 'OTU',
model: 'otus',
link: '/tasks/otus/browse',
param: 'otu_id',
propertyLabel: 'object_label'
},
export default [
{
label: 'Source',
model: 'sources',
link: '/tasks/sources/new_source',
param: 'source_id',
propertyLabel: 'cached'
labelProperty: 'cached',
labelFunction: source => {
if (source.year && source.cached_author_string) {
return [source.cached_author_string, source.year].join(', ')
}

if (source.cached_author_string) {
return source.cached_author_string
}

return source.cached
}
},
{
label: 'OTU',
model: 'otus',
labelProperty: 'object_label'
},
{
label: 'Taxon name',
model: 'taxon_names',
link: '/tasks/nomenclature/browse',
param: 'taxon_name_id',
propertyLabel: 'object_label'
labelProperty: 'object_label'
}
]
38 changes: 27 additions & 11 deletions app/javascript/vue/components/markdown/customLinks.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<template>
<modal-component @close="$emit('close')">
<modal-component
:container-style="{ width: '500px' }"
@close="$emit('close')">
<template #header>
<h3>Data links</h3>
</template>
<template #body>
<ul class="no_bullets context-menu">
<li v-for="button in links">
<li
v-for="button in links"
:key="button.label">
<button
type="button"
class="button normal-input button-default"
Expand All @@ -14,19 +18,23 @@
</button>
</li>
</ul>
<div v-if="selected">
<div
class="margin-medium-top">
<smart-selector
target="Otu"
:model="selected.model"
@selected="sendObject"/>
:label="selected.labelProperty"
autofocus
@selected="sendObject"
/>
</div>
</template>
</modal-component>
</template>

<script>
import buttonLinks from './buttonLinks.js'
import BUTTON_LINKS from './buttonLinks.js'
import ModalComponent from 'components/ui/Modal'
import SmartSelector from 'components/ui/SmartSelector'
Expand All @@ -43,8 +51,8 @@ export default {
data () {
return {
links: buttonLinks(),
selected: undefined
links: BUTTON_LINKS,
selected: BUTTON_LINKS[0]
}
},
Expand All @@ -54,12 +62,20 @@ export default {
},
sendObject (item) {
const data = {
label: item[this.selected.propertyLabel],
link: `${window.location.href.split('/').slice(0, 3).join('/')}${this.selected.link}?${this.selected.param}=${item.id}`
const {
labelFunction,
labelProperty,
model
} = this.selected
const label = labelFunction ? labelFunction(item) : item[labelProperty]
const payload = {
label,
link: `/${model}/${item.id}`
}
this.$emit('selected', data)
this.$emit('selected', payload)
this.$emit('close')
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,17 @@
@unset="topic = undefined"
/>
</fieldset>
<markdown-editor
v-model="content.text"
:configs="config"
/>
<div>
<spinner-component
v-if="!topic"
:show-spinner="false"
legend="Select a topic first"
/>
<markdown-editor
v-model="content.text"
:configs="config"
/>
</div>
<div class="margin-small-top margin-small-bottom">
<button
type="button"
Expand Down Expand Up @@ -85,6 +92,7 @@ import TableList from 'components/table_list.vue'
import MarkdownEditor from 'components/markdown-editor.vue'
import SmartSelector from 'components/ui/SmartSelector.vue'
import SmartSelectorItem from 'components/ui/SmartSelectorItem.vue'
import SpinnerComponent from 'components/spinner.vue'
import { shorten } from 'helpers/strings.js'
import { ControlledVocabularyTerm, Content } from 'routes/endpoints'
Expand All @@ -98,7 +106,8 @@ export default {
MarkdownEditor,
TopicItem,
TableList,
SmartSelectorItem
SmartSelectorItem,
SpinnerComponent
},
data () {
Expand Down
8 changes: 7 additions & 1 deletion app/javascript/vue/components/ui/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Parameters:
@keydown.down="downKey"
@keydown.up="upKey"
@keydown.enter="enterKey"
@keyup="sendKeyEvent"
autocomplete="off"
:autofocus="autofocus"
:disabled="disabled"
Expand Down Expand Up @@ -173,7 +174,8 @@ export default {
'update:modelValue',
'getInput',
'getItem',
'found'
'found',
'keyEvent'
],
data () {
Expand Down Expand Up @@ -231,6 +233,10 @@ export default {
this.$emit('getItem', item)
},
sendKeyEvent (e) {
this.$emit('keyEvent', e)
},
cleanInput() {
this.type = ''
},
Expand Down
Loading

0 comments on commit 50d9d51

Please sign in to comment.