Sha256: b3344e5ebf7275f3b68e21b1be2412fc5473b22dd54cedb811583a3d1f5449db

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

module Admin::PagesHelper
  include Admin::NodeHelper
  include Admin::ReferencesHelper
  
  def class_of_page
    @page.class
  end
  
  def filter
    @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

3 entries across 3 versions & 1 rubygems

Version Path
radiant-0.7.2 app/helpers/admin/pages_helper.rb
radiant-0.7.0 app/helpers/admin/pages_helper.rb
radiant-0.7.1 app/helpers/admin/pages_helper.rb