voidtools 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,14 @@
1
+ = Voidrails
2
+
3
+ == growing toolset for Rails 3 dm+jquery+haml+warden setup flavored with:
4
+
5
+ === DataMapper
6
+ - error_messages_for
7
+
8
+ === Haml
9
+ -
10
+
11
+ === Warden, Devise
12
+ -
13
+
14
+ ruby 1.9 required
@@ -0,0 +1,25 @@
1
+ module Voidtools
2
+
3
+ # namespace our plugin and inherit from Rails::Railtie
4
+ # to get our plugin into the initialization process
5
+ class Railtie < Rails::Railtie
6
+
7
+ # configure our plugin on boot. other extension points such
8
+ # as configuration, rake tasks, etc, are also available
9
+ initializer "voidtools.initialize" do |app|
10
+
11
+ # subscribe to all rails notifications: controllers, AR, etc.
12
+ # ActiveSupport::Notifications.subscribe do |*args|
13
+ # event = ActiveSupport::Notifications::Event.new(*args)
14
+ # puts "Voidrails - got notification: #{event.inspect}"
15
+ # end
16
+ # ActiveSupport.on_load(:action_view) do
17
+ # # module ApplicationHelper
18
+ # # include FormHelpers
19
+ # # end
20
+ # end
21
+ require 'voidtools/datamapper/form_helpers'
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,17 @@
1
+ module Voidtools
2
+ module FormHelpers
3
+
4
+ def error_messages_for(entity)
5
+ obj = if entity.is_a? (Symbol) || entity.is_a?(String)
6
+ instance_variable_get("@#{entity.to_s}")
7
+ else
8
+ entity
9
+ end
10
+ return nil if obj.errors.map{ |e| e } == []
11
+ lis = "".html_safe
12
+ obj.errors.map{ |e| lis << content_tag( :li, e[0].to_s) }
13
+ content_tag( :ul, lis, class: "error_messages")
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Voidtools
2
+ VERSION = "0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: voidtools
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ version: "0.1"
9
+ platform: ruby
10
+ authors:
11
+ - Francesco 'makevoid' Canessa
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2010-08-09 00:00:00 +02:00
17
+ default_executable:
18
+ dependencies: []
19
+
20
+ description: "growing toolset for Rails 3 setup with helpers for: datamapper, jquery, haml and warden"
21
+ email: makevoid@gmail.com
22
+ executables: []
23
+
24
+ extensions: []
25
+
26
+ extra_rdoc_files: []
27
+
28
+ files:
29
+ - Readme.md
30
+ - lib/voidtools/datamapper/form_helpers.rb
31
+ - lib/voidtools/version.rb
32
+ - lib/voidtools.rb
33
+ has_rdoc: true
34
+ homepage: http://www.makevoid.com
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ segments:
48
+ - 0
49
+ version: "0"
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ requirements: []
59
+
60
+ rubyforge_project: voidtools
61
+ rubygems_version: 1.3.7
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: growing toolset for Rails 3 dm+jquery+haml+warden setup
65
+ test_files: []
66
+