Class: PlutoAdmin::Server

Inherits:
Sinatra::Base
  • Object
show all
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

Class Method Details



14
15
16
# File 'lib/pluto/admin/server.rb', line 14

def self.banner
  "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_pathObject



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_pathObject



59
60
61
# File 'lib/pluto/admin/server.rb', line 59

def items_path
  "#{path_prefix}/items"
end

#path_prefixObject



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_pathObject



71
72
73
# File 'lib/pluto/admin/server.rb', line 71

def root_path
  "#{path_prefix}/"
end

#root_urlObject



75
76
77
# File 'lib/pluto/admin/server.rb', line 75

def root_url
  url( '/' )
end

#sites_pathObject



47
48
49
# File 'lib/pluto/admin/server.rb', line 47

def sites_path
  "#{path_prefix}/sites"
end

#timeline_pathObject



67
68
69
# File 'lib/pluto/admin/server.rb', line 67

def timeline_path
  "#{path_prefix}/time"
end