pluto-admin 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,8 @@ require 'pluto/admin/version' # let it always go first
7
7
  module PlutoAdmin
8
8
 
9
9
  def self.banner
10
- "pluto-admin #{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
10
+ ## todo: add RUBY_PATCHLEVEL or PATCH_LEVEL
11
+ "pluto-admin/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
11
12
  end
12
13
 
13
14
  def self.root
@@ -39,6 +39,11 @@ class Server < Sinatra::Base
39
39
  #################
40
40
  # Helpers
41
41
 
42
+ include TextUtils::DateHelper # e.g. lets us use time_ago_in_words, etc.
43
+ include TextUtils::HypertextHelper # e.g. lets us use link_to, sanitize, etc.
44
+ include TextUtils::XmlHelper # e.g. lets us use prettify_xml etc.
45
+
46
+
42
47
  def path_prefix
43
48
  request.script_name # request.env['SCRIPT_NAME']
44
49
  end
@@ -75,18 +80,6 @@ class Server < Sinatra::Base
75
80
  url( '/' )
76
81
  end
77
82
 
78
- def content_tag( tag, text )
79
- "<#{tag}>#{text}</#{tag}>"
80
- end
81
-
82
- def link_to( text, url, opts={} )
83
- attributes = ""
84
- opts.each do |key,value|
85
- attributes << "#{key}='#{value}' "
86
- end
87
- "<a href='#{url}' #{attributes}>#{text}</a>"
88
- end
89
-
90
83
 
91
84
  def render_items( items, opts={} )
92
85
  erb( 'shared/_items'.to_sym,
@@ -97,24 +90,6 @@ class Server < Sinatra::Base
97
90
  })
98
91
  end
99
92
 
100
- def prettify_xml( xml )
101
- require 'rexml/document'
102
-
103
- begin
104
- d = REXML::Document.new( xml )
105
-
106
- # d.write( pretty_xml="", 2 )
107
- # pretty_xml # return prettified xml
108
-
109
- formatter = REXML::Formatters::Pretty.new( 2 ) # indent=2
110
- formatter.compact = true # This is the magic line that does what you need!
111
- pretty_xml = formatter.write( d.root, "" ) # todo/checl: what's 2nd arg used for ??
112
- pretty_xml
113
- rescue Exception => ex
114
- "warn: prettify_xml failed: #{ex}\n\n\n" + xml
115
- end
116
- end
117
-
118
93
 
119
94
  def h( text )
120
95
  Rack::Utils.escape_html(text)
@@ -1,4 +1,4 @@
1
1
 
2
2
  module PlutoAdmin
3
- VERSION = '0.2.1'
3
+ VERSION = '0.3.1'
4
4
  end
@@ -2,17 +2,17 @@
2
2
  <h2>Timeline</h2>
3
3
 
4
4
  <table>
5
- <% Action.order( 'created_at DESC' ).each do |action| %>
5
+ <% Activitiy.order( 'created_at DESC' ).each do |acti| %>
6
6
  <tr>
7
- <td><%= action.title %></td>
8
- <td><%= action.object %></td>
9
- <td><%= action.created_at.strftime( '%b %d, %Y %H:%M' ) %></td>
7
+ <td><%= acti.text %></td>
8
+ <td><%= acti.created_at.strftime( '%b %d, %Y %H:%M' ) %></td>
10
9
  <td>
11
10
  <!-- only show if different from created_at -->
12
- <% unless action.created_at == action.updated_at %>
13
- <%= action.updated_at.strftime( '%b %d, %Y %H:%M' ) %>
11
+ <% unless acti.created_at == acti.updated_at %>
12
+ <%= acti.updated_at.strftime( '%b %d, %Y %H:%M' ) %>
14
13
  <% end %>
15
14
  </td>
16
15
  </tr>
17
16
  <% end %>
18
17
  </table>
18
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pluto-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-06 00:00:00.000000000 Z
12
+ date: 2013-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: logutils
16
- requirement: &73749590 !ruby/object:Gem::Requirement
16
+ requirement: &77477660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *73749590
24
+ version_requirements: *77477660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &73749270 !ruby/object:Gem::Requirement
27
+ requirement: &77477430 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.10'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *73749270
35
+ version_requirements: *77477430
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hoe
38
- requirement: &73749030 !ruby/object:Gem::Requirement
38
+ requirement: &77477190 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '3.3'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *73749030
46
+ version_requirements: *77477190
47
47
  description: planet web admin - sintara web app ready to get mounted into your web
48
48
  app
49
49
  email: feedreader@googlegroups.com