camaleon_cms 2.5.3.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of camaleon_cms might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/apps/plugins/front_cache/front_cache_helper.rb +1 -1
- data/app/assets/images/camaleon_cms/language/md.png +0 -0
- data/app/models/camaleon_cms/ability.rb +94 -92
- data/app/models/camaleon_cms/category.rb +45 -44
- data/app/models/camaleon_cms/custom_field.rb +26 -25
- data/app/models/camaleon_cms/custom_field_group.rb +115 -114
- data/app/models/camaleon_cms/custom_fields_relationship.rb +21 -19
- data/app/models/camaleon_cms/media.rb +48 -44
- data/app/models/camaleon_cms/meta.rb +5 -3
- data/app/models/camaleon_cms/nav_menu.rb +27 -24
- data/app/models/camaleon_cms/nav_menu_item.rb +58 -54
- data/app/models/camaleon_cms/plugin.rb +62 -60
- data/app/models/camaleon_cms/post.rb +205 -227
- data/app/models/camaleon_cms/post_comment.rb +44 -42
- data/app/models/camaleon_cms/post_default.rb +65 -62
- data/app/models/camaleon_cms/post_relationship.rb +1 -2
- data/app/models/camaleon_cms/post_tag.rb +9 -6
- data/app/models/camaleon_cms/post_type.rb +170 -163
- data/app/models/camaleon_cms/site.rb +211 -203
- data/app/models/camaleon_cms/term_relationship.rb +16 -14
- data/app/models/camaleon_cms/term_taxonomy.rb +49 -54
- data/app/models/camaleon_cms/theme.rb +24 -23
- data/app/models/camaleon_cms/user.rb +18 -13
- data/app/models/camaleon_cms/user_role.rb +130 -128
- data/app/models/camaleon_cms/widget/assigned.rb +25 -21
- data/app/models/camaleon_cms/widget/main.rb +40 -36
- data/app/models/camaleon_cms/widget/sidebar.rb +20 -16
- data/app/validators/camaleon_cms/post_uniq_validator.rb +28 -0
- data/app/validators/camaleon_cms/uniq_validator.rb +9 -0
- data/config/locales/camaleon_cms/admin/ar.yml +1 -0
- data/config/locales/camaleon_cms/admin/de.yml +1 -0
- data/config/locales/camaleon_cms/admin/en.yml +82 -21
- data/config/locales/camaleon_cms/admin/fr.yml +1 -0
- data/config/locales/camaleon_cms/admin/it.yml +1 -0
- data/config/locales/camaleon_cms/admin/js/de.yml +51 -0
- data/config/locales/camaleon_cms/admin/js/en.yml +51 -0
- data/config/locales/camaleon_cms/admin/js/es.yml +53 -0
- data/config/locales/camaleon_cms/admin/js/it.yml +44 -0
- data/config/locales/camaleon_cms/admin/js/nl.yml +42 -0
- data/config/locales/camaleon_cms/admin/js/pt-BR.yml +44 -0
- data/config/locales/camaleon_cms/admin/js/ru.yml +51 -0
- data/config/locales/camaleon_cms/admin/js/uk.yml +51 -0
- data/config/locales/camaleon_cms/admin/js/zh-CN.yml +51 -0
- data/config/locales/camaleon_cms/admin/nl.yml +1 -0
- data/config/locales/camaleon_cms/admin/ru.yml +1 -0
- data/config/locales/camaleon_cms/admin/uk.yml +2 -1
- data/config/locales/camaleon_cms/admin/zh-CH.yml +1 -0
- data/config/locales/camaleon_cms/common.md +3 -0
- data/config/locales/camaleon_cms/common/ar.yml +66 -0
- data/config/locales/camaleon_cms/common/de.yml +66 -0
- data/config/locales/camaleon_cms/common/en.yml +63 -0
- data/config/locales/camaleon_cms/common/es.yml +66 -0
- data/config/locales/camaleon_cms/common/fr.yml +66 -0
- data/config/locales/camaleon_cms/common/it.yml +63 -0
- data/config/locales/camaleon_cms/common/md.yml +60 -0
- data/config/locales/camaleon_cms/common/nl.yml +64 -0
- data/config/locales/camaleon_cms/common/pt-BR.yml +65 -0
- data/config/locales/camaleon_cms/common/pt.yml +65 -0
- data/config/locales/camaleon_cms/common/ru.yml +66 -0
- data/config/locales/camaleon_cms/common/uk.yml +64 -0
- data/config/locales/camaleon_cms/common/zh-CN.yml +66 -0
- data/config/locales/camaleon_cms/languages/ar.yml +16 -0
- data/config/locales/camaleon_cms/languages/de.yml +16 -0
- data/config/locales/camaleon_cms/languages/en.yml +16 -0
- data/config/locales/camaleon_cms/languages/es.yml +16 -0
- data/config/locales/camaleon_cms/languages/it.yml +16 -0
- data/config/locales/camaleon_cms/languages/md.yml +15 -0
- data/config/locales/camaleon_cms/languages/nl.yml +16 -0
- data/config/locales/camaleon_cms/languages/pt-BR.yml +16 -0
- data/config/locales/camaleon_cms/languages/pt.yml +16 -0
- data/config/locales/camaleon_cms/languages/ru.yml +16 -0
- data/config/locales/camaleon_cms/languages/uk.yml +16 -0
- data/config/locales/camaleon_cms/languages/zh-CN.yml +16 -0
- data/config/locales/camaleon_cms/routes/de.yml +8 -0
- data/config/locales/camaleon_cms/routes/es.yml +8 -0
- data/config/locales/camaleon_cms/routes/fr.yml +8 -0
- data/config/locales/camaleon_cms/routes/it.yml +8 -0
- data/config/locales/camaleon_cms/routes/md.yml +8 -0
- data/config/locales/camaleon_cms/routes/pt-BR.yml +8 -0
- data/config/locales/camaleon_cms/routes/pt.yml +8 -0
- data/config/locales/camaleon_cms/routes/ru.yml +8 -0
- data/config/locales/camaleon_cms/routes/uk.yml +8 -0
- data/config/locales/camaleon_cms/routes/zh-CN.yml +8 -0
- data/config/locales/md.yml +207 -0
- data/lib/camaleon_cms/version.rb +1 -1
- data/spec/dummy/config/application.rb +14 -2
- metadata +102 -109
- data/config/locales/camaleon_cms/admin/js.yml +0 -435
- data/config/locales/camaleon_cms/common.yml +0 -786
- data/config/locales/camaleon_cms/languages.yml +0 -167
- data/config/locales/camaleon_cms/routes.yml +0 -71
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -254
- data/spec/dummy/log/test.log +0 -46384
- data/spec/dummy/public/media/1/rails_tmp.png +0 -0
- data/spec/dummy/public/media/1/rails_tmp_1.png +0 -0
- data/spec/dummy/public/media/1/rails_tmp_2.png +0 -0
- data/spec/dummy/public/media/1/rails_tmp_3.png +0 -0
- data/spec/dummy/public/media/1/sample/rails_tmp.png +0 -0
- data/spec/dummy/public/media/1/sample/thumb/rails_tmp-png.png +0 -0
- data/spec/dummy/public/media/1/slide33.jpg +0 -0
- data/spec/dummy/public/media/1/thumb/rails_tmp-png.png +0 -0
- data/spec/dummy/public/media/1/thumb/rails_tmp-png_20x.png +0 -0
- data/spec/dummy/public/media/1/thumb/rails_tmp-png_300x300.png +0 -0
- data/spec/dummy/public/media/1/thumb/rails_tmp-png_505x350.png +0 -0
- data/spec/dummy/public/media/1/thumb/rails_tmp_1-png.png +0 -0
- data/spec/dummy/public/media/1/thumb/rails_tmp_2-png.png +0 -0
- data/spec/dummy/public/media/1/thumb/rails_tmp_3-png.png +0 -0
- data/spec/dummy/public/media/1/thumb/slide33-jpg.jpg +0 -0
- data/spec/dummy/tmp/capybara/screenshot_2019-09-04-09-19-13.472.html +0 -457
- data/spec/dummy/tmp/capybara/screenshot_2019-09-04-09-19-13.472.png +0 -0
- data/spec/dummy/tmp/capybara/screenshot_2019-09-04-09-19-28.693.html +0 -428
- data/spec/dummy/tmp/capybara/screenshot_2019-09-04-09-19-28.693.png +0 -0
- data/spec/dummy/tmp/capybara/screenshot_2019-09-04-09-22-45.502.html +0 -337
- data/spec/dummy/tmp/capybara/screenshot_2019-09-04-09-22-45.502.png +0 -0
- data/spec/support/fixtures/rails_tmp.png +0 -0
@@ -1,27 +1,29 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module CamaleonCms
|
2
|
+
class CustomFieldsRelationship < ActiveRecord::Base
|
3
|
+
self.table_name = "#{PluginRoutes.static_system_info['db_prefix']}custom_fields_relationships"
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
5
|
+
# attr_accessible :objectid, :custom_field_id, :term_order, :value, :object_class,
|
6
|
+
# :custom_field_slug, :group_number
|
7
|
+
default_scope { order("#{CamaleonCms::CustomFieldsRelationship.table_name}.term_order ASC") }
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
# relations
|
10
|
+
belongs_to :custom_field
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
# validates :objectid, :custom_field_id, presence: true
|
13
|
+
validates :custom_field_id, presence: true # error on clone model
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
after_save :set_parent_slug
|
16
|
+
after_save :update_model_owner # TODO: convert this model into polymorphic
|
16
17
|
|
17
|
-
|
18
|
+
private
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
def set_parent_slug
|
21
|
+
# self.update_column('custom_field_slug', self.custom_fields.slug)
|
22
|
+
end
|
23
|
+
|
24
|
+
# touch owner model
|
25
|
+
def update_model_owner
|
26
|
+
"CamaleonCms::#{object_class}".constantize.find(objectid).touch rescue nil # owner model
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
@@ -1,54 +1,58 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
validates :name, uniqueness: {
|
5
|
-
scope: [:site_id, :is_folder, :folder_path, :is_public],
|
6
|
-
message: 'Duplicates not allowed'
|
7
|
-
}
|
8
|
-
scope :only_folder, ->{ where(is_folder: true) }
|
9
|
-
scope :only_file, ->{ where(is_folder: false) }
|
10
|
-
default_scope { order(is_folder: :asc, name: :asc) }
|
11
|
-
before_save :create_parent_folders
|
12
|
-
before_destroy :delete_folder_items
|
1
|
+
module CamaleonCms
|
2
|
+
class Media < ActiveRecord::Base
|
3
|
+
self.table_name = "#{PluginRoutes.static_system_info['db_prefix']}media"
|
13
4
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
belongs_to :site
|
6
|
+
validates :name, uniqueness: {
|
7
|
+
scope: [:site_id, :is_folder, :folder_path, :is_public],
|
8
|
+
message: 'Duplicates not allowed'
|
9
|
+
}
|
10
|
+
scope :only_folder, ->{ where(is_folder: true) }
|
11
|
+
scope :only_file, ->{ where(is_folder: false) }
|
12
|
+
default_scope { order(is_folder: :asc, name: :asc) }
|
13
|
+
|
14
|
+
before_save :create_parent_folders
|
15
|
+
before_destroy :delete_folder_items
|
16
|
+
|
17
|
+
def self.search(search_expression = '', folder = nil)
|
18
|
+
if search_expression.blank?
|
19
|
+
where(folder_path: folder)
|
20
|
+
else
|
21
|
+
where('name like ?', "%#{search_expression}%")
|
22
|
+
end
|
19
23
|
end
|
20
|
-
end
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
# search file or folder by key
|
26
|
+
def self.find_by_key(key)
|
27
|
+
key = key.cama_fix_media_key
|
28
|
+
if key == '/'
|
29
|
+
where(folder_path: File.dirname(key))
|
30
|
+
else
|
31
|
+
where(folder_path: File.dirname(key), name: File.basename(key))
|
32
|
+
end
|
29
33
|
end
|
30
|
-
end
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
# return all items of current folder
|
36
|
+
def items
|
37
|
+
coll = is_public ? site.public_media : site.private_media
|
38
|
+
coll.where(folder_path: "#{folder_path}/#{name}".cama_fix_media_key)
|
39
|
+
end
|
37
40
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
private
|
42
|
+
# recover folder or file format
|
43
|
+
def create_parent_folders
|
44
|
+
coll = is_public ? site.public_media : site.private_media
|
45
|
+
_p = []
|
46
|
+
folder_path.split('/').each do |f_name|
|
47
|
+
_path = ('/'+_p.join('/')).cama_fix_media_key
|
48
|
+
coll.only_folder.where(name: f_name, folder_path: _path).first_or_create if "#{_path}/#{f_name}".cama_fix_media_key != '/'
|
49
|
+
_p.push(f_name)
|
50
|
+
end
|
47
51
|
end
|
48
|
-
end
|
49
52
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
+
# return all children items
|
54
|
+
def delete_folder_items
|
55
|
+
items.destroy_all if is_folder
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module CamaleonCms
|
2
|
+
class Meta < ActiveRecord::Base
|
3
|
+
self.table_name = "#{PluginRoutes.static_system_info["db_prefix"]}metas"
|
4
|
+
# attr_accessible :objectid, :key, :value, :object_class
|
5
|
+
end
|
4
6
|
end
|
@@ -1,29 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
has_many :children, class_name: "CamaleonCms::NavMenuItem", foreign_key: :parent_id, dependent: :destroy, inverse_of: :parent
|
6
|
-
belongs_to :site, :class_name => "CamaleonCms::Site", foreign_key: :parent_id, inverse_of: :nav_menus
|
1
|
+
module CamaleonCms
|
2
|
+
class NavMenu < CamaleonCms::TermTaxonomy
|
3
|
+
default_scope { where(taxonomy: :nav_menu).order(id: :asc) }
|
4
|
+
alias_attribute :site_id, :parent_id
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# sample: {label: "my label", type: "external", link: "http://camaleon.tuzitio.com", target: '_blank'}
|
12
|
-
# sample: {label: "my label", type: "post", link: 10}
|
13
|
-
# sample: {label: "my label", type: "category", link: 12}
|
14
|
-
# return item created
|
15
|
-
def append_menu_item (value)
|
16
|
-
item = children.create!({name: value[:label], url: value[:link], kind: value[:type], target: value[:target]})
|
17
|
-
item
|
18
|
-
end
|
6
|
+
cama_define_common_relationships('NavMenu')
|
7
|
+
has_many :children, class_name: "CamaleonCms::NavMenuItem", foreign_key: :parent_id, dependent: :destroy, inverse_of: :parent
|
8
|
+
belongs_to :site, foreign_key: :parent_id, inverse_of: :nav_menus
|
19
9
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
10
|
+
# add menu item for current menu
|
11
|
+
# value: (Hash) is a hash object that contains label, type, link
|
12
|
+
# options for type: post | category | post_type | post_tag | external
|
13
|
+
# sample: {label: "my label", type: "external", link: "http://camaleon.tuzitio.com", target: '_blank'}
|
14
|
+
# sample: {label: "my label", type: "post", link: 10}
|
15
|
+
# sample: {label: "my label", type: "category", link: 12}
|
16
|
+
# return item created
|
17
|
+
def append_menu_item (value)
|
18
|
+
item = children.create!({name: value[:label], url: value[:link], kind: value[:type], target: value[:target]})
|
19
|
+
item
|
20
|
+
end
|
21
|
+
|
22
|
+
# skip uniq slug validation
|
23
|
+
def skip_slug_validation?
|
24
|
+
true
|
25
|
+
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
private
|
28
|
+
# overwrite termtaxonomy method
|
29
|
+
def destroy_dependencies
|
30
|
+
end
|
28
31
|
end
|
29
32
|
end
|
@@ -1,64 +1,68 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
belongs_to :parent_item, class_name: "CamaleonCms::NavMenuItem", foreign_key: :parent_id, inverse_of: :children
|
12
|
-
has_many :children, class_name: "CamaleonCms::NavMenuItem", foreign_key: :parent_id, dependent: :destroy, inverse_of: :parent_item
|
1
|
+
module CamaleonCms
|
2
|
+
class NavMenuItem < CamaleonCms::TermTaxonomy
|
3
|
+
alias_attribute :site_id, :term_group
|
4
|
+
alias_attribute :label, :name
|
5
|
+
alias_attribute :url, :description
|
6
|
+
alias_attribute :kind, :slug
|
7
|
+
alias_attribute :target, :status
|
8
|
+
# attr_accessible :label, :url, :kind
|
9
|
+
#
|
10
|
+
default_scope { where(taxonomy: :nav_menu_item).order(id: :asc) }
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
cama_define_common_relationships('NavMenuItem')
|
13
|
+
belongs_to :parent, class_name: "CamaleonCms::NavMenu", inverse_of: :children
|
14
|
+
belongs_to :parent_item, class_name: "CamaleonCms::NavMenuItem", foreign_key: :parent_id, inverse_of: :children
|
15
|
+
has_many :children, class_name: "CamaleonCms::NavMenuItem", foreign_key: :parent_id, dependent: :destroy, inverse_of: :parent_item
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
return main_menu if main_menu.present?
|
22
|
-
parent_menu = self.parent_item
|
23
|
-
parent_menu.main_menu if parent_menu.present?
|
24
|
-
end
|
17
|
+
before_create :set_parent_site
|
18
|
+
after_create :update_count
|
19
|
+
#before_destroy :update_count
|
25
20
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
21
|
+
# return the main menu
|
22
|
+
def main_menu
|
23
|
+
return parent if parent
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
# return item created
|
34
|
-
def append_menu_item(value)
|
35
|
-
children.create({name: value[:label], url: value[:link], kind: value[:type], target: value[:target]})
|
36
|
-
end
|
25
|
+
parent_item.main_menu if parent_item
|
26
|
+
end
|
37
27
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
28
|
+
# check if this menu have children
|
29
|
+
def have_children?
|
30
|
+
self.children.count != 0
|
31
|
+
end
|
43
32
|
|
44
|
-
|
45
|
-
|
46
|
-
|
33
|
+
# add sub menu for a menu item
|
34
|
+
# same values of NavMenu#append_menu_item
|
35
|
+
# return item created
|
36
|
+
def append_menu_item(value)
|
37
|
+
children.create({name: value[:label], url: value[:link], kind: value[:type], target: value[:target]})
|
38
|
+
end
|
47
39
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
self.update_column(:term_order, CamaleonCms::NavMenuItem.where(parent_id: self.parent_id).count) # update position
|
54
|
-
end
|
40
|
+
# update current menu
|
41
|
+
# value: same as append_menu_item (label, link, target)
|
42
|
+
def update_menu_item(value)
|
43
|
+
self.update({name: value[:label], url: value[:link], target: value[:target]})
|
44
|
+
end
|
55
45
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
46
|
+
# overwrite skip uniq slug validation
|
47
|
+
def skip_slug_validation?; true end
|
48
|
+
def before_validating; end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def update_count
|
53
|
+
self.parent.update_column('count', parent.children.size) if parent
|
54
|
+
self.parent_item.update_column('count', parent_item.children.size) if parent_item
|
55
|
+
self.update_column(:term_group, main_menu.parent_id)
|
56
|
+
self.update_column(:term_order, CamaleonCms::NavMenuItem.where(parent_id: parent_id).count) # update position
|
57
|
+
end
|
61
58
|
|
62
|
-
|
63
|
-
|
59
|
+
# fast access from site to menu items
|
60
|
+
def set_parent_site
|
61
|
+
self.site_id = parent_item.site_id if parent_item
|
62
|
+
self.site_id = parent.site_id if parent
|
63
|
+
end
|
64
|
+
|
65
|
+
# overwrite inherit method
|
66
|
+
def destroy_dependencies; end
|
67
|
+
end
|
64
68
|
end
|
@@ -1,76 +1,78 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module CamaleonCms
|
2
|
+
class Plugin < CamaleonCms::TermTaxonomy
|
3
|
+
# attrs:
|
4
|
+
# term_group => status active (1, nil)
|
5
|
+
# slug => plugin key
|
6
|
+
# name => plugin name
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
attr_accessor :error
|
9
|
+
cama_define_common_relationships('Plugin')
|
10
|
+
belongs_to :site, foreign_key: :parent_id
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
default_scope { where(taxonomy: :plugin) }
|
13
|
+
scope :active, -> { where(term_group: 1) }
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
before_validation :set_default
|
16
|
+
before_destroy :destroy_custom_fields
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
# active the plugin
|
19
|
+
def active
|
20
|
+
self.term_group = 1
|
21
|
+
self.save
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
# inactive the plugin
|
25
|
+
def inactive
|
26
|
+
self.term_group = nil
|
27
|
+
self.save
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
# check if plugin is active
|
31
|
+
def active?
|
32
|
+
self.term_group.to_s == "1"
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
# return theme settings configured in config.json
|
36
|
+
def settings
|
37
|
+
PluginRoutes.plugin_info(slug)
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
# check if current installation version is older
|
41
|
+
# return boolean
|
42
|
+
def old_version?
|
43
|
+
# self.installed_version.to_s != self.settings["version"].to_s
|
44
|
+
false
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
# set a new installation version for this plugin
|
48
|
+
def installed_version=(version)
|
49
|
+
self.set_option("version_installed", version)
|
50
|
+
end
|
51
|
+
|
52
|
+
# return gem installed version
|
53
|
+
def installed_version
|
54
|
+
return ""
|
50
55
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
res
|
57
|
-
self.installed_version= res
|
56
|
+
res = get_option("version_installed")
|
57
|
+
unless res.present? # fix for old installations
|
58
|
+
res = self.settings["version"]
|
59
|
+
self.installed_version = res
|
60
|
+
end
|
61
|
+
res
|
58
62
|
end
|
59
|
-
res
|
60
|
-
end
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
64
|
+
# return the title of this plugin
|
65
|
+
def title
|
66
|
+
PluginRoutes.plugin_info(slug)["title"]
|
67
|
+
end
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
69
|
+
private
|
70
|
+
def set_default
|
71
|
+
self.name = slug unless name.present?
|
72
|
+
end
|
71
73
|
|
72
|
-
|
73
|
-
|
74
|
+
def destroy_custom_fields
|
75
|
+
self.get_field_groups.destroy_all
|
76
|
+
end
|
74
77
|
end
|
75
|
-
|
76
78
|
end
|