Sha256: 99805ca7e5e31f318cb8fd4347ba06271ad2675471ad617308d9ba9fa5b03cb0

Contents?: true

Size: 1.9 KB

Versions: 12

Compression:

Stored size: 1.9 KB

Contents

=begin
  Camaleon CMS is a content management system
  Copyright (C) 2015 by Owen Peredo Diaz
  Email: owenperedo@gmail.com
  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.
=end
module Frontend::ApplicationHelper
  include Frontend::SiteHelper
  include Frontend::NavMenuHelper
  include Frontend::SeoHelper

  # add where conditionals to filter private/hidden/expired/drafts/unpublished
  # note: only for post records
  def verify_front_visibility(active_record)
    active_record = active_record.visible_frontend
    r = {active_record: active_record}
    hooks_run("filter_post", r)
    r[:active_record]
  end

  # fix for url_to or url_path or any other who need add automatically current locale in the url
  # sample: url_to_fixed("root_url", data: "asdasd", y: 12)
  # => http://localhost/fr?data=asdasd&y=12
  # note: if current locale is the default language, then locale is not added in the url
  def url_to_fixed(url_to, *args)
    options = args.extract_options!
    if request.present?
      if options.include?(:locale) && options[:locale] == false
        options.delete(:locale)
      else
        options[:locale] = I18n.locale if !options[:locale].present? && current_site.get_languages.size > 1
      end
      options[:locale] = nil if options[:locale].present? && current_site.get_languages.first.to_s == options[:locale].to_s
    end
    options.delete(:format) if PluginRoutes.system_info[:skip_format_url].present?
    send(url_to, *(args << options))
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
camaleon_cms-0.2.1 app/helpers/frontend/application_helper.rb
camaleon_cms-0.2.0 app/helpers/frontend/application_helper.rb
camaleon_cms-0.1.9 app/helpers/frontend/application_helper.rb
camaleon_cms-0.1.8 app/helpers/frontend/application_helper.rb
camaleon_cms-0.1.7 app/helpers/frontend/application_helper.rb
camaleon_cms-0.1.6 app/helpers/frontend/application_helper.rb
camaleon_cms-0.1.5 app/helpers/frontend/application_helper.rb
camaleon_cms-0.1.4 app/helpers/frontend/application_helper.rb
camaleon_cms-0.1.3 app/helpers/frontend/application_helper.rb
camaleon_cms-0.1.2 app/helpers/frontend/application_helper.rb
camaleon_cms-0.0.2 app/helpers/frontend/application_helper.rb
camaleon_cms-0.0.1 app/helpers/frontend/application_helper.rb