mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 23:16:15 +08:00
Merge branch 'develop' of https://github.com/rekonder/scinote-web into aj_SCI_7270
This commit is contained in:
commit
e8528e6120
|
@ -1,4 +1,8 @@
|
|||
#modal-print-repository-row-label {
|
||||
input::-webkit-outer-spin-button,
|
||||
input::-webkit-inner-spin-button {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.id-label {
|
||||
margin-left: .5em;
|
||||
|
@ -17,7 +21,8 @@
|
|||
|
||||
.print-copies-input {
|
||||
margin-left: .5em;
|
||||
width: 50px;
|
||||
text-align: right;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.no-printers-container {
|
||||
|
@ -42,4 +47,13 @@
|
|||
min-height: 200px;
|
||||
padding: .5em 0;
|
||||
}
|
||||
|
||||
.label-template-option {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
|
||||
img {
|
||||
margin-right: .25em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ input[type="checkbox"].sci-checkbox {
|
|||
height: var(--sci-checkbox-size);
|
||||
margin-left: calc(var(--sci-checkbox-size) * -1);
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: var(--sci-checkbox-size);
|
||||
|
||||
&::before {
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
flex: 0;
|
||||
}
|
||||
|
||||
.view-text-element {
|
||||
a {
|
||||
pointer-events: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-text-element {
|
||||
color: $color-silver-chalice;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
@editingDisabled="disableEditMode"
|
||||
@editingEnabled="enableEditMode"
|
||||
/>
|
||||
<div v-else-if="element.attributes.orderable.text_view" v-html="element.attributes.orderable.text_view"></div>
|
||||
<div class="view-text-element" v-else-if="element.attributes.orderable.text_view" v-html="element.attributes.orderable.text_view"></div>
|
||||
<div v-else class="empty-text-element">
|
||||
{{ i18n.t("protocols.steps.text.empty_text") }}
|
||||
</div>
|
||||
|
|
|
@ -36,9 +36,12 @@
|
|||
</label>
|
||||
|
||||
<DropdownSelector
|
||||
ref="labelTemplateDropdown"
|
||||
:disableSearch="true"
|
||||
:options="templates_dropdown"
|
||||
:selectorId="`LabelTemplateSelector`"
|
||||
:optionLabel="templateOption"
|
||||
:onOpen="initTooltip"
|
||||
@dropdown:changed="selectTemplate"
|
||||
/>
|
||||
<div v-if="labelTemplateError" class="label-template-warning">
|
||||
|
@ -59,6 +62,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"> {{ i18n.t('general.cancel') }}</button>
|
||||
<button class="btn btn-primary" @click="submitPrint" :disabled="!selectedPrinter || !selectedTemplate">
|
||||
{{ i18n.t('repository_row.modal_print_label.print_label') }}
|
||||
</button>
|
||||
|
@ -118,6 +122,7 @@
|
|||
mounted() {
|
||||
$.get(this.urls.labelTemplates, (result) => {
|
||||
this.templates = result.data
|
||||
this.selectDefaultLabelTemplate();
|
||||
})
|
||||
|
||||
$.get(this.urls.printers, (result) => {
|
||||
|
@ -140,7 +145,14 @@
|
|||
}
|
||||
|
||||
return templates.map(i => {
|
||||
return {value: i.id, label: i.attributes.name}
|
||||
return {
|
||||
value: i.id,
|
||||
label: i.attributes.name,
|
||||
params: {
|
||||
icon: i.attributes.icon_url,
|
||||
description: i.attributes.description || ''
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
printers_dropdown() {
|
||||
|
@ -162,8 +174,20 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
selectDefaultLabelTemplate() {
|
||||
if (this.selectedPrinter && this.templates) {
|
||||
let template = this.templates.find(i => i.attributes.default
|
||||
&& i.type.includes(this.selectedPrinter.attributes.type_of));
|
||||
if (template) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.labelTemplateDropdown.selectValues(template.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
selectPrinter(value) {
|
||||
this.selectedPrinter = this.printers.find(i => i.id === value);
|
||||
this.selectedPrinter = this.printers.find(i => i.id === value)
|
||||
this.selectDefaultLabelTemplate();
|
||||
},
|
||||
selectTemplate(value) {
|
||||
this.selectedTemplate = this.templates.find(i => i.id === value);
|
||||
|
@ -217,6 +241,17 @@
|
|||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
templateOption(option) {
|
||||
return `
|
||||
<div class="label-template-option" data-toggle="tooltip" data-placement="right" title="${option.params.description}">
|
||||
<img src="${option.params.icon}"></img>
|
||||
${option.label}
|
||||
</div>
|
||||
`
|
||||
},
|
||||
initTooltip() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,9 @@
|
|||
optionLabel: {
|
||||
type: Function
|
||||
},
|
||||
onOpen: {
|
||||
type: Function
|
||||
},
|
||||
inputTagMode: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
|
@ -114,6 +117,7 @@
|
|||
closeOnSelect: this.closeOnSelect,
|
||||
selectAppearance: this.selectAppearance,
|
||||
disableSearch: this.disableSearch,
|
||||
onOpen: this.onOpen,
|
||||
onChange: () => {
|
||||
if (this.onChange) this.onChange();
|
||||
this.selectChanged(dropdownSelector.getValues(`#${this.selectorId}`))
|
||||
|
@ -126,6 +130,9 @@
|
|||
'dropdown:changed',
|
||||
value
|
||||
);
|
||||
},
|
||||
selectValues(value) {
|
||||
dropdownSelector.selectValues(`#${this.selectorId}`, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,6 +120,7 @@
|
|||
let textArea = `#${this.objectType}_textarea_${this.objectId}`;
|
||||
|
||||
if (this.active) return
|
||||
if (e && $(e.target).prop("tagName") === 'A') return
|
||||
if (e && $(e.target).hasClass('atwho-user-popover')) return
|
||||
if (e && $(e.target).hasClass('record-info-link')) return
|
||||
if (e && $(e.target).parent().hasClass('atwho-inserted')) return
|
||||
|
|
|
@ -4,7 +4,7 @@ class LabelTemplateSerializer < ActiveModel::Serializer
|
|||
include Canaid::Helpers::PermissionsHelper
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
attributes :name, :description, :language_type, :icon_url, :urls, :content, :type
|
||||
attributes :name, :description, :language_type, :icon_url, :urls, :content, :type, :default
|
||||
|
||||
def icon_url
|
||||
ActionController::Base.helpers.image_path("label_template_icons/#{object.icon}.svg")
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<%= link_to option_text, result_table_download_path(result.result_table_id), data: { turbolinks: false } %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% if can_delete_result?(result) %>
|
||||
<% if can_delete_result?(result) && can_manage_my_module?(@my_module) %>
|
||||
<li>
|
||||
<%= link_to t('my_modules.module_archive.option_delete'),
|
||||
result_path(action: :delete, id: result.id),
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
<%= content_for :sidebar do %>
|
||||
<%= render partial: "sidebar", locals: { repositories: @repositories, archived: params[:archived] } %>
|
||||
<% end %>
|
||||
|
||||
<%= render "view_archived_btn"%>
|
||||
<%= render "view_archived_btn" %>
|
||||
<% end %>
|
||||
|
||||
<!-- table template -->
|
||||
|
|
Loading…
Reference in a new issue