Fix markup [SCI-6867]

This commit is contained in:
Anton 2022-06-03 15:26:16 +02:00
parent 2da1a380c3
commit 32273fe169
4 changed files with 42 additions and 31 deletions

View file

@ -24,7 +24,9 @@ module StepElements
render json: checklist_item, serializer: ChecklistItemSerializer, user: current_user
rescue ActiveRecord::RecordInvalid
render json: checklist_item, serializer: ChecklistItemSerializer, user: current_user, status: :unprocessable_entity
render json: checklist_item, serializer: ChecklistItemSerializer,
user: current_user,
status: :unprocessable_entity
end
def update
@ -55,7 +57,9 @@ module StepElements
render json: @checklist_item, serializer: ChecklistItemSerializer, user: current_user
rescue ActiveRecord::RecordInvalid
render json: @checklist_item, serializer: ChecklistItemSerializer, user: current_user, status: :unprocessable_entity
render json: @checklist_item, serializer: ChecklistItemSerializer,
user: current_user,
status: :unprocessable_entity
end
def destroy
@ -67,7 +71,9 @@ module StepElements
)
render json: @checklist_item, serializer: ChecklistItemSerializer, user: current_user
else
render json: @checklist_item, serializer: ChecklistItemSerializer, user: current_user, status: :unprocessable_entity
render json: @checklist_item, serializer: ChecklistItemSerializer,
user: current_user,
status: :unprocessable_entity
end
end

View file

@ -99,16 +99,20 @@ class AssetSerializer < ActiveModel::Serializer
load_asset: load_asset_path(object),
asset_file: asset_file_url_path(object),
marvin_js: marvin_js_asset_path(object),
marvin_js_icon: image_path('icon_small/marvinjs.svg'),
marvin_js_icon: image_path('icon_small/marvinjs.svg')
}
urls.merge!(
toggle_view_mode: toggle_view_mode_path(object),
edit_asset: edit_asset_path(object),
marvin_js_start_edit: start_editing_marvin_js_asset_path(object),
start_edit_image: start_edit_image_path(object),
delete: asset_destroy_path(object)
) if can_manage_asset?(object)
urls[:wopi_action] = object.get_action_url(@instance_options[:user], 'embedview') if wopi && can_manage_asset?(@asset)
if can_manage_asset?(object)
urls.merge!(
toggle_view_mode: toggle_view_mode_path(object),
edit_asset: edit_asset_path(object),
marvin_js_start_edit: start_editing_marvin_js_asset_path(object),
start_edit_image: start_edit_image_path(object),
delete: asset_destroy_path(object)
)
end
if wopi && can_manage_asset?(@asset)
urls[:wopi_action] = object.get_action_url(@instance_options[:user], 'embedview')
end
urls[:blob] = rails_blob_path(object.file, disposition: 'attachment') if object.file.attached?
urls

View file

@ -80,16 +80,16 @@ class ProtocolSerializer < ActiveModel::Serializer
end
def add_step_url
return unless (in_repository ? can_manage_protocol_in_repository?(object) : can_manage_my_module_steps?(object.my_module))
return unless can_manage_protocol_in_module?(object) || can_manage_protocol_in_repository?(object)
protocol_steps_path(protocol_id: object.id)
end
def update_protocol_url
if in_repository
protocol_path(@protocol) if can_manage_protocol_in_repository?(object)
else
protocol_my_module_path(object.my_module) if can_manage_protocol_in_module?(object)
if in_repository && can_manage_protocol_in_repository?(object)
protocol_path(@protocol)
elsif can_manage_protocol_in_module?(object)
protocol_my_module_path(object.my_module)
end
end
end

View file

@ -53,25 +53,26 @@ class StepSerializer < ActiveModel::Serializer
end
def urls
urls_list = {
elements_url: elements_step_path(object),
attachments_url: attachments_step_path(object)
}
urls_list.merge!({
delete_url: step_path(object),
state_url: toggle_step_state_step_path(object),
update_url: step_path(object),
create_table_url: step_tables_path(object),
create_text_url: step_texts_path(object),
create_checklist_url: step_checklists_path(object),
update_asset_view_mode_url: update_asset_view_mode_step_path(object),
update_view_state_step_url: update_view_state_step_path(object),
direct_upload_url: rails_direct_uploads_url,
upload_attachment_url: upload_attachment_step_path(object),
reorder_elements_url: reorder_step_step_orderable_elements_path(step_id: object.id)
}) if can_manage_step?(object)
if can_manage_step?(object)
urls_list.merge!({
delete_url: step_path(object),
state_url: toggle_step_state_step_path(object),
update_url: step_path(object),
create_table_url: step_tables_path(object),
create_text_url: step_texts_path(object),
create_checklist_url: step_checklists_path(object),
update_asset_view_mode_url: update_asset_view_mode_step_path(object),
update_view_state_step_url: update_view_state_step_path(object),
direct_upload_url: rails_direct_uploads_url,
upload_attachment_url: upload_attachment_step_path(object),
reorder_elements_url: reorder_step_step_orderable_elements_path(step_id: object.id)
})
end
urls_list
end