diff --git a/app/models/user.rb b/app/models/user.rb index 23330b3c..990f656a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -41,9 +41,6 @@ class User < ApplicationRecord has_one :theme, dependent: :destroy - attr_accessor :profile_picture_x, :profile_picture_y, :profile_picture_w, :profile_picture_h, - :profile_header_x, :profile_header_y, :profile_header_w, :profile_header_h - SCREEN_NAME_REGEX = /\A[a-zA-Z0-9_]{1,16}\z/ WEBSITE_REGEX = /https?:\/\/([A-Za-z.\-]+)\/?(?:.*)/i diff --git a/app/views/settings/_profile.haml b/app/views/settings/_profile.haml index f62a7f0c..d01b3ddf 100644 --- a/app/views/settings/_profile.haml +++ b/app/views/settings/_profile.haml @@ -48,10 +48,10 @@ = f.check_box :show_foreign_themes, label: 'Render other user themes when visiting their profile' - - %i[crop_x crop_y crop_w crop_h].each do |attrib| + - for attrib in %i(profile_picture_x profile_picture_y profile_picture_w profile_picture_h) = f.hidden_field attrib, id: attrib - - %i[crop_h_x crop_h_y crop_h_w crop_h_h].each do |attrib| + - for attrib in %i(profile_header_x profile_header_y profile_header_w profile_header_h) = f.hidden_field attrib, id: attrib = f.submit t('views.actions.save'), class: 'btn btn-primary' diff --git a/db/migrate/20200517190138_rename_crop_fields.rb b/db/migrate/20200517190138_rename_crop_fields.rb new file mode 100644 index 00000000..a9e74fbc --- /dev/null +++ b/db/migrate/20200517190138_rename_crop_fields.rb @@ -0,0 +1,23 @@ +class RenameCropFields < ActiveRecord::Migration[5.2] + def up + rename_column :users, :crop_h, :profile_picture_h + rename_column :users, :crop_w, :profile_picture_w + rename_column :users, :crop_x, :profile_picture_x + rename_column :users, :crop_y, :profile_picture_y + rename_column :users, :crop_h_h, :profile_header_h + rename_column :users, :crop_h_w, :profile_header_w + rename_column :users, :crop_h_x, :profile_header_x + rename_column :users, :crop_h_y, :profile_header_y + end + + def down + rename_column :users, :profile_picture_h, :crop_h + rename_column :users, :profile_picture_w, :crop_w + rename_column :users, :profile_picture_x, :crop_x + rename_column :users, :profile_picture_y, :crop_y + rename_column :users, :profile_header_h, :crop_h_h + rename_column :users, :profile_header_w, :crop_h_w + rename_column :users, :profile_header_x, :crop_h_x + rename_column :users, :profile_header_y, :crop_h_y + end +end diff --git a/db/schema.rb b/db/schema.rb index 499d010e..582eea28 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_05_09_094402) do +ActiveRecord::Schema.define(version: 2020_05_17_190138) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -253,10 +253,10 @@ ActiveRecord::Schema.define(version: 2020_05_09_094402) do t.integer "profile_picture_file_size" t.datetime "profile_picture_updated_at" t.boolean "profile_picture_processing" - t.integer "crop_x" - t.integer "crop_y" - t.integer "crop_w" - t.integer "crop_h" + t.integer "profile_picture_x" + t.integer "profile_picture_y" + t.integer "profile_picture_w" + t.integer "profile_picture_h" t.boolean "privacy_allow_anonymous_questions", default: true t.boolean "privacy_allow_public_timeline", default: true t.boolean "privacy_allow_stranger_answers", default: true @@ -270,10 +270,10 @@ ActiveRecord::Schema.define(version: 2020_05_09_094402) do t.integer "profile_header_file_size" t.datetime "profile_header_updated_at" t.boolean "profile_header_processing" - t.integer "crop_h_x" - t.integer "crop_h_y" - t.integer "crop_h_w" - t.integer "crop_h_h" + t.integer "profile_header_x" + t.integer "profile_header_y" + t.integer "profile_header_w" + t.integer "profile_header_h" t.string "locale", default: "en" t.string "confirmation_token" t.datetime "confirmed_at"