biovision-base 0.9.171227 → 0.11.180127
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/biovision/base/biovision-sliders.js +3 -17
- data/app/assets/javascripts/biovision/base/biovision.js +17 -5
- data/app/assets/stylesheets/biovision/base/admin.scss +0 -12
- data/app/assets/stylesheets/biovision/base/biovision.scss +2 -179
- data/app/assets/stylesheets/biovision/base/default_admin.scss +0 -1
- data/app/controllers/admin/privileges_controller.rb +0 -6
- data/app/controllers/admin/users_controller.rb +2 -2
- data/app/models/editable_page.rb +41 -3
- data/app/models/feedback_request.rb +1 -0
- data/app/models/language.rb +49 -0
- data/app/models/privilege.rb +16 -16
- data/app/models/user.rb +3 -2
- data/app/models/user_language.rb +6 -0
- data/app/models/user_privilege.rb +3 -14
- data/app/views/admin/agents/entity/_in_list.html.erb +1 -1
- data/app/views/admin/agents/index.html.erb +1 -1
- data/app/views/admin/agents/show.html.erb +2 -2
- data/app/views/admin/browsers/entity/_in_list.html.erb +2 -1
- data/app/views/admin/browsers/index.html.erb +1 -1
- data/app/views/admin/browsers/show.html.erb +2 -2
- data/app/views/admin/codes/index.html.erb +1 -1
- data/app/views/admin/codes/show.html.erb +1 -1
- data/app/views/admin/editable_pages/index.html.erb +1 -1
- data/app/views/admin/editable_pages/show.html.erb +1 -1
- data/app/views/admin/index/_biovision_base.html.erb +2 -1
- data/app/views/admin/media_files/show.html.erb +0 -1
- data/app/views/admin/metrics/index.html.erb +1 -1
- data/app/views/admin/metrics/show.html.erb +1 -1
- data/app/views/admin/privilege_groups/index.html.erb +1 -1
- data/app/views/admin/privilege_groups/show.html.erb +1 -1
- data/app/views/admin/privileges/entity/_in_list.html.erb +1 -1
- data/app/views/admin/privileges/index.html.erb +1 -1
- data/app/views/admin/privileges/show.html.erb +2 -2
- data/app/views/admin/privileges/users.html.erb +1 -1
- data/app/views/admin/stored_values/index.html.erb +1 -1
- data/app/views/admin/tokens/entity/_in_list.html.erb +1 -1
- data/app/views/admin/tokens/index.html.erb +1 -1
- data/app/views/admin/tokens/show.html.erb +2 -2
- data/app/views/admin/users/codes.html.erb +1 -1
- data/app/views/admin/users/entity/_in_list.html.erb +2 -1
- data/app/views/admin/users/entity/_privilege.html.erb +1 -1
- data/app/views/admin/users/index.html.erb +1 -1
- data/app/views/admin/users/show.html.erb +4 -4
- data/app/views/admin/users/tokens.html.erb +1 -1
- data/app/views/agents/edit.html.erb +1 -1
- data/app/views/agents/new.html.erb +1 -1
- data/app/views/application/error.html.erb +1 -1
- data/app/views/browsers/edit.html.erb +1 -1
- data/app/views/browsers/new.html.erb +1 -1
- data/app/views/codes/edit.html.erb +1 -1
- data/app/views/codes/new.html.erb +1 -1
- data/app/views/editable_pages/edit.html.erb +1 -1
- data/app/views/editable_pages/new.html.erb +1 -1
- data/app/views/errors/error.html.erb +1 -1
- data/app/views/feedback_requests/_form.html.erb +1 -3
- data/app/views/feedback_requests/create.js.erb +2 -2
- data/app/views/layouts/admin/_footer.html.erb +1 -1
- data/app/views/layouts/admin/_header.html.erb +3 -3
- data/app/views/metrics/edit.html.erb +1 -1
- data/app/views/privilege_groups/edit.html.erb +1 -1
- data/app/views/privilege_groups/new.html.erb +1 -1
- data/app/views/privileges/edit.html.erb +1 -1
- data/app/views/privileges/new.html.erb +1 -1
- data/app/views/shared/forms/_default_ajax_handler.html.erb +2 -0
- data/app/views/stored_values/edit.html.erb +1 -1
- data/app/views/stored_values/new.html.erb +1 -1
- data/app/views/tokens/edit.html.erb +1 -1
- data/app/views/tokens/new.html.erb +1 -1
- data/app/views/users/edit.html.erb +1 -1
- data/config/locales/common-en.yml +10 -2
- data/config/locales/common-ru.yml +10 -2
- data/config/locales/editable-pages-en.yml +76 -0
- data/config/locales/editable-pages-ru.yml +1 -0
- data/config/locales/feedback-en.yml +1 -0
- data/config/locales/feedback-ru.yml +1 -0
- data/config/locales/media-en.yml +92 -0
- data/config/locales/users-ru.yml +1 -0
- data/config/routes.rb +0 -10
- data/db/migrate/20170228000000_create_languages.rb +22 -0
- data/db/migrate/20170302000001_create_users.rb +2 -1
- data/db/migrate/20170302000101_create_privileges.rb +7 -6
- data/db/migrate/20170302000102_create_user_privileges.rb +1 -1
- data/db/migrate/20170302000103_create_privilege_groups.rb +0 -1
- data/db/migrate/20170302000104_create_privilege_group_privileges.rb +0 -4
- data/db/migrate/20170320000000_create_editable_pages.rb +12 -3
- data/db/migrate/20171025222222_add_new_fields_171026.rb +0 -8
- data/db/migrate/20171211000000_create_feedback_requests.rb +1 -0
- data/db/migrate/20171223333333_amend_foreign_keys.rb +1 -3
- data/db/migrate/20180117151515_add_language_to_models.rb +25 -0
- data/db/migrate/20180117160000_create_user_languages.rb +17 -0
- data/lib/biovision/base/base_methods.rb +1 -1
- data/lib/biovision/base/engine.rb +0 -1
- data/lib/biovision/base/privilege_methods.rb +3 -21
- data/lib/biovision/base/version.rb +1 -1
- metadata +13 -34
- data/app/assets/images/biovision/base/placeholders/region_image.svg +0 -1
- data/app/assets/stylesheets/biovision/base/regions.scss +0 -9
- data/app/controllers/admin/regions_controller.rb +0 -28
- data/app/controllers/regions_controller.rb +0 -73
- data/app/helpers/biovision_regions_helper.rb +0 -22
- data/app/models/central_region.rb +0 -53
- data/app/models/region.rb +0 -110
- data/app/uploaders/header_image_uploader.rb +0 -50
- data/app/uploaders/region_image_uploader.rb +0 -53
- data/app/views/admin/agents/_toggleable.html.erb +0 -7
- data/app/views/admin/browsers/_toggleable.html.erb +0 -7
- data/app/views/admin/index/dashboard/_biovision_region.html.erb +0 -8
- data/app/views/admin/privileges/_toggleable.html.erb +0 -7
- data/app/views/admin/privileges/entity/_region.html.erb +0 -12
- data/app/views/admin/privileges/regions.jbuilder +0 -10
- data/app/views/admin/regions/_nav_item.html.erb +0 -2
- data/app/views/admin/regions/_toggleable.html.erb +0 -7
- data/app/views/admin/regions/entity/_in_list.html.erb +0 -32
- data/app/views/admin/regions/index.html.erb +0 -22
- data/app/views/admin/regions/show.html.erb +0 -95
- data/app/views/admin/tokens/_toggleable.html.erb +0 -7
- data/app/views/admin/users/_toggleable.html.erb +0 -7
- data/app/views/regions/_form.html.erb +0 -73
- data/app/views/regions/edit.html.erb +0 -20
- data/app/views/regions/new.html.erb +0 -17
- data/config/locales/regions-ru.yml +0 -62
- data/db/migrate/20170301000201_create_regions.rb +0 -35
- data/lib/tasks/regions.rake +0 -105
@@ -1 +0,0 @@
|
|
1
|
-
<?xml version="1.0" ?><svg height="24" version="1.1" width="24" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><g transform="translate(0 -1028.4)"><path d="m3 1031.4v10c0 4.2 3.6322 8 9 10 5.368-2 9-5.8 9-10v-10h-18z" fill="#7f8c8d"/><path d="m3 1030.4v10c0 4.2 3.6322 8 9 10 5.368-2 9-5.8 9-10v-10h-18z" fill="#bdc3c7"/><path d="m3 1030.4v10c0 4.2 3.6322 8 9 10v-20h-9z" fill="#95a5a6"/><path d="m5 1032.4v8c0 3.4 2.8251 6.4 7 8 4.175-1.6 7-4.6 7-8v-8h-14z" fill="#ecf0f1"/><path d="m5 1040.4c0 3.4 2.8251 6.4 7 8v-8h-7z" fill="#2980b9"/><rect fill="#3498db" height="8" transform="translate(0 1028.4)" width="7" x="12" y="4"/><rect fill="#bdc3c7" height="8" transform="translate(0 1028.4)" width="7" x="5" y="4"/></g></svg>
|
@@ -1,28 +0,0 @@
|
|
1
|
-
class Admin::RegionsController < AdminController
|
2
|
-
include ToggleableEntity
|
3
|
-
include LockableEntity
|
4
|
-
|
5
|
-
before_action :set_entity, except: [:index]
|
6
|
-
|
7
|
-
# get /admin/regions
|
8
|
-
def index
|
9
|
-
@collection = Region.for_tree
|
10
|
-
end
|
11
|
-
|
12
|
-
# get /admin/regions/:id
|
13
|
-
def show
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def restrict_access
|
19
|
-
require_privilege_group :region_managers
|
20
|
-
end
|
21
|
-
|
22
|
-
def set_entity
|
23
|
-
@entity = Region.find_by(id: params[:id])
|
24
|
-
if @entity.nil?
|
25
|
-
handle_http_404("Cannot find region #{params[:id]}")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
class RegionsController < AdminController
|
2
|
-
before_action :set_entity, only: [:edit, :update, :destroy]
|
3
|
-
before_action :restrict_editing, only: [:edit, :update, :destroy]
|
4
|
-
|
5
|
-
# post /regions
|
6
|
-
def create
|
7
|
-
@entity = Region.new(creation_parameters)
|
8
|
-
if @entity.save
|
9
|
-
cache_relatives
|
10
|
-
redirect_to admin_region_path(@entity)
|
11
|
-
else
|
12
|
-
render :new, status: :bad_request
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# get /regions/:id/edit
|
17
|
-
def edit
|
18
|
-
end
|
19
|
-
|
20
|
-
# patch /regions/:id
|
21
|
-
def update
|
22
|
-
if @entity.update(entity_parameters)
|
23
|
-
cache_relatives
|
24
|
-
redirect_to admin_region_path(@entity), notice: t('regions.update.success')
|
25
|
-
else
|
26
|
-
render :edit, status: :bad_request
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# delete /post_categories/:id
|
31
|
-
def destroy
|
32
|
-
if @entity.destroy
|
33
|
-
flash[:notice] = t('regions.destroy.success')
|
34
|
-
end
|
35
|
-
redirect_to admin_regions_path
|
36
|
-
end
|
37
|
-
|
38
|
-
protected
|
39
|
-
|
40
|
-
def restrict_access
|
41
|
-
require_privilege_group :region_managers
|
42
|
-
end
|
43
|
-
|
44
|
-
def set_entity
|
45
|
-
@entity = Region.find_by(id: params[:id])
|
46
|
-
if @entity.nil?
|
47
|
-
handle_http_404('Cannot find region')
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def restrict_editing
|
52
|
-
if @entity.locked? || !@entity.editable_by?(current_user)
|
53
|
-
redirect_to admin_region_path(@entity.id), alert: t('regions.edit.forbidden')
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def entity_parameters
|
58
|
-
params.require(:region).permit(Region.entity_parameters)
|
59
|
-
end
|
60
|
-
|
61
|
-
def creation_parameters
|
62
|
-
params.require(:region).permit(Region.creation_parameters)
|
63
|
-
end
|
64
|
-
|
65
|
-
def cache_relatives
|
66
|
-
@entity.cache_parents!
|
67
|
-
unless @entity.parent.blank?
|
68
|
-
parent = @entity.parent
|
69
|
-
parent.cache_children!
|
70
|
-
parent.save
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module BiovisionRegionsHelper
|
2
|
-
# @param [Region] entity
|
3
|
-
def admin_region_link(entity)
|
4
|
-
link_to(entity.name, admin_region_path(entity.id))
|
5
|
-
end
|
6
|
-
|
7
|
-
# @param [Region] entity
|
8
|
-
def region_image_preview(entity)
|
9
|
-
unless entity.image.blank?
|
10
|
-
versions = "#{entity.image.preview_2x.url} 2x"
|
11
|
-
image_tag(entity.image.preview.url, alt: entity.name, srcset: versions)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# @param [Region] entity
|
16
|
-
def region_image_medium(entity)
|
17
|
-
unless entity.image.blank?
|
18
|
-
versions = "#{entity.image.medium_2x.url} 2x"
|
19
|
-
image_tag(entity.image.medium.url, alt: entity.name, srcset: versions)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
class CentralRegion
|
2
|
-
def id
|
3
|
-
nil
|
4
|
-
end
|
5
|
-
|
6
|
-
def name
|
7
|
-
I18n.t('activerecord.attributes.central_region.name')
|
8
|
-
end
|
9
|
-
|
10
|
-
def short_name
|
11
|
-
I18n.t('activerecord.attributes.central_region.short_name')
|
12
|
-
end
|
13
|
-
|
14
|
-
def locative
|
15
|
-
I18n.t('activerecord.attributes.central_region.locative')
|
16
|
-
end
|
17
|
-
|
18
|
-
def slug
|
19
|
-
''
|
20
|
-
end
|
21
|
-
|
22
|
-
def long_slug
|
23
|
-
''
|
24
|
-
end
|
25
|
-
|
26
|
-
def image
|
27
|
-
nil
|
28
|
-
end
|
29
|
-
|
30
|
-
def header_image
|
31
|
-
nil
|
32
|
-
end
|
33
|
-
|
34
|
-
def parents
|
35
|
-
[]
|
36
|
-
end
|
37
|
-
|
38
|
-
def parent
|
39
|
-
nil
|
40
|
-
end
|
41
|
-
|
42
|
-
def parent_id
|
43
|
-
nil
|
44
|
-
end
|
45
|
-
|
46
|
-
def child_regions
|
47
|
-
[]
|
48
|
-
end
|
49
|
-
|
50
|
-
def subbranch_ids
|
51
|
-
[]
|
52
|
-
end
|
53
|
-
end
|
data/app/models/region.rb
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
class Region < ApplicationRecord
|
2
|
-
include Toggleable
|
3
|
-
|
4
|
-
SLUG_PATTERN = /\A[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?\z/
|
5
|
-
PER_PAGE = 20
|
6
|
-
NAME_LIMIT = 70
|
7
|
-
SLUG_LIMIT = 63
|
8
|
-
|
9
|
-
toggleable :visible
|
10
|
-
|
11
|
-
belongs_to :parent, class_name: Region.to_s, optional: true, touch: true
|
12
|
-
has_many :child_regions, class_name: Region.to_s, foreign_key: :parent_id
|
13
|
-
has_many :users, dependent: :nullify
|
14
|
-
|
15
|
-
mount_uploader :image, RegionImageUploader
|
16
|
-
mount_uploader :header_image, HeaderImageUploader
|
17
|
-
|
18
|
-
before_validation { self.slug = slug.to_s.downcase.strip }
|
19
|
-
before_save { self.children_cache.uniq! }
|
20
|
-
before_save :generate_long_slug
|
21
|
-
|
22
|
-
validates_presence_of :name, :slug
|
23
|
-
validates_uniqueness_of :name, :slug, scope: [:parent_id]
|
24
|
-
validates_length_of :name, maximum: NAME_LIMIT
|
25
|
-
validates_length_of :slug, maximum: SLUG_LIMIT
|
26
|
-
validates_format_of :slug, with: SLUG_PATTERN
|
27
|
-
|
28
|
-
scope :ordered_by_slug, -> { order('slug asc') }
|
29
|
-
scope :ordered_by_name, -> { order('name asc') }
|
30
|
-
scope :visible, -> { where(visible: true) }
|
31
|
-
scope :for_tree, -> (parent_id = nil) { where(parent_id: parent_id).ordered_by_name }
|
32
|
-
|
33
|
-
# @param [Integer] page
|
34
|
-
def self.page_for_administration(page = 1)
|
35
|
-
ordered_by_name.page(page).per(PER_PAGE)
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.entity_parameters
|
39
|
-
%i(name short_name locative slug visible image header_image latitude longitude)
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.creation_parameters
|
43
|
-
entity_parameters + %i(parent_id)
|
44
|
-
end
|
45
|
-
|
46
|
-
# @param [User] user
|
47
|
-
def editable_by?(user)
|
48
|
-
administrator = UserPrivilege.user_has_privilege?(user, :administrator)
|
49
|
-
manager = UserPrivilege.user_has_privilege?(user, :region_manager, self)
|
50
|
-
administrator || manager
|
51
|
-
end
|
52
|
-
|
53
|
-
def parents
|
54
|
-
return [] if parents_cache.blank?
|
55
|
-
Region.where(id: parent_ids).order('id asc')
|
56
|
-
end
|
57
|
-
|
58
|
-
def parent_ids
|
59
|
-
parents_cache.split(',').compact
|
60
|
-
end
|
61
|
-
|
62
|
-
# @return [Array<Integer>]
|
63
|
-
def branch_ids
|
64
|
-
parents_cache.split(',').map(&:to_i).reject { |i| i < 1 }.uniq + [id]
|
65
|
-
end
|
66
|
-
|
67
|
-
# @return [Array<Integer>]
|
68
|
-
def subbranch_ids
|
69
|
-
[id] + children_cache
|
70
|
-
end
|
71
|
-
|
72
|
-
def depth
|
73
|
-
parent_ids.count
|
74
|
-
end
|
75
|
-
|
76
|
-
def long_name
|
77
|
-
return name if parents.blank?
|
78
|
-
"#{parents.map(&:name).join('/')}/#{name}"
|
79
|
-
end
|
80
|
-
|
81
|
-
def branch_name
|
82
|
-
return short_name if parents.blank?
|
83
|
-
"#{parents.map(&:short_name).join('/')}/#{short_name}"
|
84
|
-
end
|
85
|
-
|
86
|
-
def cache_parents!
|
87
|
-
return if parent.nil?
|
88
|
-
self.parents_cache = "#{parent.parents_cache},#{parent_id}".gsub(/\A,/, '')
|
89
|
-
save!
|
90
|
-
end
|
91
|
-
|
92
|
-
def cache_children!
|
93
|
-
child_regions.order('id asc').each do |child|
|
94
|
-
self.children_cache += [child.id] + child.children_cache
|
95
|
-
end
|
96
|
-
save!
|
97
|
-
parent.cache_children! unless parent.nil?
|
98
|
-
end
|
99
|
-
|
100
|
-
private
|
101
|
-
|
102
|
-
def generate_long_slug
|
103
|
-
if parents_cache.blank?
|
104
|
-
self.long_slug = slug
|
105
|
-
else
|
106
|
-
slugs = Region.where(id: parent_ids).order('id asc').pluck(:slug) + [slug]
|
107
|
-
self.long_slug = slugs.join('-')
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
class HeaderImageUploader < CarrierWave::Uploader::Base
|
2
|
-
include CarrierWave::MiniMagick
|
3
|
-
include CarrierWave::BombShelter
|
4
|
-
|
5
|
-
storage :file
|
6
|
-
|
7
|
-
def max_pixel_dimensions
|
8
|
-
[4000, 4000]
|
9
|
-
end
|
10
|
-
|
11
|
-
# Override the directory where uploaded files will be stored.
|
12
|
-
# This is a sensible default for uploaders that are meant to be mounted:
|
13
|
-
def store_dir
|
14
|
-
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
15
|
-
end
|
16
|
-
|
17
|
-
# Provide a default URL as a default if there hasn't been a file uploaded:
|
18
|
-
# def default_url
|
19
|
-
# # For Rails 3.1+ asset pipeline compatibility:
|
20
|
-
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
21
|
-
#
|
22
|
-
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
23
|
-
# end
|
24
|
-
|
25
|
-
resize_to_limit 1000, 1000
|
26
|
-
|
27
|
-
version :medium do
|
28
|
-
resize_to_fit 500, 500
|
29
|
-
end
|
30
|
-
|
31
|
-
version :preview_2x, from_version: :medium do
|
32
|
-
resize_to_fit 160, 160
|
33
|
-
end
|
34
|
-
|
35
|
-
version :preview, from_version: :preview_2x do
|
36
|
-
resize_to_fit 80, 80
|
37
|
-
end
|
38
|
-
|
39
|
-
# Add a white list of extensions which are allowed to be uploaded.
|
40
|
-
# For images you might use something like this:
|
41
|
-
def extension_whitelist
|
42
|
-
%w(jpg jpeg png)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Override the filename of the uploaded files:
|
46
|
-
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
47
|
-
# def filename
|
48
|
-
# "something.jpg" if original_filename
|
49
|
-
# end
|
50
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
class RegionImageUploader < CarrierWave::Uploader::Base
|
2
|
-
include CarrierWave::MiniMagick
|
3
|
-
include CarrierWave::BombShelter
|
4
|
-
|
5
|
-
def max_pixel_dimensions
|
6
|
-
[2000, 2000]
|
7
|
-
end
|
8
|
-
|
9
|
-
storage :file
|
10
|
-
|
11
|
-
# Override the directory where uploaded files will be stored.
|
12
|
-
# This is a sensible default for uploaders that are meant to be mounted:
|
13
|
-
def store_dir
|
14
|
-
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
15
|
-
end
|
16
|
-
|
17
|
-
# Provide a default URL as a default if there hasn't been a file uploaded:
|
18
|
-
# def default_url
|
19
|
-
# # For Rails 3.1+ asset pipeline compatibility:
|
20
|
-
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
21
|
-
#
|
22
|
-
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
23
|
-
# end
|
24
|
-
|
25
|
-
version :header_2x do
|
26
|
-
resize_to_fit 220, 220
|
27
|
-
end
|
28
|
-
|
29
|
-
version :header, from_version: :header_2x do
|
30
|
-
resize_to_fit 110, 110
|
31
|
-
end
|
32
|
-
|
33
|
-
version :preview_2x, from_version: :header_2x do
|
34
|
-
resize_to_fit 160, 160
|
35
|
-
end
|
36
|
-
|
37
|
-
version :preview, from_version: :preview_2x do
|
38
|
-
resize_to_fit 80, 80
|
39
|
-
end
|
40
|
-
|
41
|
-
# Add a white list of extensions which are allowed to be uploaded.
|
42
|
-
# For images you might use something like this:
|
43
|
-
def extension_whitelist
|
44
|
-
%w(jpg jpeg png)
|
45
|
-
end
|
46
|
-
|
47
|
-
# Override the filename of the uploaded files:
|
48
|
-
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
49
|
-
# def filename
|
50
|
-
# "something.jpg" if original_filename
|
51
|
-
# end
|
52
|
-
|
53
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<div class="toggleable" data-url="<%= toggle_admin_agent_path(entity) %>">
|
2
|
-
<% Agent.toggleable_attributes.each do |flag| %>
|
3
|
-
<span class="<%= entity.attributes[flag.to_s] ? 'active' : 'inactive' %>" data-flag="<%= flag %>">
|
4
|
-
<%= t("activerecord.attributes.agent.#{flag}") %>
|
5
|
-
</span>
|
6
|
-
<% end %>
|
7
|
-
</div>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<div class="toggleable" data-url="<%= toggle_admin_browser_path(entity) %>">
|
2
|
-
<% Browser.toggleable_attributes.each do |flag| %>
|
3
|
-
<span class="<%= entity.attributes[flag.to_s] ? 'active' : 'inactive' %>" data-flag="<%= flag %>">
|
4
|
-
<%= t("activerecord.attributes.browser.#{flag}") %>
|
5
|
-
</span>
|
6
|
-
<% end %>
|
7
|
-
</div>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<div class="toggleable" data-url="<%= toggle_admin_privilege_path(entity) %>">
|
2
|
-
<% Privilege.toggleable_attributes.each do |flag| %>
|
3
|
-
<span class="<%= entity.attributes[flag.to_s] ? 'active' : 'inactive' %>" data-flag="<%= flag %>">
|
4
|
-
<%= t("activerecord.attributes.privilege.#{flag}") %>
|
5
|
-
</span>
|
6
|
-
<% end %>
|
7
|
-
</div>
|