Merge branch 'develop' into features/shareable-links

This commit is contained in:
Andrej 2023-07-19 12:57:20 +02:00
commit f493ec0da1
84 changed files with 737 additions and 1089 deletions

View file

@ -1,16 +0,0 @@
'use strict';
(function() {
function initActivitiesButton() {
$('.btn-more-activities')
.on('ajax:success', function(e, data) {
$(data.html).insertAfter($('#list-activities li').last());
if (data.more_url) {
$(this).attr('href', data.more_url);
} else {
$(this).remove();
}
});
}
initActivitiesButton();
}());

View file

@ -249,9 +249,12 @@ var HelperModule = (function(){
return exit;
});
const RESIZE_OBSERVER = new ResizeObserver(function(entries) {
entries.forEach((entry) => {
if (entry.target.offsetWidth <= parseInt(entry.target.getAttribute('data-width-breakpoint'))) {
const RESIZE_OBSERVER = new ResizeObserver(entries => {
entries.forEach(entry => {
const { offsetWidth } = entry.target;
const breakpoint = parseInt(entry.target.getAttribute('data-width-breakpoint'));
if (offsetWidth <= breakpoint && offsetWidth !== 0) {
entry.target.classList.add('narrow');
} else {
entry.target.classList.remove('narrow');

View file

@ -499,7 +499,9 @@ var ExperimnetTable = {
});
},
updateExperimentToolbar: function() {
window.actionToolbarComponent.fetchActions({ my_module_ids: this.selectedMyModules });
if (window.actionToolbarComponent) {
window.actionToolbarComponent.fetchActions({ my_module_ids: this.selectedMyModules });
}
},
selectDate: function($field) {
var datePicker = $field.data('DateTimePicker');
@ -522,6 +524,7 @@ var ExperimnetTable = {
icon.removeClass('sn-icon-visibility-show').addClass('sn-icon-visibility-hide');
icon.parent().removeClass('visible');
} else {
if (icon.hasClass('disabled')) return;
$(`.experiment-table .${icon.data('column')}-column`).removeClass('hidden');
icon.addClass('sn-icon-visibility-show').removeClass('sn-icon-visibility-hide');
icon.parent().addClass('visible');

View file

@ -144,8 +144,10 @@
}
function updateButtons() {
window.actionToolbarComponent.fetchActions({ label_template_ids: rowsSelectedIDs() });
$('.dataTables_scrollBody').css('padding-bottom', `${rowsSelectedIDs().length > 0 ? 68 : 0}px`);
if (window.actionToolbarComponent) {
window.actionToolbarComponent.fetchActions({ label_template_ids: rowsSelectedIDs() });
$('.dataTables_scrollBody').css('padding-bottom', `${rowsSelectedIDs().length > 0 ? 68 : 0}px`);
}
}
function reloadTable() {

View file

@ -138,7 +138,7 @@ var hammertime;
* Initializes page
*/
function init() {
if ($("#canvas-container").length === 0) return;
if ($('#module-archive').length === 0 && $('#canvas-container').length === 0) return;
if($('#module-archive').length) {
bindFullZoomAjaxTabs();

View file

@ -44,7 +44,8 @@ function applyClickCallbackOnProtocolCards() {
// Set iframe content
iFrame.contents().find('body').html(data.html);
scrollbox.scrollTo(0);
scrollbox.scrollTop(0);
iFrame.contents().find('body').find('table.htCore')
.css('width', '100%')
.css('table-layout', 'auto');
@ -130,7 +131,7 @@ function applySearchCallback() {
} else if (data.html) {
resetPreviewPanel();
$('.empty-text').hide();
listWrapper.show().html(data.html).scrollTo(0);
listWrapper.show().html(data.html).scrollTop(0);
} else {
setDefaultViewState();
}

View file

@ -19,7 +19,7 @@
}
.panel-heading {
padding: 10px 15px 4px;
padding: 7px 30px 7px 15px;
}
.panel-body {
@ -82,3 +82,11 @@
background-repeat: no-repeat;
}
}
#manage-module-due-date-modal {
.input-group {
.form-control {
height: 2.5rem;
}
}
}

View file

@ -536,11 +536,16 @@
}
.table-display-modal {
.modal-description,
.column-container {
font-size: 14px;
}
.column-container {
align-items: center;
border-bottom: $border-default;
display: flex;
padding: .5em 1em;
padding: .5em 1.4em;
&:not(.visible) {
color: $color-alto;
@ -560,13 +565,15 @@
}
}
&.task_name {
padding-left: 3em;
.sn-icon {
cursor: pointer;
margin-right: .6em;
.fas {
display: none;
&.disabled {
cursor: not-allowed;
}
}
}
}

View file

@ -184,8 +184,14 @@ path, ._jsPlumb_endpoint {
height: 40px;
.dropdown {
bottom: 18px;
left: 0;
bottom: 22px;
left: 22px;
&:hover {
a {
text-decoration: none;
}
}
}
}
@ -420,7 +426,7 @@ path, ._jsPlumb_endpoint {
font-size: $font-size-large;
text-transform: uppercase;
display: block;
margin-top: 20%;
margin-top: 10%;
a {
color: $color-emperor;

View file

@ -41,9 +41,9 @@
.reports-new-body {
background: $color-concrete;
height: calc(100% - 10em);
margin-left: calc(-1em - 15px);
overflow-y: auto;
width: calc(100% + 2em + 30px);
padding-left: calc(-1em - 15px);
width: 100%;
}
.reports-new-footer {
@ -409,7 +409,7 @@
ul {
list-style-type: none;
padding-left: 1em;
padding-left: 1.5em;
}
.sci-checkbox-container {
@ -438,6 +438,10 @@
.hide-unchecked {
align-items: center;
display: flex;
.sci-checkbox-container {
margin-right: .4em;
}
}
.divider {
@ -466,7 +470,7 @@
.sn-icon-down {
cursor: pointer;
margin: 0 .5em;
margin: 0 0 0 -.1em;
&.collapsed {
@include rotate(-90deg);
@ -551,7 +555,7 @@
.sn-icon-down {
cursor: pointer;
margin: 0 .5em;
margin: 0 0 0 .5em;
&.collapsed {
@include rotate(-90deg);
@ -576,12 +580,17 @@
.repositories-items-description {
@include font-button;
display: inline-block;
display: flex;
margin-top: 1em;
padding-left: 1em;
.fas {
color: $brand-focus;
}
.sn-icon-info {
margin-right: .1em;
}
}
.all-results-container {
@ -610,6 +619,11 @@
.fa-exclamation-triangle {
color: $brand-warning;
margin-top: .5em;
width: var(--sci-checkbox-size);
}
.sci-checkbox-container {
margin-right: .4em;
}
}
}

View file

@ -149,6 +149,7 @@
}
.filter-container {
width: 424px;
margin-bottom: .5em;
.filter-title {

View file

@ -219,6 +219,9 @@
}
.atwho-user-container {
display: inline-block;
white-space: nowrap;
.atwho-user-popover {
cursor: pointer;
line-height: 1.25rem;

View file

@ -16,6 +16,7 @@
}
.step-element-header {
.step-element-name {
align-items: flex-start;
column-gap: .25em;
@ -45,7 +46,7 @@
}
.step-checklist-add-item {
margin-left: 12px;
margin-left: 1.925rem;
.fas {
margin-right: .5em;

View file

@ -4,7 +4,7 @@
}
.btn {
@apply relative inline-flex items-center text-sm shrink-0 gap-2 justify-center leading-5 py-2 px-4 rounded border-0 appearance-none whitespace-nowrap cursor-pointer;
@apply relative inline-flex items-center text-sm shrink-0 gap-2 justify-center leading-5 py-2 px-4 rounded border-0 appearance-none whitespace-nowrap cursor-pointer max-h-[40px];
}
.btn.icon-btn {
@ -12,7 +12,7 @@
}
.btn.btn-lg {
@apply py-2.5 px-[1.125rem] text-base leading-5;
@apply py-2.5 px-[1.125rem] text-base leading-5 max-h-[44px];
}
.btn.btn-lg.icon-btn {
@ -20,7 +20,7 @@
}
.btn.btn-sm {
@apply py-1.5 px-2.5 text-xs leading-5;
@apply py-1.5 px-2.5 text-xs leading-5 max-h-[36px];
}
.btn.btn-sm.icon-btn {
@ -28,7 +28,7 @@
}
.btn.btn-xs {
@apply py-0.5 px-2.5 text-xs leading-5;
@apply py-0.5 px-2.5 text-xs leading-5 max-h-[30px];
}
.btn.btn-xs.icon-btn {

View file

@ -775,6 +775,7 @@ ul.double-line > li {
}
.panel-heading .dropdown {
background-color: $color-white;
bottom: 8px;
left: 8px;
}

View file

@ -7,17 +7,9 @@ module AccessPermissions
before_action :check_read_permissions, only: %i(show)
before_action :check_manage_permissions, only: %i(edit update)
def show
respond_to do |format|
format.json
end
end
def show; end
def edit
respond_to do |format|
format.json
end
end
def edit; end
def update
user_id = permitted_update_params[:user_id]
@ -44,11 +36,7 @@ module AccessPermissions
log_change_activity
respond_to do |format|
format.json do
render :experiment_member
end
end
render :experiment_member
end
private

View file

@ -8,17 +8,9 @@ module AccessPermissions
before_action :check_read_permissions, only: %i(show)
before_action :check_manage_permissions, only: %i(edit update)
def show
respond_to do |format|
format.json
end
end
def show; end
def edit
respond_to do |format|
format.json
end
end
def edit; end
def update
user_id = permitted_update_params[:user_id]
@ -38,11 +30,7 @@ module AccessPermissions
log_change_activity
respond_to do |format|
format.json do
render :my_module_member
end
end
render :my_module_member
end
private

View file

@ -14,23 +14,11 @@ module AccessPermissions
assigned_by: current_user,
team: current_team
)
respond_to do |format|
format.json
end
end
def show
respond_to do |format|
format.json
end
end
def show; end
def edit
respond_to do |format|
format.json
end
end
def edit; end
def update
@user_assignment = @project.user_assignments.find_by(
@ -51,11 +39,7 @@ module AccessPermissions
role: @user_assignment.user_role.name })
propagate_job(@user_assignment)
respond_to do |format|
format.json do
render :project_member
end
end
render :project_member
rescue ActiveRecord::RecordInvalid
render json: { flash: t('access_permissions.update.failure') }, status: :unprocessable_entity
end
@ -92,14 +76,12 @@ module AccessPermissions
end
end
respond_to do |format|
@message = if created_count.zero?
t('access_permissions.create.success', count: t('access_permissions.all_team'))
else
t('access_permissions.create.success', count: created_count)
end
format.json { render :edit }
end
@message = if created_count.zero?
t('access_permissions.create.success', count: t('access_permissions.all_team'))
else
t('access_permissions.create.success', count: created_count)
end
render :edit
rescue ActiveRecord::RecordInvalid => e
Rails.logger.error e.message
errors = @project.errors.present? ? @project.errors&.map(&:message)&.join(',') : e.message

View file

@ -12,23 +12,11 @@ module AccessPermissions
assigned_by: current_user,
team: current_team
)
respond_to do |format|
format.json
end
end
def show
respond_to do |format|
format.json
end
end
def show; end
def edit
respond_to do |format|
format.json
end
end
def edit; end
def update
@user_assignment = @protocol.user_assignments.find_by(
@ -47,11 +35,7 @@ module AccessPermissions
log_activity(:protocol_template_access_changed, { user_target: @user_assignment.user.id,
role: @user_assignment.user_role.name })
respond_to do |format|
format.json do
render :protocol_member
end
end
render :protocol_member
rescue ActiveRecord::RecordInvalid
render json: { flash: t('access_permissions.update.failure') }, status: :unprocessable_entity
end
@ -85,15 +69,12 @@ module AccessPermissions
end
end
respond_to do |format|
@message = if created_count.zero?
t('access_permissions.create.success', count: t('access_permissions.all_team'))
else
t('access_permissions.create.success', count: created_count)
end
format.json { render :edit }
end
@message = if created_count.zero?
t('access_permissions.create.success', count: t('access_permissions.all_team'))
else
t('access_permissions.create.success', count: created_count)
end
render :edit
rescue ActiveRecord::RecordInvalid => e
Rails.logger.error e.message
errors = @protocol.errors.present? ? @protocol.errors&.map(&:message)&.join(',') : e.message

View file

@ -29,7 +29,8 @@ module ActiveStorage
preview_exists =
if @blob.variable?
@blob.service.exist?(@blob.representation(params['variation_key']).key)
rep_key = @blob.representation(params['variation_key']).key
rep_key && @blob.service.exist?(rep_key)
else
@blob.preview(params['variation_key']).image.attached?
end

View file

@ -1,36 +0,0 @@
class ActivitiesController < ApplicationController
include ActivityHelper
def index
@vars = local_vars
render json: {
more_url: local_vars.fetch(:more_activities_url),
html: render_to_string(
partial: 'list', locals: @vars, formats: :html
)
}
end
private
def local_vars
page = (params[:page] || 1).to_i
activities = current_user.last_activities
.page(page)
.per(Constants::ACTIVITY_AND_NOTIF_SEARCH_LIMIT)
unless activities.blank? || activities.last_page?
more_url = url_for(
activities_url(
format: :json,
page: page + 1,
last_activity: activities.last.id
)
)
end
{
activities: activities,
more_activities_url: more_url,
page: page
}
end
end

View file

@ -37,11 +37,8 @@ class ApplicationController < ActionController::Base
def to_user_date_format
ts = I18n.l(Time.parse(params[:timestamp]),
format: params[:ts_format].to_sym)
respond_to do |format|
format.json do
render json: { ts: ts }, status: :ok
end
end
render json: { ts: ts }, status: :ok
end
protected

View file

@ -14,16 +14,12 @@ class AtWhoController < ApplicationController
def menu_items
res = SmartAnnotation.new(current_user, current_team, @query)
respond_to do |format|
format.json do
render json: {
prj: res.projects,
exp: res.experiments,
tsk: res.my_modules,
status: :ok
}
end
end
render json: {
prj: res.projects,
exp: res.experiments,
tsk: res.my_modules,
status: :ok
}
end
def rep_items

View file

@ -58,6 +58,8 @@ module ActiveStorage
current_user.permission_team = asset.team || current_team
return true if !asset.saved && can_read_team?(asset.team)
case asset.object_type
when 'MyModule'
render_403 unless can_read_my_module?(asset.object)

View file

@ -46,17 +46,10 @@ class ExperimentsController < ApplicationController
log_activity(:create_experiment, @experiment)
flash[:success] = t('experiments.create.success_flash',
experiment: @experiment.name)
respond_to do |format|
format.json do
render json: { path: my_modules_experiment_url(@experiment) }, status: :ok
end
end
render json: { path: my_modules_experiment_url(@experiment) }, status: :ok
else
respond_to do |format|
format.json do
render json: @experiment.errors, status: :unprocessable_entity
end
end
render json: @experiment.errors, status: :unprocessable_entity
end
end

View file

@ -29,14 +29,10 @@ class LabelTemplatesController < ApplicationController
end
def datatable
respond_to do |format|
format.json do
render json: ::LabelTemplateDatatable.new(
view_context,
@label_templates
)
end
end
render json: ::LabelTemplateDatatable.new(
view_context,
@label_templates
)
end
def show

View file

@ -82,16 +82,12 @@ class MyModuleRepositoriesController < ApplicationController
status = :bad_request
end
respond_to do |format|
format.json do
render json: {
flash: flash,
rows_count: @my_module.repository_rows_count(@repository),
assigned_count: service.assigned_rows_count,
repository_id: @repository.repository_snapshots.find_by(selected: true)&.id || @repository.id
}, status: status
end
end
render json: {
flash: flash,
rows_count: @my_module.repository_rows_count(@repository),
assigned_count: service.assigned_rows_count,
repository_id: @repository.repository_snapshots.find_by(selected: true)&.id || @repository.id
}, status: status
end
def update_repository_records_modal

View file

@ -19,14 +19,14 @@ class MyModuleRepositorySnapshotsController < ApplicationController
if params[:simple_view]
repository_rows = datatable_service.repository_rows
@repository = @repository_snapshot
rows_view = 'repository_rows/simple_view_index.json'
rows_view = 'repository_rows/simple_view_index'
else
repository_rows =
datatable_service.repository_rows
.preload(:repository_columns,
:created_by,
repository_cells: { value: @repository_snapshot.cell_preload_includes })
rows_view = 'repository_rows/snapshot_index.json'
rows_view = 'repository_rows/snapshot_index'
end
@repository_rows = repository_rows.page(page).per(per_page)

View file

@ -63,13 +63,8 @@ class MyModuleTagsController < ApplicationController
my_module: my_module.id,
tag: @mt.tag.id
})
respond_to do |format|
format.json do
redirect_to my_module_tags_edit_path(format: :json), turbolinks: false,
status: 303
end
end
redirect_to my_module_tags_edit_path(format: :json), turbolinks: false,
status: :see_other
end
def destroy
@ -89,13 +84,8 @@ class MyModuleTagsController < ApplicationController
})
@mt.destroy
respond_to do |format|
format.json do
redirect_to my_module_tags_edit_path(format: :json), turbolinks: false,
status: 303
end
end
redirect_to my_module_tags_edit_path(format: :json), turbolinks: false,
status: :see_other
end
def search_tags

View file

@ -94,15 +94,11 @@ class MyModulesController < ApplicationController
end
def status_state
respond_to do |format|
format.json do
if @my_module.last_transition_error && @my_module.last_transition_error['type'] == 'repository_snapshot'
flash[:repository_snapshot_error] = @my_module.last_transition_error
end
render json: { status_changing: @my_module.status_changing? }
end
if @my_module.last_transition_error && @my_module.last_transition_error['type'] == 'repository_snapshot'
flash[:repository_snapshot_error] = @my_module.last_transition_error
end
render json: { status_changing: @my_module.status_changing? }
end
def canvas_dropdown_menu
@ -131,11 +127,19 @@ class MyModulesController < ApplicationController
@next_page = activities.next_page
@starting_timestamp = activities.first&.created_at.to_i
render json: {
activities_html: render_to_string(partial: 'global_activities/activity_list'),
next_page: @next_page,
starting_timestamp: @starting_timestamp
}
respond_to do |format|
format.json do
render json: {
activities_html: render_to_string(
partial: 'global_activities/activity_list',
formats: :html
),
next_page: @next_page,
starting_timestamp: @starting_timestamp
}
end
format.html
end
end
# Different controller for showing activities inside tab
@ -239,24 +243,20 @@ class MyModulesController < ApplicationController
render_403 && return unless can_update_my_module_description?(@my_module)
old_description = @my_module.description
respond_to do |format|
format.json do
if @my_module.update(description: params.require(:my_module)[:description])
log_activity(:change_module_description)
TinyMceAsset.update_images(@my_module, params[:tiny_mce_images], current_user)
my_module_annotation_notification(old_description)
render json: {
html: custom_auto_link(
@my_module.tinymce_render(:description),
simple_format: false,
tags: %w(img),
team: current_team
)
}
else
render json: @my_module.errors, status: :unprocessable_entity
end
end
if @my_module.update(description: params.require(:my_module)[:description])
log_activity(:change_module_description)
TinyMceAsset.update_images(@my_module, params[:tiny_mce_images], current_user)
my_module_annotation_notification(old_description)
render json: {
html: custom_auto_link(
@my_module.tinymce_render(:description),
simple_format: false,
tags: %w(img),
team: current_team
)
}
else
render json: @my_module.errors, status: :unprocessable_entity
end
end
@ -265,24 +265,20 @@ class MyModulesController < ApplicationController
old_description = protocol.description
return render_404 unless protocol
respond_to do |format|
format.json do
if protocol.update(description: params.require(:protocol)[:description])
log_activity(:protocol_description_in_task_edited)
TinyMceAsset.update_images(protocol, params[:tiny_mce_images], current_user)
protocol_annotation_notification(old_description)
render json: {
html: custom_auto_link(
protocol.tinymce_render(:description),
simple_format: false,
tags: %w(img),
team: current_team
)
}
else
render json: protocol.errors, status: :unprocessable_entity
end
end
if protocol.update(description: params.require(:protocol)[:description])
log_activity(:protocol_description_in_task_edited)
TinyMceAsset.update_images(protocol, params[:tiny_mce_images], current_user)
protocol_annotation_notification(old_description)
render json: {
html: custom_auto_link(
protocol.tinymce_render(:description),
simple_format: false,
tags: %w(img),
team: current_team
)
}
else
render json: protocol.errors, status: :unprocessable_entity
end
end

View file

@ -5,15 +5,9 @@ class ProjectActivitiesController < ApplicationController
def index
@activities = @project.last_activities
respond_to do |format|
format.json {
render :json => {
:html => render_to_string({
:partial => "index.html.erb"
})
}
}
end
render json: {
html: render_to_string({ partial: 'index', formats: :html })
}
end
private

View file

@ -134,17 +134,9 @@ class ProjectsController < ApplicationController
log_activity(:create_project)
message = t('projects.create.success_flash', name: escape_input(@project.name))
respond_to do |format|
format.json do
render json: { message: message }, status: :ok
end
end
render json: { message: message }, status: :ok
else
respond_to do |format|
format.json do
render json: @project.errors, status: :unprocessable_entity
end
end
render json: @project.errors, status: :unprocessable_entity
end
end

View file

@ -79,16 +79,12 @@ class ProtocolsController < ApplicationController
def index; end
def datatable
respond_to do |format|
format.json do
render json: ::ProtocolsDatatable.new(
view_context,
@current_team,
@type,
current_user
)
end
end
render json: ::ProtocolsDatatable.new(
view_context,
@current_team,
@type,
current_user
)
end
def versions_modal
@ -193,15 +189,11 @@ class ProtocolsController < ApplicationController
end
def update_keywords
respond_to do |format|
if @protocol.update_keywords(params[:keywords], current_user)
format.json do
log_activity(:edit_keywords_in_protocol_repository, nil, protocol: @protocol.id)
render json: @protocol, serializer: ProtocolSerializer, user: current_user
end
else
format.json { render json: I18n.t('errors.general'), status: :unprocessable_entity }
end
if @protocol.update_keywords(params[:keywords], current_user)
log_activity(:edit_keywords_in_protocol_repository, nil, protocol: @protocol.id)
render json: @protocol, serializer: ProtocolSerializer, user: current_user
else
render json: I18n.t('errors.general'), status: :unprocessable_entity
end
end
@ -225,17 +217,13 @@ class ProtocolsController < ApplicationController
def update_description
old_description = @protocol.description
respond_to do |format|
format.json do
if @protocol.update(description: params.require(:protocol)[:description], last_modified_by: current_user)
log_activity(:edit_description_in_protocol_repository, nil, protocol: @protocol.id)
TinyMceAsset.update_images(@protocol, params[:tiny_mce_images], current_user)
protocol_annotation_notification(old_description)
render json: @protocol, serializer: ProtocolSerializer, user: current_user
else
render json: @protocol.errors, status: :unprocessable_entity
end
end
if @protocol.update(description: params.require(:protocol)[:description], last_modified_by: current_user)
log_activity(:edit_description_in_protocol_repository, nil, protocol: @protocol.id)
TinyMceAsset.update_images(@protocol, params[:tiny_mce_images], current_user)
protocol_annotation_notification(old_description)
render json: @protocol, serializer: ProtocolSerializer, user: current_user
else
render json: @protocol.errors, status: :unprocessable_entity
end
end
@ -297,15 +285,11 @@ class ProtocolsController < ApplicationController
raise ActiveRecord::Rollback
end
respond_to do |format|
format.json do
if cloned.present?
render json: { message: t('protocols.index.clone.success_flash', original: @original.name, new: cloned.name) }
else
render json: { message: t('protocols.index.clone.error_flash', original: @original.name) },
status: :bad_request
end
end
if cloned.present?
render json: { message: t('protocols.index.clone.success_flash', original: @original.name, new: cloned.name) }
else
render json: { message: t('protocols.index.clone.error_flash', original: @original.name) },
status: :bad_request
end
end
@ -361,232 +345,199 @@ class ProtocolsController < ApplicationController
end
def unlink
respond_to do |format|
transaction_error = false
Protocol.transaction do
@protocol.unlink
rescue StandardError
transaction_error = true
raise ActiveRecord::Rollback
end
if transaction_error
# Bad request error
render json: {
message: t('my_modules.protocols.unlink_error')
}, status: :bad_request
else
# Everything good, display flash & render 200
flash[:success] = t(
'my_modules.protocols.unlink_flash'
)
flash.keep(:success)
render json: {}, status: :ok
end
end
def revert
if @protocol.can_destroy?
transaction_error = false
Protocol.transaction do
begin
@protocol.unlink
rescue StandardError
transaction_error = true
raise ActiveRecord::Rollback
end
# Revert is basically update from parent
@protocol.update_from_parent(current_user, @protocol.parent)
rescue StandardError
transaction_error = true
raise ActiveRecord::Rollback
end
if transaction_error
# Bad request error
render json: {
message: t('my_modules.protocols.revert_error')
},
status: :bad_request
else
# Everything good, display flash & render 200
log_activity(:update_protocol_in_task_from_repository,
@protocol.my_module.experiment.project,
my_module: @protocol.my_module.id,
protocol_repository: @protocol.parent.id)
flash[:success] = t(
'my_modules.protocols.revert_flash'
)
flash.keep(:success)
render json: {}, status: :ok
end
else
render json: {
message: t('my_modules.protocols.revert_error_locked')
}, status: :bad_request
end
end
def update_from_parent
protocol_can_destroy = @protocol.can_destroy?
if protocol_can_destroy
transaction_error = false
Protocol.transaction do
# Find original published protocol template
source_parent = if @protocol.parent.in_repository_published_original?
@protocol.parent
else
@protocol.parent.parent
end
@protocol.update_from_parent(current_user, source_parent.latest_published_version_or_self)
rescue StandardError
transaction_error = true
raise ActiveRecord::Rollback
end
end
if !protocol_can_destroy
render json: { message: t('my_modules.protocols.update_from_parent_error_locked') }, status: :bad_request
elsif transaction_error
render json: { message: t('my_modules.protocols.update_from_parent_error') }, status: :bad_request
else
log_activity(:update_protocol_in_task_from_repository,
@protocol.my_module.experiment.project,
my_module: @protocol.my_module.id,
protocol_repository: @protocol.parent.id)
flash[:success] = t('my_modules.protocols.update_from_parent_flash')
flash.keep(:success)
render json: {}, status: :ok
end
end
def load_from_repository
if @protocol.can_destroy?
transaction_error = false
Protocol.transaction do
@protocol.load_from_repository(@source, current_user)
rescue StandardError
transaction_error = true
raise ActiveRecord::Rollback
end
if transaction_error
# Bad request error
format.json do
render json: {
message: t('my_modules.protocols.unlink_error')
message: t('my_modules.protocols.load_from_repository_error')
},
status: :bad_request
end
else
# Everything good, display flash & render 200
flash[:success] = t(
'my_modules.protocols.unlink_flash'
)
# Everything good, record activity, display flash & render 200
log_activity(:load_protocol_to_task_from_repository,
@protocol.my_module.experiment.project,
my_module: @protocol.my_module.id,
protocol_repository: @protocol.parent.id)
flash[:success] = t('my_modules.protocols.load_from_repository_flash')
flash.keep(:success)
format.json { render json: {}, status: :ok }
end
end
end
def revert
respond_to do |format|
if @protocol.can_destroy?
transaction_error = false
Protocol.transaction do
# Revert is basically update from parent
@protocol.update_from_parent(current_user, @protocol.parent)
rescue StandardError
transaction_error = true
raise ActiveRecord::Rollback
end
if transaction_error
# Bad request error
format.json do
render json: {
message: t('my_modules.protocols.revert_error')
},
status: :bad_request
end
else
# Everything good, display flash & render 200
log_activity(:update_protocol_in_task_from_repository,
@protocol.my_module.experiment.project,
my_module: @protocol.my_module.id,
protocol_repository: @protocol.parent.id)
flash[:success] = t(
'my_modules.protocols.revert_flash'
)
flash.keep(:success)
format.json { render json: {}, status: :ok }
end
else
format.json do
render json: {
message: t('my_modules.protocols.revert_error_locked')
}, status: :bad_request
end
end
end
end
def update_from_parent
protocol_can_destroy = @protocol.can_destroy?
respond_to do |format|
if protocol_can_destroy
transaction_error = false
Protocol.transaction do
# Find original published protocol template
source_parent = if @protocol.parent.in_repository_published_original?
@protocol.parent
else
@protocol.parent.parent
end
@protocol.update_from_parent(current_user, source_parent.latest_published_version_or_self)
rescue StandardError
transaction_error = true
raise ActiveRecord::Rollback
end
end
format.json do
if !protocol_can_destroy
render json: { message: t('my_modules.protocols.update_from_parent_error_locked') }, status: :bad_request
elsif transaction_error
render json: { message: t('my_modules.protocols.update_from_parent_error') }, status: :bad_request
else
log_activity(:update_protocol_in_task_from_repository,
@protocol.my_module.experiment.project,
my_module: @protocol.my_module.id,
protocol_repository: @protocol.parent.id)
flash[:success] = t('my_modules.protocols.update_from_parent_flash')
flash.keep(:success)
render json: {}, status: :ok
end
end
end
end
def load_from_repository
respond_to do |format|
if @protocol.can_destroy?
transaction_error = false
Protocol.transaction do
@protocol.load_from_repository(@source, current_user)
rescue StandardError
transaction_error = true
raise ActiveRecord::Rollback
end
if transaction_error
# Bad request error
format.json do
render json: {
message: t('my_modules.protocols.load_from_repository_error')
},
status: :bad_request
end
else
# Everything good, record activity, display flash & render 200
log_activity(:load_protocol_to_task_from_repository,
@protocol.my_module.experiment.project,
my_module: @protocol.my_module.id,
protocol_repository: @protocol.parent.id)
flash[:success] = t('my_modules.protocols.load_from_repository_flash')
flash.keep(:success)
format.json { render json: {}, status: :ok }
end
else
format.json do
render json: {
message: t('my_modules.protocols.load_from_repository_error_locked')
}, status: :bad_request
end
render json: {}, status: :ok
end
else
render json: {
message: t('my_modules.protocols.load_from_repository_error_locked')
}, status: :bad_request
end
end
def load_from_file
# This is actually very similar to import
respond_to do |format|
if @protocol.can_destroy?
transaction_error = false
Protocol.transaction do
@importer.import_into_existing(
@protocol, @protocol_json
)
rescue StandardError => e
transaction_error = true
Rails.logger.error(e.message)
Rails.logger.error(e.backtrace.join("\n"))
raise ActiveRecord::Rollback
end
if transaction_error
format.json do
render json: { status: :error }, status: :bad_request
end
else
# Everything good, record activity, display flash & render 200
log_activity(:load_protocol_to_task_from_file,
@protocol.my_module.experiment.project,
my_module: @my_module.id)
flash[:success] = t(
'my_modules.protocols.load_from_file_flash'
)
flash.keep(:success)
format.json do
render json: { status: :ok }, status: :ok
end
end
else
format.json do
render json: { status: :locked }, status: :bad_request
end
end
end
end
def protocolsio_index
render json: {
html: render_to_string({ partial: 'protocols/index/protocolsio_modal_body' })
}
end
def import
protocol = nil
respond_to do |format|
if @protocol.can_destroy?
transaction_error = false
Protocol.transaction do
protocol = @importer.import_new_protocol(@protocol_json)
@importer.import_into_existing(
@protocol, @protocol_json
)
rescue StandardError => e
Rails.logger.error e.backtrace.join("\n")
transaction_error = true
Rails.logger.error(e.message)
Rails.logger.error(e.backtrace.join("\n"))
raise ActiveRecord::Rollback
end
if transaction_error
format.json do
render json: { status: :bad_request }, status: :bad_request
render json: { status: :error }, status: :bad_request
end
else
Activities::CreateActivityService
.call(activity_type: :import_protocol_in_repository,
owner: current_user,
subject: protocol,
team: protocol.team,
message_items: {
protocol: protocol.id
})
format.json do
render json: { status: :ok }, status: :ok
end
# Everything good, record activity, display flash & render 200
log_activity(:load_protocol_to_task_from_file,
@protocol.my_module.experiment.project,
my_module: @my_module.id)
flash[:success] = t(
'my_modules.protocols.load_from_file_flash'
)
flash.keep(:success)
render json: { status: :ok }, status: :ok
end
else
render json: { status: :locked }, status: :bad_request
end
end
def protocolsio_index
render json: {
html: render_to_string({ partial: 'protocols/index/protocolsio_modal_body', formats: :html })
}
end
def import
protocol = nil
transaction_error = false
Protocol.transaction do
protocol = @importer.import_new_protocol(@protocol_json)
rescue StandardError => e
Rails.logger.error e.backtrace.join("\n")
transaction_error = true
raise ActiveRecord::Rollback
end
if transaction_error
render json: { status: :bad_request }, status: :bad_request
else
Activities::CreateActivityService
.call(activity_type: :import_protocol_in_repository,
owner: current_user,
subject: protocol,
team: protocol.team,
message_items: {
protocol: protocol.id
})
render json: { status: :ok }, status: :ok
end
end
@ -716,141 +667,125 @@ class ProtocolsController < ApplicationController
def export
# Make a zip output stream and send it to the client
respond_to do |format|
format.html do
z_output_stream = Zip::OutputStream.write_buffer do |ostream|
ostream.put_next_entry('scinote.xml')
ostream.print(generate_envelope_xml(@protocols))
ostream.put_next_entry('scinote.xsd')
ostream.print(generate_envelope_xsd)
ostream.put_next_entry('eln.xsd')
ostream.print(generate_eln_xsd)
# rubocop:disable Metrics/BlockLength
z_output_stream = Zip::OutputStream.write_buffer do |ostream|
ostream.put_next_entry('scinote.xml')
ostream.print(generate_envelope_xml(@protocols))
ostream.put_next_entry('scinote.xsd')
ostream.print(generate_envelope_xsd)
ostream.put_next_entry('eln.xsd')
ostream.print(generate_eln_xsd)
# Create folder and xml file for each protocol and populate it
@protocols.each do |protocol|
protocol = protocol.latest_published_version_or_self
protocol_dir = get_guid(protocol.id).to_s
ostream.put_next_entry("#{protocol_dir}/eln.xml")
ostream.print(generate_protocol_xml(protocol))
ostream = protocol.tiny_mce_assets.save_to_eln(ostream, protocol_dir)
# Add assets to protocol folder
next if protocol.steps.count <= 0
protocol.steps.order(:id).each do |step|
step_guid = get_guid(step.id)
step_dir = "#{protocol_dir}/#{step_guid}"
if step.assets.exists?
step.assets.order(:id).each do |asset|
next unless asset.file.attached?
asset_guid = get_guid(asset.id)
asset_file_name = asset_guid.to_s + File.extname(asset.file_name).to_s
ostream.put_next_entry("#{step_dir}/#{asset_file_name}")
ostream.print(asset.file.download)
end
end
ostream = step.tiny_mce_assets.save_to_eln(ostream, step_dir)
# Create folder and xml file for each protocol and populate it
@protocols.each do |protocol|
protocol = protocol.latest_published_version_or_self
protocol_dir = get_guid(protocol.id).to_s
ostream.put_next_entry("#{protocol_dir}/eln.xml")
ostream.print(generate_protocol_xml(protocol))
ostream = protocol.tiny_mce_assets.save_to_eln(ostream, protocol_dir)
# Add assets to protocol folder
next if protocol.steps.count <= 0
step.step_texts.each do |step_text|
ostream = step_text.tiny_mce_assets.save_to_eln(ostream, step_dir)
end
protocol.steps.order(:id).each do |step|
step_guid = get_guid(step.id)
step_dir = "#{protocol_dir}/#{step_guid}"
if step.assets.exists?
step.assets.order(:id).each do |asset|
next unless asset.file.attached?
asset_guid = get_guid(asset.id)
asset_file_name = asset_guid.to_s + File.extname(asset.file_name).to_s
ostream.put_next_entry("#{step_dir}/#{asset_file_name}")
ostream.print(asset.file.download)
end
end
end
z_output_stream.rewind
ostream = step.tiny_mce_assets.save_to_eln(ostream, step_dir)
protocol_name = get_protocol_name(@protocols[0])
# Now generate filename of the archive and send file to user
if @protocols.count == 1
# Try to construct an OS-safe file name
file_name = 'protocol.eln'
unless protocol_name.nil?
escaped_name = protocol_name.gsub(/[^0-9a-zA-Z\-.,_]/i, '_')
.downcase[0..Constants::NAME_MAX_LENGTH]
file_name = escaped_name + '.eln' unless escaped_name.blank?
end
elsif @protocols.length > 1
file_name = 'protocols.eln'
end
@protocols.each do |protocol|
if params[:my_module_id]
my_module = MyModule.find(params[:my_module_id])
Activities::CreateActivityService
.call(activity_type: :export_protocol_from_task,
owner: current_user,
project: my_module.project,
subject: my_module,
team: my_module.team,
message_items: {
my_module: params[:my_module_id].to_i
})
else
Activities::CreateActivityService
.call(activity_type: :export_protocol_in_repository,
owner: current_user,
subject: protocol,
team: protocol.team,
message_items: {
protocol: protocol.id
})
step.step_texts.each do |step_text|
ostream = step_text.tiny_mce_assets.save_to_eln(ostream, step_dir)
end
end
send_data(z_output_stream.read, filename: file_name)
end
end
# rubocop:enable Metrics/BlockLength
z_output_stream.rewind
protocol_name = get_protocol_name(@protocols[0])
# Now generate filename of the archive and send file to user
if @protocols.count == 1
# Try to construct an OS-safe file name
file_name = 'protocol.eln'
unless protocol_name.nil?
escaped_name = protocol_name.gsub(/[^0-9a-zA-Z\-.,_]/i, '_')
.downcase[0..Constants::NAME_MAX_LENGTH]
file_name = escaped_name + '.eln' if escaped_name.present?
end
elsif @protocols.length > 1
file_name = 'protocols.eln'
end
@protocols.each do |protocol|
if params[:my_module_id]
my_module = MyModule.find(params[:my_module_id])
Activities::CreateActivityService
.call(activity_type: :export_protocol_from_task,
owner: current_user,
project: my_module.project,
subject: my_module,
team: my_module.team,
message_items: {
my_module: params[:my_module_id].to_i
})
else
Activities::CreateActivityService
.call(activity_type: :export_protocol_in_repository,
owner: current_user,
subject: protocol,
team: protocol.team,
message_items: {
protocol: protocol.id
})
end
end
send_data(z_output_stream.read, filename: file_name)
end
def unlink_modal
respond_to do |format|
format.json do
render json: {
title: t('my_modules.protocols.confirm_link_update_modal.unlink_title'),
message: t('my_modules.protocols.confirm_link_update_modal.unlink_message'),
btn_text: t('my_modules.protocols.confirm_link_update_modal.unlink_btn_text'),
url: unlink_protocol_path(@protocol)
}
end
end
render json: {
title: t('my_modules.protocols.confirm_link_update_modal.unlink_title'),
message: t('my_modules.protocols.confirm_link_update_modal.unlink_message'),
btn_text: t('my_modules.protocols.confirm_link_update_modal.unlink_btn_text'),
url: unlink_protocol_path(@protocol)
}
end
def revert_modal
respond_to do |format|
format.json do
render json: {
title: t('my_modules.protocols.confirm_link_update_modal.revert_title'),
message: t('my_modules.protocols.confirm_link_update_modal.revert_message'),
btn_text: t('my_modules.protocols.confirm_link_update_modal.revert_btn_text'),
url: revert_protocol_path(@protocol)
}
end
end
render json: {
title: t('my_modules.protocols.confirm_link_update_modal.revert_title'),
message: t('my_modules.protocols.confirm_link_update_modal.revert_message'),
btn_text: t('my_modules.protocols.confirm_link_update_modal.revert_btn_text'),
url: revert_protocol_path(@protocol)
}
end
def update_from_parent_modal
respond_to do |format|
format.json do
render json: {
title: t('my_modules.protocols.confirm_link_update_modal.update_self_title'),
message: t('my_modules.protocols.confirm_link_update_modal.update_self_message'),
btn_text: t('my_modules.protocols.confirm_link_update_modal.update_self_btn_text'),
url: update_from_parent_protocol_path(@protocol)
}
end
end
render json: {
title: t('my_modules.protocols.confirm_link_update_modal.update_self_title'),
message: t('my_modules.protocols.confirm_link_update_modal.update_self_message'),
btn_text: t('my_modules.protocols.confirm_link_update_modal.update_self_btn_text'),
url: update_from_parent_protocol_path(@protocol)
}
end
def load_from_repository_datatable
@protocol = Protocol.find_by_id(params[:id])
respond_to do |format|
format.json do
render json: ::LoadFromRepositoryProtocolsDatatable.new(
view_context,
@protocol.team,
current_user
)
end
end
render json: ::LoadFromRepositoryProtocolsDatatable.new(
view_context,
@protocol.team,
current_user
)
end
def load_from_repository_modal
@ -866,25 +801,17 @@ class ProtocolsController < ApplicationController
end
def version_comment
respond_to do |format|
format.json do
render json: { version_comment: @protocol.version_comment }
end
end
render json: { version_comment: @protocol.version_comment }
end
def update_version_comment
respond_to do |format|
format.json do
if @protocol.update(version_comment: params.require(:protocol)[:version_comment])
log_activity(:protocol_template_revision_notes_updated,
nil,
protocol: @protocol.id)
render json: { version_comment: @protocol.version_comment }
else
render json: { errors: @protocol.errors }, status: :unprocessable_entity
end
end
if @protocol.update(version_comment: params.require(:protocol)[:version_comment])
log_activity(:protocol_template_revision_notes_updated,
nil,
protocol: @protocol.id)
render json: { version_comment: @protocol.version_comment }
else
render json: { errors: @protocol.errors }, status: :unprocessable_entity
end
end

View file

@ -24,15 +24,11 @@ class ReportsController < ApplicationController
def index; end
def datatable
respond_to do |format|
format.json do
render json: ::ReportDatatable.new(
view_context,
current_user,
Report.viewable_by_user(current_user, current_team)
)
end
end
render json: ::ReportDatatable.new(
view_context,
current_user,
Report.viewable_by_user(current_user, current_team)
)
end
# Report grouped by modules
@ -57,24 +53,20 @@ class ReportsController < ApplicationController
report = current_team.reports.new(project: @project)
end
respond_to do |format|
format.json do
if lookup_context.template_exists?("reports/templates/#{template}/edit")
render json: {
html: render_to_string(
template: "reports/templates/#{template}/edit",
layout: 'reports/template_values_editor',
locals: { report: report },
formats: :html
)
}
else
render json: {
html: render_to_string(partial: 'reports/wizard/no_template_values',
formats: :html)
}
end
end
if lookup_context.template_exists?("reports/templates/#{template}/edit")
render json: {
html: render_to_string(
template: "reports/templates/#{template}/edit",
layout: 'reports/template_values_editor',
locals: { report: report },
formats: :html
)
}
else
render json: {
html: render_to_string(partial: 'reports/wizard/no_template_values',
formats: :html)
}
end
end
@ -166,58 +158,42 @@ class ReportsController < ApplicationController
docx = @report.docx_file.attached? ? document_preview_report_path(@report, report_type: :docx) : nil
pdf = @report.pdf_file.attached? ? document_preview_report_path(@report, report_type: :pdf) : nil
respond_to do |format|
format.json do
render json: {
docx: {
processing: @report.docx_processing?,
preview_url: docx,
error: @report.docx_error?
},
pdf: {
processing: @report.pdf_processing?,
preview_url: pdf,
error: @report.pdf_error?
}
}
end
end
render json: {
docx: {
processing: @report.docx_processing?,
preview_url: docx,
error: @report.docx_error?
},
pdf: {
processing: @report.pdf_processing?,
preview_url: pdf,
error: @report.pdf_error?
}
}
end
# Generation actions
def generate_pdf
respond_to do |format|
format.json do
render json: {
message: I18n.t('projects.reports.index.generation.accepted_message')
}
end
end
render json: {
message: I18n.t('projects.reports.index.generation.accepted_message')
}
end
def generate_docx
respond_to do |format|
format.json do
@report.docx_processing!
log_activity(:generate_docx_report)
@report.docx_processing!
log_activity(:generate_docx_report)
ensure_report_template!
Reports::DocxJob.perform_later(@report.id, current_user, root_url)
render json: {
message: I18n.t('projects.reports.index.generation.accepted_message')
}
end
end
ensure_report_template!
Reports::DocxJob.perform_later(@report.id, current_user, root_url)
render json: {
message: I18n.t('projects.reports.index.generation.accepted_message')
}
end
def save_pdf_to_inventory_modal
respond_to do |format|
format.json do
render json: {
html: render_to_string(partial: 'reports/save_PDF_to_inventory_modal', formats: :html)
}
end
end
render json: {
html: render_to_string(partial: 'reports/save_PDF_to_inventory_modal', formats: :html)
}
end
def save_pdf_to_inventory_item
@ -247,21 +223,16 @@ class ReportsController < ApplicationController
my_module = MyModule.find_by_id(params[:my_module_id])
return render_403 unless my_module.experiment.project == @project
respond_to do |format|
if my_module.blank?
format.json do
render json: {}, status: :not_found
end
else
format.json do
render json: {
html: render_to_string(
partial: 'reports/new/modal/module_contents',
locals: { project: @project, my_module: my_module }
)
}
end
end
if my_module.blank?
render json: {}, status: :not_found
else
render json: {
html: render_to_string(
partial: 'reports/new/modal/module_contents',
locals: { project: @project, my_module: my_module },
formats: :html
)
}
end
end
@ -270,21 +241,16 @@ class ReportsController < ApplicationController
step = Step.find_by_id(params[:step_id])
return render_403 unless step.my_module.experiment.project == @project
respond_to do |format|
if step.blank?
format.json do
render json: {}, status: :not_found
end
else
format.json do
render json: {
html: render_to_string(
partial: 'reports/new/modal/step_contents',
locals: { project: @project, step: step }
)
}
end
end
if step.blank?
render json: {}, status: :not_found
else
render json: {
html: render_to_string(
partial: 'reports/new/modal/step_contents',
locals: { project: @project, step: step },
formats: :html
)
}
end
end
@ -293,21 +259,16 @@ class ReportsController < ApplicationController
result = Result.find_by_id(params[:result_id])
return render_403 unless result.experiment.project == @project
respond_to do |format|
if result.blank?
format.json do
render json: {}, status: :not_found
end
else
format.json do
render json: {
html: render_to_string(
partial: 'reports/new/modal/result_contents',
locals: { project: @project, result: result }
)
}
end
end
if result.blank?
render json: {}, status: :not_found
else
render json: {
html: render_to_string(
partial: 'reports/new/modal/result_contents',
locals: { project: @project, result: result },
formats: :html
)
}
end
end
@ -315,7 +276,8 @@ class ReportsController < ApplicationController
render json: {
html: render_to_string(
partial: 'reports/wizard/project_contents',
locals: { project: @project, report: nil }
locals: { project: @project, report: nil },
formats: :html
)
}
end
@ -330,7 +292,8 @@ class ReportsController < ApplicationController
locals: {
report: @report,
report_type: params[:report_type]
}
},
formats: :html
) }
end

View file

@ -120,25 +120,22 @@ class RepositoriesController < ApplicationController
)
@repository.assign_attributes(repository_params)
respond_to do |format|
format.json do
if @repository.save
log_activity(:create_inventory)
if @repository.save
log_activity(:create_inventory)
flash[:success] = t('repositories.index.modal_create.success_flash_html', name: @repository.name)
render json: { url: repository_path(@repository) }
else
render json: @repository.errors,
status: :unprocessable_entity
end
end
flash[:success] = t('repositories.index.modal_create.success_flash_html', name: @repository.name)
render json: { url: repository_path(@repository) }
else
render json: @repository.errors,
status: :unprocessable_entity
end
end
def destroy_modal
render json: {
html: render_to_string(
partial: 'delete_repository_modal'
partial: 'delete_repository_modal',
formats: :html
)
}
end

View file

@ -197,18 +197,12 @@ class RepositoryRowsController < ApplicationController
flash = t('repositories.destroy.success_flash',
records_number: deleted_count)
end
respond_to do |format|
color = deleted_count.zero? ? 'info' : 'success'
format.json { render json: { flash: flash, color: color }, status: :ok }
end
color = deleted_count.zero? ? 'info' : 'success'
render json: { flash: flash, color: color }, status: :ok
else
respond_to do |format|
format.json do
render json: {
flash: t('repositories.destroy.no_records_selected_flash')
}, status: :bad_request
end
end
render json: {
flash: t('repositories.destroy.no_records_selected_flash')
}, status: :bad_request
end
end
@ -341,13 +335,9 @@ class RepositoryRowsController < ApplicationController
def check_snapshotting_status
return if @repository.repository_snapshots.provisioning.none?
respond_to do |format|
format.json do
render json: {
flash: t('repositories.index.snapshot_provisioning_in_progress')
}, status: :unprocessable_entity
end
end
render json: {
flash: t('repositories.index.snapshot_provisioning_in_progress')
}, status: :unprocessable_entity
end
def check_create_permissions

View file

@ -35,7 +35,7 @@ class ResultAssetsController < ApplicationController
def edit
render json: {
html: render_to_string(partial: 'edit')
html: render_to_string(partial: 'edit', formats: :html)
}
end

View file

@ -18,15 +18,9 @@ class ResultTablesController < ApplicationController
table: @table
)
respond_to do |format|
format.json {
render json: {
html: render_to_string({
partial: "new.html.erb"
})
}, status: :ok
}
end
render json: {
html: render_to_string({ partial: 'new', formats: :html })
}, status: :ok
end
def create
@ -54,15 +48,9 @@ class ResultTablesController < ApplicationController
end
def edit
respond_to do |format|
format.json {
render json: {
html: render_to_string({
partial: "edit.html.erb"
})
}, status: :ok
}
end
render json: {
html: render_to_string({ partial: 'edit', formats: :html })
}, status: :ok
end
def update
@ -71,7 +59,7 @@ class ResultTablesController < ApplicationController
@result.table.last_modified_by = current_user
@result.table.team = current_team
@result.assign_attributes(update_params)
@result.table.metadata = JSON.parse(update_params[:table_attributes][:metadata])
@result.table.metadata = JSON.parse(update_params[:table_attributes][:metadata]) if update_params[:table_attributes]
flash_success = t("result_tables.update.success_flash",
module: @my_module.name)
if @result.archived_changed?(from: false, to: true)
@ -98,9 +86,11 @@ class ResultTablesController < ApplicationController
}
format.json {
render json: {
html: render_to_string({
partial: "my_modules/result.html.erb", locals: {result: @result}
})
html: render_to_string(
partial: 'my_modules/result',
locals: { result: @result },
formats: :html
)
}, status: :ok
}
else
@ -114,7 +104,7 @@ class ResultTablesController < ApplicationController
def download
_ = JSON.parse @result_table.table.contents
@table_data = _["data"] || []
data = render_to_string partial: 'download.txt.erb'
data = render_to_string partial: 'download'
send_data data, filename: @result_table.result.name + '.txt',
type: 'plain/text'
end

View file

@ -20,15 +20,9 @@ class ResultTextsController < ApplicationController
)
@result.build_result_text
respond_to do |format|
format.json {
render json: {
html: render_to_string({
partial: "new.html.erb"
})
}, status: :ok
}
end
render json: {
html: render_to_string({ partial: 'new', formats: :html })
}, status: :ok
end
def create
@ -55,15 +49,9 @@ class ResultTextsController < ApplicationController
end
def edit
respond_to do |format|
format.json {
render json: {
html: render_to_string({
partial: "edit.html.erb"
})
}, status: :ok
}
end
render json: {
html: render_to_string({ partial: 'edit', formats: :html })
}, status: :ok
end
def update
@ -110,7 +98,7 @@ class ResultTextsController < ApplicationController
format.json do
render json: {
html: render_to_string(
partial: 'my_modules/result.html.erb',
partial: 'my_modules/result',
locals: { result: @result },
formats: :html
)

View file

@ -160,11 +160,8 @@ class StepsController < ApplicationController
view_state = @step.current_view_state(current_user)
view_state.state['assets']['sort'] = params.require(:assets).require(:order)
view_state.save! if view_state.changed?
respond_to do |format|
format.json do
render json: {}, status: :ok
end
end
render json: {}, status: :ok
end
def update_asset_view_mode

View file

@ -5,14 +5,10 @@ class UserNotificationsController < ApplicationController
page = (params[:page] || 1).to_i
notifications = load_notifications.page(page).per(Constants::INFINITE_SCROLL_LIMIT).without_count
respond_to do |format|
format.json do
render json: {
notifications: notification_serializer(notifications),
next_page: notifications.next_page
}
end
end
render json: {
notifications: notification_serializer(notifications),
next_page: notifications.next_page
}
UserNotification.where(
notification_id: notifications.except(:select).where.not(type_of: 2).select(:id)

View file

@ -4,26 +4,18 @@ class UserRepositoriesController < ApplicationController
def save_table_state
service = RepositoryTableStateService.new(current_user, @repository)
service.update_state(params.require(:state).permit!.to_h)
respond_to do |format|
format.json do
render json: {
status: :ok
}
end
end
render json: {
status: :ok
}
end
def load_table_state
service = RepositoryTableStateService.new(current_user, @repository)
state = service.load_state.state
respond_to do |format|
if state
format.json do
render json: {
state: state
}
end
end
if state
render json: {
state: state
}
end
end

View file

@ -13,17 +13,10 @@ module Users
end
def update
respond_to do |format|
if @user.update(update_params)
format.json do
render json: { status: :ok }
end
else
format.json do
render json: @user.errors,
status: :unprocessable_entity
end
end
if @user.update(update_params)
render json: { status: :ok }
else
render json: @user.errors, status: :unprocessable_entity
end
end
@ -44,21 +37,13 @@ module Users
@user.system_message_email_notification = val
end
if @user.save
respond_to do |format|
format.json do
render json: {
status: :ok
}
end
end
render json: {
status: :ok
}
else
respond_to do |format|
format.json do
render json: {
status: :unprocessable_entity
}
end
end
render json: {
status: :unprocessable_entity
}
end
end

View file

@ -38,11 +38,7 @@ module Users
end
def datatable
respond_to do |format|
format.json do
render json: ::TeamsDatatable.new(view_context, @user)
end
end
render json: ::TeamsDatatable.new(view_context, @user)
end
def new
@ -66,11 +62,7 @@ module Users
end
def users_datatable
respond_to do |format|
format.json do
render json: ::TeamUsersDatatable.new(view_context, @team, @user)
end
end
render json: ::TeamUsersDatatable.new(view_context, @team, @user)
end
def name_html
@ -94,26 +86,19 @@ module Users
end
def update
respond_to do |format|
if @team.update(update_params)
@team.update(last_modified_by: current_user)
format.json do
render json: {
status: :ok,
html: custom_auto_link(
@team.tinymce_render(:description),
simple_format: false,
tags: %w(img),
team: current_team
)
}
end
else
format.json do
render json: @team.errors,
status: :unprocessable_entity
end
end
if @team.update(update_params)
@team.update(last_modified_by: current_user)
render json: {
status: :ok,
html: custom_auto_link(
@team.tinymce_render(:description),
simple_format: false,
tags: %w(img),
team: current_team
)
}
else
render json: @team.errors, status: :unprocessable_entity
end
end

View file

@ -10,29 +10,23 @@ module Users
before_action :check_destroy_permissions, only: %i(leave_html destroy_html destroy)
def update
respond_to do |format|
if @user_assignment.update(update_params)
Activities::CreateActivityService
.call(activity_type: :change_users_role_on_team,
owner: current_user,
subject: @user_assignment.assignable,
team: @user_assignment.assignable,
message_items: {
team: @user_assignment.assignable.id,
user_changed: @user_assignment.user.id,
role: @user_assignment.user_role.name
})
if @user_assignment.update(update_params)
Activities::CreateActivityService
.call(activity_type: :change_users_role_on_team,
owner: current_user,
subject: @user_assignment.assignable,
team: @user_assignment.assignable,
message_items: {
team: @user_assignment.assignable.id,
user_changed: @user_assignment.user.id,
role: @user_assignment.user_role.name
})
format.json do
render json: {
status: :ok
}
end
else
format.json do
render json: @user_assignment.errors, status: :unprocessable_entity
end
end
render json: {
status: :ok
}
else
render json: @user_assignment.errors, status: :unprocessable_entity
end
end
@ -125,26 +119,21 @@ module Users
end
end
respond_to do |format|
if !invalid
if params[:leave]
flash[:notice] = I18n.t(
'users.settings.user_teams.leave_flash',
team: @user_assignment.assignable.name
)
flash.keep(:notice)
end
generate_notification(current_user,
@user_assignment.user,
@user_assignment.assignable,
false)
format.json { render json: { status: :ok } }
else
format.json do
render json: @user_assignment.errors,
status: :unprocessable_entity
end
if !invalid
if params[:leave]
flash[:notice] = I18n.t(
'users.settings.user_teams.leave_flash',
team: @user_assignment.assignable.name
)
flash.keep(:notice)
end
generate_notification(current_user,
@user_assignment.user,
@user_assignment.assignable,
false)
render json: { status: :ok }
else
render json: @user_assignment.errors, status: :unprocessable_entity
end
end

View file

@ -154,7 +154,7 @@ module ApplicationHelper
skip_avatar = false,
base64_encoded_imgs = false)
(defined?(controller) ? controller : ActionController::Base.new)
(defined?(controller) ? controller : ApplicationController.new)
.render_to_string(
partial: 'shared/atwho_user_container',
locals: {
@ -162,17 +162,7 @@ module ApplicationHelper
skip_avatar: skip_avatar,
skip_user_status: skip_user_status,
team: team,
base64_encoded_imgs: base64_encoded_imgs,
user_avatar_absolute_url: user_avatar_absolute_url(
user,
:icon_small,
base64_encoded_imgs
),
user_avatar_popover_absolute_url: user_avatar_absolute_url(
user,
:thumb,
base64_encoded_imgs
)
base64_encoded_imgs: base64_encoded_imgs
},
formats: :html
)

View file

@ -108,7 +108,7 @@ module CommentHelper
if partial
render json: {
html: render_to_string(
partial: "/shared/comments/#{partial}.html.erb",
partial: "/shared/comments/#{partial}",
locals: {
comment: comment,
skip_header: false

View file

@ -114,7 +114,7 @@ export default {
}
},
children: function() {
if (this.children.length > 0) {
if (this.children && this.children.length > 0) {
this.childrenExpanded = true;
} else if (this.childrenLoaded) {
this.item.has_children = false;

View file

@ -22,13 +22,13 @@
/>
</div>
<div class="step-element-controls">
<button v-if="element.attributes.orderable.urls.update_url" class="btn icon-btn btn-light" @click="editingName = true" tabindex="0">
<button v-if="element.attributes.orderable.urls.update_url" class="btn icon-btn btn-light btn-sm" @click="editingName = true" tabindex="0">
<i class="sn-icon sn-icon-edit"></i>
</button>
<button v-if="element.attributes.orderable.urls.duplicate_url" class="btn icon-btn btn-light" tabindex="0" @click="duplicateElement">
<button v-if="element.attributes.orderable.urls.duplicate_url" class="btn icon-btn btn-light btn-sm" tabindex="0" @click="duplicateElement">
<i class="sn-icon sn-icon-duplicate"></i>
</button>
<button v-if="element.attributes.orderable.urls.delete_url" class="btn icon-btn btn-light" @click="showDeleteModal" tabindex="0">
<button v-if="element.attributes.orderable.urls.delete_url" class="btn icon-btn btn-light btn-sm" @click="showDeleteModal" tabindex="0">
<i class="sn-icon sn-icon-delete"></i>
</button>
</div>
@ -63,7 +63,7 @@
/>
</Draggable>
<div v-if="element.attributes.orderable.urls.create_item_url"
class="btn btn-light step-checklist-add-item"
class="btn btn-light btn-sm step-checklist-add-item"
tabindex="0"
@keyup.enter="addItem"
@click="addItem">

View file

@ -39,10 +39,10 @@
</div>
</div>
<div class="step-element-controls">
<button v-if="!checklistItem.attributes.urls || updateUrl" class="btn icon-btn btn-light" @click="enableTextEdit" tabindex="0">
<button v-if="!checklistItem.attributes.urls || updateUrl" class="btn icon-btn btn-light btn-sm" @click="enableTextEdit" tabindex="0">
<i class="sn-icon sn-icon-edit"></i>
</button>
<button v-if="!checklistItem.attributes.urls || deleteUrl" class="btn icon-btn btn-light" @click="showDeleteModal" tabindex="0">
<button v-if="!checklistItem.attributes.urls || deleteUrl" class="btn icon-btn btn-light btn-sm" @click="showDeleteModal" tabindex="0">
<i class="sn-icon sn-icon-delete"></i>
</button>
</div>

View file

@ -106,7 +106,7 @@
},
toggleColumnsFilters(e) {
e.stopPropagation();
$('.filters-columns-list').scrollTo(0);
$('.filters-columns-list').scrollTop(0);
this.closeSavedFilters();
$('#filtersColumnsDropdown').toggleClass('open');
},
@ -146,7 +146,7 @@
},
toggleSavedFilters(e) {
e.stopPropagation();
$('.saved-filters-list').scrollTo(0);
$('.saved-filters-list').scrollTop(0);
if (this.savedFilterScrollbar) {
this.savedFilterScrollbar.update();
} else {

View file

@ -11,7 +11,7 @@
<template v-if="!isPreset">
<div class="datetime-filter-attributes">
<div class="filter-datepicker-input">
<DateTimePicker @change="updateDate" :selectorId="`DatePicker${filter.id}`" :defaultValue="date || fallbackDate()" />
<DateTimePicker @change="updateDate" :selectorId="`DatePicker${filter.id}`" :defaultValue="null" />
</div>
<div class="between-delimiter vertical" v-if="operator == 'between'"></div>
<div class="filter-datepicker-to-input">

View file

@ -153,7 +153,7 @@
description: i.attributes.description || ''
}
}
})
}).sort((temp1, temp2) => (temp1.label?.toLowerCase() > temp2.label?.toLowerCase() ? 1 : -1));
},
availablePrinters() {
return this.printers.map(i => {

View file

@ -1,6 +1,12 @@
<template>
<div class="datepicker sci-input-container right-icon">
<input @change="update" type="datetime" class="form-control calendar-input sci-input-field" :id="this.selectorId" placeholder="" />
<input
@change="update"
type="datetime"
class="form-control calendar-input sci-input-field"
:id="this.selectorId"
placeholder='dd/mm/yyyy'
/>
<i class="sn-icon sn-icon-calendar"></i>
</div>
</template>
@ -11,7 +17,7 @@
props: {
selectorId: { type: String, required: true },
useCurrent: { type: Boolean, default: true },
defaultValue: { type: Date, default: true }
defaultValue: { type: Date, default: null }
},
mounted() {
$("#" + this.selectorId).datetimepicker(
@ -22,14 +28,16 @@
format: this.dateFormat,
date: this.defaultValue
}
);
this.update($("#" + this.selectorId).data("DateTimePicker").date());
);
$("#" + this.selectorId).on('dp.change', (e) => this.update(e.date))
},
methods: {
update(value) {
this.$emit('change', (value._isAMomentObject) ? value.toDate() : '');
}
},
isValidDate(date) {
return (date instanceof Date) && !isNaN(date.getTime());
},
}
}
</script>

View file

@ -34,6 +34,7 @@
this.updateDateTime();
},
getTime(dateTime) {
if(!this.isValidDate(dateTime)) return
return `${dateTime.getHours().toString().padStart(2, '0')}:${dateTime.getMinutes().toString().padStart(2, '0')}`
},
updateTime(value) {

View file

@ -20,10 +20,10 @@
</div>
</div>
<template v-if="editing">
<div :class="{ 'btn-primary': !error, 'btn-disabled': error }" class="sci-inline-edit__control btn icon-btn" @click="update">
<div :class="{ 'btn-primary': !error, 'btn-disabled': error }" class="sci-inline-edit__control btn btn-sm icon-btn" @click="update">
<i class="sn-icon sn-icon-check"></i>
</div>
<div class="sci-inline-edit__control btn btn-light icon-btn" @mousedown="cancelEdit">
<div class="sci-inline-edit__control btn btn-light btn-sm icon-btn" @mousedown="cancelEdit">
<i class="sn-icon sn-icon-close"></i>
</div>
</template>

View file

@ -223,7 +223,7 @@ class TeamZipExport < ZipExport
file_name = preview.image.filename.to_s
file_data = preview.image.download
else
file_name = preview.filename.to_s
file_name = preview.blob.filename.to_s
begin
file_data = preview.processed.service.download(preview.key)

View file

@ -4,9 +4,13 @@ module Api
module V1
class ChecklistSerializer < ActiveModel::Serializer
type :checklists
attributes :id, :name
attributes :id, :name, :position
has_many :checklist_items, serializer: ChecklistItemSerializer
def position
object.step_orderable_element.position
end
include TimestampableModel
end
end

View file

@ -4,12 +4,16 @@ module Api
module V1
class ResultTableSerializer < ActiveModel::Serializer
type :result_tables
attributes :table_id, :table_contents, :metadata
attributes :table_id, :table_contents, :table_metadata
def table_id
object.table&.id
end
def table_metadata
object.table&.metadata
end
def table_contents
object.table&.contents&.force_encoding(Encoding::UTF_8)
end

View file

@ -4,13 +4,17 @@ module Api
module V1
class StepTextSerializer < ActiveModel::Serializer
type :step_texts
attributes :id, :text
attributes :id, :text, :position
include TimestampableModel
def contents
object.text&.force_encoding(Encoding::UTF_8)
end
def position
object.step_orderable_element.position
end
end
end
end

View file

@ -4,13 +4,17 @@ module Api
module V1
class TableSerializer < ActiveModel::Serializer
type :tables
attributes :id, :name, :contents, :metadata
attributes :id, :name, :contents, :metadata, :position
include TimestampableModel
def contents
object.contents&.force_encoding(Encoding::UTF_8)
end
def position
object.step_table&.step_orderable_element&.position
end
end
end
end

View file

@ -10,6 +10,7 @@ module Api
payload[:exp] = Rails.configuration.x.core_api_token_ttl.from_now.to_i
end
payload[:iss] = Rails.configuration.x.core_api_token_iss
payload[:salt] = SecureRandom.base64(30)
JWT.encode(payload, KEY_SECRET, Rails.configuration.x.core_api_sign_alg)
end

View file

@ -26,9 +26,8 @@ module SmartAnnotations
return "<span class='sa-type'>Exp</span>#{object.name} #{I18n.t('atwho.res.archived')}"
end
"<a class='sa-link' href='#{ROUTES.my_modules_experiment_path(object)}'>
<span class='sa-type'>Exp</span>#{object.name}
</a>"
"<a class='sa-link' href='#{ROUTES.my_modules_experiment_path(object)}'>" \
"<span class='sa-type'>Exp</span>#{object.name}</a>"
end
def generate_tsk_snippet(_, object)

View file

@ -53,7 +53,7 @@ module WopiUtil
# Currently only saves Excel, Word and PowerPoint view and edit actions
def initialize_discovery
Rails.cache.fetch(:wopi_discovery, expires_in: DISCOVERY_TTL) do
@doc = Nokogiri::XML(Kernel.open(ENV['WOPI_DISCOVERY_URL']))
@doc = Nokogiri::XML(Net::HTTP.get(URI(ENV.fetch('WOPI_DISCOVERY_URL', nil))))
discovery_json = {}
key = @doc.xpath('//proof-key')
discovery_json[:proof_key_mod] = key.xpath('@modulus').first.value

View file

@ -1,32 +0,0 @@
<li class="activity-item">
<span class="activity-item-date">
<%= l activity.created_at, format: :full %>
</span>
<span class="activity-item-text">
<%= activity_truncate(activity.message) %>
<% if activity.my_module %>
[<%=t 'Project' %>:
<% if activity.my_module.experiment.project.name.length >
Constants::NAME_TRUNCATION_LENGTH %>
<div class="modal-tooltip">
<%= truncate(activity.my_module.experiment.project.name,
lenght: Constants::NAME_TRUNCATION_LENGTH).strip %>
<span class="modal-tooltiptext"><%= activity.my_module.experiment.project.name %></span>
</div>
<% else %>
<%= activity.my_module.experiment.project.name %>
<% end %>, <%=t 'Module' %>:
<% if activity.my_module.name.length >
Constants::NAME_TRUNCATION_LENGTH %>
<div class="modal-tooltip"><%= truncate(
activity.my_module.name,
lenght: Constants::NAME_TRUNCATION_LENGTH) %>
<span class="modal-tooltiptext"><%= activity.my_module.name %></span>
</div>
<% else %>
<%= activity.my_module.name %>
<% end %>
]
<% end %>
</span>
</li>

View file

@ -1,3 +0,0 @@
<% activities.each_with_index do |activity, index| %>
<%= render 'activity', activity: activity %>
<% end %>

View file

@ -1,27 +0,0 @@
<% provide :head_title, t('nav.label.activities') %>
<div class="content-pane">
<div class="container" id="global-activity-page">
<div>
<ul id="list-activities" class="no-style content-activities">
<% if @vars[:activities].blank? %>
<li><em><%= t'activities.index.no_activities' %></em></li>
<% else %>
<% @vars[:activities].each do |activity| %>
<%= render 'activity', activity: activity %>
<% end %>
<% end %>
</ul>
<% if @vars[:more_activities_url].present? && @vars[:page] == 1 %>
<div class="text-center">
<a class="btn btn-secondary btn-more-activities"
href="<%= @vars[:more_activities_url] %>"
data-remote="true">
<%= t'activities.index.more_activities' %></a>
</div>
<% end %>
</div>
</div>
</div>
<%= javascript_include_tag 'activities/index.js' %>

View file

@ -88,7 +88,8 @@
</a>
</li>
<li role="presentation">
<a class="btn btn-light task-card-view-activities" href="<%= activities_my_module_url(id: my_module.id) %>" aria-controls="<%= my_module.id %>_activities" role="tab">
<a class="btn btn-light task-card-view-activities" href="<%= activities_my_module_url(id: my_module.id, view_mode: my_module.archived_branch? ? 'archived' : 'active') %>"
aria-controls="<%= my_module.id %>_activities" role="tab">
<span class="sn-icon sn-icon-activities" aria-hidden="true"></span>
</a>
</li>

View file

@ -8,7 +8,7 @@
</h4>
</div>
<div class="modal-body">
<p><%= t("experiments.table.column_display_modal.description") %></p>
<p class='modal-description'><%= t("experiments.table.column_display_modal.description") %></p>
<% Experiments::TableViewService::COLUMNS.each do |col| %>
<div class="column-container <%= col %> visible">
<% if col == :archived && params[:view_mode] != 'archived' %>

View file

@ -19,9 +19,9 @@
<div class="header-actions experiment-header">
<% if action_name == 'table' %>
<%= render partial: 'table_filters' %>
<button id="taskDataDisplay" class="btn btn-light btn-black icon-btn" data-toggle="modal" data-target="#tableDisplayModal">
<i class="sn-icon sn-icon sn-icon-reports"></i>
</button>
<button id="taskDataDisplay" class="btn btn-light btn-black icon-btn" data-toggle="modal" data-target="#tableDisplayModal" title="<%= t('experiments.table.toolbar.manage_columns_tooltip') %>">
<i class="sn-icon sn-icon sn-icon-reports"></i>
</button>
<div class="dropdown sort-menu" title="<%= t("general.sort.title") %>">
<button class="btn btn-light btn-black icon-btn dropdown-toggle" type="button" id="sortMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="sn-icon sn-icon-sort-up"></i>

View file

@ -18,7 +18,7 @@
<% end %>
</a>
<a class="p-4 border-b-4 border-transparent hover:no-underline capitalize <%= is_module_activities? ? "text-sn-blue" : "text-sn-grey" %>"
href="<%= activities_my_module_url(@my_module) %>"
href="<%= activities_my_module_url(@my_module, view_mode: params[:view_mode]) %>"
title="<%= t("nav2.modules.activities") %>"
>
<%= t("nav2.modules.activities") %>

View file

@ -131,6 +131,8 @@
data-repositories-list-url="<%= my_module_repositories_list_html_path(@my_module) %>">
<%= render partial: "my_modules/repositories/repositories_list" %>
</div>
<%= render partial: "my_modules/repositories/full_view_modal" %>
</div>
<!-- Protocol -->
<div class="task-section">
@ -148,7 +150,6 @@
</div>
</div>
<%= render partial: "my_modules/repositories/full_view_modal" %>
<%= render partial: "my_modules/modals/update_repository_records_modal" %>

View file

@ -1,4 +1,6 @@
<%= form_with url: update_consumption_my_module_repository_path(@my_module, @repository, module_row_id: @module_repository_row), method: :post, remote: true do |f| %>
<%= form_with url: update_consumption_my_module_repository_path(@my_module, @repository, module_row_id: @module_repository_row),
method: :post,
html: { data: { remote: true } } do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="<%= t('general.close') %>">
<span aria-hidden="true">&times;</span>

View file

@ -5,7 +5,7 @@
</div>
<div class="collapse-buttons sci-btn-group">
<button class="btn btn-light collapse-all">
<i class="sn-icon sn-icon-open-show"></i>
<i class="sn-icon sn-icon-up"></i>
<%= t("projects.reports.wizard.second_step.collapse_all") %>
</button>
<button class="btn btn-light expand-all">

View file

@ -55,7 +55,7 @@
</span><br>
<span class="repositories-items-description">
<i class="sn-icon sn-icon-info"></i>
<%= t("projects.reports.wizard.third_step.assigned_items_description") %>
<span><%= t("projects.reports.wizard.third_step.assigned_items_description") %></span>
</span>
<ul class="collapse in" id="repositoriesContents">
<li>

View file

@ -12,7 +12,7 @@
role: 'search' do %>
<div class="form-group">
<div class="input-group">
<input class="form-control"
<input class="form-control min-h-[2.5rem]"
type="text"
name="q"
placeholder="<%= t('nav.search') %>"

View file

@ -6,7 +6,7 @@
<%= form_tag search_path, method: :get, id: 'search-bar', class: 'navbar-form navbar-left', role: 'search' do %>
<div class="form-group">
<div class="input-group">
<input class="form-control" type="text" name="q" placeholder="<%= t('nav.search') %>">
<input class="form-control min-h-[2.5rem]" type="text" name="q" placeholder="<%= t('nav.search') %>">
<span class="input-group-btn">
<button id="search-button" class="btn btn-secondary" type="submit">
<span class="sn-icon sn-icon-search"></span>

View file

@ -21,7 +21,11 @@
data-full-name="<%= user.full_name %>"
data-email="<%= user.email %>"
data-popover-html="<%= popover_html %>"
data-user-avatar-popover-absolute-url="<%= user_avatar_absolute_url(user, :thumb, true) %>"
data-user-avatar-popover-absolute-url="<%= user_avatar_absolute_url(
user,
:thumb,
base64_encoded_imgs
) %>"
>
<%= user.full_name %>
</a>

View file

@ -87,7 +87,6 @@ Rails.application.config.assets.precompile += %w(repositories/share_modal.js)
Rails.application.config.assets.precompile += %w(repositories/edit.js)
Rails.application.config.assets.precompile += %w(repositories/stock.js)
Rails.application.config.assets.precompile += %w(repositories/repository_datatable.js)
Rails.application.config.assets.precompile += %w(activities/index.js)
Rails.application.config.assets.precompile += %w(global_activities/index.js)
Rails.application.config.assets.precompile += %w(repositories/show.js)
Rails.application.config.assets.precompile += %w(sidebar_toggle.js)

View file

@ -11,7 +11,7 @@ ActiveSupport::Reloader.to_prepare do
policy.font_src :self, :https, :data
policy.img_src :self, :https, :data, :blob
policy.object_src :none
policy.script_src :self, :unsafe_eval
policy.script_src :self, :unsafe_eval, *Extends::EXTERNAL_SERVICES
policy.style_src :self, :https, :unsafe_inline, :data
policy.connect_src :self, :data, *Extends::EXTERNAL_SERVICES

View file

@ -1451,6 +1451,7 @@ en:
duplicate: 'Duplicate'
task_access: 'Task access'
task_data: 'Task data display'
manage_columns_tooltip: "Manage columns"
my_module_actions:
title: 'TASK ACTIONS'
edit: 'Edit'

View file

@ -512,7 +512,7 @@ en:
protocol_repository: "Protocol templates"
team: "Team"
exports: "Exports"
label_repository: "Label repository"
label_templates: "Label templates"
subject_name:
repository: "Inventory"
project: "Project"

View file

@ -28,8 +28,6 @@ Rails.application.routes.draw do
end
end
resources :activities, only: [:index]
get '/jobs/:id/status', to: 'active_jobs#status'
get 'forbidden', to: 'application#forbidden', as: 'forbidden'