mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 20:05:55 +08:00
cleanup direct upload
This commit is contained in:
parent
310b61ec12
commit
ac52e643be
18 changed files with 59 additions and 144 deletions
1
Gemfile
1
Gemfile
|
@ -55,6 +55,7 @@ gem 'deface', '~> 1.0'
|
||||||
gem 'nokogiri' # HTML/XML parser
|
gem 'nokogiri' # HTML/XML parser
|
||||||
gem 'sneaky-save', git: 'git://github.com/einzige/sneaky-save.git'
|
gem 'sneaky-save', git: 'git://github.com/einzige/sneaky-save.git'
|
||||||
gem 'rails_autolink', '~> 1.1', '>= 1.1.6'
|
gem 'rails_autolink', '~> 1.1', '>= 1.1.6'
|
||||||
|
gem 'delayed_paperclip'
|
||||||
|
|
||||||
gem 'paperclip', '~> 4.3' # File attachment, image attachment library
|
gem 'paperclip', '~> 4.3' # File attachment, image attachment library
|
||||||
gem 'aws-sdk', '~> 2.2.8'
|
gem 'aws-sdk', '~> 2.2.8'
|
||||||
|
|
|
@ -120,6 +120,9 @@ GEM
|
||||||
delayed_job_active_record (4.1.0)
|
delayed_job_active_record (4.1.0)
|
||||||
activerecord (>= 3.0, < 5)
|
activerecord (>= 3.0, < 5)
|
||||||
delayed_job (>= 3.0, < 5)
|
delayed_job (>= 3.0, < 5)
|
||||||
|
delayed_paperclip (3.0.1)
|
||||||
|
activejob (>= 4.2)
|
||||||
|
paperclip (>= 3.3)
|
||||||
devise (3.5.6)
|
devise (3.5.6)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
|
@ -246,6 +249,8 @@ GEM
|
||||||
rainbow (2.1.0)
|
rainbow (2.1.0)
|
||||||
rake (11.2.2)
|
rake (11.2.2)
|
||||||
rdoc (4.2.0)
|
rdoc (4.2.0)
|
||||||
|
recaptcha (4.0.0)
|
||||||
|
json
|
||||||
remotipart (1.2.1)
|
remotipart (1.2.1)
|
||||||
responders (2.2.0)
|
responders (2.2.0)
|
||||||
railties (>= 4.2.0, < 5.1)
|
railties (>= 4.2.0, < 5.1)
|
||||||
|
@ -352,6 +357,7 @@ DEPENDENCIES
|
||||||
commit_param_routing
|
commit_param_routing
|
||||||
deface (~> 1.0)
|
deface (~> 1.0)
|
||||||
delayed_job_active_record
|
delayed_job_active_record
|
||||||
|
delayed_paperclip
|
||||||
devise (= 3.5.6)
|
devise (= 3.5.6)
|
||||||
devise-async
|
devise-async
|
||||||
devise_invitable
|
devise_invitable
|
||||||
|
@ -379,6 +385,7 @@ DEPENDENCIES
|
||||||
rails (= 4.2.5)
|
rails (= 4.2.5)
|
||||||
rails_12factor
|
rails_12factor
|
||||||
rails_autolink (~> 1.1, >= 1.1.6)
|
rails_autolink (~> 1.1, >= 1.1.6)
|
||||||
|
recaptcha
|
||||||
remotipart (~> 1.2)
|
remotipart (~> 1.2)
|
||||||
rgl
|
rgl
|
||||||
roo (~> 2.1.0)
|
roo (~> 2.1.0)
|
||||||
|
|
|
@ -149,8 +149,8 @@ var ResultTypeEnum = Object.freeze({
|
||||||
COMMENT: 3
|
COMMENT: 3
|
||||||
});
|
});
|
||||||
|
|
||||||
function processResult(ev, resultTypeEnum, editMode, forS3) {
|
function processResult(ev, resultTypeEnum, editMode) {
|
||||||
forS3 = (typeof forS3 !== 'undefined') ? forS3 : false;
|
|
||||||
var $form = $(ev.target.form);
|
var $form = $(ev.target.form);
|
||||||
$form.clearFormErrors();
|
$form.clearFormErrors();
|
||||||
|
|
||||||
|
@ -164,14 +164,9 @@ function processResult(ev, resultTypeEnum, editMode, forS3) {
|
||||||
editMode);
|
editMode);
|
||||||
|
|
||||||
if(nameValid && filesValid) {
|
if(nameValid && filesValid) {
|
||||||
if(forS3) {
|
|
||||||
// Redirects file uploading to S3
|
|
||||||
var url = '/asset_signature.json';
|
|
||||||
directUpload(ev, url);
|
|
||||||
} else {
|
|
||||||
// Local file uploading
|
// Local file uploading
|
||||||
animateSpinner();
|
animateSpinner();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ResultTypeEnum.TABLE:
|
case ResultTypeEnum.TABLE:
|
||||||
|
|
|
@ -495,7 +495,7 @@ $("[data-action='new-step']").on("ajax:success", function(e, data) {
|
||||||
// Needed because server-side validation failure clears locations of
|
// Needed because server-side validation failure clears locations of
|
||||||
// files to be uploaded and checklist's items etc. Also user
|
// files to be uploaded and checklist's items etc. Also user
|
||||||
// experience is improved
|
// experience is improved
|
||||||
function processStep(ev, editMode, forS3) {
|
function processStep(ev, editMode) {
|
||||||
var $form = $(ev.target.form);
|
var $form = $(ev.target.form);
|
||||||
$form.clearFormErrors();
|
$form.clearFormErrors();
|
||||||
$form.removeBlankExcelTables(editMode);
|
$form.removeBlankExcelTables(editMode);
|
||||||
|
@ -513,15 +513,9 @@ function processStep(ev, editMode, forS3) {
|
||||||
<%= Constants::TEXT_MAX_LENGTH %>);
|
<%= Constants::TEXT_MAX_LENGTH %>);
|
||||||
|
|
||||||
if (filesValid && checklistsValid && nameValid && descriptionValid) {
|
if (filesValid && checklistsValid && nameValid && descriptionValid) {
|
||||||
if (forS3) {
|
|
||||||
// Redirects file uploading to S3
|
|
||||||
var url = '/asset_signature.json';
|
|
||||||
directUpload(ev, url);
|
|
||||||
} else {
|
|
||||||
// Local file uploading
|
// Local file uploading
|
||||||
animateSpinner();
|
animateSpinner();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand all steps
|
// Expand all steps
|
||||||
|
|
|
@ -63,19 +63,13 @@ forms
|
||||||
$(this).renderFormErrors("user", data.responseJSON);
|
$(this).renderFormErrors("user", data.responseJSON);
|
||||||
});
|
});
|
||||||
|
|
||||||
function processFile(ev, forS3) {
|
function processFile(ev) {
|
||||||
var $form = $(ev.target.form);
|
var $form = $(ev.target.form);
|
||||||
$form.clearFormErrors();
|
$form.clearFormErrors();
|
||||||
|
|
||||||
var $fileInput = $form.find("input[type=file]");
|
var $fileInput = $form.find("input[type=file]");
|
||||||
if(filesValidator(ev, $fileInput, FileTypeEnum.AVATAR)) {
|
if(filesValidator(ev, $fileInput, FileTypeEnum.AVATAR)) {
|
||||||
if(forS3) {
|
|
||||||
// Redirects file uploading to S3
|
|
||||||
var url = "/avatar_signature.json";
|
|
||||||
directUpload(ev, url, true);
|
|
||||||
} else {
|
|
||||||
// Local file uploading
|
// Local file uploading
|
||||||
animateSpinner();
|
animateSpinner();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,11 @@ class AssetsController < ApplicationController
|
||||||
|
|
||||||
def preview
|
def preview
|
||||||
if @asset.is_image?
|
if @asset.is_image?
|
||||||
|
if @asset.file_content_type.include? %w(images/bmp images/tiff)
|
||||||
|
redirect_to @asset.url(:web_friendly), status: 307
|
||||||
|
else
|
||||||
redirect_to @asset.url(:medium), status: 307
|
redirect_to @asset.url(:medium), status: 307
|
||||||
|
end
|
||||||
else
|
else
|
||||||
render_400
|
render_400
|
||||||
end
|
end
|
||||||
|
@ -129,7 +133,7 @@ class AssetsController < ApplicationController
|
||||||
posts.push({
|
posts.push({
|
||||||
url: s3_post.url,
|
url: s3_post.url,
|
||||||
fields: s3_post.fields,
|
fields: s3_post.fields,
|
||||||
style_option: option,
|
style_option: option.is_a?(Array) ? option[0] : option,
|
||||||
mime_type: asset.file_content_type
|
mime_type: asset.file_content_type
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
@ -334,7 +334,6 @@ class MyModulesController < ApplicationController
|
||||||
private
|
private
|
||||||
|
|
||||||
def load_vars
|
def load_vars
|
||||||
@direct_upload = ENV['PAPERCLIP_DIRECT_UPLOAD'] == "true"
|
|
||||||
@my_module = MyModule.find_by_id(params[:id])
|
@my_module = MyModule.find_by_id(params[:id])
|
||||||
if @my_module
|
if @my_module
|
||||||
@experiment = @my_module.experiment
|
@experiment = @my_module.experiment
|
||||||
|
|
|
@ -3,7 +3,6 @@ class ResultAssetsController < ApplicationController
|
||||||
|
|
||||||
before_action :load_vars, only: [:edit, :update, :download]
|
before_action :load_vars, only: [:edit, :update, :download]
|
||||||
before_action :load_vars_nested, only: [:new, :create]
|
before_action :load_vars_nested, only: [:new, :create]
|
||||||
before_action :load_paperclip_vars
|
|
||||||
|
|
||||||
before_action :check_create_permissions, only: [:new, :create]
|
before_action :check_create_permissions, only: [:new, :create]
|
||||||
before_action :check_edit_permissions, only: [:edit, :update]
|
before_action :check_edit_permissions, only: [:edit, :update]
|
||||||
|
@ -18,16 +17,11 @@ class ResultAssetsController < ApplicationController
|
||||||
)
|
)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json {
|
format.json do
|
||||||
render json: {
|
render json: {
|
||||||
html: render_to_string({
|
html: render_to_string(partial: 'new.html.erb')
|
||||||
partial: "new.html.erb",
|
|
||||||
locals: {
|
|
||||||
direct_upload: @direct_upload
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -87,16 +81,11 @@ class ResultAssetsController < ApplicationController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json {
|
format.json do
|
||||||
render json: {
|
render json: {
|
||||||
html: render_to_string({
|
html: render_to_string(partial: 'edit.html.erb')
|
||||||
partial: "edit.html.erb",
|
|
||||||
locals: {
|
|
||||||
direct_upload: @direct_upload
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, status: :ok
|
}, status: :ok
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -188,10 +177,6 @@ class ResultAssetsController < ApplicationController
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def load_paperclip_vars
|
|
||||||
@direct_upload = ENV['PAPERCLIP_DIRECT_UPLOAD'] == "true"
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_vars
|
def load_vars
|
||||||
@result_asset = ResultAsset.find_by_id(params[:id])
|
@result_asset = ResultAsset.find_by_id(params[:id])
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
class StepsController < ApplicationController
|
class StepsController < ApplicationController
|
||||||
before_action :load_vars, only: [:edit, :update, :destroy, :show]
|
before_action :load_vars, only: [:edit, :update, :destroy, :show]
|
||||||
before_action :load_vars_nested, only: [:new, :create]
|
before_action :load_vars_nested, only: [:new, :create]
|
||||||
before_action :load_paperclip_vars
|
|
||||||
before_action :convert_table_contents_to_utf8, only: [:create, :update]
|
before_action :convert_table_contents_to_utf8, only: [:create, :update]
|
||||||
|
|
||||||
before_action :check_view_permissions, only: [:show]
|
before_action :check_view_permissions, only: [:show]
|
||||||
|
@ -15,41 +14,16 @@ class StepsController < ApplicationController
|
||||||
@step = Step.new
|
@step = Step.new
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json {
|
format.json do
|
||||||
render json: {
|
render json: {
|
||||||
html: render_to_string({
|
html: render_to_string(partial: 'new.html.erb')
|
||||||
partial: "new.html.erb",
|
|
||||||
locals: {
|
|
||||||
direct_upload: @direct_upload
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if @direct_upload
|
|
||||||
new_assets = []
|
|
||||||
step_data = step_params.except(:assets_attributes)
|
|
||||||
step_assets = step_params.slice(:assets_attributes)
|
|
||||||
@step = Step.new(step_data)
|
|
||||||
|
|
||||||
unless step_assets[:assets_attributes].nil?
|
|
||||||
step_assets[:assets_attributes].each do |_i, data|
|
|
||||||
# Ignore destroy requests on create
|
|
||||||
next if data[:_destroy].present?
|
|
||||||
|
|
||||||
asset = Asset.new(data)
|
|
||||||
asset.created_by = current_user
|
|
||||||
asset.last_modified_by = current_user
|
|
||||||
new_assets << asset
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@step.assets << new_assets
|
|
||||||
else
|
|
||||||
@step = Step.new(step_params)
|
@step = Step.new(step_params)
|
||||||
end
|
|
||||||
|
|
||||||
@step.completed = false
|
@step.completed = false
|
||||||
@step.position = @protocol.number_of_steps
|
@step.position = @protocol.number_of_steps
|
||||||
|
@ -107,12 +81,7 @@ class StepsController < ApplicationController
|
||||||
|
|
||||||
format.json {
|
format.json {
|
||||||
render json: {
|
render json: {
|
||||||
html: render_to_string({
|
html: render_to_string(partial: 'new.html.erb')
|
||||||
partial: "new.html.erb",
|
|
||||||
locals: {
|
|
||||||
direct_upload: @direct_upload
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, status: :bad_request
|
}, status: :bad_request
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -121,26 +90,26 @@ class StepsController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json {
|
format.json do
|
||||||
render json: {
|
render json: {
|
||||||
html: render_to_string({
|
html: render_to_string(
|
||||||
partial: "steps/step.html.erb", locals: {step: @step}
|
partial: 'steps/step.html.erb',
|
||||||
})}, status: :ok
|
locals: { step: @step }
|
||||||
}
|
)
|
||||||
|
},
|
||||||
|
status: :ok
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json {
|
format.json do
|
||||||
render json: {
|
render json: {
|
||||||
html: render_to_string({
|
html: render_to_string(partial: 'edit.html.erb')
|
||||||
partial: "edit.html.erb",
|
},
|
||||||
locals: {
|
status: :ok
|
||||||
direct_upload: @direct_upload
|
end
|
||||||
}
|
|
||||||
})}, status: :ok
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -155,23 +124,6 @@ class StepsController < ApplicationController
|
||||||
# NOTE - step_params_all variable is updated
|
# NOTE - step_params_all variable is updated
|
||||||
destroy_attributes(step_params_all)
|
destroy_attributes(step_params_all)
|
||||||
|
|
||||||
if @direct_upload
|
|
||||||
step_data = step_params_all.except(:assets_attributes)
|
|
||||||
step_assets = step_params_all.slice(:assets_attributes)
|
|
||||||
step_params_all = step_data
|
|
||||||
|
|
||||||
if step_assets.include? :assets_attributes
|
|
||||||
step_assets[:assets_attributes].each do |i, data|
|
|
||||||
asset = Asset.new(data)
|
|
||||||
unless @step.assets.include? asset or not asset
|
|
||||||
asset.created_by = current_user
|
|
||||||
asset.last_modified_by = current_user
|
|
||||||
@step.assets << asset
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@step.assign_attributes(step_params_all)
|
@step.assign_attributes(step_params_all)
|
||||||
@step.last_modified_by = current_user
|
@step.last_modified_by = current_user
|
||||||
|
|
||||||
|
@ -566,10 +518,6 @@ class StepsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_paperclip_vars
|
|
||||||
@direct_upload = ENV['PAPERCLIP_DIRECT_UPLOAD'] == "true"
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_vars
|
def load_vars
|
||||||
@step = Step.find_by_id(params[:id])
|
@step = Step.find_by_id(params[:id])
|
||||||
@protocol = @step.protocol
|
@protocol = @step.protocol
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
class Users::RegistrationsController < Devise::RegistrationsController
|
class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
before_action :load_paperclip_vars
|
|
||||||
prepend_before_action :check_captcha, only: [:create]
|
prepend_before_action :check_captcha, only: [:create]
|
||||||
|
|
||||||
def avatar
|
def avatar
|
||||||
|
@ -43,15 +42,6 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
def update_resource(resource, params)
|
def update_resource(resource, params)
|
||||||
@user_avatar_url = avatar_path(current_user, :thumb)
|
@user_avatar_url = avatar_path(current_user, :thumb)
|
||||||
|
|
||||||
if @direct_upload
|
|
||||||
if params.include? :avatar_file_name
|
|
||||||
file_name = params[:avatar_file_name]
|
|
||||||
file_ext = file_name.split(".").last
|
|
||||||
params[:avatar_content_type] = Rack::Mime.mime_type(".#{file_ext}")
|
|
||||||
resource.avatar.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if params.include? :change_password
|
if params.include? :change_password
|
||||||
# Special handling if changing password
|
# Special handling if changing password
|
||||||
params.delete(:change_password)
|
params.delete(:change_password)
|
||||||
|
@ -169,10 +159,6 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def load_paperclip_vars
|
|
||||||
@direct_upload = ENV['PAPERCLIP_DIRECT_UPLOAD'] == "true"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Called upon creating User (before .save). Permits parameters and extracts
|
# Called upon creating User (before .save). Permits parameters and extracts
|
||||||
# initials from :full_name (takes at most 4 chars). If :full_name is empty, it
|
# initials from :full_name (takes at most 4 chars). If :full_name is empty, it
|
||||||
# uses "PLCH" as a placeholder (user won't get error complaining about
|
# uses "PLCH" as a placeholder (user won't get error complaining about
|
||||||
|
|
|
@ -6,7 +6,8 @@ class Asset < ActiveRecord::Base
|
||||||
require 'tempfile'
|
require 'tempfile'
|
||||||
|
|
||||||
# Paperclip validation
|
# Paperclip validation
|
||||||
has_attached_file :file, styles: { medium: Constants::MEDIUM_PIC_FORMAT }
|
has_attached_file :file,
|
||||||
|
styles: { medium: [Constants::MEDIUM_PIC_FORMAT, :jpg] }
|
||||||
|
|
||||||
validates_attachment :file,
|
validates_attachment :file,
|
||||||
presence: true,
|
presence: true,
|
||||||
|
@ -20,6 +21,7 @@ class Asset < ActiveRecord::Base
|
||||||
do_not_validate_attachment_file_type :file
|
do_not_validate_attachment_file_type :file
|
||||||
|
|
||||||
before_file_post_process :is_image?
|
before_file_post_process :is_image?
|
||||||
|
process_in_background :file
|
||||||
|
|
||||||
# Asset validation
|
# Asset validation
|
||||||
# This could cause some problems if you create empty asset and want to
|
# This could cause some problems if you create empty asset and want to
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
data-module-protocols-step-text="<%=t 'tutorial.module_results_html' %>"
|
data-module-protocols-step-text="<%=t 'tutorial.module_results_html' %>"
|
||||||
data-module-protocols-click-samples-step-text="<%=t 'tutorial.module_results_click_samples_html' %>">
|
data-module-protocols-click-samples-step-text="<%=t 'tutorial.module_results_click_samples_html' %>">
|
||||||
<% ordered_result_of(@my_module).each do |result| %>
|
<% ordered_result_of(@my_module).each do |result| %>
|
||||||
<%= render partial: "result", locals: {result: result, direct_upload: @direct_upload} %>
|
<%= render partial: "result", locals: { result: result } %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<%= ff.file_field :file %>
|
<%= ff.file_field :file %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<hr>
|
<hr>
|
||||||
<%= f.submit t("result_assets.edit.update"), class: 'btn btn-primary save-result', onclick: "processResult(event, ResultTypeEnum.FILE, true, #{direct_upload});" %>
|
<%= f.submit t("result_assets.edit.update"), class: 'btn btn-primary save-result', onclick: "processResult(event, ResultTypeEnum.FILE, true);" %>
|
||||||
<button type="button" class="btn btn-default cancel-edit">
|
<button type="button" class="btn btn-default cancel-edit">
|
||||||
<%= t("general.cancel")%>
|
<%= t("general.cancel")%>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<%= f.fields_for :asset do |ff| %>
|
<%= f.fields_for :asset do |ff| %>
|
||||||
<%= ff.file_field :file %>
|
<%= ff.file_field :file %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= f.submit t("result_assets.new.create"), class: 'btn btn-primary save-result', onclick: "processResult(event, ResultTypeEnum.FILE, false, #{direct_upload});" %>
|
<%= f.submit t("result_assets.new.create"), class: 'btn btn-primary save-result', onclick: "processResult(event, ResultTypeEnum.FILE, false);" %>
|
||||||
<button type="button" class="btn btn-default cancel-new">
|
<button type="button" class="btn btn-default cancel-new">
|
||||||
<%= t("general.cancel")%>
|
<%= t("general.cancel")%>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<hr>
|
<hr>
|
||||||
<%= render partial: "empty_step.html.erb", locals: {step: @step, f: f} %>
|
<%= render partial: "empty_step.html.erb", locals: {step: @step, f: f} %>
|
||||||
<hr>
|
<hr>
|
||||||
<%= f.submit t("protocols.steps.edit.edit_step"), class: 'btn btn-primary step-save', onclick: "processStep(event, true, #{direct_upload});" %>
|
<%= f.submit t("protocols.steps.edit.edit_step"), class: 'btn btn-primary step-save', onclick: "processStep(event, true);" %>
|
||||||
<a type="button" data-action="cancel-edit" class="btn btn-default" href="<%= step_path(id: @step, format: :json) %>" data-remote="true">
|
<a type="button" data-action="cancel-edit" class="btn btn-default" href="<%= step_path(id: @step, format: :json) %>" data-remote="true">
|
||||||
<%= t("general.cancel")%>
|
<%= t("general.cancel")%>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<hr>
|
<hr>
|
||||||
<%= render partial: "empty_step.html.erb", locals: {step: @step, f: f} %>
|
<%= render partial: "empty_step.html.erb", locals: {step: @step, f: f} %>
|
||||||
<hr>
|
<hr>
|
||||||
<%= f.submit t("protocols.steps.new.add_step"), class: 'btn btn-primary step-save', onclick: "processStep(event, false, #{direct_upload});" %>
|
<%= f.submit t("protocols.steps.new.add_step"), class: 'btn btn-primary step-save', onclick: "processStep(event, false);" %>
|
||||||
<button type="button" data-action="cancel-new" class="btn btn-default">
|
<button type="button" data-action="cancel-new" class="btn btn-default">
|
||||||
<%= t("general.cancel")%>
|
<%= t("general.cancel")%>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a href="#" class="btn btn-default" data-action="cancel"><%=t "general.cancel" %></a>
|
<a href="#" class="btn btn-default" data-action="cancel"><%=t "general.cancel" %></a>
|
||||||
<%= f.submit t("users.registrations.edit.avatar_submit"), class: 'btn btn-primary', onclick: "processFile(event, #{@direct_upload});" %>
|
<%= f.submit t("users.registrations.edit.avatar_submit"), class: 'btn btn-primary', onclick: "processFile(event);" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -202,7 +202,7 @@ class Constants
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
WHITELISTED_IMAGE_TYPES = [
|
WHITELISTED_IMAGE_TYPES = [
|
||||||
'gif', 'jpeg', 'pjpeg', 'png', 'x-png', 'svg+xml', 'bmp'
|
'gif', 'jpeg', 'pjpeg', 'png', 'x-png', 'svg+xml', 'bmp', 'tiff'
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
# Very basic regex to check for validity of emails
|
# Very basic regex to check for validity of emails
|
||||||
|
|
Loading…
Add table
Reference in a new issue