Class: PlutoAdmin::Server
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- PlutoAdmin::Server
- Includes:
- Pluto::Models, TextUtils::DateHelper, TextUtils::HypertextHelper, TextUtils::XmlHelper
- Defined in:
- lib/pluto/admin/server.rb
Constant Summary collapse
- PUBLIC_FOLDER =
"#{PlutoAdmin.root}/lib/pluto/admin/public"
- VIEWS_FOLDER =
"#{PlutoAdmin.root}/lib/pluto/admin/views"
Class Method Summary collapse
Instance Method Summary collapse
- #feed_path(feed) ⇒ Object
- #feeds_path ⇒ Object
- #h(text) ⇒ Object
- #item_path(item) ⇒ Object
- #items_path ⇒ Object
- #path_prefix ⇒ Object
- #render_items(items, opts = {}) ⇒ Object
- #root_path ⇒ Object
- #root_url ⇒ Object
- #sites_path ⇒ Object
- #timeline_path ⇒ Object
Class Method Details
.banner ⇒ Object
14 15 16 |
# File 'lib/pluto/admin/server.rb', line 14 def self. "pluto-admin #{PlutoAdmin::VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] on Sinatra/#{Sinatra::VERSION} (#{ENV['RACK_ENV']})" end |
Instance Method Details
#feed_path(feed) ⇒ Object
55 56 57 |
# File 'lib/pluto/admin/server.rb', line 55 def feed_path( feed ) "#{path_prefix}/feed/#{feed.key}" end |
#feeds_path ⇒ Object
51 52 53 |
# File 'lib/pluto/admin/server.rb', line 51 def feeds_path "#{path_prefix}/feeds" end |
#h(text) ⇒ Object
90 91 92 |
# File 'lib/pluto/admin/server.rb', line 90 def h( text ) Rack::Utils.escape_html(text) end |
#item_path(item) ⇒ Object
63 64 65 |
# File 'lib/pluto/admin/server.rb', line 63 def item_path( item ) "#{path_prefix}/item/#{item.id}" end |
#items_path ⇒ Object
59 60 61 |
# File 'lib/pluto/admin/server.rb', line 59 def items_path "#{path_prefix}/items" end |
#path_prefix ⇒ Object
43 44 45 |
# File 'lib/pluto/admin/server.rb', line 43 def path_prefix request.script_name # request.env['SCRIPT_NAME'] end |
#render_items(items, opts = {}) ⇒ Object
80 81 82 83 84 85 86 87 |
# File 'lib/pluto/admin/server.rb', line 80 def render_items( items, opts={} ) erb( 'shared/_items'.to_sym, layout: false, locals: { items: items, show_feed: opts[:show_feed].present? }) end |
#root_path ⇒ Object
71 72 73 |
# File 'lib/pluto/admin/server.rb', line 71 def root_path "#{path_prefix}/" end |
#root_url ⇒ Object
75 76 77 |
# File 'lib/pluto/admin/server.rb', line 75 def root_url url( '/' ) end |
#sites_path ⇒ Object
47 48 49 |
# File 'lib/pluto/admin/server.rb', line 47 def sites_path "#{path_prefix}/sites" end |
#timeline_path ⇒ Object
67 68 69 |
# File 'lib/pluto/admin/server.rb', line 67 def timeline_path "#{path_prefix}/time" end |