Fix inline editing

This commit is contained in:
Anton 2023-09-19 13:42:56 +02:00
parent 5626bdef4b
commit dd17b46667
3 changed files with 18 additions and 4 deletions

View file

@ -9,6 +9,7 @@ class ResultsController < ApplicationController
before_action :check_destroy_permissions, only: :destroy
before_action :set_breadcrumbs_items, only: %i(index)
before_action :set_navigator, only: %i(index)
before_action :set_inline_name_editing, only: %i(index)
def index
respond_to do |format|
@ -214,4 +215,16 @@ class ResultsController < ApplicationController
message_items: message_items
)
end
def set_inline_name_editing
return unless can_manage_my_module?(@my_module)
@inline_editable_title_config = {
name: 'title',
params_group: 'my_module',
item_id: @my_module.id,
field_to_udpate: 'name',
path_to_update: my_module_path(@my_module)
}
end
end

View file

@ -12,6 +12,7 @@
:value="result.attributes.name"
class="flex-grow font-bold text-base"
:class="{ 'pointer-events-none': !urls.update_url }"
:singleLine="false"
:characterLimit="255"
:allowBlank="false"
:attributeName="`${i18n.t('Result')} ${i18n.t('name')}`"

View file

@ -18,7 +18,7 @@
@focus="setCaretAtEnd"/>
<textarea v-else
ref="input"
class="overflow-hidden leading-5 inline-block outline-none px-0 py-1 border-0 border-solid border-y w-full border-t-transparent mb-0.5"
class="overflow-hidden leading-5 inline-block outline-none px-0 py-1 border-0 border-solid border-y w-full border-t-transparent mb-[1px]"
:class="{
'inline-edit-placeholder text-sn-grey caret-black': isBlank,
'border-sn-delete-red': error,
@ -35,12 +35,12 @@
<div
v-else
ref="view"
class="sci-cursor-edit leading-5 border-0 py-1 outline-none inline-block border-solid border-y border-transparent"
class="grid sci-cursor-edit leading-5 border-0 py-1 outline-none inline-block border-solid border-y border-transparent"
:class="{ 'text-sn-grey font-normal': isBlank }"
@click="enableEdit($event)"
>
<span v-if="smartAnnotation" v-html="sa_value || placeholder" ></span>
<span v-else>{{newValue || placeholder}}</span>
<span :class="{'truncate': singleLine}" v-if="smartAnnotation" v-html="sa_value || placeholder" ></span>
<span :class="{'truncate': singleLine}" v-else>{{newValue || placeholder}}</span>
</div>
<div