mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 14:45:56 +08:00
Fix smart annotations on storage locations [SCI-11072]
This commit is contained in:
parent
926a9ee6d4
commit
f2796e54c2
|
@ -183,6 +183,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveLocation() {
|
saveLocation() {
|
||||||
|
// Smart annotation fix
|
||||||
|
this.object.description = $(this.$refs.description).val();
|
||||||
|
|
||||||
if (this.object.code) {
|
if (this.object.code) {
|
||||||
axios.put(this.object.urls.update, this.object)
|
axios.put(this.object.urls.update, this.object)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<template>
|
||||||
|
<div v-html="params.data.sa_description"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'DescriptionRenderer',
|
||||||
|
props: {
|
||||||
|
params: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -53,6 +53,7 @@ import EditModal from './modals/new_edit.vue';
|
||||||
import MoveModal from './modals/move.vue';
|
import MoveModal from './modals/move.vue';
|
||||||
import ConfirmationModal from '../shared/confirmation_modal.vue';
|
import ConfirmationModal from '../shared/confirmation_modal.vue';
|
||||||
import ShareObjectModal from '../shared/share_modal.vue';
|
import ShareObjectModal from '../shared/share_modal.vue';
|
||||||
|
import DescriptionRenderer from './renderers/description.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RepositoriesTable',
|
name: 'RepositoriesTable',
|
||||||
|
@ -61,7 +62,8 @@ export default {
|
||||||
EditModal,
|
EditModal,
|
||||||
MoveModal,
|
MoveModal,
|
||||||
ConfirmationModal,
|
ConfirmationModal,
|
||||||
ShareObjectModal
|
ShareObjectModal,
|
||||||
|
DescriptionRenderer
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
dataSource: {
|
dataSource: {
|
||||||
|
@ -136,9 +138,11 @@ export default {
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'description',
|
field: 'sa_description',
|
||||||
headerName: this.i18n.t('storage_locations.index.table.description'),
|
headerName: this.i18n.t('storage_locations.index.table.description'),
|
||||||
sortable: false
|
sortable: false,
|
||||||
|
notSelectable: true,
|
||||||
|
cellRenderer: 'DescriptionRenderer'
|
||||||
}];
|
}];
|
||||||
|
|
||||||
return columns;
|
return columns;
|
||||||
|
|
|
@ -4,9 +4,11 @@ module Lists
|
||||||
class StorageLocationSerializer < ActiveModel::Serializer
|
class StorageLocationSerializer < ActiveModel::Serializer
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
include ShareableSerializer
|
include ShareableSerializer
|
||||||
|
include ApplicationHelper
|
||||||
|
include ActionView::Helpers::TextHelper
|
||||||
|
|
||||||
attributes :id, :code, :name, :container, :description, :owned_by, :created_by,
|
attributes :id, :code, :name, :container, :description, :owned_by, :created_by,
|
||||||
:created_on, :urls, :metadata, :file_name, :sub_location_count, :is_empty
|
:created_on, :urls, :metadata, :file_name, :sub_location_count, :is_empty, :sa_description
|
||||||
|
|
||||||
def owned_by
|
def owned_by
|
||||||
object['team_name']
|
object['team_name']
|
||||||
|
@ -16,6 +18,14 @@ module Lists
|
||||||
object.empty?
|
object.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sa_description
|
||||||
|
@user = scope[:user] || @instance_options[:user]
|
||||||
|
custom_auto_link(object.description,
|
||||||
|
simple_format: false,
|
||||||
|
tags: %w(img),
|
||||||
|
team: object.team)
|
||||||
|
end
|
||||||
|
|
||||||
def metadata
|
def metadata
|
||||||
{
|
{
|
||||||
display_type: object.metadata['display_type'],
|
display_type: object.metadata['display_type'],
|
||||||
|
|
Loading…
Reference in a new issue