rocketeer 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/rocketeer.rb +44 -0
  2. metadata +47 -0
data/lib/rocketeer.rb ADDED
@@ -0,0 +1,44 @@
1
+ require 'sinatra/base'
2
+
3
+ module Sinatra
4
+ module HTMLHelper
5
+ def link_to(text, the_url, options = {})
6
+ options = options.merge({
7
+ :href => the_url ? url(the_url) : request.path_info
8
+ })
9
+ if options[:confirm]
10
+ options[:"data-confirm"] = options[:confirm]
11
+ options[:confirm] = nil
12
+ end
13
+ if options[:remote]
14
+ options[:"data-remote"] = options[:remote]
15
+ options[:remote] = nil
16
+ end
17
+
18
+ html_options = []
19
+ options.each do |k, v|
20
+ html_options.push "#{k.to_s}=\"#{v.to_s}\""
21
+ end
22
+
23
+ "<a #{html_options.join(' ')}>#{text}</a>"
24
+ end
25
+
26
+ def link_to_unless_current(text, the_url, options = {})
27
+ if request.path_info == the_url
28
+ text
29
+ else
30
+ link_to text, the_url, options
31
+ end
32
+ end
33
+
34
+ def css_inc_tag(url, media = "screen")
35
+ "<link rel=\"stylesheet\" href=\"#{url}?#{Time.now.to_i}\" media=\"#{media}\" />"
36
+ end
37
+
38
+ def js_inc_tag(url)
39
+ "<script src=\"#{url}\" type=\"text/javascript\"></script>"
40
+ end
41
+ end
42
+
43
+ helpers HTMLHelper
44
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rocketeer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jack Polgar
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-07-23 00:00:00.000000000 +10:00
13
+ default_executable:
14
+ dependencies: []
15
+ description: Helpers for Sinatra
16
+ email: xocide@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/rocketeer.rb
22
+ has_rdoc: true
23
+ homepage: http://rubygems.org/gems/rocketeer
24
+ licenses: []
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 1.5.2
44
+ signing_key:
45
+ specification_version: 3
46
+ summary: Rocketeer
47
+ test_files: []