autopage 0.0.9 → 0.0.10

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.
@@ -1,3 +1,11 @@
1
+ == 0.0.9 2009-04-16
2
+
3
+ 1 add ActionView::Base helper method for js,css file inclusion.
4
+
5
+ == 0.0.9 2009-04-15
6
+
7
+ 1 add jquery js and css file, so remove dependency of Jquery
8
+
1
9
  == 0.0.8 2009-04-15
2
10
 
3
11
  * 1 clean unused folders and add rspec for class method.
@@ -3,14 +3,15 @@ tasks/manifest.rake
3
3
  spec/spec.opts
4
4
  spec/spec_helper.rb
5
5
  spec/autopage_spec.rb
6
+ lib/.autopage.rb.swp
6
7
  lib/autopage.rb
7
8
  Manifest.txt
8
- templates/css/jquery-ui-1.7.1.custom.css
9
- templates/js/jquery-1.3.2.min.js
10
- templates/js/jquery-ui-1.7.1.custom.min.js
11
- init.rb
9
+ templates/css/jquery-ui-tab.css
10
+ templates/js/jquery.min.js
11
+ templates/js/jquery-ui.min.js
12
12
  README.rdoc
13
13
  Rakefile
14
- History.txt
15
14
  TODO
16
15
  install.rb
16
+ init.rb
17
+ History.txt
data/init.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  $:.unshift "#{File.dirname(__FILE__)}/lib"
2
2
  require 'autopage'
3
+ ActionView::Base.send :include, Autopage::ClassMethods
data/install.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require 'fileutils'
2
2
 
3
- js1 = File.dirname(__FILE__) + '/../../../public/javascripts/jquery-1.3.2.min.js'
4
- js2 = File.dirname(__FILE__) + '/../../../public/javascripts/jquery-ui-1.7.1.custom.min.js'
5
- css1 = File.dirname(__FILE__) + '/../../../public/stylesheets/jquery-ui-1.7.1.custom.css'
3
+ js1 = File.dirname(__FILE__) + '/../../../public/javascripts/jquery.min.js'
4
+ js2 = File.dirname(__FILE__) + '/../../../public/javascripts/jquery-ui.min.js'
5
+ css1 = File.dirname(__FILE__) + '/../../../public/stylesheets/jquery-ui-tab.css'
6
6
 
7
- FileUtils.cp File.dirname(__FILE__) + '/templates/js/jquery-1.3.2.min.js', js1 unless File.exist?(js1)
8
- FileUtils.cp File.dirname(__FILE__) + '/templates/js/jquery-ui-1.7.1.custom.min.js', js2 unless File.exist?(js2)
9
- FileUtils.cp File.dirname(__FILE__) + '/templates/css/jquery-ui-1.7.1.custom.css', css1 unless File.exist?(css1)
7
+ FileUtils.cp File.dirname(__FILE__) + '/templates/js/jquery.min.js', js1 unless File.exist?(js1)
8
+ FileUtils.cp File.dirname(__FILE__) + '/templates/js/jquery-ui.min.js', js2 unless File.exist?(js2)
9
+ FileUtils.cp File.dirname(__FILE__) + '/templates/css/jquery-ui-tab.css', css1 unless File.exist?(css1)
10
10
 
Binary file
@@ -5,7 +5,7 @@ $:.unshift(File.dirname(__FILE__)) unless
5
5
  # A Rails Plugin to autogenerate long text content to multipage.
6
6
  #
7
7
  module Autopage
8
- VERSION = '0.0.9'
8
+ VERSION = '0.0.10'
9
9
 
10
10
  def self.included(base)
11
11
  base.extend ClassMethods
@@ -48,16 +48,28 @@ module Autopage
48
48
 
49
49
  module ClassMethods
50
50
  ##
51
- # Split String into array with fixed length characters, provide a class method for convinience
51
+ # ActionView Helper method to generate required javascript and css inclusion in webpage's head
52
+ # and initialize the tab DIV
52
53
  #
53
- # "xxxxxxxxx".split_page(3) #=> ['xxx','xxx','xxx']
54
+ # Usage: <%= javascript_include_autopage %>
54
55
  #
55
- # @return [Array]
56
+ # @return [String]
56
57
  #
57
58
  # @api public
58
- def split_page(content, width=200)
59
- content.scan(/.{1,#{width}}/u)
59
+ def javascript_include_autopage(pageDiv='idTabs')
60
+ %{
61
+ <link rel="stylesheet" type="text/css" href="/stylesheets/jquery-ui-tab.css" />
62
+ <script src="/javascripts/jquery.min.js" type="text/javascript"></script>
63
+ <script src="/javascripts/jquery-ui.min.js" type="text/javascript"></script>
64
+ <script type="text/javascript">
65
+ $(function(){
66
+ $('##{pageDiv}').tabs();
67
+ });
68
+ </script>
69
+ }
60
70
  end
71
+
72
+
61
73
  end
62
74
 
63
75
  end
@@ -65,3 +77,9 @@ end
65
77
  class String
66
78
  include Autopage
67
79
  end
80
+
81
+ if defined?(ActionView) && defined?(ActionView::Base)
82
+ ActionView::Base.send :include, Autopage::ClassMethods
83
+ else
84
+ Object.send :extend, Autopage::ClassMethods
85
+ end
@@ -29,12 +29,4 @@ describe "autopage" do
29
29
  end
30
30
  end
31
31
 
32
- describe 'ClassMethod#split_page' do
33
- it 'split_page should return an array' do
34
- String.split_page('xxxxxx',3).should be_kind_of(Array)
35
- String.split_page('xxxxxx',3).should == ['xxx','xxx']
36
- String.split_page('xxxxxxx',3).should == ['xxx','xxx','x']
37
- end
38
- end
39
-
40
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autopage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - eiffel qiu
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-15 00:00:00 +08:00
12
+ date: 2009-04-16 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -49,17 +49,18 @@ files:
49
49
  - spec/spec.opts
50
50
  - spec/spec_helper.rb
51
51
  - spec/autopage_spec.rb
52
+ - lib/.autopage.rb.swp
52
53
  - lib/autopage.rb
53
54
  - Manifest.txt
54
- - templates/css/jquery-ui-1.7.1.custom.css
55
- - templates/js/jquery-1.3.2.min.js
56
- - templates/js/jquery-ui-1.7.1.custom.min.js
57
- - init.rb
55
+ - templates/css/jquery-ui-tab.css
56
+ - templates/js/jquery.min.js
57
+ - templates/js/jquery-ui.min.js
58
58
  - README.rdoc
59
59
  - Rakefile
60
- - History.txt
61
60
  - TODO
62
61
  - install.rb
62
+ - init.rb
63
+ - History.txt
63
64
  has_rdoc: true
64
65
  homepage: http://autopage.rubyforge.org
65
66
  post_install_message: