Migrate from Refile and Carrierwave to ActiveStorage
This commit is contained in:
parent
281b69e66d
commit
4c96ba1e9c
|
@ -23,3 +23,4 @@
|
|||
.sass-cache/
|
||||
/coverage/
|
||||
/db/structure.sql
|
||||
/storage/
|
13
Gemfile
13
Gemfile
|
@ -26,15 +26,6 @@ gem "simple_form"
|
|||
gem "phony"
|
||||
gem "phony_rails"
|
||||
|
||||
# Picture uploads
|
||||
gem "carrierwave"
|
||||
# gem 'rmagick'
|
||||
gem "mini_magick"
|
||||
|
||||
gem "refile", git: "https://github.com/refile/refile", require: ["refile/rails", "refile/simple_form"]
|
||||
gem "refile-mini_magick"
|
||||
gem "image_processing"
|
||||
|
||||
gem "puma", group: :production
|
||||
|
||||
gem "globalize"
|
||||
|
@ -74,10 +65,6 @@ group :development do
|
|||
gem "pry-rails"
|
||||
# gem 'hirb'
|
||||
gem "awesome_print"
|
||||
gem "capistrano"
|
||||
gem "capistrano-rails"
|
||||
gem 'capistrano-rvm'
|
||||
gem "capistrano3-puma"
|
||||
gem "better_errors"
|
||||
gem "binding_of_caller"
|
||||
end
|
||||
|
|
79
Gemfile.lock
79
Gemfile.lock
|
@ -1,11 +1,3 @@
|
|||
GIT
|
||||
remote: https://github.com/refile/refile
|
||||
revision: c4ac577c6fdad92bc079a62a0e82888319daedc8
|
||||
specs:
|
||||
refile (0.7.0)
|
||||
mime-types
|
||||
sinatra (>= 2.0.0, <= 3.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
|
@ -89,8 +81,6 @@ GEM
|
|||
tzinfo (~> 2.0)
|
||||
addressable (2.8.6)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
airbrussh (1.5.1)
|
||||
sshkit (>= 1.6.1, != 1.7.0)
|
||||
ast (2.4.2)
|
||||
autoprefixer-rails (10.4.16.0)
|
||||
execjs (~> 2)
|
||||
|
@ -122,23 +112,6 @@ GEM
|
|||
railties (>= 3.1)
|
||||
builder (3.2.4)
|
||||
byebug (11.1.3)
|
||||
capistrano (3.18.0)
|
||||
airbrussh (>= 1.0.0)
|
||||
i18n
|
||||
rake (>= 10.0.0)
|
||||
sshkit (>= 1.9.0)
|
||||
capistrano-bundler (2.1.0)
|
||||
capistrano (~> 3.1)
|
||||
capistrano-rails (1.6.3)
|
||||
capistrano (~> 3.1)
|
||||
capistrano-bundler (>= 1.1, < 3)
|
||||
capistrano-rvm (0.1.2)
|
||||
capistrano (~> 3.0)
|
||||
sshkit (~> 1.2)
|
||||
capistrano3-puma (5.2.0)
|
||||
capistrano (~> 3.7)
|
||||
capistrano-bundler
|
||||
puma (>= 4.0, < 6.0)
|
||||
capybara (3.40.0)
|
||||
addressable
|
||||
matrix
|
||||
|
@ -291,16 +264,11 @@ GEM
|
|||
marcel (1.0.2)
|
||||
matrix (0.4.2)
|
||||
method_source (1.0.0)
|
||||
mime-types (3.5.2)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2024.0206)
|
||||
mini_magick (4.12.0)
|
||||
mini_mime (1.1.5)
|
||||
mini_portile2 (2.8.5)
|
||||
minitest (5.22.2)
|
||||
msgpack (1.7.2)
|
||||
mustermann (3.0.0)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
mutex_m (0.2.0)
|
||||
nenv (0.3.0)
|
||||
nested_form (0.3.2)
|
||||
|
@ -313,13 +281,8 @@ GEM
|
|||
net-protocol
|
||||
net-protocol (0.2.2)
|
||||
timeout
|
||||
net-scp (4.0.0)
|
||||
net-ssh (>= 2.6.5, < 8.0.0)
|
||||
net-sftp (4.0.0)
|
||||
net-ssh (>= 5.0.0, < 8.0.0)
|
||||
net-smtp (0.4.0.1)
|
||||
net-protocol
|
||||
net-ssh (7.2.1)
|
||||
nio4r (2.7.0)
|
||||
nokogiri (1.16.2)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
|
@ -345,19 +308,17 @@ GEM
|
|||
psych (5.1.2)
|
||||
stringio
|
||||
public_suffix (5.0.4)
|
||||
puma (5.6.8)
|
||||
puma (6.4.2)
|
||||
nio4r (~> 2.0)
|
||||
racc (1.7.3)
|
||||
rack (2.2.8)
|
||||
rack-protection (3.0.0)
|
||||
rack
|
||||
rack-session (1.0.2)
|
||||
rack (< 3)
|
||||
rack (3.0.9)
|
||||
rack-session (2.0.0)
|
||||
rack (>= 3.0.0)
|
||||
rack-test (2.1.0)
|
||||
rack (>= 1.3)
|
||||
rackup (1.0.0)
|
||||
rack (< 3)
|
||||
webrick
|
||||
rackup (2.1.0)
|
||||
rack (>= 3)
|
||||
webrick (~> 1.8)
|
||||
rails (7.1.3)
|
||||
actioncable (= 7.1.3)
|
||||
actionmailbox (= 7.1.3)
|
||||
|
@ -403,9 +364,6 @@ GEM
|
|||
ffi (~> 1.0)
|
||||
rdoc (6.6.2)
|
||||
psych (>= 4.0.0)
|
||||
refile-mini_magick (0.2.0)
|
||||
mini_magick (~> 4.0)
|
||||
refile (~> 0.5)
|
||||
regexp_parser (2.9.0)
|
||||
reline (0.4.2)
|
||||
io-console (~> 0.5)
|
||||
|
@ -480,7 +438,7 @@ GEM
|
|||
sprockets-rails
|
||||
tilt
|
||||
search_object (1.2.5)
|
||||
selenium-webdriver (4.18.0)
|
||||
selenium-webdriver (4.18.1)
|
||||
base64 (~> 0.2)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 3.0)
|
||||
|
@ -495,11 +453,6 @@ GEM
|
|||
simplecov_json_formatter (~> 0.1)
|
||||
simplecov-html (0.12.3)
|
||||
simplecov_json_formatter (0.1.4)
|
||||
sinatra (3.0.0)
|
||||
mustermann (~> 3.0)
|
||||
rack (~> 2.2, >= 2.2.4)
|
||||
rack-protection (= 3.0.0)
|
||||
tilt (~> 2.0)
|
||||
slim (5.2.1)
|
||||
temple (~> 0.10.0)
|
||||
tilt (>= 2.1.0)
|
||||
|
@ -520,11 +473,6 @@ GEM
|
|||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.7.2)
|
||||
mini_portile2 (~> 2.8.0)
|
||||
sshkit (1.22.0)
|
||||
mutex_m
|
||||
net-scp (>= 1.1.2)
|
||||
net-sftp (>= 2.1.2)
|
||||
net-ssh (>= 2.8.0)
|
||||
ssrf_filter (1.1.2)
|
||||
standard (1.34.0)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
|
@ -578,12 +526,7 @@ DEPENDENCIES
|
|||
bootstrap-sass-extras
|
||||
bootswatch-rails
|
||||
byebug
|
||||
capistrano
|
||||
capistrano-rails
|
||||
capistrano-rvm
|
||||
capistrano3-puma
|
||||
capybara
|
||||
carrierwave
|
||||
coffee-rails
|
||||
copy_carrierwave_file
|
||||
database_cleaner
|
||||
|
@ -599,11 +542,9 @@ DEPENDENCIES
|
|||
guard-rspec
|
||||
i18n-tasks
|
||||
icalendar
|
||||
image_processing
|
||||
jbuilder
|
||||
jquery-datatables-rails
|
||||
jquery-rails
|
||||
mini_magick
|
||||
nested_form
|
||||
pg
|
||||
phony
|
||||
|
@ -614,8 +555,6 @@ DEPENDENCIES
|
|||
rails-erd
|
||||
rails-i18n
|
||||
raphael-rails
|
||||
refile!
|
||||
refile-mini_magick
|
||||
rqrcode
|
||||
rspec-rails
|
||||
sass-rails
|
||||
|
@ -633,4 +572,4 @@ DEPENDENCIES
|
|||
yaml_db
|
||||
|
||||
BUNDLED WITH
|
||||
2.4.12
|
||||
2.5.6
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
//= link_tree ../images
|
||||
//= link_tree ../../../lib/initfest/assets/images
|
||||
//= link_directory ../javascripts .js
|
||||
//= link_directory ../stylesheets .css
|
||||
//= link initfest/application.css
|
||||
//= link initfest/application.js
|
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -3,6 +3,5 @@
|
|||
//= require jquery_nested_form
|
||||
//= require bootstrap-sprockets
|
||||
//= require raphael
|
||||
//= require morris
|
||||
//= require chroma-js/chroma
|
||||
//= require_directory .
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
@import "bootstrap";
|
||||
@import "bootswatch/simplex/bootswatch";
|
||||
|
||||
@import "morris";
|
||||
/* @import "morris"; */
|
||||
|
||||
@import "users";
|
||||
@import "colors";
|
||||
|
@ -19,4 +19,4 @@
|
|||
& > div {
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ module Management
|
|||
@conference = find_conference
|
||||
@profile = find_profile
|
||||
|
||||
if @profile.update_attributes(profile_params)
|
||||
if @profile.update(profile_params)
|
||||
redirect_to [:management, @conference, @profile]
|
||||
else
|
||||
render action: "edit"
|
||||
|
|
|
@ -20,7 +20,7 @@ module Public
|
|||
def update
|
||||
@profile = current_user.personal_profile(current_conference)
|
||||
|
||||
if @profile.update_attributes(profile_params)
|
||||
if @profile.update(profile_params)
|
||||
flash[:notice] = t("views.personal_profiles.successfully_updated")
|
||||
redirect_to root_path
|
||||
else
|
||||
|
|
|
@ -13,7 +13,7 @@ class PersonalProfile < ActiveRecord::Base
|
|||
|
||||
phony_normalize :mobile_phone, default_country_code: "BG", add_plus: false
|
||||
|
||||
mount_uploader :picture, PictureUploader
|
||||
has_one_attached :picture
|
||||
|
||||
accepts_nested_attributes_for :user
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class User < ActiveRecord::Base
|
|||
def build_personal_profile(conference, params = {})
|
||||
if personal_profiles.last.present?
|
||||
new_personal_profile = personal_profiles.last.try(:dup)
|
||||
CopyCarrierwaveFile::CopyFileService.new(personal_profiles.last, new_personal_profile, :picture).set_file
|
||||
new_personal_profile.picture.attach(personal_profiles.last.picture.blob)
|
||||
else
|
||||
new_personal_profile = personal_profiles.build
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ class Volunteer < ActiveRecord::Base
|
|||
TSHIRT_CUTS = [:unisex, :female]
|
||||
FOOD_PREFERENCES = [:none, :vegetarian, :vegan]
|
||||
|
||||
attachment :picture, type: :image
|
||||
has_one_attached :picture
|
||||
|
||||
validates :name, :language, :tshirt_size, :tshirt_cut, :food_preferences, presence: true
|
||||
validates :tshirt_size, inclusion: {in: TSHIRT_SIZES.map(&:to_s)}
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
class PictureUploader < CarrierWave::Uploader::Base
|
||||
# Include RMagick or MiniMagick support:
|
||||
# include CarrierWave::RMagick
|
||||
include CarrierWave::MiniMagick
|
||||
|
||||
# Choose what kind of storage to use for this uploader:
|
||||
storage :file
|
||||
# storage :fog
|
||||
|
||||
# Override the directory where uploaded files will be stored.
|
||||
# This is a sensible default for uploaders that are meant to be mounted:
|
||||
def store_dir
|
||||
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||
end
|
||||
|
||||
# Provide a default URL as a default if there hasn't been a file uploaded:
|
||||
def default_url
|
||||
ActionController::Base.helpers.asset_path("fallback/profile_picture/" + [version_name, "default.png"].compact.join("_"))
|
||||
end
|
||||
|
||||
# Process files as they are uploaded:
|
||||
# process :scale => [200, 300]
|
||||
#
|
||||
# def scale(width, height)
|
||||
# # do something
|
||||
# end
|
||||
|
||||
# Create different versions of your uploaded files:
|
||||
|
||||
version :medium do
|
||||
process resize_to_fit: [171, 180]
|
||||
end
|
||||
|
||||
version :thumb do
|
||||
process resize_to_fit: [50, 50]
|
||||
end
|
||||
|
||||
version :schedule do
|
||||
process resize_to_fill: [100, 100]
|
||||
end
|
||||
|
||||
# Add a white list of extensions which are allowed to be uploaded.
|
||||
# For images you might use something like this:
|
||||
def extension_white_list
|
||||
%w[jpg jpeg png]
|
||||
end
|
||||
|
||||
# Override the filename of the uploaded files:
|
||||
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
||||
# def filename
|
||||
# "something.jpg" if original_filename
|
||||
# end
|
||||
end
|
|
@ -5,7 +5,7 @@
|
|||
.panel.panel-default
|
||||
- if personal_profile.present?
|
||||
.panel-image
|
||||
= image_tag personal_profile.picture.url
|
||||
= image_tag personal_profile.picture
|
||||
.panel-body
|
||||
.media
|
||||
.media-body
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
.panel-body
|
||||
.row
|
||||
.col-lg-12
|
||||
- if f.object.picture.present?
|
||||
- if f.object.picture.attached?
|
||||
.col-sm-offset-3.col-sm-9
|
||||
= image_tag f.object.picture.medium.url, class: 'img-thumbnail'
|
||||
= image_tag f.object.picture.variant(resize_to_limit: [150, 150]), class: 'img-thumbnail'
|
||||
|
||||
= f.input :picture, wrapper: :horizontal_file_input
|
||||
|
||||
|
|
|
@ -27,10 +27,9 @@
|
|||
.media
|
||||
.media-left
|
||||
- if profile.present?
|
||||
= image_tag(profile.picture.thumb.url)
|
||||
= image_tag(profile.picture.variant(resize_to_fill: [50, 50]))
|
||||
- else
|
||||
= image_tag(PictureUploader.new.thumb.url)
|
||||
|
||||
= image_tag('avatar-placeholder')
|
||||
.media-body
|
||||
h4.media-heading
|
||||
- if profile.try(:name).present?
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
.col-sm-5.col-md-4
|
||||
.panel.panel-default
|
||||
.panel-image
|
||||
= image_tag @profile.picture.url
|
||||
= image_tag @profile.picture
|
||||
.panel-body
|
||||
.media
|
||||
.media-body
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
.col-lg-12
|
||||
- if f.object.picture.present?
|
||||
.col-sm-offset-3.col-sm-9
|
||||
= attachment_image_tag(@volunteer, :picture, :fill, 150, 150) if @volunteer.picture.present?
|
||||
= @volunteer.picture.variant(resize_to_limit: [150, 150]) if @volunteer.picture.attached?
|
||||
|
||||
= f.input :picture, as: :attachment, wrapper: :horizontal_file_input, direct: true
|
||||
= f.input :picture, as: :file, wrapper: :horizontal_file_input, direct: true
|
||||
|
||||
= f.input :name, autofocus: true
|
||||
= f.input :email
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
.media
|
||||
.media-left
|
||||
- if volunteer.picture.present?
|
||||
= attachment_image_tag(volunteer, :picture, :fill, 50, 50)
|
||||
= image_tag volunteer.picture.variant(resize_to_limit: [50, 50])
|
||||
- else
|
||||
= image_tag(PictureUploader.new.thumb.url)
|
||||
= image_tag('avatar-placeholder.png')
|
||||
.media-body
|
||||
h4.media-heading
|
||||
= volunteer.name
|
||||
|
|
|
@ -10,17 +10,18 @@
|
|||
.panel-body
|
||||
.media
|
||||
.media-left.hidden-sm.hidden-xs
|
||||
- if @volunteer.picture.present?
|
||||
= attachment_image_tag(@volunteer, :picture, :fill, 150, 150)
|
||||
- if @volunteer.picture.attached?
|
||||
= image_tag @volunteer.picture.variant(resize_to_limit: [150, 150])
|
||||
- else
|
||||
= image_tag(PictureUploader.new.medium.url)
|
||||
= image_tag('avatar-placeholder.png')
|
||||
|
||||
.media-body
|
||||
.text-center.visible-sm.visible-xs
|
||||
- if @volunteer.picture.present?
|
||||
= attachment_image_tag(@volunteer, :picture, :fill, 150, 150)
|
||||
- if @volunteer.picture.attached?
|
||||
= image_tag @volunteer.picture.variant(resize_to_limit: [150, 150])
|
||||
- else
|
||||
= image_tag(PictureUploader.new.medium.url)
|
||||
= image_tag('avatar-placeholder.png')
|
||||
|
||||
h4.media-heading
|
||||
= @volunteer.name
|
||||
hr
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
Екипи: <%= @volunteer.volunteer_teams.map(&:name).join(', ') %>
|
||||
|
||||
Снимка: <%= attachment_url(@volunteer, :picture, host: "https://#{@volunteer.conference.host_name}/") %>
|
||||
Език: <%= @volunteer.language %>
|
||||
Телефон: <%= @volunteer.phone %>
|
||||
Размер на тениска: <%= @volunteer.tshirt_size %>
|
||||
|
|
|
@ -9,7 +9,7 @@ Bundler.require(*Rails.groups)
|
|||
module Clarion
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 5.2
|
||||
config.load_defaults 7.1
|
||||
|
||||
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
||||
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
||||
|
|
|
@ -76,4 +76,6 @@ Rails.application.configure do
|
|||
|
||||
# Raise error when a before_action's only/except options reference missing actions
|
||||
config.action_controller.raise_on_missing_callback_actions = true
|
||||
|
||||
config.hosts << "dev.openfest.org:3000"
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ Rails.application.config.assets.version = "1.0"
|
|||
Rails.application.config.assets.paths << "lib/initfest/assets/images"
|
||||
Rails.application.config.assets.paths << "lib/initfest/assets/javascripts"
|
||||
Rails.application.config.assets.paths << "lib/initfest/assets/stylesheets"
|
||||
Rails.application.config.assets.precompile << /\.(?:png|jpg|jpeg|gif)\z/
|
||||
#Rails.application.config.assets.precompile << /\.(?:png|jpg|jpeg|gif)\z/
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in the app/assets
|
||||
|
|
|
@ -34,6 +34,8 @@ bg:
|
|||
no_comments_received: Все още няма коментари.
|
||||
private_email: Личен e-mail
|
||||
events:
|
||||
update:
|
||||
event_successfully_updated: Събитието беше обновено успешно
|
||||
show:
|
||||
average_grade: Средна оценка
|
||||
total_feedback_grades:
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
# This migration comes from active_storage (originally 20170806125915)
|
||||
class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
# Use Active Record's configured type for primary and foreign keys
|
||||
primary_key_type, foreign_key_type = primary_and_foreign_key_types
|
||||
|
||||
create_table :active_storage_blobs, id: primary_key_type do |t|
|
||||
t.string :key, null: false
|
||||
t.string :filename, null: false
|
||||
t.string :content_type
|
||||
t.text :metadata
|
||||
t.string :service_name, null: false
|
||||
t.bigint :byte_size, null: false
|
||||
t.string :checksum
|
||||
|
||||
if connection.supports_datetime_with_precision?
|
||||
t.datetime :created_at, precision: 6, null: false
|
||||
else
|
||||
t.datetime :created_at, null: false
|
||||
end
|
||||
|
||||
t.index [ :key ], unique: true
|
||||
end
|
||||
|
||||
create_table :active_storage_attachments, id: primary_key_type do |t|
|
||||
t.string :name, null: false
|
||||
t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
|
||||
t.references :blob, null: false, type: foreign_key_type
|
||||
|
||||
if connection.supports_datetime_with_precision?
|
||||
t.datetime :created_at, precision: 6, null: false
|
||||
else
|
||||
t.datetime :created_at, null: false
|
||||
end
|
||||
|
||||
t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true
|
||||
t.foreign_key :active_storage_blobs, column: :blob_id
|
||||
end
|
||||
|
||||
create_table :active_storage_variant_records, id: primary_key_type do |t|
|
||||
t.belongs_to :blob, null: false, index: false, type: foreign_key_type
|
||||
t.string :variation_digest, null: false
|
||||
|
||||
t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true
|
||||
t.foreign_key :active_storage_blobs, column: :blob_id
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def primary_and_foreign_key_types
|
||||
config = Rails.configuration.generators
|
||||
setting = config.options[config.orm][:primary_key_type]
|
||||
primary_key_type = setting || :primary_key
|
||||
foreign_key_type = setting || :bigint
|
||||
[primary_key_type, foreign_key_type]
|
||||
end
|
||||
end
|
12
db/seeds.rb
12
db/seeds.rb
|
@ -5,8 +5,10 @@
|
|||
#
|
||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
||||
# Mayor.create(name: 'Emanuel', city: cities.first
|
||||
User.create(email: "foo@example.com",
|
||||
password: "123qweASD",
|
||||
password_confirmation: "123qweASD",
|
||||
confirmed_at: Time.current,
|
||||
admin: true)
|
||||
User.create(
|
||||
email: "foo@example.com",
|
||||
password: "123qweASD",
|
||||
password_confirmation: "123qweASD",
|
||||
confirmed_at: Time.current,
|
||||
admin: true
|
||||
)
|
||||
|
|
|
@ -13,3 +13,4 @@
|
|||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
//= require_tree .
|
||||
//= require activestorage
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
|
||||
.form-inputs
|
||||
.input
|
||||
= image_tag(@profile.picture.medium.url) if @profile.picture?
|
||||
= f.input :picture, as: :file, required: true, wrapper: false
|
||||
|
||||
= f.hidden_field :picture_cache, class: 'image_preview', wrapper: false
|
||||
= image_tag(@profile.picture.variant(resize_to_limit: [150, 150])) if @profile.picture.attached?
|
||||
= f.hidden_field :picture, value: @profile.picture.signed_id if @profile.picture.attached?
|
||||
= f.input :picture, as: :file, required: true, wrapper: false, input_html: {direct_upload: true}
|
||||
= f.input :first_name, autofocus: true
|
||||
= f.input :last_name
|
||||
= f.input :public_email
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
.form-inputs
|
||||
.input
|
||||
= attachment_image_tag(@volunteer, :picture, :fill, 150, 150) if @volunteer.picture.present?
|
||||
= f.input :picture, as: :attachment, direct: true, wrapper: false
|
||||
= image_tag @volunteer.picture.variant(resize_to_limit: [150, 150]) if @volunteer.picture.attached?
|
||||
= f.input :picture, as: :file, direct: true, wrapper: false
|
||||
= f.input :name, autofocus: true
|
||||
= f.input :email
|
||||
= f.input :phone, input_html: {value: @volunteer.phone.try(:phony_formatted, format: :international)}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe Volunteership, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
|
@ -103,7 +103,7 @@ module FeatureHelpers
|
|||
attach_file PersonalProfile.human_attribute_name(:picture), Rails.root.join("spec", "support", "picture.jpg")
|
||||
fill_in PersonalProfile.human_attribute_name(:first_name), with: "Foo"
|
||||
fill_in PersonalProfile.human_attribute_name(:last_name), with: "Bar"
|
||||
fill_in PersonalProfile.human_attribute_name(:mobile_phone), with: "+359666666"
|
||||
fill_in PersonalProfile.human_attribute_name(:mobile_phone), with: "+359883123456"
|
||||
fill_in PersonalProfile.human_attribute_name(:biography), with: "Lorem"
|
||||
|
||||
click_on I18n.t("helpers.submit.create", model: PersonalProfile.model_name.human)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
RSpec::Matchers.define :have_error_on do |expected|
|
||||
match do |actual|
|
||||
expect(actual).to_not be_valid
|
||||
expect(actual.errors.keys).to include expected
|
||||
expect(actual.errors).to have_key expected
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue