Class: Caboose::CorePlugin
- Inherits:
-
CaboosePlugin
- Object
- CaboosePlugin
- Caboose::CorePlugin
- Defined in:
- app/models/caboose/core_plugin.rb
Class Method Summary collapse
- .admin_nav(nav, user, page) ⇒ Object
-
.block_types(block_types) ⇒ Object
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.
- .global_js_assets(files) ⇒ Object
Methods inherited from CaboosePlugin
Class Method Details
.admin_nav(nav, user, page) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/models/caboose/core_plugin.rb', line 3 def self.admin_nav(nav, user, page) return nav if user.nil? nav << { 'id' => 'logout' , 'text' => 'Logout' , 'href' => '/logout' , 'modal' => false } nav << { 'id' => 'my-account' , 'text' => 'My Account' , 'href' => '/my-account' , 'modal' => true } #item = { # 'id' => 'profile', # 'text' => 'Profile', # 'children' => [] #} #item['children'] << { 'id' => 'my-account' , 'text' => 'Edit Profile' , 'href' => '/my-account' , 'modal' => false } #item['children'] << { 'id' => 'logout' , 'text' => 'Logout' , 'href' => '/logout' , 'modal' => false } #nav << item item = { 'id' => 'core', 'text' => 'Settings', 'children' => [] } item['children'] << { 'id' => 'users' , 'text' => 'Users' , 'href' => '/admin/users' , 'modal' => false } if user.is_allowed('users' , 'view') item['children'] << { 'id' => 'roles' , 'text' => 'Roles' , 'href' => '/admin/roles' , 'modal' => false } if user.is_allowed('roles' , 'view') item['children'] << { 'id' => 'permissions' , 'text' => 'Permissions' , 'href' => '/admin/permissions' , 'modal' => false } if user.is_allowed('permissions' , 'view') item['children'] << { 'id' => 'sites' , 'text' => 'Sites' , 'href' => '/admin/sites' , 'modal' => false } if user.is_allowed('sites' , 'view') item['children'] << { 'id' => 'blocktypes' , 'text' => 'AB Test Variants' , 'href' => '/admin/ab-variants' , 'modal' => false } if user.is_allowed('abvariants' , 'view') item['children'] << { 'id' => 'variables' , 'text' => 'Variables' , 'href' => '/admin/settings' , 'modal' => false } if user.is_allowed('settings' , 'view') item['children'] << { 'id' => 'blocktypes' , 'text' => 'Block Types' , 'href' => '/admin/block-types' , 'modal' => false } if user.is_allowed('blocktypes' , 'view') item['children'] << { 'id' => 'redirects' , 'text' => 'Permanent Redirects' , 'href' => '/admin/redirects' , 'modal' => false } if user.is_allowed('redirects' , 'view') nav << item if item['children'].count > 0 item = { 'id' => 'content', 'text' => 'Content', 'children' => [] } item['children'] << { 'id' => 'pages' , 'text' => 'Pages' , 'href' => '/admin/pages' , 'modal' => false } if user.is_allowed('pages' , 'view') item['children'] << { 'id' => 'posts' , 'text' => 'Posts' , 'href' => '/admin/posts' , 'modal' => false } if user.is_allowed('posts' , 'view') nav << item if item['children'].count > 0 return nav end |
.block_types(block_types) ⇒ Object
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
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/models/caboose/core_plugin.rb', line 61 def self.block_types(block_types) block_types << { :id => 'heading', :name => "Heading", :attributes => [ { name: 'text' , nice_name: 'Text' , type: 'text' , default: '', width: 800, fixed_placeholder: false }, { name: 'size' , nice_name: 'Size' , type: 'select', default: 1, width: 800, fixed_placeholder: false, options: ["1 - Largest", "2", "3", "4", "5", "6"]} ] } block_types << { :id => 'richtext', :name => "Rich Text", :attributes => [ { name: 'text' , nice_name: 'Text' , type: 'richtext', default: '', width: 800, height: 400, fixed_placeholder: false } ] } return block_types end |
.global_js_assets(files) ⇒ Object
80 81 82 |
# File 'app/models/caboose/core_plugin.rb', line 80 def self.global_js_assets(files) return files end |