facebox-rails2 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/.rspec +3 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +9 -0
- data/app/assets/images/facebox-rails/closelabel.png +0 -0
- data/app/assets/images/facebox-rails/loading.gif +0 -0
- data/app/assets/javascripts/facebox-rails/facebox.js.erb +313 -0
- data/app/assets/javascripts/facebox-rails.js +1 -0
- data/app/assets/stylesheets/facebox-rails/facebox.css +80 -0
- data/app/assets/stylesheets/facebox-rails.css +3 -0
- data/facebox-rails.gemspec +26 -0
- data/lib/facebox-rails/engine.rb +6 -0
- data/lib/facebox-rails/version.rb +5 -0
- data/lib/facebox-rails.rb +18 -0
- data/log/development.log +0 -0
- data/log/test.log +0 -0
- data/spec/apps/facebox_rails/app/assets/javascripts/application.js +1 -0
- data/spec/apps/facebox_rails/app/assets/stylesheets/application.css +3 -0
- data/spec/apps/facebox_rails/app/controllers/facebox_rails_controller.rb +4 -0
- data/spec/apps/facebox_rails/app/views/facebox_rails/index.html.haml +0 -0
- data/spec/apps/facebox_rails/app/views/layouts/facebox_rails.html.haml +9 -0
- data/spec/apps/facebox_rails/config/application.rb +39 -0
- data/spec/apps/facebox_rails/config/boot.rb +1 -0
- data/spec/apps/facebox_rails/config/environment.rb +5 -0
- data/spec/apps/facebox_rails/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/apps/facebox_rails/config/initializers/inflections.rb +15 -0
- data/spec/apps/facebox_rails/config/initializers/mime_types.rb +5 -0
- data/spec/apps/facebox_rails/config/initializers/secret_token.rb +7 -0
- data/spec/apps/facebox_rails/config/initializers/session_store.rb +8 -0
- data/spec/apps/facebox_rails/config/initializers/wrap_parameters.rb +10 -0
- data/spec/apps/facebox_rails/config/locales/en.yml +5 -0
- data/spec/apps/facebox_rails/config/routes.rb +58 -0
- data/spec/controllers/facebox_rails_controller_spec.rb +10 -0
- data/spec/spec_helper.rb +6 -0
- metadata +171 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Sam Woodard
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Facebox::Rails
|
2
|
+
|
3
|
+
TODO: Write specs!
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'facebox-rails2', :require => 'facebox-rails'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install facebox-rails2
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,313 @@
|
|
1
|
+
/*
|
2
|
+
* Facebox (for jQuery)
|
3
|
+
* version: 1.3
|
4
|
+
* @requires jQuery v1.2 or later
|
5
|
+
* @homepage https://github.com/defunkt/facebox
|
6
|
+
*
|
7
|
+
* Licensed under the MIT:
|
8
|
+
* http://www.opensource.org/licenses/mit-license.php
|
9
|
+
*
|
10
|
+
* Copyright Forever Chris Wanstrath, Kyle Neath
|
11
|
+
*
|
12
|
+
* Usage:
|
13
|
+
*
|
14
|
+
* jQuery(document).ready(function() {
|
15
|
+
* jQuery('a[rel*=facebox]').facebox()
|
16
|
+
* })
|
17
|
+
*
|
18
|
+
* <a href="#terms" rel="facebox">Terms</a>
|
19
|
+
* Loads the #terms div in the box
|
20
|
+
*
|
21
|
+
* <a href="terms.html" rel="facebox">Terms</a>
|
22
|
+
* Loads the terms.html page in the box
|
23
|
+
*
|
24
|
+
* <a href="terms.png" rel="facebox">Terms</a>
|
25
|
+
* Loads the terms.png image in the box
|
26
|
+
*
|
27
|
+
*
|
28
|
+
* You can also use it programmatically:
|
29
|
+
*
|
30
|
+
* jQuery.facebox('some html')
|
31
|
+
* jQuery.facebox('some html', 'my-groovy-style')
|
32
|
+
*
|
33
|
+
* The above will open a facebox with "some html" as the content.
|
34
|
+
*
|
35
|
+
* jQuery.facebox(function($) {
|
36
|
+
* $.get('blah.html', function(data) { $.facebox(data) })
|
37
|
+
* })
|
38
|
+
*
|
39
|
+
* The above will show a loading screen before the passed function is called,
|
40
|
+
* allowing for a better ajaxy experience.
|
41
|
+
*
|
42
|
+
* The facebox function can also display an ajax page, an image, or the contents of a div:
|
43
|
+
*
|
44
|
+
* jQuery.facebox({ ajax: 'remote.html' })
|
45
|
+
* jQuery.facebox({ ajax: 'remote.html' }, 'my-groovy-style')
|
46
|
+
* jQuery.facebox({ image: 'stairs.jpg' })
|
47
|
+
* jQuery.facebox({ image: 'stairs.jpg' }, 'my-groovy-style')
|
48
|
+
* jQuery.facebox({ div: '#box' })
|
49
|
+
* jQuery.facebox({ div: '#box' }, 'my-groovy-style')
|
50
|
+
*
|
51
|
+
* Want to close the facebox? Trigger the 'close.facebox' document event:
|
52
|
+
*
|
53
|
+
* jQuery(document).trigger('close.facebox')
|
54
|
+
*
|
55
|
+
* Facebox also has a bunch of other hooks:
|
56
|
+
*
|
57
|
+
* loading.facebox
|
58
|
+
* beforeReveal.facebox
|
59
|
+
* reveal.facebox (aliased as 'afterReveal.facebox')
|
60
|
+
* init.facebox
|
61
|
+
* afterClose.facebox
|
62
|
+
*
|
63
|
+
* Simply bind a function to any of these hooks:
|
64
|
+
*
|
65
|
+
* $(document).bind('reveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })
|
66
|
+
*
|
67
|
+
*/
|
68
|
+
(function($) {
|
69
|
+
$.facebox = function(data, klass) {
|
70
|
+
$.facebox.loading(data.settings || [])
|
71
|
+
|
72
|
+
if (data.ajax) fillFaceboxFromAjax(data.ajax, klass)
|
73
|
+
else if (data.image) fillFaceboxFromImage(data.image, klass)
|
74
|
+
else if (data.div) fillFaceboxFromHref(data.div, klass)
|
75
|
+
else if ($.isFunction(data)) data.call($)
|
76
|
+
else $.facebox.reveal(data, klass)
|
77
|
+
}
|
78
|
+
|
79
|
+
/*
|
80
|
+
* Public, $.facebox methods
|
81
|
+
*/
|
82
|
+
|
83
|
+
$.extend($.facebox, {
|
84
|
+
settings: {
|
85
|
+
opacity : 0.2,
|
86
|
+
overlay : true,
|
87
|
+
loadingImage : <%= FaceboxRails.configuration.loading_image_path %>,
|
88
|
+
closeImage : <%= FaceboxRails.configuration.closeimage_image_path %>,
|
89
|
+
imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],
|
90
|
+
faceboxHtml : '\
|
91
|
+
<div id="facebox" style="display:none;"> \
|
92
|
+
<div class="popup"> \
|
93
|
+
<div class="content"> \
|
94
|
+
</div> \
|
95
|
+
<a href="#" class="close"></a> \
|
96
|
+
</div> \
|
97
|
+
</div>'
|
98
|
+
},
|
99
|
+
|
100
|
+
loading: function() {
|
101
|
+
init()
|
102
|
+
if ($('#facebox .loading').length == 1) return true
|
103
|
+
showOverlay()
|
104
|
+
|
105
|
+
$('#facebox .content').empty().
|
106
|
+
append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')
|
107
|
+
|
108
|
+
$('#facebox').show().css({
|
109
|
+
top: getPageScroll()[1] + (getPageHeight() / 10),
|
110
|
+
left: $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2)
|
111
|
+
})
|
112
|
+
|
113
|
+
$(document).bind('keydown.facebox', function(e) {
|
114
|
+
if (e.keyCode == 27) $.facebox.close()
|
115
|
+
return true
|
116
|
+
})
|
117
|
+
$(document).trigger('loading.facebox')
|
118
|
+
},
|
119
|
+
|
120
|
+
reveal: function(data, klass) {
|
121
|
+
$(document).trigger('beforeReveal.facebox')
|
122
|
+
if (klass) $('#facebox .content').addClass(klass)
|
123
|
+
$('#facebox .content').empty().append(data)
|
124
|
+
$('#facebox .popup').children().fadeIn('normal')
|
125
|
+
$('#facebox').css('left', $(window).width() / 2 - ($('#facebox .popup').outerWidth() / 2))
|
126
|
+
$(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
|
127
|
+
},
|
128
|
+
|
129
|
+
close: function() {
|
130
|
+
$(document).trigger('close.facebox')
|
131
|
+
return false
|
132
|
+
}
|
133
|
+
})
|
134
|
+
|
135
|
+
/*
|
136
|
+
* Public, $.fn methods
|
137
|
+
*/
|
138
|
+
|
139
|
+
$.fn.facebox = function(settings) {
|
140
|
+
if ($(this).length == 0) return
|
141
|
+
|
142
|
+
init(settings)
|
143
|
+
|
144
|
+
function clickHandler() {
|
145
|
+
$.facebox.loading(true)
|
146
|
+
|
147
|
+
// support for rel="facebox.inline_popup" syntax, to add a class
|
148
|
+
// also supports deprecated "facebox[.inline_popup]" syntax
|
149
|
+
var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
|
150
|
+
if (klass) klass = klass[1]
|
151
|
+
|
152
|
+
fillFaceboxFromHref(this.href, klass)
|
153
|
+
return false
|
154
|
+
}
|
155
|
+
|
156
|
+
return this.bind('click.facebox', clickHandler)
|
157
|
+
}
|
158
|
+
|
159
|
+
/*
|
160
|
+
* Private methods
|
161
|
+
*/
|
162
|
+
|
163
|
+
// called one time to setup facebox on this page
|
164
|
+
function init(settings) {
|
165
|
+
if ($.facebox.settings.inited) return true
|
166
|
+
else $.facebox.settings.inited = true
|
167
|
+
|
168
|
+
$(document).trigger('init.facebox')
|
169
|
+
makeCompatible()
|
170
|
+
|
171
|
+
var imageTypes = $.facebox.settings.imageTypes.join('|')
|
172
|
+
$.facebox.settings.imageTypesRegexp = new RegExp('\\.(' + imageTypes + ')(\\?.*)?$', 'i')
|
173
|
+
|
174
|
+
if (settings) $.extend($.facebox.settings, settings)
|
175
|
+
$('body').append($.facebox.settings.faceboxHtml)
|
176
|
+
|
177
|
+
var preload = [ new Image(), new Image() ]
|
178
|
+
preload[0].src = $.facebox.settings.closeImage
|
179
|
+
preload[1].src = $.facebox.settings.loadingImage
|
180
|
+
|
181
|
+
$('#facebox').find('.b:first, .bl').each(function() {
|
182
|
+
preload.push(new Image())
|
183
|
+
preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
|
184
|
+
})
|
185
|
+
|
186
|
+
$('#facebox .close')
|
187
|
+
.click($.facebox.close)
|
188
|
+
.append('<img src="'
|
189
|
+
+ $.facebox.settings.closeImage
|
190
|
+
+ '" class="close_image" title="close">')
|
191
|
+
}
|
192
|
+
|
193
|
+
// getPageScroll() by quirksmode.com
|
194
|
+
function getPageScroll() {
|
195
|
+
var xScroll, yScroll;
|
196
|
+
if (self.pageYOffset) {
|
197
|
+
yScroll = self.pageYOffset;
|
198
|
+
xScroll = self.pageXOffset;
|
199
|
+
} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
|
200
|
+
yScroll = document.documentElement.scrollTop;
|
201
|
+
xScroll = document.documentElement.scrollLeft;
|
202
|
+
} else if (document.body) {// all other Explorers
|
203
|
+
yScroll = document.body.scrollTop;
|
204
|
+
xScroll = document.body.scrollLeft;
|
205
|
+
}
|
206
|
+
return new Array(xScroll,yScroll)
|
207
|
+
}
|
208
|
+
|
209
|
+
// Adapted from getPageSize() by quirksmode.com
|
210
|
+
function getPageHeight() {
|
211
|
+
var windowHeight
|
212
|
+
if (self.innerHeight) { // all except Explorer
|
213
|
+
windowHeight = self.innerHeight;
|
214
|
+
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
|
215
|
+
windowHeight = document.documentElement.clientHeight;
|
216
|
+
} else if (document.body) { // other Explorers
|
217
|
+
windowHeight = document.body.clientHeight;
|
218
|
+
}
|
219
|
+
return windowHeight
|
220
|
+
}
|
221
|
+
|
222
|
+
// Backwards compatibility
|
223
|
+
function makeCompatible() {
|
224
|
+
var $s = $.facebox.settings
|
225
|
+
|
226
|
+
$s.loadingImage = $s.loading_image || $s.loadingImage
|
227
|
+
$s.closeImage = $s.close_image || $s.closeImage
|
228
|
+
$s.imageTypes = $s.image_types || $s.imageTypes
|
229
|
+
$s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
|
230
|
+
}
|
231
|
+
|
232
|
+
// Figures out what you want to display and displays it
|
233
|
+
// formats are:
|
234
|
+
// div: #id
|
235
|
+
// image: blah.extension
|
236
|
+
// ajax: anything else
|
237
|
+
function fillFaceboxFromHref(href, klass) {
|
238
|
+
// div
|
239
|
+
if (href.match(/#/)) {
|
240
|
+
var url = window.location.href.split('#')[0]
|
241
|
+
var target = href.replace(url,'')
|
242
|
+
if (target == '#') return
|
243
|
+
$.facebox.reveal($(target).html(), klass)
|
244
|
+
|
245
|
+
// image
|
246
|
+
} else if (href.match($.facebox.settings.imageTypesRegexp)) {
|
247
|
+
fillFaceboxFromImage(href, klass)
|
248
|
+
// ajax
|
249
|
+
} else {
|
250
|
+
fillFaceboxFromAjax(href, klass)
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
function fillFaceboxFromImage(href, klass) {
|
255
|
+
var image = new Image()
|
256
|
+
image.onload = function() {
|
257
|
+
$.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
|
258
|
+
}
|
259
|
+
image.src = href
|
260
|
+
}
|
261
|
+
|
262
|
+
function fillFaceboxFromAjax(href, klass) {
|
263
|
+
$.facebox.jqxhr = $.get(href, function(data) { $.facebox.reveal(data, klass) })
|
264
|
+
}
|
265
|
+
|
266
|
+
function skipOverlay() {
|
267
|
+
return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null
|
268
|
+
}
|
269
|
+
|
270
|
+
function showOverlay() {
|
271
|
+
if (skipOverlay()) return
|
272
|
+
|
273
|
+
if ($('#facebox_overlay').length == 0)
|
274
|
+
$("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')
|
275
|
+
|
276
|
+
$('#facebox_overlay').hide().addClass("facebox_overlayBG")
|
277
|
+
.css('opacity', $.facebox.settings.opacity)
|
278
|
+
.click(function() { $(document).trigger('close.facebox') })
|
279
|
+
.fadeIn(200)
|
280
|
+
return false
|
281
|
+
}
|
282
|
+
|
283
|
+
function hideOverlay() {
|
284
|
+
if (skipOverlay()) return
|
285
|
+
|
286
|
+
$('#facebox_overlay').fadeOut(200, function(){
|
287
|
+
$("#facebox_overlay").removeClass("facebox_overlayBG")
|
288
|
+
$("#facebox_overlay").addClass("facebox_hide")
|
289
|
+
$("#facebox_overlay").remove()
|
290
|
+
})
|
291
|
+
|
292
|
+
return false
|
293
|
+
}
|
294
|
+
|
295
|
+
/*
|
296
|
+
* Bindings
|
297
|
+
*/
|
298
|
+
|
299
|
+
$(document).bind('close.facebox', function() {
|
300
|
+
if ($.facebox.jqxhr) {
|
301
|
+
$.facebox.jqxhr.abort()
|
302
|
+
$.facebox.jqxhr = null
|
303
|
+
}
|
304
|
+
$(document).unbind('keydown.facebox')
|
305
|
+
$('#facebox').fadeOut(function() {
|
306
|
+
$('#facebox .content').removeClass().addClass('content')
|
307
|
+
$('#facebox .loading').remove()
|
308
|
+
$(document).trigger('afterClose.facebox')
|
309
|
+
})
|
310
|
+
hideOverlay()
|
311
|
+
})
|
312
|
+
|
313
|
+
})(jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require facebox-rails/facebox
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#facebox {
|
2
|
+
position: absolute;
|
3
|
+
top: 0;
|
4
|
+
left: 0;
|
5
|
+
z-index: 100;
|
6
|
+
text-align: left;
|
7
|
+
}
|
8
|
+
|
9
|
+
|
10
|
+
#facebox .popup{
|
11
|
+
position:relative;
|
12
|
+
border:3px solid rgba(0,0,0,0);
|
13
|
+
-webkit-border-radius:5px;
|
14
|
+
-moz-border-radius:5px;
|
15
|
+
border-radius:5px;
|
16
|
+
-webkit-box-shadow:0 0 18px rgba(0,0,0,0.4);
|
17
|
+
-moz-box-shadow:0 0 18px rgba(0,0,0,0.4);
|
18
|
+
box-shadow:0 0 18px rgba(0,0,0,0.4);
|
19
|
+
}
|
20
|
+
|
21
|
+
#facebox .content {
|
22
|
+
display:table;
|
23
|
+
width: 370px;
|
24
|
+
padding: 10px;
|
25
|
+
background: #fff;
|
26
|
+
-webkit-border-radius:4px;
|
27
|
+
-moz-border-radius:4px;
|
28
|
+
border-radius:4px;
|
29
|
+
}
|
30
|
+
|
31
|
+
#facebox .content > p:first-child{
|
32
|
+
margin-top:0;
|
33
|
+
}
|
34
|
+
#facebox .content > p:last-child{
|
35
|
+
margin-bottom:0;
|
36
|
+
}
|
37
|
+
|
38
|
+
#facebox .close{
|
39
|
+
position:absolute;
|
40
|
+
top:5px;
|
41
|
+
right:5px;
|
42
|
+
padding:2px;
|
43
|
+
background:#fff;
|
44
|
+
}
|
45
|
+
#facebox .close img{
|
46
|
+
opacity:0.3;
|
47
|
+
}
|
48
|
+
#facebox .close:hover img{
|
49
|
+
opacity:1.0;
|
50
|
+
}
|
51
|
+
|
52
|
+
#facebox .loading {
|
53
|
+
text-align: center;
|
54
|
+
}
|
55
|
+
|
56
|
+
#facebox .image {
|
57
|
+
text-align: center;
|
58
|
+
}
|
59
|
+
|
60
|
+
#facebox img {
|
61
|
+
border: 0;
|
62
|
+
margin: 0;
|
63
|
+
}
|
64
|
+
|
65
|
+
#facebox_overlay {
|
66
|
+
position: fixed;
|
67
|
+
top: 0px;
|
68
|
+
left: 0px;
|
69
|
+
height:100%;
|
70
|
+
width:100%;
|
71
|
+
}
|
72
|
+
|
73
|
+
.facebox_hide {
|
74
|
+
z-index:-100;
|
75
|
+
}
|
76
|
+
|
77
|
+
.facebox_overlayBG {
|
78
|
+
background-color: #000;
|
79
|
+
z-index: 99;
|
80
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/facebox-rails/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Sam Woodard"]
|
6
|
+
gem.email = ["sam.h.woodard@gmail.com"]
|
7
|
+
gem.description = %q{Facebox for rails}
|
8
|
+
gem.summary = %q{Railtie for asset pipeline}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "facebox-rails2"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Facebox::Rails::VERSION
|
17
|
+
|
18
|
+
gem.add_runtime_dependency "railties"
|
19
|
+
gem.add_runtime_dependency "activesupport"
|
20
|
+
|
21
|
+
gem.add_development_dependency "rspec"
|
22
|
+
gem.add_development_dependency "rspec-rails"
|
23
|
+
gem.add_development_dependency "rails"
|
24
|
+
gem.add_development_dependency "haml-rails"
|
25
|
+
# gem.add_development_dependency "sass-rails"
|
26
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "facebox-rails/version"
|
2
|
+
require 'facebox-rails/engine'
|
3
|
+
|
4
|
+
module FaceboxRails
|
5
|
+
class << self
|
6
|
+
def configure(&blk)
|
7
|
+
@configuration ||= ActiveSupport::OrderedOptions.new
|
8
|
+
yield(@configuration) if block_given?
|
9
|
+
@configuration
|
10
|
+
end
|
11
|
+
alias_method :configuration, :configure
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
FaceboxRails.configure do |conf|
|
16
|
+
conf.loading_image_path = '/assets/facebox-rails/loading.gif'
|
17
|
+
conf.closelabel_image_path = '/assets/facebox-rails/closelabel.png'
|
18
|
+
end
|
data/log/development.log
ADDED
File without changes
|
data/log/test.log
ADDED
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require facebox-rails
|
File without changes
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "action_controller/railtie"
|
4
|
+
require "sprockets/railtie"
|
5
|
+
require 'haml-rails'
|
6
|
+
require 'sass-rails'
|
7
|
+
require 'facebox-rails'
|
8
|
+
|
9
|
+
module FaceboxRails
|
10
|
+
class Application < Rails::Application
|
11
|
+
config.root = File.expand_path("../..", __FILE__)
|
12
|
+
|
13
|
+
config.assets.enabled = true
|
14
|
+
|
15
|
+
# Version of your assets, change this if you want to expire all your assets
|
16
|
+
config.assets.version = '1.0'
|
17
|
+
|
18
|
+
# Configure static asset server for tests with Cache-Control for performance
|
19
|
+
config.serve_static_assets = true
|
20
|
+
config.static_cache_control = "public, max-age=3600"
|
21
|
+
config.assets.debug = true
|
22
|
+
|
23
|
+
# Log error messages when you accidentally call methods on nil
|
24
|
+
config.whiny_nils = true
|
25
|
+
|
26
|
+
# Show full error reports and disable caching
|
27
|
+
config.consider_all_requests_local = true
|
28
|
+
config.action_controller.perform_caching = false
|
29
|
+
|
30
|
+
# Raise exceptions instead of rendering exception templates
|
31
|
+
config.action_dispatch.show_exceptions = false
|
32
|
+
|
33
|
+
# Disable request forgery protection in test environment
|
34
|
+
config.action_controller.allow_forgery_protection = false
|
35
|
+
|
36
|
+
# Print deprecation notices to the stderr
|
37
|
+
config.active_support.deprecation = :stderr
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'rubygems'
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# These inflection rules are supported but not enabled by default:
|
13
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
14
|
+
# inflect.acronym 'RESTful'
|
15
|
+
# end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
FaceboxRails::Application.config.secret_token = '0f0616fd5c77572174e667c919d3a72607ec7afc12ec1ba0a4395af2a0bd07598395d0c559e1addb5fcf8a9966c8fb28b2cd1984ff5077e903693e405a1ba2a9'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
FaceboxRails::Application.config.session_store :cookie_store, :key => '_facebox_rails_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# FaceboxRails::Application.config.session_store :active_record_store
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters :format => [:json]
|
9
|
+
end
|
10
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
FaceboxRails::Application.routes.draw do
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get 'short'
|
20
|
+
# post 'toggle'
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get 'sold'
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get 'recent', :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => 'welcome#index'
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id))(.:format)'
|
58
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: facebox-rails2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sam Woodard
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-29 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: railties
|
16
|
+
requirement: &70127534866320 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70127534866320
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activesupport
|
27
|
+
requirement: &70127534865340 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70127534865340
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &70127534864120 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70127534864120
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec-rails
|
49
|
+
requirement: &70127534863160 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70127534863160
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rails
|
60
|
+
requirement: &70127534862440 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70127534862440
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: haml-rails
|
71
|
+
requirement: &70127534860980 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70127534860980
|
80
|
+
description: Facebox for rails
|
81
|
+
email:
|
82
|
+
- sam.h.woodard@gmail.com
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- .rspec
|
89
|
+
- Gemfile
|
90
|
+
- LICENSE
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- app/assets/images/facebox-rails/closelabel.png
|
94
|
+
- app/assets/images/facebox-rails/loading.gif
|
95
|
+
- app/assets/javascripts/facebox-rails.js
|
96
|
+
- app/assets/javascripts/facebox-rails/facebox.js.erb
|
97
|
+
- app/assets/stylesheets/facebox-rails.css
|
98
|
+
- app/assets/stylesheets/facebox-rails/facebox.css
|
99
|
+
- facebox-rails.gemspec
|
100
|
+
- lib/facebox-rails.rb
|
101
|
+
- lib/facebox-rails/engine.rb
|
102
|
+
- lib/facebox-rails/version.rb
|
103
|
+
- log/development.log
|
104
|
+
- log/test.log
|
105
|
+
- spec/apps/facebox_rails/app/assets/javascripts/application.js
|
106
|
+
- spec/apps/facebox_rails/app/assets/stylesheets/application.css
|
107
|
+
- spec/apps/facebox_rails/app/controllers/facebox_rails_controller.rb
|
108
|
+
- spec/apps/facebox_rails/app/views/facebox_rails/index.html.haml
|
109
|
+
- spec/apps/facebox_rails/app/views/layouts/facebox_rails.html.haml
|
110
|
+
- spec/apps/facebox_rails/config/application.rb
|
111
|
+
- spec/apps/facebox_rails/config/boot.rb
|
112
|
+
- spec/apps/facebox_rails/config/environment.rb
|
113
|
+
- spec/apps/facebox_rails/config/initializers/backtrace_silencers.rb
|
114
|
+
- spec/apps/facebox_rails/config/initializers/inflections.rb
|
115
|
+
- spec/apps/facebox_rails/config/initializers/mime_types.rb
|
116
|
+
- spec/apps/facebox_rails/config/initializers/secret_token.rb
|
117
|
+
- spec/apps/facebox_rails/config/initializers/session_store.rb
|
118
|
+
- spec/apps/facebox_rails/config/initializers/wrap_parameters.rb
|
119
|
+
- spec/apps/facebox_rails/config/locales/en.yml
|
120
|
+
- spec/apps/facebox_rails/config/routes.rb
|
121
|
+
- spec/controllers/facebox_rails_controller_spec.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
homepage: ''
|
124
|
+
licenses: []
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
segments:
|
136
|
+
- 0
|
137
|
+
hash: -3169348394538286998
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
segments:
|
145
|
+
- 0
|
146
|
+
hash: -3169348394538286998
|
147
|
+
requirements: []
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 1.8.15
|
150
|
+
signing_key:
|
151
|
+
specification_version: 3
|
152
|
+
summary: Railtie for asset pipeline
|
153
|
+
test_files:
|
154
|
+
- spec/apps/facebox_rails/app/assets/javascripts/application.js
|
155
|
+
- spec/apps/facebox_rails/app/assets/stylesheets/application.css
|
156
|
+
- spec/apps/facebox_rails/app/controllers/facebox_rails_controller.rb
|
157
|
+
- spec/apps/facebox_rails/app/views/facebox_rails/index.html.haml
|
158
|
+
- spec/apps/facebox_rails/app/views/layouts/facebox_rails.html.haml
|
159
|
+
- spec/apps/facebox_rails/config/application.rb
|
160
|
+
- spec/apps/facebox_rails/config/boot.rb
|
161
|
+
- spec/apps/facebox_rails/config/environment.rb
|
162
|
+
- spec/apps/facebox_rails/config/initializers/backtrace_silencers.rb
|
163
|
+
- spec/apps/facebox_rails/config/initializers/inflections.rb
|
164
|
+
- spec/apps/facebox_rails/config/initializers/mime_types.rb
|
165
|
+
- spec/apps/facebox_rails/config/initializers/secret_token.rb
|
166
|
+
- spec/apps/facebox_rails/config/initializers/session_store.rb
|
167
|
+
- spec/apps/facebox_rails/config/initializers/wrap_parameters.rb
|
168
|
+
- spec/apps/facebox_rails/config/locales/en.yml
|
169
|
+
- spec/apps/facebox_rails/config/routes.rb
|
170
|
+
- spec/controllers/facebox_rails_controller_spec.rb
|
171
|
+
- spec/spec_helper.rb
|