camaleon_cms 0.2.1 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of camaleon_cms might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +266 -0
- data/app/apps/plugins/attack/config/config.json +1 -1
- data/app/apps/plugins/contact_form/config/config.json +1 -1
- data/app/apps/plugins/contact_form/contact_form_html_helper.rb +15 -10
- data/app/apps/plugins/contact_form/front_controller.rb +1 -0
- data/app/apps/plugins/contact_form/views/admin_forms/edit.html.erb +1 -2
- data/app/apps/plugins/contact_form/views/admin_forms/index.html.erb +1 -1
- data/app/apps/plugins/contact_form/views/admin_forms/responses.html.erb +1 -1
- data/app/apps/plugins/contact_form/views/forms_shorcode.html.erb +6 -6
- data/app/apps/plugins/front_cache/config/config.json +1 -1
- data/app/apps/plugins/front_cache/views/admin/settings.html.erb +1 -1
- data/app/apps/plugins/visibility_post/config/config.json +1 -1
- data/app/apps/themes/camaleon_first/assets/css/style-ver.css.scss +59 -32
- data/app/apps/themes/camaleon_first/views/layouts/index.html.erb +2 -2
- data/app/apps/themes/default/assets/css/style.css.scss +3 -0
- data/app/apps/themes/default/views/category.html.erb +1 -1
- data/app/apps/themes/default/views/post_tag.html.erb +1 -1
- data/app/apps/themes/default/views/post_type.html.erb +1 -1
- data/app/apps/themes/default/views/search.html.erb +1 -1
- data/app/apps/themes/new/views/category.html.erb +1 -1
- data/app/apps/themes/new/views/layouts/index.html.erb +2 -2
- data/app/apps/themes/new/views/post_tag.html.erb +1 -1
- data/app/apps/themes/new/views/post_type.html.erb +1 -1
- data/app/apps/themes/new/views/search.html.erb +1 -1
- data/app/assets/{stylesheets/admin/bootstrap/images → images/admin}/glyphicons-halflings.png +0 -0
- data/app/assets/javascripts/admin/actions.js +12 -205
- data/app/assets/javascripts/admin/admin-basic-manifest.js +3 -0
- data/app/assets/javascripts/admin/admin-manifest.js +14 -4
- data/app/assets/javascripts/admin/custom_fields.js +4 -2
- data/app/assets/javascripts/admin/data.js +49 -20
- data/app/assets/javascripts/admin/elfinder/upload_elfinder.js +4 -4
- data/app/assets/javascripts/admin/grid-editor.js +390 -113
- data/app/assets/javascripts/admin/i18n.js +22 -0
- data/app/assets/javascripts/admin/jquery.validate.js +2 -54
- data/app/assets/javascripts/admin/{core.js → libraries.js} +92 -76
- data/app/assets/javascripts/admin/login_manifest.js +0 -3
- data/app/assets/javascripts/admin/lte/app.js +758 -0
- data/app/assets/javascripts/admin/modal.js +76 -22
- data/app/assets/javascripts/admin/nav-menu.js +98 -39
- data/app/assets/javascripts/admin/post.js +28 -29
- data/app/assets/javascripts/admin/tinymce/skins/lightgray/content.min.css.scss +1 -1
- data/app/assets/javascripts/admin/tinymce/tinymce.min.js +11 -11
- data/app/assets/javascripts/admin/translator.js +9 -7
- data/app/assets/javascripts/admin/widgets.js +1 -0
- data/app/assets/stylesheets/admin/admin-basic-manifest.css +15 -0
- data/app/assets/stylesheets/admin/admin-manifest.css +7 -11
- data/app/assets/stylesheets/admin/bootstrap-datepicker.css.scss +472 -0
- data/app/assets/stylesheets/admin/bootstrap-datetimepicker.css.scss +339 -0
- data/app/assets/stylesheets/admin/colorpicker.css.scss +95 -0
- data/app/assets/stylesheets/admin/custom_admin.css.scss +160 -0
- data/app/assets/stylesheets/admin/elfinder-manifest.css +1 -1
- data/app/assets/stylesheets/admin/grid-editor.css.scss +14 -299
- data/app/assets/stylesheets/admin/lte/admin.css.scss +4747 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-black-light.css +176 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-black.css +154 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-blue-light.css +167 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-blue.css +142 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-green-light.css +156 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-green.css +134 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-purple-light.css +156 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-purple.css +134 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-red-light.css +156 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-red.css +134 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-yellow-light.css +156 -0
- data/app/assets/stylesheets/admin/lte/skins/skin-yellow.css +134 -0
- data/app/assets/stylesheets/admin/nav-menu.css.scss +33 -0
- data/app/controllers/admin/appearances/nav_menus_controller.rb +13 -10
- data/app/controllers/admin/appearances/themes_controller.rb +1 -2
- data/app/controllers/admin/appearances_controller.rb +0 -4
- data/app/controllers/admin/categories_controller.rb +9 -15
- data/app/controllers/admin/comments_controller.rb +8 -14
- data/app/controllers/admin/grid_editor_controller.rb +55 -0
- data/app/controllers/admin/installers_controller.rb +1 -1
- data/app/controllers/admin/media_controller.rb +1 -3
- data/app/controllers/admin/plugins_controller.rb +2 -2
- data/app/controllers/admin/post_tags_controller.rb +9 -18
- data/app/controllers/admin/posts/drafts_controller.rb +1 -9
- data/app/controllers/admin/posts_controller.rb +12 -15
- data/app/controllers/admin/sessions_controller.rb +6 -7
- data/app/controllers/admin/settings/custom_fields_controller.rb +4 -9
- data/app/controllers/admin/settings/post_types_controller.rb +6 -16
- data/app/controllers/admin/settings/sites_controller.rb +5 -7
- data/app/controllers/admin/settings_controller.rb +0 -4
- data/app/controllers/admin/user_roles_controller.rb +8 -8
- data/app/controllers/admin/users_controller.rb +8 -9
- data/app/controllers/admin_controller.rb +4 -5
- data/app/controllers/apps/plugins_admin_controller.rb +3 -3
- data/app/controllers/apps/plugins_front_controller.rb +2 -2
- data/app/controllers/apps/themes_admin_controller.rb +2 -2
- data/app/controllers/apps/themes_front_controller.rb +2 -2
- data/app/controllers/camaleon_controller.rb +0 -1
- data/app/controllers/concerns/frontend_concern.rb +1 -2
- data/app/controllers/frontend_controller.rb +25 -9
- data/app/decorators/category_decorator.rb +0 -1
- data/app/decorators/custom_field_decorator.rb +0 -1
- data/app/decorators/custom_fields_concern.rb +9 -3
- data/app/decorators/post_comment_decorator.rb +0 -1
- data/app/decorators/post_decorator.rb +10 -4
- data/app/decorators/post_tag_decorator.rb +0 -1
- data/app/decorators/post_type_decorator.rb +0 -1
- data/app/decorators/site_decorator.rb +35 -11
- data/app/decorators/term_taxonomy_decorator.rb +1 -3
- data/app/decorators/theme_decorator.rb +0 -1
- data/app/decorators/user_decorator.rb +7 -5
- data/app/decorators/widget_decorator.rb +0 -1
- data/app/helpers/admin/application_helper.rb +14 -0
- data/app/helpers/admin/menus_helper.rb +8 -8
- data/app/helpers/camaleon_helper.rb +10 -3
- data/app/helpers/captcha_helper.rb +2 -2
- data/app/helpers/frontend/application_helper.rb +0 -1
- data/app/helpers/frontend/nav_menu_helper.rb +2 -1
- data/app/helpers/frontend/seo_helper.rb +1 -2
- data/app/helpers/frontend/site_helper.rb +4 -4
- data/app/helpers/hooks_helper.rb +2 -5
- data/app/helpers/html_helper.rb +9 -7
- data/app/helpers/plugins_helper.rb +34 -8
- data/app/helpers/session_helper.rb +1 -2
- data/app/helpers/short_code_helper.rb +91 -10
- data/app/helpers/site_helper.rb +17 -8
- data/app/helpers/theme_helper.rb +34 -7
- data/app/helpers/uploader_helper.rb +6 -2
- data/app/mailers/html_mailer.rb +15 -6
- data/app/models/category.rb +2 -1
- data/app/models/concerns/custom_fields_read.rb +14 -3
- data/app/models/concerns/metas.rb +7 -4
- data/app/models/custom_field_group.rb +3 -0
- data/app/models/{concerns/metas_saved.rb → grid_template.rb} +7 -2
- data/app/models/meta.rb +0 -1
- data/app/models/nav_menu.rb +15 -1
- data/app/models/nav_menu_item.rb +10 -0
- data/app/models/post.rb +100 -6
- data/app/models/post_comment.rb +6 -0
- data/app/models/post_default.rb +9 -8
- data/app/models/post_relationship.rb +2 -0
- data/app/models/post_type.rb +36 -24
- data/app/models/site.rb +7 -16
- data/app/models/term_taxonomy.rb +3 -2
- data/app/models/theme.rb +5 -0
- data/app/models/widget/assigned.rb +3 -2
- data/app/views/admin/appearances/nav_menus/_custom_fields.html.erb +6 -0
- data/app/views/admin/appearances/{_external_menu.html.erb → nav_menus/_external_menu.html.erb} +8 -10
- data/app/views/admin/appearances/nav_menus/_menu_form.html.erb +35 -0
- data/app/views/admin/appearances/nav_menus/_menu_list.html.erb +22 -0
- data/app/views/admin/appearances/nav_menus/index.html.erb +110 -0
- data/app/views/admin/appearances/themes/index.html.erb +4 -3
- data/app/views/admin/appearances/widgets/main/_sidebar.html.erb +29 -0
- data/app/views/admin/appearances/widgets/main/form.html.erb +1 -1
- data/app/views/admin/appearances/widgets/main/index.html.erb +19 -41
- data/app/views/admin/categories/edit.html.erb +2 -6
- data/app/views/admin/categories/index.html.erb +7 -11
- data/app/views/admin/comments/form.html.erb +4 -7
- data/app/views/admin/comments/index.html.erb +24 -41
- data/app/views/admin/comments/reply.html.erb +9 -10
- data/app/views/admin/grid_editor/form.html.erb +31 -0
- data/app/views/admin/grid_editor/index.html.erb +29 -0
- data/app/views/admin/media/index.html.erb +3 -15
- data/app/views/admin/plugins/_plugins_list.html.erb +1 -2
- data/app/views/admin/post_tags/edit.html.erb +2 -6
- data/app/views/admin/post_tags/index.html.erb +3 -8
- data/app/views/admin/posts/_sidebar.html.erb +136 -0
- data/app/views/admin/posts/form.html.erb +87 -281
- data/app/views/admin/posts/index.html.erb +89 -104
- data/app/views/admin/sessions/forgot.html.erb +7 -13
- data/app/views/admin/sessions/login.html.erb +21 -11
- data/app/views/admin/sessions/register.html.erb +3 -6
- data/app/views/admin/settings/custom_fields/_meta_data.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/_render.html.erb +6 -14
- data/app/views/admin/settings/custom_fields/fields/audio.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/field_attrs.html.erb +3 -5
- data/app/views/admin/settings/custom_fields/fields/file.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/image.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/posts.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/select.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/users.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/video.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/form.html.erb +11 -9
- data/app/views/admin/settings/custom_fields/get_items.html.erb +3 -6
- data/app/views/admin/settings/custom_fields/index.html.erb +3 -10
- data/app/views/admin/settings/languages.html.erb +2 -10
- data/app/views/admin/settings/post_types/_form.html.erb +1 -1
- data/app/views/admin/settings/post_types/edit.html.erb +2 -6
- data/app/views/admin/settings/post_types/index.html.erb +4 -12
- data/app/views/admin/settings/site.html.erb +143 -149
- data/app/views/admin/settings/sites/form.html.erb +4 -19
- data/app/views/admin/settings/sites/index.html.erb +8 -9
- data/app/views/admin/taxonomy/index.html.erb +1 -1
- data/app/views/admin/user_roles/form.html.erb +2 -3
- data/app/views/admin/user_roles/index.html.erb +2 -8
- data/app/views/admin/users/form.html.erb +14 -9
- data/app/views/admin/users/index.html.erb +3 -8
- data/app/views/admin/users/profile_edit.html.erb +21 -14
- data/app/views/default_theme/custom_fields/audio.html.erb +3 -0
- data/app/views/default_theme/custom_fields/checkbox.html.erb +3 -0
- data/app/views/default_theme/custom_fields/checkboxes.html.erb +3 -0
- data/app/views/default_theme/custom_fields/colorpicker.html.erb +3 -0
- data/app/views/default_theme/custom_fields/date.html.erb +3 -0
- data/app/views/default_theme/custom_fields/editor.html.erb +3 -0
- data/app/views/default_theme/custom_fields/email.html.erb +3 -0
- data/app/views/default_theme/custom_fields/field_attrs.html.erb +3 -0
- data/app/views/default_theme/custom_fields/file.html.erb +3 -0
- data/app/views/default_theme/custom_fields/image.html.erb +3 -0
- data/app/views/default_theme/custom_fields/numeric.html.erb +3 -0
- data/app/views/default_theme/custom_fields/phone.html.erb +3 -0
- data/app/views/default_theme/custom_fields/posts.html.erb +3 -0
- data/app/views/default_theme/custom_fields/radio.html.erb +3 -0
- data/app/views/default_theme/custom_fields/select.html.erb +3 -0
- data/app/views/default_theme/custom_fields/select_eval.html.erb +3 -0
- data/app/views/default_theme/custom_fields/text_area.html.erb +3 -0
- data/app/views/default_theme/custom_fields/text_box.html.erb +3 -0
- data/app/views/default_theme/custom_fields/url.html.erb +3 -0
- data/app/views/default_theme/custom_fields/users.html.erb +3 -0
- data/app/views/default_theme/custom_fields/video.html.erb +3 -0
- data/app/views/default_theme/layouts/index.html.erb +2 -2
- data/app/views/default_theme/{post.html.erb → single.html.erb} +1 -1
- data/app/views/default_theme/{post.rss.builder → single.rss.builder} +0 -0
- data/app/views/layouts/admin.html.erb +35 -133
- data/app/views/layouts/admin/_flash_messages.html.erb +1 -15
- data/app/views/layouts/admin/_footer.html.erb +6 -0
- data/app/views/layouts/admin/_header.html.erb +51 -0
- data/app/views/layouts/admin/_sidebar.html.erb +21 -30
- data/app/views/layouts/admin/installer.html.erb +2 -2
- data/app/views/layouts/login.html.erb +15 -33
- data/config/initializers/active_record_extension.rb +14 -2
- data/config/initializers/assets.rb +21 -7
- data/config/initializers/page_caching.rb +1 -2
- data/config/locales/admin/en.yml +17 -9
- data/config/locales/admin/es.yml +8 -3
- data/config/locales/admin/it.yml +4 -2
- data/config/locales/admin/js.yml +147 -0
- data/config/routes/admin.rb +4 -4
- data/config/routes/frontend.rb +2 -2
- data/config/system.json +1 -0
- data/db/migrate/20150926095310_rename_column_posts.rb +18 -0
- data/lib/camaleon_cms.rb +1 -1
- data/lib/camaleon_cms/engine.rb +17 -2
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/generators/camaleon_cms/gem_plugin_generator.rb +122 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/controllers/plugins/my_plugin/admin_controller.rb +8 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/controllers/plugins/my_plugin/front_controller.rb +8 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/helpers/plugins/my_plugin/main_helper.rb +22 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/models/plugins/my_plugin/my_plugin.rb +12 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/views/plugins/my_plugin/admin/index.html.erb +2 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/views/plugins/my_plugin/front/index.html.erb +2 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/app/views/plugins/my_plugin/layouts/readme.txt +2 -0
- data/lib/generators/camaleon_cms/gem_plugin_template/config/camaleon_plugin.json +21 -0
- data/lib/generators/camaleon_cms/install_generator.rb +1 -2
- data/lib/generators/camaleon_cms/install_template/plugin_routes.rb +1 -10
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/config/config.json +5 -5
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb +6 -5
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/views/layouts/index.html.erb +2 -2
- data/lib/plugin_routes.rb +40 -2
- metadata +257 -22
- data/app/assets/stylesheets/admin/animate/animate.min.css +0 -6
- data/app/assets/stylesheets/admin/bootstrap/bootstrap-datetimepicker.css.scss +0 -339
- data/app/assets/stylesheets/admin/bootstrap/bootstrap.min.css +0 -5
- data/app/assets/stylesheets/admin/core.scss +0 -349
- data/app/assets/stylesheets/admin/fonts/OpenSans-Regular-webfont.eot +0 -0
- data/app/assets/stylesheets/admin/fonts/OpenSans-Regular-webfont.svg +0 -1831
- data/app/assets/stylesheets/admin/fonts/OpenSans-Regular-webfont.ttf +0 -0
- data/app/assets/stylesheets/admin/fonts/OpenSans-Regular-webfont.woff +0 -0
- data/app/assets/stylesheets/admin/nav-menu.css +0 -54
- data/app/assets/stylesheets/admin/theme-default.scss +0 -8462
- data/app/models/concerns/site_public.rb +0 -23
- data/app/views/admin/appearances/menu.html.erb +0 -199
- data/lib/Gemfile +0 -25
@@ -24,4 +24,18 @@ module Admin::ApplicationHelper
|
|
24
24
|
end
|
25
25
|
args[:content] << current_site.get_meta("date_notified_message", "")
|
26
26
|
end
|
27
|
+
|
28
|
+
# render pagination for current items
|
29
|
+
# items is a will pagination object
|
30
|
+
# sample: <%= raw do_pagination(@posts) %>
|
31
|
+
def do_pagination(items)
|
32
|
+
"<div class='row' class='pagination_panel'>
|
33
|
+
<div class='col-md-6'>
|
34
|
+
#{will_paginate items }
|
35
|
+
</div>
|
36
|
+
<div class='col-md-6 text-right total-items'>
|
37
|
+
<strong>Total: #{items.total_entries} </strong>
|
38
|
+
</div>
|
39
|
+
</div>"
|
40
|
+
end
|
27
41
|
end
|
@@ -10,7 +10,7 @@ module Admin::MenusHelper
|
|
10
10
|
include Admin::BreadcrumbHelper
|
11
11
|
|
12
12
|
def admin_menus_add_commons
|
13
|
-
admin_menu_add_menu("
|
13
|
+
admin_menu_add_menu("dashboard", {icon: "dashboard", title: t('admin.sidebar.dashboard'), url: admin_dashboard_path})
|
14
14
|
#if can? :manager, :content
|
15
15
|
items = []
|
16
16
|
|
@@ -40,7 +40,7 @@ module Admin::MenusHelper
|
|
40
40
|
admin_menu_add_menu("appearance", {icon: "paint-brush", title: t('admin.sidebar.appearance'), url: "", items: items}) if items.present?
|
41
41
|
|
42
42
|
|
43
|
-
admin_menu_add_menu("plugins", {icon: "plug", title: "#{t('admin.sidebar.plugins')} <
|
43
|
+
admin_menu_add_menu("plugins", {icon: "plug", title: "#{t('admin.sidebar.plugins')} <small class='label label-primary'>#{PluginRoutes.all_plugins.size}</small>", url: admin_plugins_path}) if can? :manager, :plugins
|
44
44
|
|
45
45
|
if can? :manager, :users
|
46
46
|
items = []
|
@@ -54,7 +54,7 @@ module Admin::MenusHelper
|
|
54
54
|
items = []
|
55
55
|
items << {icon: "desktop", title: t('admin.sidebar.general_site'), url: admin_settings_site_path}
|
56
56
|
items << {icon: "cog", title: t('admin.sidebar.sites'), url: admin_settings_sites_path} if current_site.manage_sites?
|
57
|
-
items << {icon: "files-o", title: t('admin.sidebar.
|
57
|
+
items << {icon: "files-o", title: t('admin.sidebar.post_type'), url: admin_settings_post_types_path}
|
58
58
|
items << {icon: "cog", title: t('admin.sidebar.custom_fields'), url: admin_settings_custom_fields_path}
|
59
59
|
items << {icon: "language", title: t('admin.sidebar.languages'), url: admin_settings_languages_path}
|
60
60
|
admin_menu_add_menu("settings", {icon: "cogs", title: t('admin.sidebar.settings'), url: "", items: items})
|
@@ -119,8 +119,8 @@ module Admin::MenusHelper
|
|
119
119
|
@_tmp_menu_parents = []
|
120
120
|
menus = _get_url_current
|
121
121
|
menus.each do |menu|
|
122
|
-
res << "<li data-key='#{menu[:key]}' class='#{"
|
123
|
-
<a href='#{menu[:url]}'><
|
122
|
+
res << "<li data-key='#{menu[:key]}' class='#{"treeview" if menu.has_key?(:items)} #{'active' if is_active_menu(menu[:key])}'>
|
123
|
+
<a href='#{menu[:url]}'><i class='fa fa-#{menu[:icon]}'></i> <span class=''>#{menu[:title]}</span> #{'<i class="fa fa-angle-left pull-right"></i>' if menu.has_key?(:items) }</a>
|
124
124
|
#{_admin_menu_draw(menu[:items]) if menu.has_key?(:items)}
|
125
125
|
</li>"
|
126
126
|
end
|
@@ -175,10 +175,10 @@ module Admin::MenusHelper
|
|
175
175
|
|
176
176
|
def _admin_menu_draw(items)
|
177
177
|
res = []
|
178
|
-
res << "<ul>"
|
178
|
+
res << "<ul class='treeview-menu'>"
|
179
179
|
items.each do |item|
|
180
180
|
res << "<li class='#{"xn-openable" if item.has_key?(:items)} #{'active' if is_active_menu(item[:key])}'>
|
181
|
-
<a href='#{item[:url]}'><
|
181
|
+
<a href='#{item[:url]}'><i class='fa fa-#{item[:icon]}'></i> #{item[:title]} #{'<i class="fa fa-angle-left pull-right"></i>' if item.has_key?(:items) }</a>
|
182
182
|
#{_admin_menu_draw(item[:items]) if item.has_key?(:items)}
|
183
183
|
</li>"
|
184
184
|
end
|
@@ -189,7 +189,7 @@ module Admin::MenusHelper
|
|
189
189
|
def _admin_menu_draw_active
|
190
190
|
bread = []
|
191
191
|
@_tmp_menu_parents.uniq.each do |item|
|
192
|
-
bread << [item[:title].to_s.strip_tags, item[:url]] if item.present? && item[:key] != "
|
192
|
+
bread << [item[:title].to_s.strip_tags, item[:url]] if item.present? && item[:key] != "dashboard"
|
193
193
|
end
|
194
194
|
@_admin_breadcrumb = [[t('admin.sidebar.dashboard'), admin_dashboard_path]] + bread + @_admin_breadcrumb
|
195
195
|
end
|
@@ -7,7 +7,6 @@
|
|
7
7
|
See the GNU Affero General Public License (GPLv3) for more details.
|
8
8
|
=end
|
9
9
|
module CamaleonHelper
|
10
|
-
|
11
10
|
# send and email
|
12
11
|
# email: email to
|
13
12
|
# subject: Subject of the email
|
@@ -24,6 +23,15 @@ module CamaleonHelper
|
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
26
|
+
# create the html link with the url passed
|
27
|
+
# verify if current user is logged in, if not, then return nil
|
28
|
+
# return html link
|
29
|
+
def cama_edit_link(url, title = nil, attrs = { })
|
30
|
+
return '' unless current_user.present?
|
31
|
+
attrs = {target: "_blank", style: "font-size:11px !important;cursor:pointer;"}.merge(attrs)
|
32
|
+
ActionController::Base.helpers.link_to("→ #{title || ct("edit")}".html_safe, url, attrs)
|
33
|
+
end
|
34
|
+
|
27
35
|
# execute controller action and return response
|
28
36
|
def requestAction(controller,action,params={})
|
29
37
|
controller.class_eval{
|
@@ -63,5 +71,4 @@ module CamaleonHelper
|
|
63
71
|
def is_admin_request?
|
64
72
|
!(@_admin_menus.nil?)
|
65
73
|
end
|
66
|
-
|
67
|
-
end
|
74
|
+
end
|
@@ -76,8 +76,8 @@ module CaptchaHelper
|
|
76
76
|
captcha_tag(*captcha_parmas) if captcha_under_attack?(key)
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
79
|
private
|
80
|
+
|
81
81
|
def rand_str(len=6)
|
82
82
|
alphabets = [('A'..'Z').to_a].flatten!
|
83
83
|
alphanumerics = [('A'..'Z').to_a,('0'..'9').to_a].flatten!
|
@@ -87,4 +87,4 @@ module CaptchaHelper
|
|
87
87
|
end
|
88
88
|
str
|
89
89
|
end
|
90
|
-
end
|
90
|
+
end
|
@@ -68,7 +68,8 @@ module Frontend::NavMenuHelper
|
|
68
68
|
|
69
69
|
args = args_def.merge(args)
|
70
70
|
nav_menu = current_site.nav_menus.find_by_slug(args[:menu_slug])
|
71
|
-
|
71
|
+
nav_menu = current_site.nav_menus.first unless nav_menu.present?
|
72
|
+
html = "<#{args[:container]} class='#{args[:container_class]}' id='#{args[:container_id]}'>#{args[:container_prepend]}{__}#{cama_edit_link(admin_appearances_nav_menus_menu_url(slug: nav_menu.slug)) rescue ""}#{args[:container_append]}</#{args[:container]}>"
|
72
73
|
if nav_menu.present?
|
73
74
|
html = html.sub("{__}", _menu_draw_items(args, nav_menu.children))
|
74
75
|
else
|
@@ -9,7 +9,6 @@
|
|
9
9
|
module Frontend::SeoHelper
|
10
10
|
def init_seo(model)
|
11
11
|
@_seo_info = model.the_seo
|
12
|
-
|
13
12
|
end
|
14
13
|
|
15
14
|
# add seo attributes to your page
|
@@ -58,4 +57,4 @@ module Frontend::SeoHelper
|
|
58
57
|
r = {seo_data: s, object: options[:object]}; hooks_run("seo", r)
|
59
58
|
r[:seo_data]
|
60
59
|
end
|
61
|
-
end
|
60
|
+
end
|
@@ -7,7 +7,6 @@
|
|
7
7
|
See the GNU Affero General Public License (GPLv3) for more details.
|
8
8
|
=end
|
9
9
|
module Frontend::SiteHelper
|
10
|
-
|
11
10
|
# return full current visited url
|
12
11
|
def site_current_url
|
13
12
|
request.original_url
|
@@ -51,10 +50,11 @@ module Frontend::SiteHelper
|
|
51
50
|
|
52
51
|
# show custom assets added by plugins
|
53
52
|
# show respond js and html5shiv
|
54
|
-
|
53
|
+
# seo_attrs: Custom attributes for seo in Hash format
|
54
|
+
# show_seo: (Boolean) control to append or not the seo attributes
|
55
|
+
def the_head(seo_attrs = {}, show_seo = true)
|
55
56
|
icon = "<link rel='shortcut icon' href='#{current_site.the_icon}'>"
|
56
57
|
js = "<script>var ROOT_URL = '#{root_url}'; var LANGUAGE = '#{I18n.locale}'; </script>"
|
57
|
-
icon + "\n" + csrf_meta_tag + "\n" + (
|
58
|
+
icon + "\n" + csrf_meta_tag + "\n" + (show_seo ? display_meta_tags(the_seo.merge(seo_attrs)) : "") + "\n" + js + "\n" + draw_custom_assets
|
58
59
|
end
|
59
|
-
|
60
60
|
end
|
data/app/helpers/hooks_helper.rb
CHANGED
@@ -32,6 +32,7 @@ module HooksHelper
|
|
32
32
|
end
|
33
33
|
|
34
34
|
private
|
35
|
+
|
35
36
|
def _do_hook(plugin, hook_key, params = nil)
|
36
37
|
return if !plugin.present? || !plugin["hooks"].present? || !plugin["hooks"][hook_key].present?
|
37
38
|
|
@@ -42,13 +43,9 @@ module HooksHelper
|
|
42
43
|
send(hook) if params.nil?
|
43
44
|
rescue
|
44
45
|
plugin_load_helpers(plugin)
|
45
|
-
# begin
|
46
46
|
send(hook, params) unless params.nil?
|
47
47
|
send(hook) if params.nil?
|
48
|
-
# rescue => e
|
49
|
-
# Rails.logger.info "--------------------------------------- error executing hook '#{hook_key}' for plugin '#{plugin["title"]}': #{e.message} --- #{e.backtrace.join("\n")}"
|
50
|
-
# end
|
51
48
|
end
|
52
49
|
end
|
53
50
|
end
|
54
|
-
end
|
51
|
+
end
|
data/app/helpers/html_helper.rb
CHANGED
@@ -14,6 +14,7 @@ module HtmlHelper
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# enable to load admin libraries (colorpicker, datepicker, form_builder, tinymce, form_ajax, cropper)
|
17
|
+
# sample: add_asset_library("datepicker", "colorpicker")
|
17
18
|
def add_asset_library(*keys)
|
18
19
|
keys.each do |key|
|
19
20
|
library = assets_libraries[key.to_sym]
|
@@ -21,8 +22,12 @@ module HtmlHelper
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
# add asset libraries (js, css)
|
25
|
-
#
|
25
|
+
# add custom asset libraries (js, css or both), also you can add extra css or js files for existent libraries
|
26
|
+
# sample: (add new library)
|
27
|
+
# append_asset_libraries({"my_library_key"=> { js: [plugin_asset("js/my_js"), "plugins/myplugin/assets/js/my_js2"], css: [plugin_asset("css/my_css"), "plugins/myplugin/assets/css/my_css2"] }})
|
28
|
+
# sample: (update existent library)
|
29
|
+
# append_asset_libraries({"colorpicker"=>{js: [[plugin_asset("js/my_custom_js")] } })
|
30
|
+
# return nil
|
26
31
|
def append_asset_libraries(libraries)
|
27
32
|
libraries.each do |key, library|
|
28
33
|
if @_assets_libraries.include?(key)
|
@@ -88,15 +93,13 @@ module HtmlHelper
|
|
88
93
|
end
|
89
94
|
|
90
95
|
def html_tooltip(text='Tooltip', location='left')
|
91
|
-
|
96
|
+
"<a href='javascript:;' title='#{text}' data-toggle='tooltip' data-placement='#{location}'><i class='fa fa-info-circle'></i></a>"
|
92
97
|
end
|
93
98
|
|
94
|
-
|
95
|
-
|
96
99
|
private
|
97
100
|
def assets_libraries
|
98
101
|
libs = {}
|
99
|
-
libs[:colorpicker] = {js: ['admin/bootstrap-colorpicker']}
|
102
|
+
libs[:colorpicker] = {js: ['admin/bootstrap-colorpicker'], css: ["admin/colorpicker.css"]}
|
100
103
|
libs[:datepicker] = {js: ['admin/bootstrap-datepicker']}
|
101
104
|
libs[:datetimepicker] = {js: ['admin/bootstrap-datetimepicker.min']}
|
102
105
|
libs[:tinymce] = {js: ['admin/tinymce/tinymce.min', "admin/tinymce/plugins/filemanager/plugin.min"], css: ["admin/tinymce/skins/lightgray/content.min"]}
|
@@ -106,7 +109,6 @@ module HtmlHelper
|
|
106
109
|
libs[:post] = {js: ["admin/jquery.tagsinput.min", 'admin/post'], css: ["admin/jquery.tagsinput"]}
|
107
110
|
libs[:multiselect] = {js: ['admin/bootstrap-select.js']}
|
108
111
|
libs[:validate] = {js: ['admin/jquery.validate']}
|
109
|
-
libs[:custom_field] = {js: ['admin/custom_fields']}
|
110
112
|
libs[:nav_menu] = {css: ['admin/nestable/jquery.nestable', "admin/nav-menu"], js: ["admin/jquery.nestable", 'admin/nav-menu']}
|
111
113
|
libs[:elfinder_front] = {js: ['elfinder_front.js']}
|
112
114
|
libs
|
@@ -95,7 +95,11 @@ module PluginsHelper
|
|
95
95
|
# sample: <script src="<%= plugin_asset_path("my_plugin", "js/admin.js") %>"></script> => /assets/plugins/my_plugin/assets/css/main-54505620f.css
|
96
96
|
def plugin_asset_path(plugin_key, asset)
|
97
97
|
p = "plugins/#{plugin_key}/assets/#{asset}"
|
98
|
-
|
98
|
+
begin
|
99
|
+
asset_url(p)
|
100
|
+
rescue NoMethodError => e
|
101
|
+
p
|
102
|
+
end
|
99
103
|
end
|
100
104
|
|
101
105
|
# return the full url for asset of current plugin:
|
@@ -105,9 +109,26 @@ module PluginsHelper
|
|
105
109
|
# plugin_asset_url("css/main.css") => return: http://myhost.com/assets/plugins/my_plugin/assets/css/main-54505620f.css
|
106
110
|
def plugin_asset_url(asset, plugin_key = nil)
|
107
111
|
p = "plugins/#{plugin_key || self_plugin_key}/assets/#{asset}"
|
108
|
-
|
112
|
+
begin
|
113
|
+
asset_url(p)
|
114
|
+
rescue NoMethodError => e
|
115
|
+
p
|
116
|
+
end
|
109
117
|
end
|
110
118
|
|
119
|
+
# built asset file for current theme
|
120
|
+
# plugin_name: (String) if nil, will be used self_plugin_key method
|
121
|
+
# return (String), sample: plugin_asset("css/mains.css") => plugins/my_plugin/assets/css/main.css
|
122
|
+
def plugin_asset(asset, plugin_name = nil)
|
123
|
+
"plugins/#{plugin_name || self_plugin_key }/assets/#{asset}"
|
124
|
+
end
|
125
|
+
|
126
|
+
# built asset file for current theme
|
127
|
+
# plugin_name: (String) if nil, will be used self_plugin_key method
|
128
|
+
# return (String), sample: plugin_asset("mains.css") => plugins/my_plugin/main.css
|
129
|
+
def plugin_gem_asset(asset, plugin_name = nil)
|
130
|
+
"plugins/#{plugin_name || self_plugin_key }/#{asset}"
|
131
|
+
end
|
111
132
|
|
112
133
|
# auto load all helpers of this plugin
|
113
134
|
def plugin_load_helpers(plugin)
|
@@ -123,7 +144,7 @@ module PluginsHelper
|
|
123
144
|
# flash.now[:error] = "app loading error for #{h}: #{e.message}. Please check the plugins and themes presence"
|
124
145
|
end
|
125
146
|
|
126
|
-
#self.class.helper h.constantize rescue ActionController::Base.helper(h.constantize)
|
147
|
+
# self.class.helper h.constantize rescue ActionController::Base.helper(h.constantize)
|
127
148
|
end
|
128
149
|
end
|
129
150
|
|
@@ -139,9 +160,15 @@ module PluginsHelper
|
|
139
160
|
|
140
161
|
# return plugin key for current plugin file (helper|controller|view)
|
141
162
|
def self_plugin_key
|
142
|
-
k = "app/apps/plugins/"
|
143
|
-
|
144
|
-
f
|
163
|
+
# k = "app/apps/plugins/"
|
164
|
+
k = "/plugins/"
|
165
|
+
f = caller[0]
|
166
|
+
f2 = caller[1]
|
167
|
+
if f.include?(k)
|
168
|
+
f.split(k).last.split("/").first
|
169
|
+
elsif f2.include?(k)
|
170
|
+
f2.split(k).last.split("/").first
|
171
|
+
end
|
145
172
|
end
|
146
173
|
|
147
174
|
# method called only from files within plugins directory
|
@@ -149,5 +176,4 @@ module PluginsHelper
|
|
149
176
|
def current_plugin
|
150
177
|
current_site.get_plugin(self_plugin_key)
|
151
178
|
end
|
152
|
-
|
153
|
-
end
|
179
|
+
end
|
@@ -7,7 +7,6 @@
|
|
7
7
|
See the GNU Affero General Public License (GPLv3) for more details.
|
8
8
|
=end
|
9
9
|
module SessionHelper
|
10
|
-
|
11
10
|
# log in the user in to system
|
12
11
|
# user: User model
|
13
12
|
# remember_me: true/false (remember session permanently)
|
@@ -105,4 +104,4 @@ module SessionHelper
|
|
105
104
|
session[:autor] = "Owen Peredo Diaz" unless request.session_options[:id].present?
|
106
105
|
request.session_options[:id]
|
107
106
|
end
|
108
|
-
end
|
107
|
+
end
|
@@ -7,18 +7,81 @@
|
|
7
7
|
See the GNU Affero General Public License (GPLv3) for more details.
|
8
8
|
=end
|
9
9
|
module ShortCodeHelper
|
10
|
-
|
11
10
|
# Internal method
|
12
11
|
def shortcodes_init
|
13
|
-
@_shortcodes = [
|
12
|
+
@_shortcodes = []
|
14
13
|
@_shortcodes_template = {}
|
15
14
|
@_shortcodes_descr = {}
|
15
|
+
|
16
|
+
# shortcode_add("load_libraries", nil, "Renderize the widget content in this place. Sample: [widget widget_key]")
|
17
|
+
|
18
|
+
shortcode_add("load_libraries",
|
19
|
+
lambda{|attrs, args| add_asset_library(*attrs["data"].to_s.split(",")); return ""; },
|
20
|
+
"Permit to load libraries on demand, sample: [load_libraries data='datepicker,tinymce']")
|
21
|
+
|
22
|
+
shortcode_add("custom_field",
|
23
|
+
lambda{|attrs, args|
|
24
|
+
post = args[:owner]
|
25
|
+
post = current_site.the_posts.find_by_slug(attrs["post_slug"]).decorate rescue nil if attrs["post_slug"].present?
|
26
|
+
return "" unless post.present?
|
27
|
+
field = post.get_field_object(attrs["key"])
|
28
|
+
if attrs["render"].present?
|
29
|
+
return render :file => "custom_fields/#{field.options["field_key"]}", :locals => {object: post, field: field, field_key: attrs["key"], attibutes: attrs}
|
30
|
+
else
|
31
|
+
return post.the_field(attrs["key"])
|
32
|
+
end
|
33
|
+
},
|
34
|
+
"Permit you to include your custom fields in anywhere.
|
35
|
+
key: slug or key of the custom_field
|
36
|
+
attrs: custom html attributes
|
37
|
+
render: (true) enable to render the custom field as html. (Sample text_field: <span>my_field_value</span>)
|
38
|
+
post_slug: (Optional, default current post) slug or key of a Post.
|
39
|
+
Sample1: [custom_field key='subtitle']
|
40
|
+
Sample2: [custom_field key='subtitle' post_slug='contact' render=true attrs='style=\"width: 50px;\"'] // return the custom field of page with slug = contact")
|
41
|
+
|
42
|
+
shortcode_add("asset",
|
43
|
+
lambda{|attrs, args|
|
44
|
+
url = attrs["as_path"].present? ? ActionController::Base.helpers.asset_url(attrs["file"]) : ActionController::Base.helpers.asset_url(attrs["file"])
|
45
|
+
if attrs["image"].present?
|
46
|
+
ActionController::Base.helpers.image_tag(attrs["file"], class: attrs["class"], style: attrs["style"])
|
47
|
+
else
|
48
|
+
url
|
49
|
+
end
|
50
|
+
},
|
51
|
+
"Permit to generate an asset url (
|
52
|
+
add file='' asset file path,
|
53
|
+
add as_path='true' to generate only the path and not the full url,
|
54
|
+
add class='my_class' to setup image class,
|
55
|
+
add style='height: 100px; width: 200px;...' to setup image style,
|
56
|
+
add image='true' to generate the image tag with this url),
|
57
|
+
sample: <img src=\"[asset as_path='true' file='themes/my_theme/assets/img/signature.png']\" /> or [asset image='true' file='themes/my_theme/assets/img/signature.png' style='height: 50px;']")
|
58
|
+
|
59
|
+
shortcode_add("post_url",
|
60
|
+
lambda{|attrs, args|
|
61
|
+
post = current_site.the_post(attrs["id"].to_i) if attrs["id"].present?
|
62
|
+
post = current_site.the_post(attrs["key"].to_s) if attrs["key"].present?
|
63
|
+
if post.present?
|
64
|
+
if attrs["link"].present?
|
65
|
+
return ActionController::Base.helpers.link_to(attrs["title"].present? ? attrs["title"].html_safe : post.the_title, post.the_url, target: attrs["target"])
|
66
|
+
else
|
67
|
+
return post.the_url
|
68
|
+
end
|
69
|
+
end
|
70
|
+
return ""
|
71
|
+
},
|
72
|
+
"Permit to generate the url of a post (add path='' to generate the path and not the full url,
|
73
|
+
add id='123' to use the POST ID,
|
74
|
+
add key='my_slug' to use the POST SLUG,
|
75
|
+
add link='true' to generate the full link,
|
76
|
+
add title='my title' text of the link (default post title),
|
77
|
+
add target='_blank' to open the link in a new window this is valid only if link is present),
|
78
|
+
sample: [post_url id='122' link=true target='_blank']")
|
16
79
|
end
|
17
80
|
|
18
81
|
# add shortcode
|
19
82
|
# key: shortcode key
|
20
83
|
# template: template to render, if nil will render "shortcode_templates/<key>"
|
21
|
-
|
84
|
+
# Also can be a function to execute that instead a render, sample: lambda{|attrs, args| return "my custom content"; }
|
22
85
|
# descr: description for shortcode
|
23
86
|
def shortcode_add(key, template = nil, descr = '')
|
24
87
|
@_shortcodes << key
|
@@ -42,37 +105,55 @@ module ShortCodeHelper
|
|
42
105
|
# run all shortcodes in the content
|
43
106
|
# content: (string) text to find a short codes
|
44
107
|
# args: custom arguments to pass for short codes render, sample: {owner: my_model, a: true}
|
45
|
-
|
108
|
+
# if args != Hash, this will re send as args = {owner: args}
|
46
109
|
def do_shortcode(content, args = {})
|
47
110
|
args = {owner: args} unless args.is_a?(Hash)
|
48
|
-
content.scan(
|
49
|
-
|
111
|
+
content.scan(/#{cama_reg_shortcode}/) do |item|
|
112
|
+
# content.scan(/(\[(#{@_shortcodes.join("|")})\s?(.*?)\])/) do |item|
|
113
|
+
shortcode, code, space, attrs = item
|
50
114
|
content = content.sub(shortcode, _eval_shortcode(code, attrs, args))
|
51
115
|
end
|
52
116
|
content
|
53
117
|
end
|
54
118
|
|
119
|
+
# remove all shortcodes from text
|
120
|
+
# Arguments
|
121
|
+
# text: String that contains shortcodes
|
122
|
+
# return String
|
123
|
+
def cama_strip_shortcodes(text)
|
124
|
+
text.gsub(/#{cama_reg_shortcode}/, "")
|
125
|
+
end
|
126
|
+
|
55
127
|
# render direct a shortcode
|
56
128
|
# text: text that contain the shortcode
|
57
129
|
# key: shortcode key
|
58
130
|
# template: template to render, if nil this will render default render file
|
59
|
-
|
131
|
+
# Also can be a function to execute that instead a render, sample: lambda{|attrs, args| return "my custom content"; }
|
60
132
|
# render_shortcode("asda dasdasdas[owen a='1'] [bbb] sdasdas dasd as das[owen a=213]", "owen", lambda{|attrs, args| puts attrs; return "my test"; })
|
61
133
|
def render_shortcode(text, key, template = nil)
|
62
|
-
text.scan(
|
63
|
-
shortcode, code, attrs = item
|
134
|
+
text.scan(/#{cama_reg_shortcode(key)}/).each do |item|
|
135
|
+
shortcode, code, space, attrs = item
|
64
136
|
text = text.sub(shortcode, _eval_shortcode(code, attrs, {}, template))
|
65
137
|
end
|
66
138
|
text
|
67
139
|
end
|
68
140
|
|
69
141
|
private
|
142
|
+
# create the regexpression for shortcodes
|
143
|
+
# codes: (String) shortcode keys separated by |
|
144
|
+
# sample: load_libraries|asset
|
145
|
+
# if empty, codes will be replaced with all registered shortcodes
|
146
|
+
# Return: (String) reg expression string
|
147
|
+
def cama_reg_shortcode(codes = nil)
|
148
|
+
"(\\[(#{codes || @_shortcodes.join("|")})(\s|\\]){1}(.*?)\\])"
|
149
|
+
end
|
150
|
+
|
70
151
|
# determine the content to replace instead the shortcode
|
71
152
|
# return string
|
72
153
|
def _eval_shortcode(code, attrs, args={}, template = nil)
|
73
154
|
template ||= (@_shortcodes_template[code].present? ? @_shortcodes_template[code] : "shortcode_templates/#{code}")
|
74
155
|
if @_shortcodes_template[code].class.name == "Proc"
|
75
|
-
res = @_shortcodes_template[code].call(
|
156
|
+
res = @_shortcodes_template[code].call(_shortcode_parse_attr(attrs), args)
|
76
157
|
else
|
77
158
|
res = render :file => template, :locals => {attributes: _shortcode_parse_attr(attrs), args: args}
|
78
159
|
end
|