Fix merging issues

This commit is contained in:
Anton Ignatov 2019-07-12 15:47:15 +02:00
parent ffd415d409
commit ba1d6d45ca
6 changed files with 11 additions and 20 deletions

View file

@ -572,7 +572,7 @@ var FilePreviewModal = (function() {
modal.find('.file-preview-container')
.append($('<img>')
.attr('src', data['large-preview-url'])
.attr('alt', data.name)
.attr('alt', data.file_name)
.click(function(ev) {
ev.stopPropagation();
}));

View file

@ -33,7 +33,6 @@ class AssetsController < ApplicationController
elsif @assoc.class == RepositoryCell
can_manage_repository_rows?(@repository.team)
end
if response_json['type'] == 'image'
if ['image/jpeg', 'image/pjpeg'].include? @asset.file.content_type
response_json['quality'] = @asset.file_image_quality || 90

View file

@ -27,19 +27,10 @@ class MarvinJsAssetsController < ApplicationController
end
end
def destroy
asset = current_team.marvin_js_assets.find_by_id(params[:id])
if asset.destroy
render json: { id: asset.id }
else
render json: { error: t('marvinjs.no_sketches_found') }, status: :unprocessable_entity
end
end
def update
asset = MarvinJsService.update_sketch(marvin_params, current_user)
if asset
render json: { url: asset.url, id: asset.id }
render json: { url: asset.medium_preview, id: asset.id }
else
render json: { error: t('marvinjs.no_sketches_found') }, status: :unprocessable_entity
end

View file

@ -198,13 +198,13 @@ class Asset < ApplicationRecord
end
def medium_preview
return file.variant(resize: Constants::MEDIUM_PIC_FORMAT) if previewable_image?
return file.variant(resize: Constants::MEDIUM_PIC_FORMAT).processed.service_url if previewable_image?
file.preview(resize: Constants::MEDIUM_PIC_FORMAT)
end
def large_preview
return file.variant(resize: Constants::LARGE_PIC_FORMAT) if previewable_image?
return file.variant(resize: Constants::LARGE_PIC_FORMAT).processed.service_url if previewable_image?
file.preview(resize: Constants::LARGE_PIC_FORMAT)
end
@ -257,7 +257,7 @@ class Asset < ApplicationRecord
end
def image?
content_type == %r{^image/#{Regexp.union(Constants::WHITELISTED_IMAGE_TYPES)}}
content_type =~ %r{^image/#{Regexp.union(Constants::WHITELISTED_IMAGE_TYPES)}}
end
def text?

View file

@ -41,7 +41,7 @@ class Team < ApplicationRecord
has_many :repositories, dependent: :destroy
has_many :reports, inverse_of: :team, dependent: :destroy
has_many :activities, inverse_of: :team, dependent: :destroy
has_many :marvin_js_assets, inverse_of: :team, dependent: :destroy
has_many :assets, inverse_of: :team, dependent: :destroy
attr_accessor :without_templates
attr_accessor :without_intro_demo

View file

@ -1765,10 +1765,11 @@ en:
complete_title: "Complete Step"
uncomplete_title: "Uncomplete Step"
attachments:
sort_new: "Newest first &#8595;"
sort_old: "Oldest first &#8593;"
sort_atoz: "Name &#8595;"
sort_ztoa: "Name &#8593;"
sort:
new_html: "Newest first &#8595;"
old_html: "Oldest first &#8593;"
atoz_html: "Name &#8595;"
ztoa_html: "Name &#8593;"
new:
add_step_title: "Add new step"
tab_checklists: "Checklists"