peiji-san 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,129 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: LICENSE</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>LICENSE</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>LICENSE
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Apr 05 12:42:17 +0200 2011</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ Copyright © 2009 Fingertips, Eloy Duran &lt;eloy.de.enige@gmail.com&gt;
74
+ </p>
75
+ <p>
76
+ Permission is hereby granted, free of charge, to any person obtaining a
77
+ copy of this software and associated documentation files (the
78
+ &quot;Software&quot;), to deal in the Software without restriction,
79
+ including without limitation the rights to use, copy, modify, merge,
80
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
81
+ permit persons to whom the Software is furnished to do so, subject to the
82
+ following conditions:
83
+ </p>
84
+ <p>
85
+ The above copyright notice and this permission notice shall be included in
86
+ all copies or substantial portions of the Software.
87
+ </p>
88
+ <p>
89
+ THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
90
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
91
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
92
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
93
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
94
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
95
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
96
+ </p>
97
+
98
+ </div>
99
+
100
+
101
+ </div>
102
+
103
+
104
+ </div>
105
+
106
+
107
+ <!-- if includes -->
108
+
109
+ <div id="section">
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <!-- if method_list -->
119
+
120
+
121
+ </div>
122
+
123
+
124
+ <div id="validator-badges">
125
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
126
+ </div>
127
+
128
+ </body>
129
+ </html>
@@ -0,0 +1,157 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: README.rdoc</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>README.rdoc</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README.rdoc
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Apr 05 13:56:19 +0200 2011</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h1>Peiji-San</h1>
73
+ <p>
74
+ Peiji-San uses scopes to create a thin pagination layer.
75
+ </p>
76
+ <p>
77
+ We try to stay out of the way of your application as much as possible.
78
+ That&#8216;s why you need to include Peiji in the places where you actually
79
+ use it.
80
+ </p>
81
+ <pre>
82
+ class Member &lt; ActiveRecord::Base
83
+ extend PeijiSan
84
+ self.entries_per_page = 32
85
+ end
86
+ </pre>
87
+ <p>
88
+ After that a special extended scope is defined on the model and you will be
89
+ able to select a collection that contains only records on that page.
90
+ </p>
91
+ <pre>
92
+ @collection = Member.active.page(2)
93
+ </pre>
94
+ <p>
95
+ In the view you can either build your own links to the pages or you can use
96
+ the helpers shipped with Peiji. Like with the model extension the view
97
+ helpers aren&#8216;t defined by default, you will need to include them in
98
+ another helper class.
99
+ </p>
100
+ <pre>
101
+ class ApplicationHelper
102
+ include PeijiSan::ViewHelper
103
+ end
104
+ </pre>
105
+ <p>
106
+ After that the helpers will be usable in your view.
107
+ </p>
108
+ <pre>
109
+ &lt;% if @collection.page_count &gt; 1 %&gt;
110
+ &lt;% pages_to_link_to(@collection).each do |page| %&gt;
111
+ &lt;%= page.is_a?(String) ? page : link_to_page(page, @collection) %&gt;
112
+ &lt;% end %&gt;
113
+ &lt;% end %&gt;
114
+ </pre>
115
+ <h2>Rails 2.3 and earlier</h2>
116
+ <p>
117
+ The latest version of Peiji only works in Rails 3 because of extensive
118
+ changes to the scope API. However, earlier version work just fine in Rails
119
+ 2.3. Rails 3 support starts at version 1.0, so put the following in
120
+ environment.rb:
121
+ </p>
122
+ <pre>
123
+ config.gem &quot;peiji-san&quot;, :lib =&gt; &quot;peiji_san&quot;, :version =&gt; &quot;&lt; 1.0&quot;
124
+ </pre>
125
+
126
+ </div>
127
+
128
+
129
+ </div>
130
+
131
+
132
+ </div>
133
+
134
+
135
+ <!-- if includes -->
136
+
137
+ <div id="section">
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <!-- if method_list -->
147
+
148
+
149
+ </div>
150
+
151
+
152
+ <div id="validator-badges">
153
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
154
+ </div>
155
+
156
+ </body>
157
+ </html>
@@ -0,0 +1,101 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: view_helper.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>view_helper.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/peiji_san/view_helper.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Apr 05 13:35:26 +0200 2011</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+
73
+ </div>
74
+
75
+
76
+ </div>
77
+
78
+
79
+ <!-- if includes -->
80
+
81
+ <div id="section">
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <!-- if method_list -->
91
+
92
+
93
+ </div>
94
+
95
+
96
+ <div id="validator-badges">
97
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
+ </div>
99
+
100
+ </body>
101
+ </html>
@@ -0,0 +1,133 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: peiji_san.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>peiji_san.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/peiji_san.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Apr 05 13:57:40 +0200 2011</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ Peiji-San uses named scopes to create a thin pagination layer.
74
+ </p>
75
+ <p>
76
+ Example:
77
+ </p>
78
+ <pre>
79
+ class Member &lt; ActiveRecord::Base
80
+ extend PeijiSan
81
+ self.entries_per_page = 32
82
+ end
83
+ </pre>
84
+ <p>
85
+ Now you can start scoping your queries by `page&#8217;:
86
+ </p>
87
+ <pre>
88
+ Member.active.page(2)
89
+ </pre>
90
+ <p>
91
+ Which will return 32 records with an offset of 32, as that&#8216;s the
92
+ second page.
93
+ </p>
94
+ <p>
95
+ See <a
96
+ href="../../classes/PeijiSan/PaginationMethods.html">PeijiSan::PaginationMethods</a>
97
+ and <a
98
+ href="../../classes/PeijiSan/ViewHelper.html">PeijiSan::ViewHelper</a> for
99
+ more info.
100
+ </p>
101
+
102
+ </div>
103
+
104
+
105
+ </div>
106
+
107
+
108
+ </div>
109
+
110
+
111
+ <!-- if includes -->
112
+
113
+ <div id="section">
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+ <!-- if method_list -->
123
+
124
+
125
+ </div>
126
+
127
+
128
+ <div id="validator-badges">
129
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
130
+ </div>
131
+
132
+ </body>
133
+ </html>
@@ -0,0 +1,29 @@
1
+
2
+ <?xml version="1.0" encoding="utf-8"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Classes
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Classes</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Classes</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/PeijiSan.html">PeijiSan</a><br />
24
+ <a href="classes/PeijiSan/PaginationMethods.html">PeijiSan::PaginationMethods</a><br />
25
+ <a href="classes/PeijiSan/ViewHelper.html">PeijiSan::ViewHelper</a><br />
26
+ </div>
27
+ </div>
28
+ </body>
29
+ </html>
@@ -0,0 +1,30 @@
1
+
2
+ <?xml version="1.0" encoding="utf-8"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Files
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Files</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Files</h1>
22
+ <div id="index-entries">
23
+ <a href="files/LICENSE.html">LICENSE</a><br />
24
+ <a href="files/README_rdoc.html">README.rdoc</a><br />
25
+ <a href="files/lib/peiji_san_rb.html">lib/peiji_san.rb</a><br />
26
+ <a href="files/lib/peiji_san/view_helper_rb.html">lib/peiji_san/view_helper.rb</a><br />
27
+ </div>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,39 @@
1
+
2
+ <?xml version="1.0" encoding="utf-8"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Methods
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Methods</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Methods</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/PeijiSan/PaginationMethods.html#M000007">current_page? (PeijiSan::PaginationMethods)</a><br />
24
+ <a href="classes/PeijiSan.html#M000002">entries_per_page (PeijiSan)</a><br />
25
+ <a href="classes/PeijiSan.html#M000001">entries_per_page= (PeijiSan)</a><br />
26
+ <a href="classes/PeijiSan/PaginationMethods.html#M000008">has_next_page? (PeijiSan::PaginationMethods)</a><br />
27
+ <a href="classes/PeijiSan/PaginationMethods.html#M000009">has_previous_page? (PeijiSan::PaginationMethods)</a><br />
28
+ <a href="classes/PeijiSan/ViewHelper.html#M000005">link_to_page (PeijiSan::ViewHelper)</a><br />
29
+ <a href="classes/PeijiSan/PaginationMethods.html#M000010">next_page (PeijiSan::PaginationMethods)</a><br />
30
+ <a href="classes/PeijiSan.html#M000003">page (PeijiSan)</a><br />
31
+ <a href="classes/PeijiSan/PaginationMethods.html#M000013">page_count (PeijiSan::PaginationMethods)</a><br />
32
+ <a href="classes/PeijiSan/ViewHelper.html#M000006">pages_to_link_to (PeijiSan::ViewHelper)</a><br />
33
+ <a href="classes/PeijiSan/ViewHelper.html#M000004">peiji_san_options (PeijiSan::ViewHelper)</a><br />
34
+ <a href="classes/PeijiSan/PaginationMethods.html#M000011">previous_page (PeijiSan::PaginationMethods)</a><br />
35
+ <a href="classes/PeijiSan/PaginationMethods.html#M000012">unpaged_count (PeijiSan::PaginationMethods)</a><br />
36
+ </div>
37
+ </div>
38
+ </body>
39
+ </html>
data/rdoc/index.html ADDED
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ PeijiSan
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>PeijiSan</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/README_rdoc.html" name="docwin" />
23
+ </frameset>
24
+ </html>