My favorites
▼
|
Sign in
substruct
Open-source Ruby on Rails E-Commerce
Project Home
Downloads
Wiki
Issues
Source
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
74
attachment: pagination_prefs.patch
(2.6 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Index: vendor/plugins/substruct/app/controllers/store_controller.rb
===================================================================
--- vendor/plugins/substruct/app/controllers/store_controller.rb (revision 57)
+++ vendor/plugins/substruct/app/controllers/store_controller.rb (working copy)
@@ -38,7 +38,7 @@
:order => 'name ASC',
:conditions => Product::CONDITIONS_AVAILABLE,
:page => params[:page],
- :per_page => 10
+ :per_page => per_page
)
end
@@ -49,7 +49,7 @@
:order => 'name ASC',
:conditions => ["(name LIKE ? OR code = ?) AND #{Product::CONDITIONS_AVAILABLE}", "%#{@search_term}%", @search_term],
:page => params[:page],
- :per_page => 10
+ :per_page => per_page
)
# If only one product comes back, take em directly to it.
if @products.size == 1
@@ -82,7 +82,6 @@
# Paginate products so we don't have a ton of ugly SQL
# and conditions in the controller
- per_page = 10
list = Product.find_by_tags(tag_ids_array, true)
pager = Paginator.new(list, list.size, per_page, params[:page])
@products = returning WillPaginate::Collection.new(params[:page] || 1, per_page, list.size) do |p|
@@ -481,4 +480,9 @@
end
end
+ def per_page
+ pref = Preference.find_by_name('store_products_per_page')
+ pref && pref.value.to_i || 10
+ end
+
end
Index: vendor/plugins/substruct/app/views/admin/preferences/index.rhtml
===================================================================
--- vendor/plugins/substruct/app/views/admin/preferences/index.rhtml (revision 57)
+++ vendor/plugins/substruct/app/views/admin/preferences/index.rhtml (working copy)
@@ -58,6 +58,10 @@
After login, their adress information will be auto-filled in the checkout form.
</span>
</p>
+ <p>
+ <%= make_label('Products per Page', false) %>
+ <%= text_field_tag('prefs[store_products_per_page]', @prefs['store_products_per_page'].value, :class => 'textInput')%>
+ </p>
</div>
</div>
@@ -152,4 +156,4 @@
<%= render :partial => 'sidebar' %>
</div>
-<div class="clear"></div>
\ No newline at end of file
+<div class="clear"></div>
Index: vendor/plugins/substruct/db/bootstrap/preferences.yml
===================================================================
--- vendor/plugins/substruct/db/bootstrap/preferences.yml (revision 57)
+++ vendor/plugins/substruct/db/bootstrap/preferences.yml (working copy)
@@ -67,3 +67,7 @@
name: store_test_transactions
id: 17
value: "1"
+preference_00018:
+ name: store_products_per_page
+ id: 18
+ value: "10"
Powered by
Google Project Hosting