rails-footnotes 3.7.5 → 3.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.travis.yml +9 -0
- data/README.rdoc +9 -2
- data/lib/rails-footnotes/notes/controller_note.rb +2 -2
- data/lib/rails-footnotes/notes/files_note.rb +25 -7
- data/lib/rails-footnotes/version.rb +1 -1
- data/spec/notes/controller_note_spec.rb +12 -0
- data/spec/notes/files_note_spec.rb +10 -4
- data/spec/spec_helper.rb +2 -0
- metadata +58 -87
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.rdoc
CHANGED
@@ -31,7 +31,7 @@ In RAILS_ROOT/config/environments/development.rb (yes, you want it only in devel
|
|
31
31
|
|
32
32
|
== Configuration
|
33
33
|
|
34
|
-
For version greater
|
34
|
+
For version greater than 3.7.0
|
35
35
|
|
36
36
|
If you want to add alternate logic to enable or disable footnotes,
|
37
37
|
add something like this to config/initializers/footnotes.rb:
|
@@ -129,7 +129,14 @@ Then put in your environment:
|
|
129
129
|
|
130
130
|
Footnotes::Filter.notes += [:current_user]
|
131
131
|
|
132
|
-
==
|
132
|
+
== Display of the notes
|
133
|
+
|
134
|
+
By default the notes will be showed at the bottom of your page (appended just before </body>).
|
135
|
+
If you'd like these notes on a different place (perhaps for aesthetical reasons) you can edit one of your views and add:
|
136
|
+
<div id="footnotes_holder"></div>
|
137
|
+
at an appropriate place, your notes will now appear inside div#footnotes_holder
|
138
|
+
|
139
|
+
== Collaborators
|
133
140
|
|
134
141
|
* Leon Li - http://github.com/scorpio
|
135
142
|
* Keenan Brock - http://github.com/kbrock
|
@@ -14,7 +14,7 @@ module Footnotes
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def valid?
|
17
|
-
prefix? && File.exists?(
|
17
|
+
prefix? && controller_filename && File.exists?(controller_filename)
|
18
18
|
end
|
19
19
|
|
20
20
|
protected
|
@@ -23,7 +23,7 @@ module Footnotes
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def controller_filename
|
26
|
-
@controller_filename ||= Gem.find_files(
|
26
|
+
@controller_filename ||= Gem.find_files(controller_path).first # tnx https://github.com/MasterLambaster
|
27
27
|
end
|
28
28
|
|
29
29
|
def controller_text
|
@@ -14,7 +14,7 @@ module Footnotes
|
|
14
14
|
if @files.empty?
|
15
15
|
""
|
16
16
|
else
|
17
|
-
"<ul><li
|
17
|
+
"<ul><li>%s</li></ul>" % @files.join("</li><li>")
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -28,12 +28,30 @@ module Footnotes
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def parse_files!
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
if Rails.version >= '3.1' && Rails.application.config.assets[:enabled]
|
32
|
+
asset_paths = Rails.application.config.assets.paths
|
33
|
+
linked_files = []
|
34
|
+
|
35
|
+
@files.collect do |file|
|
36
|
+
base_name = File.basename(file)
|
37
|
+
asset_paths.each do |asset_path|
|
38
|
+
results = Dir[File.expand_path(base_name, asset_path) + '*']
|
39
|
+
results.each do |r|
|
40
|
+
linked_files << %[<a href="#{Footnotes::Filter.prefix(r, 1, 1)}">#{File.basename(r)}</a>]
|
41
|
+
end
|
42
|
+
break if results.present?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
@files = linked_files
|
46
|
+
else
|
47
|
+
#Original Implementation
|
48
|
+
@files.collect! do |filename|
|
49
|
+
if filename =~ %r{^/}
|
50
|
+
full_filename = File.join(File.expand_path(Rails.root), 'public', filename)
|
51
|
+
%[<a href="#{Footnotes::Filter.prefix(full_filename, 1, 1)}">#{filename}</a>]
|
52
|
+
else
|
53
|
+
%[<a href="#{filename}">#{filename}</a>]
|
54
|
+
end
|
37
55
|
end
|
38
56
|
end
|
39
57
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "rails-footnotes/notes/controller_note"
|
3
|
+
|
4
|
+
describe Footnotes::Notes::ControllerNote do
|
5
|
+
# Issue #60
|
6
|
+
it "should not be valid if conftroller file not exist" do
|
7
|
+
note = Footnotes::Notes::ControllerNote.new(mock)
|
8
|
+
note.stub(:controller_filename).and_return(nil)
|
9
|
+
|
10
|
+
note.should_not be_valid
|
11
|
+
end
|
12
|
+
end
|
@@ -3,9 +3,15 @@ require 'action_controller'
|
|
3
3
|
require "rails-footnotes/notes/files_note"
|
4
4
|
|
5
5
|
describe Footnotes::Notes::FilesNote do
|
6
|
-
let(:note) {Footnotes::Notes::FilesNote.new(mock('controller', :response => mock('', :body => '')))}
|
7
|
-
subject {note}
|
8
6
|
|
9
|
-
|
10
|
-
|
7
|
+
let(:note) do
|
8
|
+
Rails.stub(:version).and_return('3.0.12');
|
9
|
+
Footnotes::Notes::FilesNote.new(mock('controller', :response => mock('', :body => '')))
|
10
|
+
end
|
11
|
+
|
12
|
+
subject { note }
|
13
|
+
|
14
|
+
it { should be_valid }
|
15
|
+
its(:row) { should eql :edit }
|
16
|
+
|
11
17
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,94 +1,71 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-footnotes
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.7.6
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 3
|
8
|
-
- 7
|
9
|
-
- 5
|
10
|
-
version: 3.7.5
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Keenan Brock
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-03-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rails
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70324691484480 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 7
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 0
|
32
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 3.0.0
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rails
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *70324691484480
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rails
|
27
|
+
requirement: &70324691483740 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 7
|
45
|
-
segments:
|
46
|
-
- 3
|
47
|
-
- 0
|
48
|
-
- 0
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
49
32
|
version: 3.0.0
|
50
33
|
type: :development
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: rspec
|
54
34
|
prerelease: false
|
55
|
-
|
35
|
+
version_requirements: *70324691483740
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &70324691483080 !ruby/object:Gem::Requirement
|
56
39
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
64
44
|
type: :development
|
65
|
-
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: watchr
|
68
45
|
prerelease: false
|
69
|
-
|
46
|
+
version_requirements: *70324691483080
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: watchr
|
49
|
+
requirement: &70324691482220 !ruby/object:Gem::Requirement
|
70
50
|
none: false
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
78
55
|
type: :development
|
79
|
-
|
80
|
-
|
81
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70324691482220
|
58
|
+
description: Every Rails page has footnotes that gives information about your application
|
59
|
+
and links back to your editor.
|
60
|
+
email:
|
82
61
|
- keenan@thebrocks.net
|
83
62
|
executables: []
|
84
|
-
|
85
63
|
extensions: []
|
86
|
-
|
87
64
|
extra_rdoc_files: []
|
88
|
-
|
89
|
-
files:
|
65
|
+
files:
|
90
66
|
- .gitignore
|
91
67
|
- .rspec.example
|
68
|
+
- .travis.yml
|
92
69
|
- .watchr.example
|
93
70
|
- CHANGELOG
|
94
71
|
- Gemfile
|
@@ -126,6 +103,7 @@ files:
|
|
126
103
|
- spec/abstract_note_spec.rb
|
127
104
|
- spec/footnotes_spec.rb
|
128
105
|
- spec/notes/assigns_note_spec.rb
|
106
|
+
- spec/notes/controller_note_spec.rb
|
129
107
|
- spec/notes/files_note_spec.rb
|
130
108
|
- spec/notes/javascripts_note_spec.rb
|
131
109
|
- spec/notes/partials_notes_spec.rb
|
@@ -133,41 +111,34 @@ files:
|
|
133
111
|
- spec/spec_helper.rb
|
134
112
|
homepage: http://github.com/josevalim/rails-footnotes
|
135
113
|
licenses: []
|
136
|
-
|
137
114
|
post_install_message:
|
138
115
|
rdoc_options: []
|
139
|
-
|
140
|
-
require_paths:
|
116
|
+
require_paths:
|
141
117
|
- lib
|
142
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
119
|
none: false
|
144
|
-
requirements:
|
145
|
-
- -
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
|
148
|
-
|
149
|
-
- 0
|
150
|
-
version: "0"
|
151
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
125
|
none: false
|
153
|
-
requirements:
|
154
|
-
- -
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
|
157
|
-
segments:
|
158
|
-
- 0
|
159
|
-
version: "0"
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
160
130
|
requirements: []
|
161
|
-
|
162
131
|
rubyforge_project: rails-footnotes
|
163
|
-
rubygems_version: 1.8.
|
132
|
+
rubygems_version: 1.8.17
|
164
133
|
signing_key:
|
165
134
|
specification_version: 3
|
166
|
-
summary: Every Rails page has footnotes that gives information about your application
|
167
|
-
|
135
|
+
summary: Every Rails page has footnotes that gives information about your application
|
136
|
+
and links back to your editor.
|
137
|
+
test_files:
|
168
138
|
- spec/abstract_note_spec.rb
|
169
139
|
- spec/footnotes_spec.rb
|
170
140
|
- spec/notes/assigns_note_spec.rb
|
141
|
+
- spec/notes/controller_note_spec.rb
|
171
142
|
- spec/notes/files_note_spec.rb
|
172
143
|
- spec/notes/javascripts_note_spec.rb
|
173
144
|
- spec/notes/partials_notes_spec.rb
|