Module: CamaleonCms::Admin::ApplicationHelper
- Includes:
- CategoryHelper, CustomFieldsHelper, MenusHelper, PostTypeHelper
- Included in:
- CamaleonCms::AdminController
- Defined in:
- app/helpers/camaleon_cms/admin/application_helper.rb
Overview
Camaleon CMS is a content management system
Copyright (C) 2015 by Owen Peredo Diaz
Email: [email protected]
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License (GPLv3) for more details.
Instance Method Summary collapse
-
#admin_system_notifications(args) ⇒ Object
load system notification.
-
#cama_do_pagination(items, *will_paginate_options) ⇒ Object
render pagination for current items items is a will pagination object sample: <%= raw cama_do_pagination(@posts) %>.
-
#cama_get_i18n_frontend ⇒ Object
return the locale for frontend translations initialized in admin controller used by models like posts, categories, …, sample: my_post.the_url fix for github.com/owen2345/camaleon-cms/issues/233#issuecomment-215385432.
-
#cama_shortcode_print(code) ⇒ Object
print code with auto copy.
Instance Method Details
#admin_system_notifications(args) ⇒ Object
load system notification
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/camaleon_cms/admin/application_helper.rb', line 17 def admin_system_notifications(args) if Date.parse(current_site.get_option("date_notified", 2.days.ago).to_s) < Date.today current_site.set_option("date_notified", Date.today) url = "http://camaleon.tuzitio.com/plugins/camaleon_notification/?version=#{CamaleonCms::VERSION}&admin_locale=#{current_site.get_admin_language}&site=#{current_site.the_url}" Thread.new do current_site.("date_notified_message", open(url).read) ActiveRecord::Base.connection.close #closing connection end end args[:content] << current_site.("date_notified_message", "") end |
#cama_do_pagination(items, *will_paginate_options) ⇒ Object
render pagination for current items items is a will pagination object sample: <%= raw cama_do_pagination(@posts) %>
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/helpers/camaleon_cms/admin/application_helper.rb', line 32 def cama_do_pagination(items, *) = . custom_class = [:panel_class] .delete(:panel_class) "<div class='row #{custom_class} pagination_panel cama_ajax_request'> <div class='col-md-6'> #{will_paginate(items, ) rescue '' } </div> <div class='col-md-6 text-right total-items'> <strong>Total: #{items.total_entries rescue items.count} </strong> </div> </div>" end |
#cama_get_i18n_frontend ⇒ Object
return the locale for frontend translations initialized in admin controller used by models like posts, categories, …, sample: my_post.the_url fix for github.com/owen2345/camaleon-cms/issues/233#issuecomment-215385432
49 50 51 |
# File 'app/helpers/camaleon_cms/admin/application_helper.rb', line 49 def cama_get_i18n_frontend @cama_i18n_frontend end |
#cama_shortcode_print(code) ⇒ Object
print code with auto copy
54 55 56 |
# File 'app/helpers/camaleon_cms/admin/application_helper.rb', line 54 def cama_shortcode_print(code) "<input onmousedown=\"this.clicked = 1;\" readonly onfocus=\"if (!this.clicked) this.select(); else this.clicked = 2;\" onclick=\"if (this.clicked == 2) this.select(); this.clicked = 0;\" class='code_style' tabindex='-1' value=\"#{code}\">" end |