backtrack 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.
- data/.document +5 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +23 -0
- data/Rakefile +19 -0
- data/VERSION +1 -0
- data/backtrack.gemspec +49 -0
- data/lib/backtrack.rb +33 -0
- data/lib/backtrack/extensions.rb +4 -0
- data/lib/backtrack/extensions/action_controller.rb +31 -0
- data/lib/backtrack/extensions/action_view.rb +7 -0
- data/rails/init.rb +3 -0
- data/test/helper.rb +18 -0
- data/test/test_backula.rb +7 -0
- metadata +61 -0
data/.document
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Scott Tadman, The Working Group Inc.
|
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.
|
data/README.rdoc
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
= backtrack
|
2
|
+
|
3
|
+
Backtrack is a "back" tracking system for Rails that allows to to save
|
4
|
+
and restore the back-out state of forms.
|
5
|
+
|
6
|
+
Add backtracking to your forms with the backtrack_fields method:
|
7
|
+
|
8
|
+
<%= backtrack_fields %>
|
9
|
+
|
10
|
+
Add a link to a page that goes to the previous entry in the backtracking
|
11
|
+
table:
|
12
|
+
|
13
|
+
<%= link_to('Back', backtrack_url) %>
|
14
|
+
|
15
|
+
Create a link that captures the backtracking state:
|
16
|
+
|
17
|
+
<%= link_to('Forward', some_path(backtrack_params)) %>
|
18
|
+
<%= link_to('Forward', some_path(backtrack_params(:other_id => other_id))) %>
|
19
|
+
|
20
|
+
== Copyright
|
21
|
+
|
22
|
+
Copyright (c) 2012 Scott Tadman, The Working Group Inc. See LICENSE.txt for
|
23
|
+
further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
require 'jeweler'
|
6
|
+
|
7
|
+
Jeweler::Tasks.new do |gem|
|
8
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
9
|
+
gem.name = "backtrack"
|
10
|
+
gem.homepage = "http://github.com/twg/backtrack"
|
11
|
+
gem.license = "MIT"
|
12
|
+
gem.summary = %Q{Form Link Backtrack Tracking for Ruby on Rails}
|
13
|
+
gem.description = %Q{Makes it easier to provide a 'Cancel' or 'Back' link on web forms in Ruby on Rails}
|
14
|
+
gem.email = "github@tadman.ca"
|
15
|
+
gem.authors = [ "Scott Tadman" ]
|
16
|
+
# dependencies defined in Gemfile
|
17
|
+
end
|
18
|
+
|
19
|
+
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/backtrack.gemspec
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "backtrack"
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Scott Tadman"]
|
12
|
+
s.date = "2012-01-23"
|
13
|
+
s.description = "Makes it easier to provide a 'Cancel' or 'Back' link on web forms in Ruby on Rails"
|
14
|
+
s.email = "github@tadman.ca"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"LICENSE.txt",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"backtrack.gemspec",
|
26
|
+
"lib/backtrack.rb",
|
27
|
+
"lib/backtrack/extensions.rb",
|
28
|
+
"lib/backtrack/extensions/action_controller.rb",
|
29
|
+
"lib/backtrack/extensions/action_view.rb",
|
30
|
+
"rails/init.rb",
|
31
|
+
"test/helper.rb",
|
32
|
+
"test/test_backula.rb"
|
33
|
+
]
|
34
|
+
s.homepage = "http://github.com/twg/backtrack"
|
35
|
+
s.licenses = ["MIT"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = "1.8.11"
|
38
|
+
s.summary = "Form Link Backtrack Tracking for Ruby on Rails"
|
39
|
+
|
40
|
+
if s.respond_to? :specification_version then
|
41
|
+
s.specification_version = 3
|
42
|
+
|
43
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
44
|
+
else
|
45
|
+
end
|
46
|
+
else
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
data/lib/backtrack.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Backtrack
|
2
|
+
# == Submodules ===========================================================
|
3
|
+
|
4
|
+
autoload(:Extensions, 'backtrack/extensions')
|
5
|
+
|
6
|
+
# == Constants ============================================================
|
7
|
+
|
8
|
+
BACKTRACK_PARAM = :_back
|
9
|
+
|
10
|
+
# == Module Methods =======================================================
|
11
|
+
|
12
|
+
def self.install!
|
13
|
+
ActionController::Base.send(:include, Backtrack::Extensions::ActionController)
|
14
|
+
|
15
|
+
ActionView::Base.send(:include, Backtrack::Extensions::ActionView)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.backtrack_param
|
19
|
+
@backtrack_param ||= BACKTRACK_PARAM
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.backtrack_param=(value)
|
23
|
+
@backtrack_param = value
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.default_path
|
27
|
+
@default_path
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.default_path=(value)
|
31
|
+
@default_path = value
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Backtrack::Extensions::ActionController
|
2
|
+
def self.included(base)
|
3
|
+
base.send(:helper_method, :backtrack_params)
|
4
|
+
base.send(:helper_method, :backtrack_path)
|
5
|
+
base.send(:helper_method, :backtrack_stack)
|
6
|
+
end
|
7
|
+
|
8
|
+
def backtrack_stack
|
9
|
+
[
|
10
|
+
request.request_uri,
|
11
|
+
(
|
12
|
+
params[Backtrack.backtrack_param] or
|
13
|
+
request.referrer or
|
14
|
+
Backtrack.default_path or
|
15
|
+
root_path
|
16
|
+
)
|
17
|
+
].flatten
|
18
|
+
end
|
19
|
+
|
20
|
+
def backtrack_path
|
21
|
+
self.backtrack_stack[1]
|
22
|
+
end
|
23
|
+
|
24
|
+
def backtrack_params(params = nil)
|
25
|
+
_params = {
|
26
|
+
Backtrack.backtrack_param => backtrack_path
|
27
|
+
}
|
28
|
+
|
29
|
+
params ? _params.merge(params) : _params
|
30
|
+
end
|
31
|
+
end
|
data/rails/init.rb
ADDED
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'backula'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: backtrack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Scott Tadman
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-23 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Makes it easier to provide a 'Cancel' or 'Back' link on web forms in
|
15
|
+
Ruby on Rails
|
16
|
+
email: github@tadman.ca
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files:
|
20
|
+
- LICENSE.txt
|
21
|
+
- README.rdoc
|
22
|
+
files:
|
23
|
+
- .document
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.rdoc
|
26
|
+
- Rakefile
|
27
|
+
- VERSION
|
28
|
+
- backtrack.gemspec
|
29
|
+
- lib/backtrack.rb
|
30
|
+
- lib/backtrack/extensions.rb
|
31
|
+
- lib/backtrack/extensions/action_controller.rb
|
32
|
+
- lib/backtrack/extensions/action_view.rb
|
33
|
+
- rails/init.rb
|
34
|
+
- test/helper.rb
|
35
|
+
- test/test_backula.rb
|
36
|
+
homepage: http://github.com/twg/backtrack
|
37
|
+
licenses:
|
38
|
+
- MIT
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.8.11
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: Form Link Backtrack Tracking for Ruby on Rails
|
61
|
+
test_files: []
|