Sha256: 2a3f2e609eb8b7e5081f8dc3c2314b8188f4bb972944bb89119aeba7391a43e5

Contents?: true

Size: 1.63 KB

Versions: 12

Compression:

Stored size: 1.63 KB

Contents

module Admin::PagesHelper
  include Admin::NodeHelper
  include Admin::ReferencesHelper
  
  def class_of_page
    @page.class
  end
  
  def filter
    @page.parts.empty? ? nil : @page.parts.first.filter
  end
  
  def meta_errors?
    !!(@page.errors[:slug] or @page.errors[:breadcrumb])
  end

  def default_filter_name
    @page.parts.empty? ? "" : @page.parts[0].filter_id
  end

  def homepage
    @homepage ||= Page.find_by_parent_id(nil)
  end

  def page_edit_javascripts
    <<-CODE
    var last_type = "#{@page.class_name}";
    function load_tag_reference(part) {
      page_type = $F('page_class_name');
      popup = $('tag-reference-popup');
      if(last_type != page_type) {
        url = "#{admin_reference_path(:id => 'tags')}";
        params = "class_name=" + page_type;
        new Effect.Highlight('tag-reference-link-'+ part);
        req = new Ajax.Request(url, { method: 'get', parameters: params, evalScripts: true });
      } else {
         center(popup);
         Element.toggle(popup);
      }
      return false;
    }
    var last_filter = "#{default_filter_name}";
    function load_filter_reference(part) {
      filter_type = $F("part_" + part + "_filter_id");
      popup = $('filter-reference-popup');
      if(last_filter != filter_type) {
        url = "#{admin_reference_path(:id => 'filters')}";
        params = "filter_name=" + filter_type;
        new Effect.Highlight('filter-reference-link-'+ part);
        req = new Ajax.Request(url, { method: 'get', parameters: params, evalScripts: true });
      } else {
        center(popup);
        Element.toggle(popup);
      }
      return false;
    }
    CODE
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
radiantcms-couchrest_model-0.2.4 app/helpers/admin/pages_helper.rb
radiantcms-couchrest_model-0.2.2 app/helpers/admin/pages_helper.rb
radiantcms-couchrest_model-0.2.1 app/helpers/admin/pages_helper.rb
radiantcms-couchrest_model-0.2 app/helpers/admin/pages_helper.rb
radiantcms-couchrest_model-0.1.9 app/helpers/admin/pages_helper.rb
radiantcms-couchrest_model-0.1.8 app/helpers/admin/pages_helper.rb
radiantcms-couchrest_model-0.1.7 app/helpers/admin/pages_helper.rb
radiantcms-couchrest_model-0.1.6 app/helpers/admin/pages_helper.rb
radiantcms-couchrest_model-0.1.5 app/helpers/admin/pages_helper.rb
radiant-0.8.2 app/helpers/admin/pages_helper.rb
radiant-0.8.1 app/helpers/admin/pages_helper.rb
radiant-0.8.0 app/helpers/admin/pages_helper.rb