voidtools 0.2.0 → 0.2.2

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.
data/Readme.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Voidtools
2
2
  #### growing toolset for Rails 3 dm+jquery+haml+warden setup flavored with:
3
3
 
4
+
5
+ ### building the gem locally and installing it in one line (for trying things and stuff):
6
+
7
+ gem build voidtools.gemspec; gem install voidtools-0.2.1.gem
8
+
9
+
4
10
  ---
5
11
 
6
12
  ### DataMapper
@@ -1,7 +1,18 @@
1
1
  module Voidtools
2
2
  module NameUrl
3
+ def generate_url_from_name
4
+ name.gsub(/\./, '').gsub(/'|"/, ' ').gsub(/\s+/, '_').gsub(/_-_/, '_').downcase
5
+ end
6
+
7
+ # TODO: try to embed this into the model
8
+
9
+ # before :create do
10
+ # self.name_url = generate_url_from_name
11
+ # end
12
+
13
+
3
14
  def generate_name_url
4
- nurl = name.gsub(/\./, '').gsub(/'|"/, ' ').gsub(/\s+/, '_').gsub(/_-_/, '_').downcase
15
+ nurl = generate_url_from_name
5
16
  update(name_url: nurl)
6
17
  end
7
18
  end
@@ -0,0 +1,8 @@
1
+ module Voidtools
2
+ module AppMixin
3
+ def not_found
4
+ #render template: "exceptions/not_found", status: :not_found
5
+ render file: "/public/404.html", layout: false, status: 404
6
+ end
7
+ end
8
+ end
@@ -1,10 +1,14 @@
1
1
  module Voidtools
2
2
  module Sinatra
3
3
  module ViewHelpers
4
- def link_to(label, path)
5
- haml_tag :a, { href: path } do
6
- haml_concat label
7
- end
4
+ def link_to(label, path="javascript:void(0)", options={})
5
+ # haml_tag :a, { href: path } do
6
+ # haml_concat label
7
+ # end
8
+ options = options.map do |key, value|
9
+ " #{key}='#{value}'"
10
+ end.join(" ")
11
+ haml_concat "<a href='#{path}'#{options}>#{label}</a>"
8
12
  end
9
13
 
10
14
  def image_tag(url, options={})
@@ -1,3 +1,3 @@
1
1
  module Voidtools
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Francesco 'makevoid' Canessa
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-23 00:00:00 +01:00
17
+ date: 2011-01-17 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -31,6 +31,7 @@ files:
31
31
  - lib/voidtools/dm/form_helpers.rb
32
32
  - lib/voidtools/dm/name_url.rb
33
33
  - lib/voidtools/dm/paginable.rb
34
+ - lib/voidtools/rails/app_mixin.rb
34
35
  - lib/voidtools/sinatra/sinatra.rb
35
36
  - lib/voidtools/sinatra/view_helpers.rb
36
37
  - lib/voidtools/version.rb