diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8d736c2..2672ef1 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -8,8 +8,6 @@ module ApplicationHelper
include PermissionNameHelper
- include LightboxHelper
-
include ColorboxHelper
include BoxesHelper
@@ -649,8 +647,8 @@ module ApplicationHelper
' onfocus="if(this.value==\''+s+'\'){this.value=\'\'} this.form.className=\'focus-in\'"'+
' onblur="if(/^\s*$/.test(this.value)){this.value=\''+s+'\'} this.form.className=\'focus-out\'">'+
''
- else #opt == 'lightbox_link' is default
- lightbox_link_to ''+ _('Search'), {
+ else
+ colorbox_link_to ''+ _('Search'), {
:controller => 'search',
:action => 'popup',
:category_path => (@category ? @category.explode_path : nil)},
diff --git a/app/helpers/colorbox_helper.rb b/app/helpers/colorbox_helper.rb
index 6cfebb7..a18daf4 100644
--- a/app/helpers/colorbox_helper.rb
+++ b/app/helpers/colorbox_helper.rb
@@ -17,7 +17,7 @@ module ColorboxHelper
end
def colorbox_close_button(text, options = {})
- button(:close, text, '#', colorbox_options(options, :close))
+ button(:close, text, '#', colorbox_options(options, :close).merge(:rel => 'deactivate'))
end
def colorbox_button(type, label, url, options = {})
diff --git a/app/helpers/lightbox_helper.rb b/app/helpers/lightbox_helper.rb
deleted file mode 100644
index ffb8d35..0000000
--- a/app/helpers/lightbox_helper.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-module LightboxHelper
-
- def lightbox_link_to(text, url, options = {})
- link_to(text, url, lightbox_options(options))
- end
-
- def lightbox_close_button(text, options = {})
- button(:close, text, '#', lightbox_options(options, 'lbAction').merge(:rel => 'deactivate'))
- end
-
- def lightbox_button(type, label, url, options = {})
- button(type, label, url, lightbox_options(options))
- end
-
- def lightbox_icon_button(type, label, url, options = {})
- icon_button(type, label, url, lightbox_options(options))
- end
-
- # options must be an HTML options hash as passed to link_to etc.
- #
- # returns a new hash with lightbox class added. Keeps existing classes.
- def lightbox_options(options, lightbox_type = 'lbOn')
- the_class = lightbox_type
- the_class << " #{options[:class]}" if options.has_key?(:class)
- options.merge(:class => the_class)
- end
-
- def lightbox?
- request.xhr?
- end
-
- def lightbox_remote_button(type, label, url, options = {})
- button(type, label, url, lightbox_options(options, 'remote-lbOn'))
- end
-
-end
diff --git a/app/views/account/_login_form.html.erb b/app/views/account/_login_form.html.erb
index a145e92..1e6354a 100644
--- a/app/views/account/_login_form.html.erb
+++ b/app/views/account/_login_form.html.erb
@@ -1,12 +1,9 @@
<%= labelled_form_for :user,
:url => { :controller => 'account', :action => (params[:enterprise_code] ? 'activate_enterprise' : 'login') } do |f| %>
-<%= f.text_field :login,
- :id => ( lightbox? ? 'lightbox_' : '' ) + 'user_login',
- :onchange => 'this.value = convToValidLogin( this.value )' %>
+<%= f.text_field :login, :id => 'user_login', :onchange => 'this.value = convToValidLogin( this.value )' %>
-<%= f.password_field :password,
- :id => ( lightbox? ? 'lightbox_' : '' ) + 'user_password' %>
+<%= f.password_field :password, :id => 'user_password' %>
<% if params[:enterprise_code] %>
<%= hidden_field_tag :enterprise_code, params[:enterprise_code] %>
@@ -16,7 +13,7 @@
<% button_bar do %>
<%= submit_button( 'login', _('Log in') )%>
- <%= lightbox_close_button(_('Cancel')) if lightbox? %>
+ <%= colorbox_close_button _('Cancel') if request.xhr? %>
<% end %>
<% end %>
diff --git a/app/views/account/index_anonymous.html.erb b/app/views/account/index_anonymous.html.erb
index a2b2601..b4e1ae1 100644
--- a/app/views/account/index_anonymous.html.erb
+++ b/app/views/account/index_anonymous.html.erb
@@ -1,7 +1,7 @@
<%= _('Identify yourself') %>
-<%= lightbox_link_to _('Login.'), { :controller => 'account', :action => 'login_popup' } %>
+<%= colorbox_link_to _('Login.'), { :controller => 'account', :action => 'login_popup' } %>
<%= _('You need to login to be able to use all the features in this environment.') %>
diff --git a/app/views/account/logout_popup.html.erb b/app/views/account/logout_popup.html.erb
index ee2c1ef..bcbb3e8 100644
--- a/app/views/account/logout_popup.html.erb
+++ b/app/views/account/logout_popup.html.erb
@@ -2,6 +2,6 @@
<% button_bar do %>
<%= button :ok, _('Yes'), { :controller => 'account', :action => 'logout' } %>
- <%= lightbox_close_button _('No, I want to stay.') %>
+ <%= colorbox_close_button _('No, I want to stay.') %>
<% end %>
diff --git a/app/views/cms/edit.html.erb b/app/views/cms/edit.html.erb
index 4e8fe9b..3140fe3 100644
--- a/app/views/cms/edit.html.erb
+++ b/app/views/cms/edit.html.erb
@@ -28,7 +28,7 @@
<% end %>
- <%= lightbox_button :help, _('Why categorize?'), :action => 'why_categorize' %>
+ <%= colorbox_button :help, _('Why categorize?'), :action => 'why_categorize' %>
<%= select_categories(:article, _('Categorize your article')) %>
diff --git a/app/views/cms/why_categorize.html.erb b/app/views/cms/why_categorize.html.erb
index 0735f68..3c9f2dd 100644
--- a/app/views/cms/why_categorize.html.erb
+++ b/app/views/cms/why_categorize.html.erb
@@ -5,5 +5,5 @@
<% button_bar do %>
- <%= lightbox_close_button _('Close') %>
+ <%= colorbox_close_button _('Close') %>
<% end %>
diff --git a/app/views/profile/join.html.erb b/app/views/profile/join.html.erb
index a836f75..60fa529 100644
--- a/app/views/profile/join.html.erb
+++ b/app/views/profile/join.html.erb
@@ -9,7 +9,7 @@
<%= hidden_field_tag(:confirmation, 1) %>
<%= submit_button(:ok, _("Yes, I want to join.") % profile.name) %>
<% if logged_in? && request.xhr? %>
- <%= lightbox_close_button(_("No, I don't want")) %>
+ <%= colorbox_close_button _("No, I don't want") %>
<% else %>
<%= button(:cancel, _("No, I don't want."), profile.url) %>
<% end %>
diff --git a/app/views/profile/leave.html.erb b/app/views/profile/leave.html.erb
index a1f3433..46415ca 100644
--- a/app/views/profile/leave.html.erb
+++ b/app/views/profile/leave.html.erb
@@ -9,7 +9,7 @@
<%= hidden_field_tag(:back_to, @back_to) %>
<%= submit_button(:ok, _("Yes, I want to leave.") % profile.name) %>
<% if logged_in? && request.xhr? %>
- <%= lightbox_close_button(_("No, I don't want")) %>
+ <%= colorbox_close_button _("No, I don't want") %>
<% else %>
<%= button(:cancel, _("No, I don't want."), profile.url) %>
<% end %>
diff --git a/app/views/profile_themes/add_css.html.erb b/app/views/profile_themes/add_css.html.erb
index 1f5d28e..68e39d3 100644
--- a/app/views/profile_themes/add_css.html.erb
+++ b/app/views/profile_themes/add_css.html.erb
@@ -5,7 +5,7 @@
<% button_bar do %>
<%= submit_button(:add, _('Add')) %>
- <%= lightbox_close_button(_('Cancel')) %>
+ <%= colorbox_close_button _('Cancel') %>
<% end %>
<% end %>
diff --git a/app/views/profile_themes/edit.html.erb b/app/views/profile_themes/edit.html.erb
index b282c99..405a861 100644
--- a/app/views/profile_themes/edit.html.erb
+++ b/app/views/profile_themes/edit.html.erb
@@ -16,7 +16,7 @@
<% end %>
<% button_bar do %>
- <%= lightbox_button(:add, _('New CSS'), :action => 'add_css', :id => @theme.id) %>
+ <%= colorbox_button :add, _('New CSS'), :action => 'add_css', :id => @theme.id %>
<% end %>
@@ -25,10 +25,10 @@
<% for image in @image_files %>
- <%= image_tag("/user_themes/#{@theme.id}/images/#{image}") %>
- <% end %>
+ <% end %>
<% button_bar do %>
- <%= lightbox_button(:add, _('Add image'), :action => 'add_image', :id => @theme.id) %>
+ <%= colorbox_button :add, _('Add image'), :action => 'add_image', :id => @theme.id %>
<% end %>
diff --git a/app/views/profile_themes/index.html.erb b/app/views/profile_themes/index.html.erb
index 55c25ad..39a7b1e 100644
--- a/app/views/profile_themes/index.html.erb
+++ b/app/views/profile_themes/index.html.erb
@@ -42,7 +42,7 @@
<% button_bar do %>
<% if environment.enabled?('user_themes') %>
- <%= lightbox_button(:add, _('New theme ...'), :action => 'new') %>
+ <%= colorbox_button :add, _('New theme ...'), :action => 'new' %>
<% end %>
<%= button(:back, _('Back'), :controller => 'profile_editor', :action => 'index') %>
<% end %>
diff --git a/app/views/shared/user_menu.html.erb b/app/views/shared/user_menu.html.erb
index e94ffce..4a7031e 100644
--- a/app/views/shared/user_menu.html.erb
+++ b/app/views/shared/user_menu.html.erb
@@ -20,7 +20,7 @@
- <%= lightbox_link_to('' + _('New article'), '/myprofile/{login}/cms/new') %>
+ <%= colorbox_link_to '' + _('New article'), '/myprofile/{login}/cms/new' %>
<%= _('Manage %s') % '{name}' %>
diff --git a/public/javascripts/lightbox.js b/public/javascripts/lightbox.js
deleted file mode 100644
index 0adedf2..0000000
--- a/public/javascripts/lightbox.js
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
-Created By: Chris Campbell
-Website: http://particletree.com
-Date: 2/1/2006
-
-Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
-*/
-
-/*-------------------------------GLOBAL VARIABLES------------------------------------*/
-
-var detect = navigator.userAgent.toLowerCase();
-var OS,browser,version,total,thestring;
-
-/*-----------------------------------------------------------------------------------------------*/
-
-//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/
-
-function getBrowserInfo() {
- if (checkIt('konqueror')) {
- browser = "Konqueror";
- OS = "Linux";
- }
- else if (checkIt('safari')) browser = "Safari"
- else if (checkIt('omniweb')) browser = "OmniWeb"
- else if (checkIt('opera')) browser = "Opera"
- else if (checkIt('webtv')) browser = "WebTV";
- else if (checkIt('icab')) browser = "iCab"
- else if (checkIt('msie')) browser = "Internet Explorer"
- else if (!checkIt('compatible')) {
- browser = "Netscape Navigator"
- version = detect.charAt(8);
- }
- else browser = "An unknown browser";
-
- if (!version) version = detect.charAt(place + thestring.length);
-
- if (!OS) {
- if (checkIt('linux')) OS = "Linux";
- else if (checkIt('x11')) OS = "Unix";
- else if (checkIt('mac')) OS = "Mac"
- else if (checkIt('win')) OS = "Windows"
- else OS = "an unknown operating system";
- }
-}
-
-function checkIt(string) {
- place = detect.indexOf(string) + 1;
- thestring = string;
- return place;
-}
-
-/*-----------------------------------------------------------------------------------------------*/
-
-Event.observe(window, 'load', getBrowserInfo, false);
-
-var lightbox = Class.create();
-
-lightbox.prototype = {
-
- yPos : 0,
- xPos : 0,
-
- initialize: function(ctrl) {
- this.content = ctrl.href;
- if (ctrl.id != '') {
- this.lightbox_className = ctrl.id;
- }
- ctrl.onclick = function(){return false;};
- ctrl.lightbox = this;
- },
-
- // Turn everything on - mainly the IE fixes
- activate: function(){
- if (browser == 'Internet Explorer'){
- this.getScroll();
- this.prepareIE('100%', 'hidden');
- this.setScroll(0,0);
- this.hideSelects('hidden');
- }
- this.hideObjectsAndEmbeds('hidden');
- this.displayLightbox("block");
- },
-
- // Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox
- prepareIE: function(height, overflow){
- bod = document.getElementsByTagName('body')[0];
- bod.style.height = height;
- bod.style.overflow = overflow;
-
- htm = document.getElementsByTagName('html')[0];
- htm.style.height = height;
- htm.style.overflow = overflow;
- },
-
- // In IE, select elements hover on top of the lightbox
- hideSelects: function(visibility){
- selects = document.getElementsByTagName('select');
- for(i = 0; i < selects.length; i++) {
- selects[i].style.visibility = visibility;
- }
- },
-
- // In FF, objects and embeds elements hover on top of the lightbox
- hideObjectsAndEmbeds: function(visibility){
- var f = function(collection) {
- for(i = 0; i < collection.length; i++) {
- if (collection[i].style) {
- collection[i].style.visibility = visibility;
- }
- }
- };
- f(document.getElementsByTagName('object'));
- f(document.getElementsByTagName('embed'));
- },
-
- // Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
- getScroll: function(){
- if (self.pageYOffset) {
- this.yPos = self.pageYOffset;
- } else if (document.documentElement && document.documentElement.scrollTop){
- this.yPos = document.documentElement.scrollTop;
- } else if (document.body) {
- this.yPos = document.body.scrollTop;
- }
- },
-
- setScroll: function(x, y){
- window.scrollTo(x, y);
- },
-
- displayLightbox: function(display){
- $('overlay').style.display = display;
- $('lightbox').style.display = display;
- if(display != 'none') this.loadInfo();
- },
-
- // Begin Ajax request based off of the href of the clicked linked
- loadInfo: function() {
- var myAjax = new Ajax.Request(
- this.content,
- {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)}
- );
-
- },
-
- // Display Ajax response
- processInfo: function(response){
- info = "" + response.responseText + "
";
- new Insertion.Before($('lbLoadMessage'), info)
- if (this.lightbox_className) {
- $('lightbox').className = "done " + this.lightbox_className;
- } else {
- $('lightbox').className = "done";
- }
- this.actions();
- },
-
- // Search through new links within the lightbox, and attach click event
- actions: function(){
- lbActions = document.getElementsByClassName('lbAction');
-
- for(i = 0; i < lbActions.length; i++) {
- Event.observe(lbActions[i], 'click', this[lbActions[i].rel].bindAsEventListener(this), false);
- lbActions[i].onclick = function(){return false;};
- }
-
- },
-
- // Example of creating your own functionality once lightbox is initiated
- insert: function(e){
- link = Event.element(e).parentNode;
- Element.remove($('lbContent'));
-
- var myAjax = new Ajax.Request(
- link.href,
- {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)}
- );
-
- },
-
- // Example of creating your own functionality once lightbox is initiated
- deactivate: function(){
- Element.remove($('lbContent'));
-
- if (browser == "Internet Explorer"){
- this.setScroll(0,this.yPos);
- this.prepareIE("auto", "auto");
- this.hideSelects("visible");
- }
- this.hideObjectsAndEmbeds("visible");
- this.displayLightbox("none");
- }
-}
-
-/*-----------------------------------------------------------------------------------------------*/
-
-jQuery('.lbOn').live('click', function(event) {
- if (jQuery('#lbLoadMessage').length == 0)
- addLightboxMarkup();
- if (this.lightbox == undefined)
- valid = new lightbox(this);
- else {
- removeLightboxMarkup();
- addLightboxMarkup();
- }
-
- this.lightbox.activate();
-
- event.preventDefault();
- return false;
-});
-
-// Add in markup necessary to make this work. Basically two divs:
-// Overlay holds the shadow
-// Lightbox is the centered square that the content is put into.
-function addLightboxMarkup() {
- bod = document.getElementsByTagName('body')[0];
- overlay = document.createElement('div');
- overlay.id = 'overlay';
- lb = document.createElement('div');
- lb.id = 'lightbox';
- lb.className = 'loading';
- lb.innerHTML = '' +
- '
 + '/images/2loading.gif)
' +
- '
';
- bod.appendChild(overlay);
- bod.appendChild(lb);
-}
-function removeLightboxMarkup() {
- Element.remove($('overlay'));
- Element.remove($('lightbox'));
-}
diff --git a/public/stylesheets/lightbox.css b/public/stylesheets/lightbox.css
deleted file mode 100644
index 8f8a197..0000000
--- a/public/stylesheets/lightbox.css
+++ /dev/null
@@ -1,63 +0,0 @@
-/* - - - - - - - - - - - - - - - - - - - - -
-
-Title : Lightbox CSS
-Author : Kevin Hale
-URL : http://particletree.com/features/lightbox-gone-wild/
-
-Created : January 13, 2006
-Modified : February 1, 2006
-
-- - - - - - - - - - - - - - - - - - - - - */
-
-#lightbox {
- display: none;
- position: absolute;
- top: 150px;
- left: 50%;
- z-index: 300;
- width: 500px;
- margin-left: -265px;
- border: 1px solid #000;
- text-align: left;
- padding: 1em;
- background: #FFF;
-}
-
-#overlay{
- display:none;
- position:absolute;
- top:0;
- left:0;
- width:100%;
- height:100%;
- z-index:200;
- background-color:#000;
- -moz-opacity: 0.75;
- opacity:.75;
- filter: alpha(opacity=75);
-}
-#overlay[id]{
- position:fixed;
-}
-
-#lightbox.done #lbLoadMessage{
- display:none;
-}
-#lightbox.done #lbContent{
- display:block;
-}
-#lightbox.loading #lbContent{
- display:none;
-}
-#lightbox.loading #lbLoadMessage{
- display:block;
-}
-
-#lightbox.done img{
- width:100%;
- height:100%;
-}
-
-#lightbox select {
- max-width: 100%;
-}
diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb
index 14ba1c1..51e47ac 100644
--- a/test/functional/cms_controller_test.rb
+++ b/test/functional/cms_controller_test.rb
@@ -638,7 +638,7 @@ class CmsControllerTest < ActionController::TestCase
should 'display OK button on why_categorize popup' do
get :why_categorize, :profile => profile.identifier
- assert_tag :tag => 'a', :attributes => { :rel => 'deactivate'} # lightbox close button
+ assert_tag :tag => 'a', :attributes => { :rel => 'deactivate'} # colorbox close button
end
should 'display published option' do
diff --git a/test/unit/lightbox_helper_test.rb b/test/unit/lightbox_helper_test.rb
deleted file mode 100644
index 58889d1..0000000
--- a/test/unit/lightbox_helper_test.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-require_relative "../test_helper"
-
-class LightboxHelperTest < ActiveSupport::TestCase
-
- include LightboxHelper
-
- def setup
- stubs(:_).with(anything).returns('TEXT')
- end
-
- should 'provide the needed files' do
- assert File.exists?(Rails.root.join('public', 'stylesheets', 'lightbox.css')), 'lightbox.css expected to be in public/stylesheets, but not found'
- assert File.exists?(Rails.root.join('public', 'javascripts', 'lightbox.js')), 'lightbox.js expected to be in public/javascripts, but not found'
- end
-
- should 'provide lightbox_link_to helper' do
- expects(:link_to).with('text', { :action => 'view', :id => '1' }, has_entries({ :class => 'lbOn', :id => 'my-link' })).returns('[link]')
- assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :id => 'my-link' })
- end
-
- should 'merge existing :class option in lightbox_link_to' do
- expects(:link_to).with('text', { :action => 'view', :id => '1' }, has_entries({ :class => 'lbOn my-button', :id => 'my-link' })).returns('[link]')
- assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :class => 'my-button', :id => 'my-link' })
-
- end
-
- should 'provide link to close lightbox' do
- expects(:button).with(:close, 'text', '#', has_entries({ :class => 'lbAction', :rel => 'deactivate', :id => 'my-id' })).returns('[close-lightbox]')
-
- assert_equal '[close-lightbox]', lightbox_close_button('text', :id => 'my-id')
- end
-
- should 'merge existing :class option in lightbox_close_button' do
- expects(:button).with(:close, 'text', '#', has_entries({ :class => 'lbAction my-class', :rel => 'deactivate', :id => 'my-id' })).returns('[close-lightbox]')
-
- assert_equal '[close-lightbox]', lightbox_close_button('text', :class => 'my-class', :id => 'my-id' )
- end
-
- should 'provide lightbox_button' do
- expects(:button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'lbOn' })).returns('[button]')
-
- assert_equal '[button]', lightbox_button('type', 'label', { :action => 'popup'})
- end
-
- should 'provide lightbox_icon_button' do
- expects(:icon_button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'lbOn' })).returns('[button]')
-
- assert_equal '[button]', lightbox_icon_button('type', 'label', { :action => 'popup'})
- end
-
- should 'tell if rendering inside lightbox' do
- request = mock
- expects(:request).returns(request)
- request.expects(:xhr?).returns(true)
-
- assert lightbox?
- end
-
- should 'provide lightbox_remote_button' do
- expects(:button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'remote-lbOn' })).returns('[button]')
-
- assert_equal '[button]', lightbox_remote_button('type', 'label', { :action => 'popup'})
- end
-
-end
--
libgit2 0.21.2