back_mark 0.0.1 → 1.0.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/README.md +53 -0
- data/lib/back_mark/version.rb +1 -1
- metadata +4 -4
- data/README +0 -13
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
Back Mark
|
2
|
+
=============
|
3
|
+
|
4
|
+
`Backmark` gem can be used to mark pages with labels that can be linked back from future pages as back links.
|
5
|
+
Also remembers the last accessed non Create/Update/Delete page (as in CRUD).
|
6
|
+
For instance, a user is viewing items index, and navigates to 'new item' page.
|
7
|
+
Once he is done with the creation of the item (i.e., POST to items/create),
|
8
|
+
it would be nice if the user is taken to the index page rather than the 'new'
|
9
|
+
page, which was the LAST VISITED page. Hence, such CUD actions are `not_remembered`.
|
10
|
+
|
11
|
+
Installation
|
12
|
+
------------
|
13
|
+
|
14
|
+
gem install back_mark
|
15
|
+
|
16
|
+
Usage
|
17
|
+
-----
|
18
|
+
|
19
|
+
`back_mark` marks the current url with the given label.
|
20
|
+
Invoke from an action with a meaningful label, if you want that page to be linked back from future pages
|
21
|
+
|
22
|
+
## Arguments:
|
23
|
+
|
24
|
+
- `label` :: label for the back mark
|
25
|
+
- `url_to_mark` :: the url to remember instead of the current request url. Default is `request.url`
|
26
|
+
- `mark_now` :: Mark the location so that the back link can be rendered in the current action. Default is `false`
|
27
|
+
|
28
|
+
## Examples:
|
29
|
+
|
30
|
+
back_mark("Inbox")
|
31
|
+
back_mark("Home")
|
32
|
+
back_mark("Login", '/Login', true)
|
33
|
+
|
34
|
+
The request can be redirected to the back link stored in the session or the default url passed by invoking the method `redirect_to_back_mark_or_default`.
|
35
|
+
The argument is the url to be redirected to incase there is no back link.
|
36
|
+
Please note that we redirect back to the url stored by the filter. Not the last back_marked url.
|
37
|
+
|
38
|
+
redirect_to_back_mark_or_default(`default_url`)
|
39
|
+
|
40
|
+
For example:
|
41
|
+
|
42
|
+
redirect_to_back_mark_or_default(users_path)
|
43
|
+
|
44
|
+
The back_marking can be made easy by adding `back_mark_pages` as a `before_filter` to the action in the controller.
|
45
|
+
|
46
|
+
before_filter :back_mark_pages
|
47
|
+
|
48
|
+
|
49
|
+
Author
|
50
|
+
------
|
51
|
+
|
52
|
+
B V Satyaram <[bvsatyaram.com](http://bvsatyaram.com)>
|
53
|
+
Inspired by back mark plugin authored by Vikram Venkatesan
|
data/lib/back_mark/version.rb
CHANGED
metadata
CHANGED
@@ -3,10 +3,10 @@ name: back_mark
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
+
- 1
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.1
|
9
|
+
version: 1.0.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Satyaram B V
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-05-16 00:00:00 +05:30
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -30,7 +30,7 @@ extra_rdoc_files: []
|
|
30
30
|
files:
|
31
31
|
- .gitignore
|
32
32
|
- Gemfile
|
33
|
-
- README
|
33
|
+
- README.md
|
34
34
|
- Rakefile
|
35
35
|
- back_mark.gemspec
|
36
36
|
- lib/back_mark.rb
|