Commit fce59b408583470041b25fd8c0d6b94856ae921f

Authored by Antonio Terceiro
1 parent c8619833

ActionItem1020: adding a class to the lightbox

When the lightbox button has an id, it will be used as a CSS class in
the lightbox that opens up.
app/views/home/index.rhtml
1 1 <% if environment.enabled?('display_wizard_signup') && !logged_in? %>
2   - <%= lightbox_button(:new, _('Signup'), { :controller => 'account', :action => 'wizard' }, :class => 'wizard') %>
  2 + <%= lightbox_button(:new, _('Signup'), { :controller => 'account', :action => 'wizard' }, :class => 'wizard', :id => 'signup-wizard') %>
3 3 <% end %>
4 4  
5 5 <% if @has_news %>
... ...
public/javascripts/lightbox.js
... ... @@ -64,6 +64,9 @@ lightbox.prototype = {
64 64  
65 65 initialize: function(ctrl) {
66 66 this.content = ctrl.href;
  67 + if (ctrl.id != '') {
  68 + this.lightbox_className = ctrl.id;
  69 + }
67 70 Event.observe(ctrl, 'click', this.activate.bindAsEventListener(this), false);
68 71 ctrl.onclick = function(){return false;};
69 72 },
... ... @@ -146,7 +149,11 @@ lightbox.prototype = {
146 149 processInfo: function(response){
147 150 info = "<div id='lbContent'>" + response.responseText + "</div>";
148 151 new Insertion.Before($('lbLoadMessage'), info)
149   - $('lightbox').className = "done";
  152 + if (this.lightbox_className) {
  153 + $('lightbox').className = "done " + this.lightbox_className;
  154 + } else {
  155 + $('lightbox').className = "done";
  156 + }
150 157 this.actions();
151 158 },
152 159  
... ...