Skip to content

Commit

Permalink
First Import
Browse files Browse the repository at this point in the history
  • Loading branch information
DAddYE committed Jul 2, 2008
0 parents commit 0c60058
Show file tree
Hide file tree
Showing 15 changed files with 963 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,21 @@
Created by Davide D'Agostino on 2008-01-11.
Copyright 2008 Lipsiasoft s.r.l. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 changes: 23 additions & 0 deletions README
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,23 @@
LightBoxObject v.1.1
====================
This LightBox Helper is based on the lastest javascript http://www.huddletogether.com/projects/lightbox2/

It's only make an helper, copy the lastest javascripts, css, and images on your public/javascript directory
and register the javascript in the AssetTagHelper of rails,
so for include the javascript in your page you only can add this (if you havn't yet):

<%= javascript_include_tag :defaults %>

You must add also the stylesheet so add this on your page head:

<%= stylesheet_link_tag 'lightbox' %>

The is very simple for add a LightBox in your page add this:

<%= lightbox_link_to "Link Name", "/path/of/your/image.png" %>
or
<%= lightbox_image_tag("/path/of/your/image-thumb.png", "/path/of/your/image.png", {:class=>"images"}, :title => "This is a test!") %>

You can add, title, controller, action what do u whant becaue it's based on image_tag and link_to.

Vist my website: http://blog.lipsiasoft.com
1 change: 1 addition & 0 deletions init.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
require 'lightbox_view_helper'
25 changes: 25 additions & 0 deletions install.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'fileutils'

blank_gif = File.dirname(__FILE__) + '/../../../public/images/blank.gif'
close_gif = File.dirname(__FILE__) + '/../../../public/images/close.gif'
closelabel_gif = File.dirname(__FILE__) + '/../../../public/images/closelabel.gif'
loading_gif = File.dirname(__FILE__) + '/../../../public/images/loading.gif'
next_gif = File.dirname(__FILE__) + '/../../../public/images/next.gif'
nextlabel_gif = File.dirname(__FILE__) + '/../../../public/images/nextlabel.gif'
prev_gif = File.dirname(__FILE__) + '/../../../public/images/prev.gif'
prevlabel_gif = File.dirname(__FILE__) + '/../../../public/images/prevlabel.gif'
lightbox_js = File.dirname(__FILE__) + '/../../../public/javascripts/lightbox.js'
lightbox_css = File.dirname(__FILE__) + '/../../../public/stylesheets/lightbox.css'

FileUtils.cp File.dirname(__FILE__) + '/public/images/blank.gif', blank_gif unless File.exist?(blank_gif)
FileUtils.cp File.dirname(__FILE__) + '/public/images/close.gif', close_gif unless File.exist?(close_gif)
FileUtils.cp File.dirname(__FILE__) + '/public/images/closelabel.gif', closelabel_gif unless File.exist?(closelabel_gif)
FileUtils.cp File.dirname(__FILE__) + '/public/images/loading.gif', loading_gif unless File.exist?(loading_gif)
FileUtils.cp File.dirname(__FILE__) + '/public/images/next.gif', next_gif unless File.exist?(next_gif)
FileUtils.cp File.dirname(__FILE__) + '/public/images/nextlabel.gif', nextlabel_gif unless File.exist?(nextlabel_gif)
FileUtils.cp File.dirname(__FILE__) + '/public/images/prev.gif', prev_gif unless File.exist?(prev_gif)
FileUtils.cp File.dirname(__FILE__) + '/public/images/prevlabel.gif', prevlabel_gif unless File.exist?(prevlabel_gif)
FileUtils.cp File.dirname(__FILE__) + '/public/javascripts/lightbox.js', lightbox_js unless File.exist?(lightbox_js)
FileUtils.cp File.dirname(__FILE__) + '/public/stylesheets/lightbox.css', lightbox_css unless File.exist?(lightbox_css)

puts IO.read(File.join(File.dirname(__FILE__), 'README'))
34 changes: 34 additions & 0 deletions lib/lightbox_view_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,34 @@
# Author:: Davide D'Agostino (DAddYE)
# WebSite:: http://blog.lipsiasoft.com
require 'action_view'

module ActionView
module Helpers
module LightBoxHelper
def self.included(base)
base.class_eval do
include InstanceMethods
end
end
module InstanceMethods
def lightbox_image_tag(source, destination, image_options = {}, html_options = {})
html_options.merge!(:rel => "lightbox") unless html_options[:rel]
html_options.merge!(:title => "") unless html_options[:title]
link_to(image_tag(source, image_options), destination, html_options)
end

def lightbox_link_to(name, options = {}, html_options = {}, *parameters_for_method_reference)
html_options.merge!(:rel => "lightbox") unless html_options[:rel]
html_options.merge!(:title => "") unless html_options[:title]
link_to(name, options, html_options, *parameters_for_method_reference)
end
end
end
end
end

ActionView::Base.class_eval do
include ActionView::Helpers::LightBoxHelper
end

ActionView::Helpers::AssetTagHelper.register_javascript_include_default 'lightbox'
Binary file added public/images/blank.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/close.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/closelabel.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/next.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/nextlabel.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/prev.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/prevlabel.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0c60058

Please sign in to comment.