Sha256: a1fa7c7a8de45ac3e2962687623ab569b1011fdd10d46dd7b951f455c9f4e6c3

Contents?: true

Size: 1.6 KB

Versions: 41

Compression:

Stored size: 1.6 KB

Contents

class Caboose::PagePlugin < Caboose::CaboosePlugin

  def self.admin_nav(nav, user, page)    
    return nav if user.nil? || !user.is_allowed('pages', 'view')
    
    item = {
      'id' => 'pages', 
      'text' => 'Pages',
      'children' => []
      #'show_children_default' => true
    }
      
    is_admin = user.is_allowed('all', 'all')
    actions = Caboose::Page.permissible_actions(user.id, page.id)
    if (actions.include?('edit') || is_admin)
    	item['children'] << { 'href' => "/pages/#{page.id}/sitemap"       , 'text' => 'Site Map This Page'  }
    	item['children'] << { 'href' => "/pages/#{page.id}/edit"          , 'text' => 'Edit Page Content'   }
    	item['children'] << { 'href' => "/pages/#{page.id}/edit-settings" , 'text' => 'Edit Page Settings', 'modal' => true }

    	#uru = session['use_redirect_urls'].nil? ? true : session['use_redirect_urls']
    	#item['children'] << { 'id' => 'use_redirect_urls', 'href' => '#', 'text' => '' + (uru ? 'Disable' : 'Enable') + ' Redirect Urls' }
    end
    if (user.is_allowed('pages', 'add') || is_admin)
      item['children'] << { 'href' => "/pages/new?parent_id=#{page.id}"  , 'text' => 'New Page', 'modal' => true }
    end    
    nav << item
    return nav
  end
  
  def self.admin_js
    return "
      $('#use_redirect_urls').click(function() {
        uru = $('#use_redirect_urls');
        val = (uru.html() == 'Enable' ? 1 : 0);        
        $.ajax({
          url: '/admin/settings/toggle-redirect-urls',
          data: 'val='+val,
          succes: function(resp) { uri.html(val == 1 ? 'Disable' : 'Enable'); }
        });
      });"
  end
  
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
caboose-cms-0.2.57 app/models/caboose/page_plugin.rb
caboose-cms-0.2.55 app/models/caboose/page_plugin.rb
caboose-cms-0.2.54 app/models/caboose/page_plugin.rb
caboose-cms-0.2.52 app/models/caboose/page_plugin.rb
caboose-cms-0.2.50 app/models/caboose/page_plugin.rb
caboose-cms-0.2.49 app/models/caboose/page_plugin.rb
caboose-cms-0.2.48 app/models/caboose/page_plugin.rb
caboose-cms-0.2.47 app/models/caboose/page_plugin.rb
caboose-cms-0.2.46 app/models/caboose/page_plugin.rb
caboose-cms-0.2.45 app/models/caboose/page_plugin.rb
caboose-cms-0.2.44 app/models/caboose/page_plugin.rb
caboose-cms-0.2.43 app/models/caboose/page_plugin.rb
caboose-cms-0.2.42 app/models/caboose/page_plugin.rb
caboose-cms-0.2.41 app/models/caboose/page_plugin.rb
caboose-cms-0.2.40 app/models/caboose/page_plugin.rb
caboose-cms-0.2.39 app/models/caboose/page_plugin.rb
caboose-cms-0.2.38 app/models/caboose/page_plugin.rb
caboose-cms-0.2.37 app/models/caboose/page_plugin.rb
caboose-cms-0.2.36 app/models/caboose/page_plugin.rb
caboose-cms-0.2.35 app/models/caboose/page_plugin.rb