cartoset 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.markdown +6 -12
- data/app/controllers/admin/admin_controller.rb +1 -0
- data/app/controllers/admin/dashboard_controller.rb +1 -1
- data/app/helpers/admin/admin_helper.rb +22 -1
- data/app/helpers/application_helper.rb +2 -2
- data/lib/cartoset/version.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/README.markdown
CHANGED
@@ -6,7 +6,7 @@ Requirements.
|
|
6
6
|
|
7
7
|
The requirements you will need in order to run a Cartoset based project are:
|
8
8
|
|
9
|
-
- valid Ruby interpreter (versions 1.
|
9
|
+
- valid Ruby interpreter (versions >=1.9.2 supported)
|
10
10
|
- [rubygems](http://rubygems.org/pages/download)
|
11
11
|
- [git](http://git-scm.com/)
|
12
12
|
- [PostgreSQL 9.0](http://www.postgresql.org/download/)
|
@@ -33,20 +33,12 @@ The requirements you will need in order to run a Cartoset based project are:
|
|
33
33
|
Setting up a new Cartoset based project.
|
34
34
|
----------------------------------------
|
35
35
|
|
36
|
-
1.
|
36
|
+
1. Create a new rails project. Version should be equal or greater than 3.1
|
37
37
|
|
38
|
-
2.
|
38
|
+
2. Add the cartoset gem to the project Gemfile
|
39
39
|
|
40
|
-
|
40
|
+
4. Install all the gems in the Gemfile:
|
41
41
|
|
42
|
-
4. Install Ruby 1.9.2:
|
43
|
-
|
44
|
-
$ cd cartoset
|
45
|
-
$ rvm install 1.9.2
|
46
|
-
$ rvm use 1.9.2
|
47
|
-
$ rvm gemset create cartoset
|
48
|
-
$ rvm use 1.9.2@cartoset
|
49
|
-
$ gem install bundler
|
50
42
|
$ bundle install
|
51
43
|
|
52
44
|
5. Start a new server session:
|
@@ -64,3 +56,5 @@ Setting up a new Cartoset based project.
|
|
64
56
|
8. When you finish the setup proccess, you will have your cartoset project configured!
|
65
57
|
|
66
58
|
9. Customize your cartoset project, adding some css styles and giving it some love!
|
59
|
+
|
60
|
+
10. You can also add your own controllers, or override the existing ones.
|
@@ -1,4 +1,25 @@
|
|
1
1
|
module Admin::AdminHelper
|
2
|
+
def paginate(rows, current_page, total_count, per_page = 10, params = {})
|
3
|
+
|
4
|
+
if per_page.is_a?(Hash)
|
5
|
+
params = per_page
|
6
|
+
per_page = 10
|
7
|
+
end
|
8
|
+
|
9
|
+
window = 2
|
10
|
+
total_pages = (total_count.to_f / per_page.to_f).ceil
|
11
|
+
last_page = total_pages - 1
|
12
|
+
|
13
|
+
left = (current_page - 1).downto(1).to_a.first(window).sort
|
14
|
+
right = (current_page + 1).upto(total_pages).to_a.first(window)
|
15
|
+
|
16
|
+
pages = 1.upto(current_page - 1).to_a.map{|p| left.include?(p) || p == 1 ? p : '...'}.uniq + [current_page] + (current_page + 1).upto(last_page).to_a.map{|p| right.include?(p) || p == last_page ? p : '...'}.uniq
|
17
|
+
|
18
|
+
content_tag :div, :class => 'pagination' do
|
19
|
+
raw pages.map{|page| page.eql?('...') ? content_tag(:span, page) : link_to(page, admin_path(params.merge({:page => page})), :class => page == current_page ? 'current' : nil)}.join(' ')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
2
23
|
def build_field_for_column(column, value = nil)
|
3
24
|
|
4
25
|
case column[:type]
|
@@ -22,4 +43,4 @@ module Admin::AdminHelper
|
|
22
43
|
text_field_tag column[:name], value, :id => column[:name], :class => column[:type]
|
23
44
|
end
|
24
45
|
end
|
25
|
-
end
|
46
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module ApplicationHelper
|
2
2
|
def paginate(rows, current_page, total_count, per_page = 10, params = {})
|
3
|
-
|
3
|
+
|
4
4
|
if per_page.is_a?(Hash)
|
5
5
|
params = per_page
|
6
6
|
per_page = 10
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
window = 2
|
10
10
|
total_pages = (total_count.to_f / per_page.to_f).ceil
|
11
11
|
last_page = total_pages - 1
|
data/lib/cartoset/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cartoset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -279,7 +279,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
279
279
|
version: '0'
|
280
280
|
segments:
|
281
281
|
- 0
|
282
|
-
hash: -
|
282
|
+
hash: -1985439045041671426
|
283
283
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
284
284
|
none: false
|
285
285
|
requirements:
|
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
288
|
version: '0'
|
289
289
|
segments:
|
290
290
|
- 0
|
291
|
-
hash: -
|
291
|
+
hash: -1985439045041671426
|
292
292
|
requirements: []
|
293
293
|
rubyforge_project: cartoset
|
294
294
|
rubygems_version: 1.8.24
|