anchor_for 0.0.1

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.
@@ -0,0 +1,4 @@
1
+ README.textile
2
+ Rakefile
3
+ lib/anchor_for.rb
4
+ Manifest
@@ -0,0 +1,26 @@
1
+ h1. AnchorFor
2
+
3
+ HTML anchor rails helper
4
+
5
+ h2. Usage
6
+
7
+ <pre>
8
+ def my_action
9
+ @object = ...
10
+ ...
11
+ redirect_to home_path(:anchor => anchor_for(@object))
12
+ end
13
+ </pre>
14
+
15
+ Or in views:
16
+
17
+ <pre>
18
+ <%= anchor_tag_for(@object) %>
19
+ </pre>
20
+
21
+ h2. Installation
22
+
23
+ <pre>
24
+ gem install anchor_for
25
+ </pre>
26
+
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('anchor_for', '0.0.1') do |p|
6
+ p.description = "HTML anchor rails helper"
7
+ p.url = "http://github.com/mcasimir/anchor_for"
8
+ p.author = "Maurizio Casimirri"
9
+ p.email = "maurizio.cas@gmail.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
15
+
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{anchor_for}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Maurizio Casimirri"]
9
+ s.date = %q{2010-09-05}
10
+ s.description = %q{HTML anchor rails helper}
11
+ s.email = %q{maurizio.cas@gmail.com}
12
+ s.extra_rdoc_files = ["README.textile", "lib/anchor_for.rb"]
13
+ s.files = ["README.textile", "Rakefile", "lib/anchor_for.rb", "Manifest", "anchor_for.gemspec"]
14
+ s.homepage = %q{http://github.com/mcasimir/anchor_for}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Anchor_for", "--main", "README.textile"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{anchor_for}
18
+ s.rubygems_version = %q{1.3.7}
19
+ s.summary = %q{HTML anchor rails helper}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ else
27
+ end
28
+ else
29
+ end
30
+ end
@@ -0,0 +1,39 @@
1
+ # Copyright (c) 2010 Maurizio Casimirri
2
+
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+
23
+ module AnchorFor
24
+ def anchor_for(object)
25
+ "#{object.class.name.tableize.singularize}_#{object._id}"
26
+ end
27
+ end
28
+
29
+ class ActionView::Base
30
+ include AnchorFor
31
+ def anchor_tag_for(object)
32
+ "<a name='#{anchor_for(object)}'></a>".html_safe
33
+ end
34
+ end
35
+
36
+ class ActionController::Base
37
+ include AnchorFor
38
+ end
39
+
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: anchor_for
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Maurizio Casimirri
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-09-05 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: HTML anchor rails helper
22
+ email: maurizio.cas@gmail.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README.textile
29
+ - lib/anchor_for.rb
30
+ files:
31
+ - README.textile
32
+ - Rakefile
33
+ - lib/anchor_for.rb
34
+ - Manifest
35
+ - anchor_for.gemspec
36
+ has_rdoc: true
37
+ homepage: http://github.com/mcasimir/anchor_for
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options:
42
+ - --line-numbers
43
+ - --inline-source
44
+ - --title
45
+ - Anchor_for
46
+ - --main
47
+ - README.textile
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 1
65
+ - 2
66
+ version: "1.2"
67
+ requirements: []
68
+
69
+ rubyforge_project: anchor_for
70
+ rubygems_version: 1.3.7
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: HTML anchor rails helper
74
+ test_files: []
75
+