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



18
19
20
# File 'lib/pluto/admin/server.rb', line 18

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



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

def feed_path( feed )
  "#{path_prefix}/feed/#{feed.key}"
end

#feeds_pathObject



55
56
57
# File 'lib/pluto/admin/server.rb', line 55

def feeds_path
  "#{path_prefix}/feeds"
end

#h(text) ⇒ Object



94
95
96
# File 'lib/pluto/admin/server.rb', line 94

def h( text )
  Rack::Utils.escape_html(text)
end

#item_path(item) ⇒ Object



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

def item_path( item )
  "#{path_prefix}/item/#{item.id}"
end

#items_pathObject



63
64
65
# File 'lib/pluto/admin/server.rb', line 63

def items_path
  "#{path_prefix}/items"
end

#path_prefixObject



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

def path_prefix
  request.script_name   # request.env['SCRIPT_NAME']
end

#render_items(items, opts = {}) ⇒ Object



84
85
86
87
88
89
90
91
# File 'lib/pluto/admin/server.rb', line 84

def render_items( items, opts={} )
  erb( 'shared/_items'.to_sym,
       layout: false,
       locals: {
                  items: items,
                  show_feed: opts[:show_feed].present?
                })
end

#root_pathObject



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

def root_path
  "#{path_prefix}/"
end

#root_urlObject



79
80
81
# File 'lib/pluto/admin/server.rb', line 79

def root_url
  url( '/' )
end

#sites_pathObject



51
52
53
# File 'lib/pluto/admin/server.rb', line 51

def sites_path
  "#{path_prefix}/sites"
end

#timeline_pathObject



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

def timeline_path
  "#{path_prefix}/time"
end