Commit ffae019b9e736c4559c8403d6e0d05f5772cda91
Exists in
master
and in
21 other branches
Merge branch 'modal' into 'master'
Use only colorbox for modals (popins) See merge request !424
Showing
56 changed files
with
239 additions
and
1940 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -8,11 +8,7 @@ module ApplicationHelper |
8 | 8 | |
9 | 9 | include PermissionNameHelper |
10 | 10 | |
11 | - include LightboxHelper | |
12 | - | |
13 | - include ThickboxHelper | |
14 | - | |
15 | - include ColorboxHelper | |
11 | + include ModalHelper | |
16 | 12 | |
17 | 13 | include BoxesHelper |
18 | 14 | |
... | ... | @@ -651,8 +647,8 @@ module ApplicationHelper |
651 | 647 | ' onfocus="if(this.value==\''+s+'\'){this.value=\'\'} this.form.className=\'focus-in\'"'+ |
652 | 648 | ' onblur="if(/^\s*$/.test(this.value)){this.value=\''+s+'\'} this.form.className=\'focus-out\'">'+ |
653 | 649 | '</form>' |
654 | - else #opt == 'lightbox_link' is default | |
655 | - lightbox_link_to '<span class="icon-menu-search"></span>'+ _('Search'), { | |
650 | + else | |
651 | + modal_link_to '<span class="icon-menu-search"></span>'+ _('Search'), { | |
656 | 652 | :controller => 'search', |
657 | 653 | :action => 'popup', |
658 | 654 | :category_path => (@category ? @category.explode_path : nil)}, |
... | ... | @@ -1050,7 +1046,7 @@ module ApplicationHelper |
1050 | 1046 | {s_('contents|Most commented') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_comments'})}} |
1051 | 1047 | ] |
1052 | 1048 | if logged_in? |
1053 | - links.push(_('New content') => colorbox_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})})) | |
1049 | + links.push(_('New content') => modal_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})})) | |
1054 | 1050 | end |
1055 | 1051 | |
1056 | 1052 | link_to(content_tag(:span, _('Contents'), :class => 'icon-menu-articles'), {:controller => "search", :action => 'contents', :category_path => nil}, :id => 'submenu-contents') + | ... | ... |
app/helpers/boxes_helper.rb
... | ... | @@ -231,7 +231,7 @@ module BoxesHelper |
231 | 231 | end |
232 | 232 | |
233 | 233 | if block.editable? |
234 | - buttons << colorbox_icon_button(:edit, _('Edit'), { :action => 'edit', :id => block.id }) | |
234 | + buttons << modal_icon_button(:edit, _('Edit'), { :action => 'edit', :id => block.id }) | |
235 | 235 | end |
236 | 236 | |
237 | 237 | if !block.main? |
... | ... | @@ -241,7 +241,7 @@ module BoxesHelper |
241 | 241 | end |
242 | 242 | |
243 | 243 | if block.respond_to?(:help) |
244 | - buttons << thickbox_inline_popup_icon(:help, _('Help on this block'), {}, "help-on-box-#{block.id}") << content_tag('div', content_tag('h2', _('Help')) + content_tag('div', block.help, :style => 'margin-bottom: 1em;') + thickbox_close_button(_('Close')), :style => 'display: none;', :id => "help-on-box-#{block.id}") | |
244 | + buttons << modal_inline_icon(:help, _('Help on this block'), {}, "#help-on-box-#{block.id}") << content_tag('div', content_tag('h2', _('Help')) + content_tag('div', block.help, :style => 'margin-bottom: 1em;') + modal_close_button(_('Close')), :style => 'display: none;', :id => "help-on-box-#{block.id}") | |
245 | 245 | end |
246 | 246 | |
247 | 247 | if block.embedable? | ... | ... |
app/helpers/colorbox_helper.rb
... | ... | @@ -1,25 +0,0 @@ |
1 | -module ColorboxHelper | |
2 | - | |
3 | - def colorbox_close_button(text, options = {}) | |
4 | - button(:close, text, '#', colorbox_options(options, :close)) | |
5 | - end | |
6 | - | |
7 | - def colorbox_button(type, label, url, options = {}) | |
8 | - button(type, label, url, colorbox_options(options)) | |
9 | - end | |
10 | - | |
11 | - def colorbox_icon_button(type, label, url, options = {}) | |
12 | - icon_button(type, label, url, colorbox_options(options)) | |
13 | - end | |
14 | - | |
15 | - # options must be an HTML options hash as passed to link_to etc. | |
16 | - # | |
17 | - # returns a new hash with colorbox class added. Keeps existing classes. | |
18 | - def colorbox_options(options, type=nil) | |
19 | - the_class = 'colorbox' | |
20 | - the_class += "-#{type.to_s}" unless type.nil? | |
21 | - the_class << " #{options[:class]}" if options.has_key?(:class) | |
22 | - options.merge(:class => the_class) | |
23 | - end | |
24 | - | |
25 | -end |
app/helpers/comment_helper.rb
... | ... | @@ -65,7 +65,7 @@ module CommentHelper |
65 | 65 | |
66 | 66 | def link_for_edit(comment) |
67 | 67 | if comment.can_be_updated_by?(user) |
68 | - {:link => expirable_comment_link(comment, :edit, _('Edit'), url_for(:profile => profile.identifier, :controller => :comment, :action => :edit, :id => comment.id),:class => 'colorbox')} | |
68 | + {:link => expirable_comment_link(comment, :edit, _('Edit'), url_for(:profile => profile.identifier, :controller => :comment, :action => :edit, :id => comment.id),:class => 'modal')} | |
69 | 69 | end |
70 | 70 | end |
71 | 71 | ... | ... |
app/helpers/lightbox_helper.rb
... | ... | @@ -1,36 +0,0 @@ |
1 | -module LightboxHelper | |
2 | - | |
3 | - def lightbox_link_to(text, url, options = {}) | |
4 | - link_to(text, url, lightbox_options(options)) | |
5 | - end | |
6 | - | |
7 | - def lightbox_close_button(text, options = {}) | |
8 | - button(:close, text, '#', lightbox_options(options, 'lbAction').merge(:rel => 'deactivate')) | |
9 | - end | |
10 | - | |
11 | - def lightbox_button(type, label, url, options = {}) | |
12 | - button(type, label, url, lightbox_options(options)) | |
13 | - end | |
14 | - | |
15 | - def lightbox_icon_button(type, label, url, options = {}) | |
16 | - icon_button(type, label, url, lightbox_options(options)) | |
17 | - end | |
18 | - | |
19 | - # options must be an HTML options hash as passed to link_to etc. | |
20 | - # | |
21 | - # returns a new hash with lightbox class added. Keeps existing classes. | |
22 | - def lightbox_options(options, lightbox_type = 'lbOn') | |
23 | - the_class = lightbox_type | |
24 | - the_class << " #{options[:class]}" if options.has_key?(:class) | |
25 | - options.merge(:class => the_class) | |
26 | - end | |
27 | - | |
28 | - def lightbox? | |
29 | - request.xhr? | |
30 | - end | |
31 | - | |
32 | - def lightbox_remote_button(type, label, url, options = {}) | |
33 | - button(type, label, url, lightbox_options(options, 'remote-lbOn')) | |
34 | - end | |
35 | - | |
36 | -end |
... | ... | @@ -0,0 +1,46 @@ |
1 | +module ModalHelper | |
2 | + | |
3 | + def modal_inline_link_to title, url, selector, options = {} | |
4 | + link_to title, url, modal_options(options.merge(:inline => selector)) | |
5 | + end | |
6 | + | |
7 | + def modal_inline_icon type, title, url, selector, options = {} | |
8 | + icon_button type, title, url, modal_options(options.merge(:inline => selector)) | |
9 | + end | |
10 | + | |
11 | + def modal_link_to title, url, options = {} | |
12 | + link_to title, url, modal_options(options) | |
13 | + end | |
14 | + | |
15 | + def modal_close_link text, options = {} | |
16 | + link_to text, '#', modal_options(options, :close) | |
17 | + end | |
18 | + | |
19 | + def modal_close_button(text, options = {}) | |
20 | + button :close, text, '#', modal_options(options, :close).merge(:rel => 'deactivate') | |
21 | + end | |
22 | + | |
23 | + def modal_button(type, label, url, options = {}) | |
24 | + button type, label, url, modal_options(options) | |
25 | + end | |
26 | + | |
27 | + def modal_icon_button(type, label, url, options = {}) | |
28 | + icon_button type, label, url, modal_options(options) | |
29 | + end | |
30 | + | |
31 | + # options must be an HTML options hash as passed to link_to etc. | |
32 | + # | |
33 | + # returns a new hash with modal class added. Keeps existing classes. | |
34 | + def modal_options(options, type=nil) | |
35 | + inline_selector = options.delete :inline | |
36 | + options[:onclick] = "return noosfero.modal.inline('#{inline_selector}')" if inline_selector | |
37 | + | |
38 | + classes = if inline_selector then '' else 'modal-toggle' end | |
39 | + classes += " modal-#{type.to_s}" if type.present? | |
40 | + classes << " #{options[:class]}" if options.has_key? :class | |
41 | + options.merge!(:class => classes) | |
42 | + | |
43 | + options | |
44 | + end | |
45 | + | |
46 | +end | ... | ... |
app/helpers/thickbox_helper.rb
... | ... | @@ -1,11 +0,0 @@ |
1 | -module ThickboxHelper | |
2 | - def thickbox_inline_popup_link(title, url, id, options = {}) | |
3 | - link_to(title, url_for(url) + "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => 'thickbox'}.merge(options)) | |
4 | - end | |
5 | - def thickbox_inline_popup_icon(type, title, url, id, options = {}) | |
6 | - icon_button(type, title, url_for(url) + "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => "thickbox"}.merge(options)) | |
7 | - end | |
8 | - def thickbox_close_button(title) | |
9 | - button_to_function(:close, title, 'tb_remove();') | |
10 | - end | |
11 | -end |
app/views/account/_login_form.html.erb
1 | 1 | <%= labelled_form_for :user, |
2 | 2 | :url => { :controller => 'account', :action => (params[:enterprise_code] ? 'activate_enterprise' : 'login') } do |f| %> |
3 | 3 | |
4 | -<%= f.text_field :login, | |
5 | - :id => ( lightbox? ? 'lightbox_' : '' ) + 'user_login', | |
6 | - :onchange => 'this.value = convToValidLogin( this.value )' %> | |
4 | +<%= f.text_field :login, :id => 'user_login', :onchange => 'this.value = convToValidLogin( this.value )' %> | |
7 | 5 | |
8 | -<%= f.password_field :password, | |
9 | - :id => ( lightbox? ? 'lightbox_' : '' ) + 'user_password' %> | |
6 | +<%= f.password_field :password, :id => 'user_password' %> | |
10 | 7 | |
11 | 8 | <% if params[:enterprise_code] %> |
12 | 9 | <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %> |
... | ... | @@ -16,7 +13,7 @@ |
16 | 13 | |
17 | 14 | <% button_bar do %> |
18 | 15 | <%= submit_button( 'login', _('Log in') )%> |
19 | - <%= lightbox_close_button(_('Cancel')) if lightbox? %> | |
16 | + <%= modal_close_button _('Cancel') if request.xhr? %> | |
20 | 17 | <% end %> |
21 | 18 | |
22 | 19 | <% end %> | ... | ... |
app/views/account/index_anonymous.html.erb
1 | 1 | <h1><%= _('Identify yourself') %></h1> |
2 | 2 | |
3 | 3 | <p> |
4 | -<%= lightbox_link_to _('Login.'), { :controller => 'account', :action => 'login_popup' } %> | |
4 | +<%= modal_link_to _('Login.'), { :controller => 'account', :action => 'login_popup' } %> | |
5 | 5 | |
6 | 6 | <%= _('You need to login to be able to use all the features in this environment.') %> |
7 | 7 | </p> | ... | ... |
app/views/account/login.html.erb
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <h2><%= _('Login') %></h2> |
4 | 4 | |
5 | 5 | <% @user ||= User.new %> |
6 | -<% is_thickbox ||= false %> | |
6 | +<% is_popin ||= false %> | |
7 | 7 | |
8 | 8 | <%= @message %> |
9 | 9 | |
... | ... | @@ -17,8 +17,8 @@ |
17 | 17 | |
18 | 18 | <% button_bar do %> |
19 | 19 | <%= submit_button( 'login', _('Log in') )%> |
20 | - <% if is_thickbox %> | |
21 | - <%= thickbox_close_button(_('Cancel')) %> | |
20 | + <% if is_popin %> | |
21 | + <%= modal_close_button(_('Cancel')) %> | |
22 | 22 | <% end %> |
23 | 23 | <% end %> |
24 | 24 | ... | ... |
app/views/account/logout_popup.html.erb
app/views/box_organizer/add_block.html.erb
app/views/box_organizer/edit.html.erb
app/views/box_organizer/index.html.erb
1 | 1 | <h1><%= _('Editing sideboxes')%></h1> |
2 | 2 | |
3 | 3 | <% button_bar :class=>'design-menu' do %> |
4 | - <%= colorbox_button('add', _('Add a block'), { :action => 'add_block' }) %> | |
4 | + <%= modal_button('add', _('Add a block'), { :action => 'add_block' }) %> | |
5 | 5 | <%= button(:back, _('Back to control panel'), :controller => (profile.nil? ? 'admin_panel': 'profile_editor')) %> |
6 | 6 | <% end %> | ... | ... |
app/views/cms/edit.html.erb
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 | <% end %> |
29 | 29 | |
30 | 30 | <div style='float: right'> |
31 | - <%= lightbox_button :help, _('Why categorize?'), :action => 'why_categorize' %> | |
31 | + <%= modal_button :help, _('Why categorize?'), :action => 'why_categorize' %> | |
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <%= select_categories(:article, _('Categorize your article')) %> | ... | ... |
app/views/cms/select_article_type.html.erb
app/views/cms/view.html.erb
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | <% button_bar(:style => 'margin-bottom: 1em;') do %> |
18 | 18 | <% parent_id = ((@article && @article.allow_children?) ? @article : nil) %> |
19 | 19 | |
20 | - <%= colorbox_button('new', _('New content'), :action => 'new', :parent_id => parent_id, :cms => true) %> | |
20 | + <%= modal_button('new', _('New content'), :action => 'new', :parent_id => parent_id, :cms => true) %> | |
21 | 21 | <%= button(:back, _('Back to control panel'), :controller => 'profile_editor', :action => "index") %> |
22 | 22 | <% end %> |
23 | 23 | ... | ... |
app/views/cms/why_categorize.html.erb
app/views/comment/_comment_form.html.erb
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | <%= recaptcha_tags(:display => { :theme => 'clean' }, :ajax => true) %> |
11 | 11 | <% button_bar do %> |
12 | 12 | <%= button_to_function :add, _('Confirm'), "return false", :id => "confirm-captcha" %> |
13 | - <%= button_to_function :cancel, _('Cancel'), "jQuery.colorbox.close()" %> | |
13 | + <%= button_to_function :cancel, _('Cancel'), "noosfero.modal.close()" %> | |
14 | 14 | <% end %> |
15 | 15 | </div> |
16 | 16 | |
... | ... | @@ -31,10 +31,10 @@ function check_captcha(button, confirm_action) { |
31 | 31 | return true; |
32 | 32 | <% else %> |
33 | 33 | jQuery('#recaptcha-container').show(); |
34 | - jQuery.colorbox({ html: jQuery('#recaptcha-container').html(), maxWidth : '600px', maxHeight : '300px' }); | |
34 | + noosfero.modal.inline('#recaptcha-container', {maxWidth :'600px', maxHeight : '300px' }); | |
35 | 35 | jQuery('#confirm-captcha').unbind('click'); |
36 | 36 | jQuery('#confirm-captcha').bind('click', function() { |
37 | - jQuery.colorbox.close(); | |
37 | + noosfero.modal.close(); | |
38 | 38 | button.form.recaptcha_response_field.value = jQuery('#recaptcha_response_field').val(); |
39 | 39 | button.form.recaptcha_challenge_field.value = jQuery('#recaptcha_challenge_field').val(); |
40 | 40 | button.form.confirm.value = 'true'; |
... | ... | @@ -88,7 +88,7 @@ function check_captcha(button, confirm_action) { |
88 | 88 | <% if !edition_mode %> |
89 | 89 | <%= button :cancel, _('Cancel'), '', :id => 'cancel-comment' %> |
90 | 90 | <% else %> |
91 | - <%= button :cancel, _('Cancel'), '#', :onclick => "jQuery.colorbox.close();" %> | |
91 | + <%= button :cancel, _('Cancel'), '#', :onclick => "noosfero.modal.close();" %> | |
92 | 92 | <% end %> |
93 | 93 | <% end %> |
94 | 94 | <% end %> | ... | ... |
app/views/content_viewer/_article_toolbar.html.erb
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 | <%= expirable_button @page, :locale, content, url %> |
29 | 29 | <% end %> |
30 | 30 | |
31 | - <%= colorbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) unless remove_content_button(:new, @page) %> | |
31 | + <%= modal_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) unless remove_content_button(:new, @page) %> | |
32 | 32 | <% end %> |
33 | 33 | |
34 | 34 | <% if @page.accept_uploads? && @page.allow_create?(user) %> | ... | ... |
app/views/content_viewer/_comment_form.html.erb
... | ... | @@ -7,10 +7,10 @@ function submit_comment_form(button) { |
7 | 7 | return true; |
8 | 8 | <% else %> |
9 | 9 | jQuery('#recaptcha-container').show(); |
10 | - jQuery.colorbox({ inline : true, href : '#recaptcha-container', maxWidth : '600px', maxHeight : '300px' }); | |
10 | + noosfero.modal.inline('#recaptcha-container', {maxWidth :'600px', maxHeight : '300px' }); | |
11 | 11 | jQuery('#confirm-captcha').unbind('click'); |
12 | 12 | jQuery('#confirm-captcha').bind('click', function() { |
13 | - jQuery.colorbox.close(); | |
13 | + noosfero.modal.close(); | |
14 | 14 | button.form.recaptcha_response_field.value = jQuery('#recaptcha_response_field').val(); |
15 | 15 | button.form.recaptcha_challenge_field.value = jQuery('#recaptcha_challenge_field').val(); |
16 | 16 | button.form.confirm.value = 'true'; |
... | ... | @@ -38,7 +38,7 @@ function submit_comment_form(button) { |
38 | 38 | <%= recaptcha_tags(:display => { :theme => 'clean' }, :ajax => true) %> |
39 | 39 | <% button_bar do %> |
40 | 40 | <%= button_to_function :add, _('Confirm'), "return false", :id => "confirm-captcha" %> |
41 | - <%= button_to_function :cancel, _('Cancel'), "jQuery.colorbox.close()" %> | |
41 | + <%= button_to_function :cancel, _('Cancel'), "noosfero.modal.close()" %> | |
42 | 42 | <% end %> |
43 | 43 | </div> |
44 | 44 | ... | ... |
app/views/layouts/_user.html.erb
... | ... | @@ -7,11 +7,11 @@ |
7 | 7 | </span> |
8 | 8 | <% else %> |
9 | 9 | <span class='not-logged-in'> |
10 | - <%= _("<span class='login'>%s</span>") % thickbox_inline_popup_link('<i class="icon-menu-login"></i><strong>' + _('Login') + '</strong>', login_url, 'inlineLoginBox', :id => 'link_login') %> | |
10 | + <%= _("<span class='login'>%s</span>") % modal_inline_link_to('<i class="icon-menu-login"></i><strong>' + _('Login') + '</strong>', login_url, '#inlineLoginBox', :id => 'link_login') %> | |
11 | 11 | <%= @plugins.dispatch(:alternative_authentication_link).collect { |content| instance_exec(&content) }.join("") %> |
12 | 12 | |
13 | 13 | <div id='inlineLoginBox' style='display: none;'> |
14 | - <%= render :file => 'account/login', :locals => { :is_thickbox => true } %> | |
14 | + <%= render :file => 'account/login', :locals => { :is_popin => true } %> | |
15 | 15 | </div> |
16 | 16 | |
17 | 17 | <% unless @plugins.dispatch(:allow_user_registration).include?(false) %> | ... | ... |
app/views/layouts/application-ng.html.erb
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | <%= yield :head %> |
19 | 19 | <%= |
20 | 20 | @plugins.dispatch(:head_ending).map do |content| |
21 | - if content.respond_to?(:call) then instance_exec(&content).html_safe else content.html_safe end | |
21 | + if content.respond_to?(:call) then instance_exec(&content).to_s.html_safe else content.to_s.html_safe end | |
22 | 22 | end.join("\n") |
23 | 23 | %> |
24 | 24 | |
... | ... | @@ -32,7 +32,7 @@ |
32 | 32 | |
33 | 33 | <%= |
34 | 34 | @plugins.dispatch(:body_beginning).map do |content| |
35 | - if content.respond_to?(:call) then instance_exec(&content).html_safe else content.html_safe end | |
35 | + if content.respond_to?(:call) then instance_exec(&content).to_s.html_safe else content.to_s.html_safe end | |
36 | 36 | end.join("\n") |
37 | 37 | %> |
38 | 38 | ... | ... |
app/views/profile/join.html.erb
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | <%= hidden_field_tag(:confirmation, 1) %> |
10 | 10 | <%= submit_button(:ok, _("Yes, I want to join.") % profile.name) %> |
11 | 11 | <% if logged_in? && request.xhr? %> |
12 | - <%= lightbox_close_button(_("No, I don't want")) %> | |
12 | + <%= modal_close_button _("No, I don't want") %> | |
13 | 13 | <% else %> |
14 | 14 | <%= button(:cancel, _("No, I don't want."), profile.url) %> |
15 | 15 | <% end %> | ... | ... |
app/views/profile/leave.html.erb
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | <%= hidden_field_tag(:back_to, @back_to) %> |
10 | 10 | <%= submit_button(:ok, _("Yes, I want to leave.") % profile.name) %> |
11 | 11 | <% if logged_in? && request.xhr? %> |
12 | - <%= lightbox_close_button(_("No, I don't want")) %> | |
12 | + <%= modal_close_button _("No, I don't want") %> | |
13 | 13 | <% else %> |
14 | 14 | <%= button(:cancel, _("No, I don't want."), profile.url) %> |
15 | 15 | <% end %> | ... | ... |
app/views/profile/report_abuse.html.erb
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | <% end %> |
10 | 10 | |
11 | 11 | <%= submit_button(:send, _('Report profile'), :style => 'float: left; cursor: pointer;', :id => 'report-abuse-submit-button', :onclick => "jQuery('#form-submit-loading').show()") %> |
12 | - <%= button(:cancel, _('Cancel'), {}, :style => 'float: left; padding-top: 0px; padding-bottom: 0px;', :onclick => 'jQuery.colorbox.close(); return false;')%> | |
12 | + <%= button(:cancel, _('Cancel'), {}, :style => 'float: left; padding-top: 0px; padding-bottom: 0px;', :onclick => 'noosfero.modal.close(); return false;')%> | |
13 | 13 | <div id="form-submit-loading" class="small-loading" style="width: 16px; height: 16px; margin-top: 3px; float: left; display: none;"></div> |
14 | 14 | <% end %> |
15 | 15 | |
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | success: function(data, status, ajax){ |
31 | 31 | if ( !data.ok ) display_notice(data.error.message); |
32 | 32 | else { |
33 | - $.colorbox.close(); | |
33 | + noosfero.modal.close(); | |
34 | 34 | display_notice(data.message); |
35 | 35 | window.location.reload(); |
36 | 36 | } | ... | ... |
app/views/profile_themes/add_css.html.erb
app/views/profile_themes/edit.html.erb
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | <% end %> |
17 | 17 | </ul> |
18 | 18 | <% button_bar do %> |
19 | - <%= lightbox_button(:add, _('New CSS'), :action => 'add_css', :id => @theme.id) %> | |
19 | + <%= modal_button :add, _('New CSS'), :action => 'add_css', :id => @theme.id %> | |
20 | 20 | <% end %> |
21 | 21 | </div> |
22 | 22 | |
... | ... | @@ -25,10 +25,10 @@ |
25 | 25 | <ul> |
26 | 26 | <% for image in @image_files %> |
27 | 27 | <li><%= image_tag("/user_themes/#{@theme.id}/images/#{image}") %></li> |
28 | - <% end %> | |
28 | + <% end %> | |
29 | 29 | </ul> |
30 | 30 | <% button_bar do %> |
31 | - <%= lightbox_button(:add, _('Add image'), :action => 'add_image', :id => @theme.id) %> | |
31 | + <%= modal_button :add, _('Add image'), :action => 'add_image', :id => @theme.id %> | |
32 | 32 | <% end %> |
33 | 33 | </div> |
34 | 34 | ... | ... |
app/views/profile_themes/index.html.erb
... | ... | @@ -42,7 +42,7 @@ |
42 | 42 | |
43 | 43 | <% button_bar do %> |
44 | 44 | <% if environment.enabled?('user_themes') %> |
45 | - <%= lightbox_button(:add, _('New theme ...'), :action => 'new') %> | |
45 | + <%= modal_button :add, _('New theme ...'), :action => 'new' %> | |
46 | 46 | <% end %> |
47 | 47 | <%= button(:back, _('Back'), :controller => 'profile_editor', :action => 'index') %> |
48 | 48 | <% end %> | ... | ... |
app/views/shared/user_menu.html.erb
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | </li> |
21 | 21 | |
22 | 22 | <li> |
23 | - <%= lightbox_link_to('<span class="icon-new"></span>' + _('New article'), '/myprofile/{login}/cms/new') %> | |
23 | + <%= modal_link_to '<span class="icon-new"></span>' + _('New article'), '/myprofile/{login}/cms/new' %> | |
24 | 24 | </li> |
25 | 25 | |
26 | 26 | <li id='manage-enterprises-link-template' style='display: none'><a href='/myprofile/{identifier}'><span class="icon-menu-enterprise"></span><%= _('Manage %s') % '{name}' %></a></li> |
... | ... | @@ -58,9 +58,9 @@ |
58 | 58 | <% if theme_option( :menu_login ) == 'full_form' %> |
59 | 59 | <%= render :file => 'account/login_block' %> |
60 | 60 | <% else %> |
61 | - <%= thickbox_inline_popup_link('<span class="icon-menu-login"></span>'+ _('Login'), login_url, 'inlineLoginBox', :id => 'link_login') %> | |
61 | + <%= modal_inline_link_to('<span class="icon-menu-login"></span>'+ _('Login'), login_url, '#inlineLoginBox', :id => 'link_login') %> | |
62 | 62 | <div id='inlineLoginBox' style='display: none;'> |
63 | - <%= render :file => 'account/login', :locals => { :is_thickbox => true } %> | |
63 | + <%= render :file => 'account/login', :locals => { :is_popin => true } %> | |
64 | 64 | </div> |
65 | 65 | <% end %> |
66 | 66 | <% end %> | ... | ... |
plugins/custom_forms/public/style.css
plugins/custom_forms/views/custom_forms_plugin_myprofile/_edit_select.html.erb
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | <%= labelled_radio_button 'Multiple Select', "fields[#{counter}][kind]", 'multiple_select', field.multiple && field.list %><br /> |
27 | 27 | |
28 | 28 | <% button_bar do %> |
29 | - <%= button :ok, c_('Ok'), '#', :class => 'colorbox-ok-button', :div_id => elem_id %> | |
29 | + <%= button :ok, _('Ok'), '#', :div_id => elem_id %> | |
30 | 30 | <% end %> |
31 | 31 | </div> |
32 | 32 | ... | ... |
plugins/shopping_cart/public/cart.js
... | ... | @@ -290,14 +290,11 @@ function Cart(config) { |
290 | 290 | log.error('Send request - HTTP '+status, errorThrown); |
291 | 291 | }, |
292 | 292 | complete: function() { |
293 | - $.colorbox.close(); | |
293 | + noosfero.modal.close(); | |
294 | 294 | } |
295 | 295 | }); |
296 | 296 | } |
297 | 297 | |
298 | - Cart.colorbox_close = function() { | |
299 | - $.colorbox.close(); | |
300 | - } | |
301 | 298 | |
302 | 299 | $(window).bind('beforeunload', function(){ |
303 | 300 | log('Page unload.'); | ... | ... |
plugins/shopping_cart/views/cart.html.erb
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | <a href="cart:clean" onclick="Cart.clean(this); return false" class="cart-clean"><%=_('Clean basket')%></a> |
6 | 6 | <ul class="cart-items"></ul> |
7 | 7 | <div class="cart-total"><%=_('Total:')%> <b></b></div> |
8 | - <a href="/plugin/shopping_cart/buy" class="cart-buy colorbox"><%=_('Shopping checkout')%></a> | |
8 | + <a href="/plugin/shopping_cart/buy" class="cart-buy modal"><%=_('Shopping checkout')%></a> | |
9 | 9 | </div> |
10 | 10 | <a href="#" onclick="Cart.toggle(this); return false" class="cart-toggle"> |
11 | 11 | <span class="str-show"><%=_('Show basket')%></span> | ... | ... |
plugins/shopping_cart/views/shopping_cart_plugin/buy.html.erb
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | <% end %> |
25 | 25 | <% delivery_option = @settings.delivery_options.first && @settings.delivery_options.first.first %> |
26 | 26 | <%= items_table(@cart[:items], @profile, delivery_option) %> |
27 | - <%= link_to '', '#', :onclick => "Cart.colorbox_close(this);", :class => 'cart-box-close icon-cancel' %> | |
27 | + <%= link_to_function '', "noosfero.modal.close();", :class => 'cart-box-close icon-cancel' %> | |
28 | 28 | </div> |
29 | 29 | |
30 | 30 | <%= javascript_include_tag '../plugins/shopping_cart/buy' %> | ... | ... |
plugins/shopping_cart/views/shopping_cart_plugin_profile/buy.html.erb
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | </div> |
18 | 18 | <% end %> |
19 | 19 | <%= items_table(session[:cart][:items], profile) %> |
20 | - <%= link_to '', '#', :onclick => "Cart.colorbox_close(this);", :class => 'cart-box-close icon-cancel' %> | |
20 | + <%= link_to_function '', "noosfero.modal.close();", :class => 'cart-box-close icon-cancel' %> | |
21 | 21 | </div> |
22 | 22 | |
23 | 23 | <script type="text/javascript"> | ... | ... |
plugins/stoa/public/javascripts/signup_complement.js
... | ... | @@ -55,9 +55,10 @@ $("#usp_id_field").observe_field(1, function(){ |
55 | 55 | }); |
56 | 56 | |
57 | 57 | function displayValidationUspIdError(error){ |
58 | - jQuery.colorbox({html: '<h2>'+error.message+'</h2>'+error.backtrace.join("<br />"), | |
58 | + noosfero.modal.html('<h2>'+error.message+'</h2>'+error.backtrace.join("<br />"), { | |
59 | 59 | height: "80%", |
60 | - width: "70%" }); | |
60 | + width: "70%" | |
61 | + }); | |
61 | 62 | } |
62 | 63 | |
63 | 64 | jQuery('#usp_id_field').focus(function() { jQuery('#usp-id-balloon').fadeIn('slow'); }); | ... | ... |
public/images/colorbox/controls.png
public/javascripts/application.js
... | ... | @@ -1005,31 +1005,6 @@ log.error = function() { |
1005 | 1005 | window.log.apply(window, jQuery.merge(['error'], arguments)); |
1006 | 1006 | } |
1007 | 1007 | |
1008 | -jQuery(function($) { | |
1009 | - $('.colorbox').live('click', function() { | |
1010 | - $.colorbox({ | |
1011 | - href: $(this).attr('href'), | |
1012 | - maxWidth: $(window).width()-50, | |
1013 | - height: $(window).height()-50, | |
1014 | - open: true, | |
1015 | - fixed: true, | |
1016 | - close: 'Cancel', | |
1017 | - onComplete: function(bt) { | |
1018 | - var opt = {}, maxH = $(window).height()-50; | |
1019 | - if ($('#cboxLoadedContent *:first').height() > maxH) opt.height = maxH; | |
1020 | - $.colorbox.resize(opt); | |
1021 | - } | |
1022 | - }); | |
1023 | - return false; | |
1024 | - }); | |
1025 | - | |
1026 | - $('.colorbox-close').live('click', function() { | |
1027 | - $.colorbox.close(); | |
1028 | - return false; | |
1029 | - }); | |
1030 | - | |
1031 | -}); | |
1032 | - | |
1033 | 1008 | function showHideTermsOfUse() { |
1034 | 1009 | if( jQuery("#article_has_terms_of_use").attr("checked") ) |
1035 | 1010 | jQuery("#text_area_terms_of_use").show(); | ... | ... |
public/javascripts/article.js
... | ... | @@ -88,7 +88,7 @@ jQuery(function($) { |
88 | 88 | var $item = $(this).closest('.item'); |
89 | 89 | var html_selector = $item.attr('data-item'); |
90 | 90 | insert_item_in_text($item.find(html_selector)); |
91 | - $.colorbox.close(); | |
91 | + noosfero.modal.close(); | |
92 | 92 | return false; |
93 | 93 | }); |
94 | 94 | $('a.zoom').live('click', function() { |
... | ... | @@ -96,14 +96,13 @@ jQuery(function($) { |
96 | 96 | var html_selector = $item.attr('data-item'); |
97 | 97 | var name = $item.attr('title'); |
98 | 98 | var img = $item.find(html_selector).find('img').attr('src'); |
99 | - $.colorbox({ | |
100 | - html: zoom_dialog_html(name, img), | |
101 | - scrolling: false | |
99 | + noosfero.modal.html(zoom_dialog_html(img), { | |
100 | + scrolling: false, | |
102 | 101 | }); |
103 | 102 | return false; |
104 | 103 | }); |
105 | 104 | $('a.close').live('click', function() { |
106 | - $.colorbox.close(); | |
105 | + noosfero.modal.close(); | |
107 | 106 | return false; |
108 | 107 | }) |
109 | 108 | ... | ... |
public/javascripts/colorbox.js
... | ... | @@ -1,814 +0,0 @@ |
1 | -// ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+ | |
2 | -// Copyright (c) 2011 Jack Moore - jack@colorpowered.com | |
3 | -// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php | |
4 | -(function ($, document, window) { | |
5 | - var | |
6 | - // ColorBox Default Settings. | |
7 | - // See http://colorpowered.com/colorbox for details. | |
8 | - defaults = { | |
9 | - transition: "elastic", | |
10 | - speed: 300, | |
11 | - width: false, | |
12 | - initialWidth: "600", | |
13 | - innerWidth: false, | |
14 | - maxWidth: false, | |
15 | - height: false, | |
16 | - initialHeight: "450", | |
17 | - innerHeight: false, | |
18 | - maxHeight: false, | |
19 | - scalePhotos: true, | |
20 | - scrolling: true, | |
21 | - inline: false, | |
22 | - html: false, | |
23 | - iframe: false, | |
24 | - fastIframe: true, | |
25 | - photo: false, | |
26 | - href: false, | |
27 | - title: false, | |
28 | - rel: false, | |
29 | - opacity: 0.9, | |
30 | - preloading: true, | |
31 | - current: "image {current} of {total}", | |
32 | - previous: "previous", | |
33 | - next: "next", | |
34 | - close: "close", | |
35 | - open: false, | |
36 | - returnFocus: true, | |
37 | - loop: true, | |
38 | - slideshow: false, | |
39 | - slideshowAuto: true, | |
40 | - slideshowSpeed: 2500, | |
41 | - slideshowStart: "start slideshow", | |
42 | - slideshowStop: "stop slideshow", | |
43 | - onOpen: false, | |
44 | - onLoad: false, | |
45 | - onComplete: false, | |
46 | - onCleanup: false, | |
47 | - onClosed: false, | |
48 | - overlayClose: true, | |
49 | - escKey: true, | |
50 | - arrowKey: true | |
51 | - }, | |
52 | - | |
53 | - // Abstracting the HTML and event identifiers for easy rebranding | |
54 | - colorbox = 'colorbox', | |
55 | - prefix = 'cbox', | |
56 | - | |
57 | - // Events | |
58 | - event_open = prefix + '_open', | |
59 | - event_load = prefix + '_load', | |
60 | - event_complete = prefix + '_complete', | |
61 | - event_cleanup = prefix + '_cleanup', | |
62 | - event_closed = prefix + '_closed', | |
63 | - event_purge = prefix + '_purge', | |
64 | - | |
65 | - // Special Handling for IE | |
66 | - isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome. | |
67 | - isIE6 = isIE && $.browser.version < 7, | |
68 | - event_ie6 = prefix + '_IE6', | |
69 | - | |
70 | - // Cached jQuery Object Variables | |
71 | - $overlay, | |
72 | - $box, | |
73 | - $wrap, | |
74 | - $content, | |
75 | - $topBorder, | |
76 | - $leftBorder, | |
77 | - $rightBorder, | |
78 | - $bottomBorder, | |
79 | - $related, | |
80 | - $window, | |
81 | - $loaded, | |
82 | - $loadingBay, | |
83 | - $loadingOverlay, | |
84 | - $title, | |
85 | - $current, | |
86 | - $slideshow, | |
87 | - $next, | |
88 | - $prev, | |
89 | - $close, | |
90 | - $groupControls, | |
91 | - | |
92 | - // Variables for cached values or use across multiple functions | |
93 | - settings = {}, | |
94 | - interfaceHeight, | |
95 | - interfaceWidth, | |
96 | - loadedHeight, | |
97 | - loadedWidth, | |
98 | - element, | |
99 | - index, | |
100 | - photo, | |
101 | - open, | |
102 | - active, | |
103 | - closing = false, | |
104 | - | |
105 | - publicMethod, | |
106 | - boxElement = prefix + 'Element'; | |
107 | - | |
108 | - // **************** | |
109 | - // HELPER FUNCTIONS | |
110 | - // **************** | |
111 | - | |
112 | - // jQuery object generator to reduce code size | |
113 | - function $div(id, cssText) { | |
114 | - var div = document.createElement('div'); | |
115 | - if (id) { | |
116 | - div.id = prefix + id; | |
117 | - } | |
118 | - div.style.cssText = cssText || false; | |
119 | - return $(div); | |
120 | - } | |
121 | - | |
122 | - // Convert % values to pixels | |
123 | - function setSize(size, dimension) { | |
124 | - dimension = dimension === 'x' ? $window.width() : $window.height(); | |
125 | - return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size; | |
126 | - } | |
127 | - | |
128 | - // Checks an href to see if it is a photo. | |
129 | - // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex. | |
130 | - function isImage(url) { | |
131 | - return settings.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url); | |
132 | - } | |
133 | - | |
134 | - // Assigns function results to their respective settings. This allows functions to be used as values. | |
135 | - function process(settings) { | |
136 | - for (var i in settings) { | |
137 | - if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time. | |
138 | - settings[i] = settings[i].call(element); | |
139 | - } | |
140 | - } | |
141 | - settings.rel = settings.rel || element.rel || 'nofollow'; | |
142 | - settings.href = $.trim(settings.href || $(element).attr('href')); | |
143 | - settings.title = settings.title || element.title; | |
144 | - } | |
145 | - | |
146 | - function trigger(event, callback) { | |
147 | - if (callback) { | |
148 | - callback.call(element); | |
149 | - } | |
150 | - $.event.trigger(event); | |
151 | - } | |
152 | - | |
153 | - // Slideshow functionality | |
154 | - function slideshow() { | |
155 | - var | |
156 | - timeOut, | |
157 | - className = prefix + "Slideshow_", | |
158 | - click = "click." + prefix, | |
159 | - start, | |
160 | - stop, | |
161 | - clear; | |
162 | - | |
163 | - if (settings.slideshow && $related[1]) { | |
164 | - start = function () { | |
165 | - $slideshow | |
166 | - .text(settings.slideshowStop) | |
167 | - .unbind(click) | |
168 | - .bind(event_complete, function () { | |
169 | - if (index < $related.length - 1 || settings.loop) { | |
170 | - timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); | |
171 | - } | |
172 | - }) | |
173 | - .bind(event_load, function () { | |
174 | - clearTimeout(timeOut); | |
175 | - }) | |
176 | - .one(click + ' ' + event_cleanup, stop); | |
177 | - $box.removeClass(className + "off").addClass(className + "on"); | |
178 | - timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); | |
179 | - }; | |
180 | - | |
181 | - stop = function () { | |
182 | - clearTimeout(timeOut); | |
183 | - $slideshow | |
184 | - .text(settings.slideshowStart) | |
185 | - .unbind([event_complete, event_load, event_cleanup, click].join(' ')) | |
186 | - .one(click, start); | |
187 | - $box.removeClass(className + "on").addClass(className + "off"); | |
188 | - }; | |
189 | - | |
190 | - if (settings.slideshowAuto) { | |
191 | - start(); | |
192 | - } else { | |
193 | - stop(); | |
194 | - } | |
195 | - } | |
196 | - } | |
197 | - | |
198 | - function launch(elem) { | |
199 | - if (!closing) { | |
200 | - | |
201 | - element = elem; | |
202 | - | |
203 | - process($.extend(settings, $.data(element, colorbox))); | |
204 | - | |
205 | - $related = $(element); | |
206 | - | |
207 | - index = 0; | |
208 | - | |
209 | - if (settings.rel !== 'nofollow') { | |
210 | - $related = $('.' + boxElement).filter(function () { | |
211 | - var relRelated = $.data(this, colorbox).rel || this.rel; | |
212 | - return (relRelated === settings.rel); | |
213 | - }); | |
214 | - index = $related.index(element); | |
215 | - | |
216 | - // Check direct calls to ColorBox. | |
217 | - if (index === -1) { | |
218 | - $related = $related.add(element); | |
219 | - index = $related.length - 1; | |
220 | - } | |
221 | - } | |
222 | - | |
223 | - if (!open) { | |
224 | - open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys. | |
225 | - | |
226 | - $box.show(); | |
227 | - | |
228 | - if (settings.returnFocus) { | |
229 | - try { | |
230 | - element.blur(); | |
231 | - $(element).one(event_closed, function () { | |
232 | - try { | |
233 | - this.focus(); | |
234 | - } catch (e) { | |
235 | - // do nothing | |
236 | - } | |
237 | - }); | |
238 | - } catch (e) { | |
239 | - // do nothing | |
240 | - } | |
241 | - } | |
242 | - | |
243 | - // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5' | |
244 | - $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show(); | |
245 | - | |
246 | - // Opens inital empty ColorBox prior to content being loaded. | |
247 | - settings.w = setSize(settings.initialWidth, 'x'); | |
248 | - settings.h = setSize(settings.initialHeight, 'y'); | |
249 | - publicMethod.position(0); | |
250 | - | |
251 | - if (isIE6) { | |
252 | - $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () { | |
253 | - $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()}); | |
254 | - }).trigger('resize.' + event_ie6); | |
255 | - } | |
256 | - | |
257 | - trigger(event_open, settings.onOpen); | |
258 | - | |
259 | - $groupControls.add($title).hide(); | |
260 | - | |
261 | - $close.html(settings.close).show(); | |
262 | - } | |
263 | - | |
264 | - publicMethod.load(true); | |
265 | - } | |
266 | - } | |
267 | - | |
268 | - // **************** | |
269 | - // PUBLIC FUNCTIONS | |
270 | - // Usage format: $.fn.colorbox.close(); | |
271 | - // Usage from within an iframe: parent.$.fn.colorbox.close(); | |
272 | - // **************** | |
273 | - | |
274 | - publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) { | |
275 | - var $this = this, autoOpen; | |
276 | - | |
277 | - if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit. | |
278 | - return $this; | |
279 | - } | |
280 | - | |
281 | - options = options || {}; | |
282 | - | |
283 | - if (callback) { | |
284 | - options.onComplete = callback; | |
285 | - } | |
286 | - | |
287 | - if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox() | |
288 | - $this = $('<a/>'); | |
289 | - options.open = true; // assume an immediate open | |
290 | - } | |
291 | - | |
292 | - $this.each(function () { | |
293 | - $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options)); | |
294 | - $(this).addClass(boxElement); | |
295 | - }); | |
296 | - | |
297 | - autoOpen = options.open; | |
298 | - | |
299 | - if ($.isFunction(autoOpen)) { | |
300 | - autoOpen = autoOpen.call($this); | |
301 | - } | |
302 | - | |
303 | - if (autoOpen) { | |
304 | - launch($this[0]); | |
305 | - } | |
306 | - | |
307 | - return $this; | |
308 | - }; | |
309 | - | |
310 | - // Initialize ColorBox: store common calculations, preload the interface graphics, append the html. | |
311 | - // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only | |
312 | - // having to run once, instead of each time colorbox is opened. | |
313 | - publicMethod.init = function () { | |
314 | - // Create & Append jQuery Objects | |
315 | - $window = $(window); | |
316 | - $box = $div().attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''}); | |
317 | - $overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide(); | |
318 | - | |
319 | - $wrap = $div("Wrapper"); | |
320 | - $content = $div("Content").append( | |
321 | - $loaded = $div("LoadedContent", 'width:0; height:0; overflow:hidden'), | |
322 | - $loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")), | |
323 | - $title = $div("Title"), | |
324 | - $current = $div("Current"), | |
325 | - $next = $div("Next"), | |
326 | - $prev = $div("Previous"), | |
327 | - $slideshow = $div("Slideshow").bind(event_open, slideshow), | |
328 | - $close = $div("Close") | |
329 | - ); | |
330 | - $wrap.append( // The 3x3 Grid that makes up ColorBox | |
331 | - $div().append( | |
332 | - $div("TopLeft"), | |
333 | - $topBorder = $div("TopCenter"), | |
334 | - $div("TopRight") | |
335 | - ), | |
336 | - $div(false, 'clear:left').append( | |
337 | - $leftBorder = $div("MiddleLeft"), | |
338 | - $content, | |
339 | - $rightBorder = $div("MiddleRight") | |
340 | - ), | |
341 | - $div(false, 'clear:left').append( | |
342 | - $div("BottomLeft"), | |
343 | - $bottomBorder = $div("BottomCenter"), | |
344 | - $div("BottomRight") | |
345 | - ) | |
346 | - ).children().children().css({'float': 'left'}); | |
347 | - | |
348 | - $loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none'); | |
349 | - | |
350 | - $('body').prepend($overlay, $box.append($wrap, $loadingBay)); | |
351 | - | |
352 | - $content.children() | |
353 | - .hover(function () { | |
354 | - $(this).addClass('hover'); | |
355 | - }, function () { | |
356 | - $(this).removeClass('hover'); | |
357 | - }).addClass('hover'); | |
358 | - | |
359 | - // Cache values needed for size calculations | |
360 | - interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6 | |
361 | - interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width(); | |
362 | - loadedHeight = $loaded.outerHeight(true); | |
363 | - loadedWidth = $loaded.outerWidth(true); | |
364 | - | |
365 | - // Setting padding to remove the need to do size conversions during the animation step. | |
366 | - $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide(); | |
367 | - | |
368 | - // Setup button events. | |
369 | - $next.click(function () { | |
370 | - publicMethod.next(); | |
371 | - }); | |
372 | - $prev.click(function () { | |
373 | - publicMethod.prev(); | |
374 | - }); | |
375 | - $close.click(function () { | |
376 | - publicMethod.close(); | |
377 | - }); | |
378 | - | |
379 | - $groupControls = $next.add($prev).add($current).add($slideshow); | |
380 | - | |
381 | - // Adding the 'hover' class allowed the browser to load the hover-state | |
382 | - // background graphics. The class can now can be removed. | |
383 | - $content.children().removeClass('hover'); | |
384 | - | |
385 | - $('.' + boxElement).live('click', function (e) { | |
386 | - // checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt. | |
387 | - if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) { | |
388 | - e.preventDefault(); | |
389 | - launch(this); | |
390 | - } | |
391 | - }); | |
392 | - | |
393 | - $overlay.click(function () { | |
394 | - if (settings.overlayClose) { | |
395 | - publicMethod.close(); | |
396 | - } | |
397 | - }); | |
398 | - | |
399 | - // Set Navigation Key Bindings | |
400 | - $(document).bind('keydown.' + prefix, function (e) { | |
401 | - var key = e.keyCode; | |
402 | - if (open && settings.escKey && key === 27) { | |
403 | - e.preventDefault(); | |
404 | - publicMethod.close(); | |
405 | - } | |
406 | - if (open && settings.arrowKey && $related[1]) { | |
407 | - if (key === 37) { | |
408 | - e.preventDefault(); | |
409 | - $prev.click(); | |
410 | - } else if (key === 39) { | |
411 | - e.preventDefault(); | |
412 | - $next.click(); | |
413 | - } | |
414 | - } | |
415 | - }); | |
416 | - }; | |
417 | - | |
418 | - publicMethod.remove = function () { | |
419 | - $box.add($overlay).remove(); | |
420 | - $('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement); | |
421 | - }; | |
422 | - | |
423 | - publicMethod.position = function (speed, loadedCallback) { | |
424 | - var | |
425 | - animate_speed, | |
426 | - // keeps the top and left positions within the browser's viewport. | |
427 | - posTop = Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(), | |
428 | - posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft(); | |
429 | - | |
430 | - // setting the speed to 0 to reduce the delay between same-sized content. | |
431 | - animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed; | |
432 | - | |
433 | - // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly, | |
434 | - // but it has to be shrank down around the size of div#colorbox when it's done. If not, | |
435 | - // it can invoke an obscure IE bug when using iframes. | |
436 | - $wrap[0].style.width = $wrap[0].style.height = "9999px"; | |
437 | - | |
438 | - function modalDimensions(that) { | |
439 | - // loading overlay height has to be explicitly set for IE6. | |
440 | - $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width; | |
441 | - $loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height; | |
442 | - } | |
443 | - | |
444 | - $box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, { | |
445 | - duration: animate_speed, | |
446 | - complete: function () { | |
447 | - modalDimensions(this); | |
448 | - | |
449 | - active = false; | |
450 | - | |
451 | - // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation. | |
452 | - $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px"; | |
453 | - $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px"; | |
454 | - | |
455 | - if (loadedCallback) { | |
456 | - loadedCallback(); | |
457 | - } | |
458 | - }, | |
459 | - step: function () { | |
460 | - modalDimensions(this); | |
461 | - } | |
462 | - }); | |
463 | - }; | |
464 | - | |
465 | - publicMethod.resize = function (options) { | |
466 | - if (open) { | |
467 | - options = options || {}; | |
468 | - | |
469 | - if (options.width) { | |
470 | - settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth; | |
471 | - } | |
472 | - if (options.innerWidth) { | |
473 | - settings.w = setSize(options.innerWidth, 'x'); | |
474 | - } | |
475 | - $loaded.css({width: settings.w}); | |
476 | - | |
477 | - if (options.height) { | |
478 | - settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight; | |
479 | - } | |
480 | - if (options.innerHeight) { | |
481 | - settings.h = setSize(options.innerHeight, 'y'); | |
482 | - } | |
483 | - if (!options.innerHeight && !options.height) { | |
484 | - var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be. | |
485 | - settings.h = $child.height(); | |
486 | - $child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation | |
487 | - } | |
488 | - $loaded.css({height: settings.h}); | |
489 | - | |
490 | - publicMethod.position(settings.transition === "none" ? 0 : settings.speed); | |
491 | - } | |
492 | - }; | |
493 | - | |
494 | - publicMethod.prep = function (object) { | |
495 | - if (!open) { | |
496 | - return; | |
497 | - } | |
498 | - | |
499 | - var speed = settings.transition === "none" ? 0 : settings.speed; | |
500 | - | |
501 | - $window.unbind('resize.' + prefix); | |
502 | - $loaded.remove(); | |
503 | - $loaded = $div('LoadedContent').html(object); | |
504 | - | |
505 | - function getWidth() { | |
506 | - settings.w = settings.w || $loaded.width(); | |
507 | - settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w; | |
508 | - return settings.w; | |
509 | - } | |
510 | - function getHeight() { | |
511 | - settings.h = settings.h || $loaded.height(); | |
512 | - settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h; | |
513 | - return settings.h; | |
514 | - } | |
515 | - | |
516 | - $loaded.hide() | |
517 | - .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations. | |
518 | - .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'}) | |
519 | - .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height. | |
520 | - .prependTo($content); | |
521 | - | |
522 | - $loadingBay.hide(); | |
523 | - | |
524 | - // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width. | |
525 | - //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'}); | |
526 | - | |
527 | - $(photo).css({'float': 'none'}); | |
528 | - | |
529 | - // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay. | |
530 | - if (isIE6) { | |
531 | - $('select').not($box.find('select')).filter(function () { | |
532 | - return this.style.visibility !== 'hidden'; | |
533 | - }).css({'visibility': 'hidden'}).one(event_cleanup, function () { | |
534 | - this.style.visibility = 'inherit'; | |
535 | - }); | |
536 | - } | |
537 | - | |
538 | - function setPosition(s) { | |
539 | - publicMethod.position(s, function () { | |
540 | - var prev, prevSrc, next, nextSrc, total = $related.length, iframe, complete; | |
541 | - | |
542 | - if (!open) { | |
543 | - return; | |
544 | - } | |
545 | - | |
546 | - complete = function () { | |
547 | - $loadingOverlay.hide(); | |
548 | - trigger(event_complete, settings.onComplete); | |
549 | - }; | |
550 | - | |
551 | - if (isIE) { | |
552 | - //This fadeIn helps the bicubic resampling to kick-in. | |
553 | - if (photo) { | |
554 | - $loaded.fadeIn(100); | |
555 | - } | |
556 | - } | |
557 | - | |
558 | - $title.html(settings.title).add($loaded).show(); | |
559 | - | |
560 | - if (total > 1) { // handle grouping | |
561 | - if (typeof settings.current === "string") { | |
562 | - $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show(); | |
563 | - } | |
564 | - | |
565 | - $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next); | |
566 | - $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous); | |
567 | - | |
568 | - prev = index ? $related[index - 1] : $related[total - 1]; | |
569 | - next = index < total - 1 ? $related[index + 1] : $related[0]; | |
570 | - | |
571 | - if (settings.slideshow) { | |
572 | - $slideshow.show(); | |
573 | - } | |
574 | - | |
575 | - // Preloads images within a rel group | |
576 | - if (settings.preloading) { | |
577 | - nextSrc = $.data(next, colorbox).href || next.href; | |
578 | - prevSrc = $.data(prev, colorbox).href || prev.href; | |
579 | - | |
580 | - nextSrc = $.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc; | |
581 | - prevSrc = $.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc; | |
582 | - | |
583 | - if (isImage(nextSrc)) { | |
584 | - $('<img/>')[0].src = nextSrc; | |
585 | - } | |
586 | - | |
587 | - if (isImage(prevSrc)) { | |
588 | - $('<img/>')[0].src = prevSrc; | |
589 | - } | |
590 | - } | |
591 | - } else { | |
592 | - $groupControls.hide(); | |
593 | - } | |
594 | - | |
595 | - if (settings.iframe) { | |
596 | - iframe = $('<iframe/>').addClass(prefix + 'Iframe')[0]; | |
597 | - | |
598 | - if (settings.fastIframe) { | |
599 | - complete(); | |
600 | - } else { | |
601 | - $(iframe).load(complete); | |
602 | - } | |
603 | - iframe.name = prefix + (+new Date()); | |
604 | - iframe.src = settings.href; | |
605 | - | |
606 | - if (!settings.scrolling) { | |
607 | - iframe.scrolling = "no"; | |
608 | - } | |
609 | - | |
610 | - if (isIE) { | |
611 | - iframe.frameBorder=0; | |
612 | - iframe.allowTransparency = "true"; | |
613 | - } | |
614 | - | |
615 | - $(iframe).appendTo($loaded).one(event_purge, function () { | |
616 | - iframe.src = "//about:blank"; | |
617 | - }); | |
618 | - } else { | |
619 | - complete(); | |
620 | - } | |
621 | - | |
622 | - if (settings.transition === 'fade') { | |
623 | - $box.fadeTo(speed, 1, function () { | |
624 | - $box[0].style.filter = ""; | |
625 | - }); | |
626 | - } else { | |
627 | - $box[0].style.filter = ""; | |
628 | - } | |
629 | - | |
630 | - $window.bind('resize.' + prefix, function () { | |
631 | - publicMethod.position(0); | |
632 | - }); | |
633 | - }); | |
634 | - } | |
635 | - | |
636 | - if (settings.transition === 'fade') { | |
637 | - $box.fadeTo(speed, 0, function () { | |
638 | - setPosition(0); | |
639 | - }); | |
640 | - } else { | |
641 | - setPosition(speed); | |
642 | - } | |
643 | - }; | |
644 | - | |
645 | - publicMethod.load = function (launched) { | |
646 | - var href, setResize, prep = publicMethod.prep; | |
647 | - | |
648 | - active = true; | |
649 | - | |
650 | - photo = false; | |
651 | - | |
652 | - element = $related[index]; | |
653 | - | |
654 | - if (!launched) { | |
655 | - process($.extend(settings, $.data(element, colorbox))); | |
656 | - } | |
657 | - | |
658 | - trigger(event_purge); | |
659 | - | |
660 | - trigger(event_load, settings.onLoad); | |
661 | - | |
662 | - settings.h = settings.height ? | |
663 | - setSize(settings.height, 'y') - loadedHeight - interfaceHeight : | |
664 | - settings.innerHeight && setSize(settings.innerHeight, 'y'); | |
665 | - | |
666 | - settings.w = settings.width ? | |
667 | - setSize(settings.width, 'x') - loadedWidth - interfaceWidth : | |
668 | - settings.innerWidth && setSize(settings.innerWidth, 'x'); | |
669 | - | |
670 | - // Sets the minimum dimensions for use in image scaling | |
671 | - settings.mw = settings.w; | |
672 | - settings.mh = settings.h; | |
673 | - | |
674 | - // Re-evaluate the minimum width and height based on maxWidth and maxHeight values. | |
675 | - // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead. | |
676 | - if (settings.maxWidth) { | |
677 | - settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth; | |
678 | - settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw; | |
679 | - } | |
680 | - if (settings.maxHeight) { | |
681 | - settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight; | |
682 | - settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh; | |
683 | - } | |
684 | - | |
685 | - href = settings.href; | |
686 | - | |
687 | - $loadingOverlay.show(); | |
688 | - | |
689 | - if (settings.inline) { | |
690 | - // Inserts an empty placeholder where inline content is being pulled from. | |
691 | - // An event is bound to put inline content back when ColorBox closes or loads new content. | |
692 | - $div().hide().insertBefore($(href)[0]).one(event_purge, function () { | |
693 | - $(this).replaceWith($loaded.children()); | |
694 | - }); | |
695 | - prep($(href)); | |
696 | - } else if (settings.iframe) { | |
697 | - // IFrame element won't be added to the DOM until it is ready to be displayed, | |
698 | - // to avoid problems with DOM-ready JS that might be trying to run in that iframe. | |
699 | - prep(" "); | |
700 | - } else if (settings.html) { | |
701 | - prep(settings.html); | |
702 | - } else if (isImage(href)) { | |
703 | - $(photo = new Image()) | |
704 | - .addClass(prefix + 'Photo') | |
705 | - .error(function () { | |
706 | - settings.title = false; | |
707 | - prep($div('Error').text('This image could not be loaded')); | |
708 | - }) | |
709 | - .load(function () { | |
710 | - var percent; | |
711 | - photo.onload = null; //stops animated gifs from firing the onload repeatedly. | |
712 | - | |
713 | - if (settings.scalePhotos) { | |
714 | - setResize = function () { | |
715 | - photo.height -= photo.height * percent; | |
716 | - photo.width -= photo.width * percent; | |
717 | - }; | |
718 | - if (settings.mw && photo.width > settings.mw) { | |
719 | - percent = (photo.width - settings.mw) / photo.width; | |
720 | - setResize(); | |
721 | - } | |
722 | - if (settings.mh && photo.height > settings.mh) { | |
723 | - percent = (photo.height - settings.mh) / photo.height; | |
724 | - setResize(); | |
725 | - } | |
726 | - } | |
727 | - | |
728 | - if (settings.h) { | |
729 | - photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px'; | |
730 | - } | |
731 | - | |
732 | - if ($related[1] && (index < $related.length - 1 || settings.loop)) { | |
733 | - photo.style.cursor = 'pointer'; | |
734 | - photo.onclick = function () { | |
735 | - publicMethod.next(); | |
736 | - }; | |
737 | - } | |
738 | - | |
739 | - if (isIE) { | |
740 | - photo.style.msInterpolationMode = 'bicubic'; | |
741 | - } | |
742 | - | |
743 | - setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise. | |
744 | - prep(photo); | |
745 | - }, 1); | |
746 | - }); | |
747 | - | |
748 | - setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise. | |
749 | - photo.src = href; | |
750 | - }, 1); | |
751 | - } else if (href) { | |
752 | - $loadingBay.load(href, function (data, status, xhr) { | |
753 | - prep(status === 'error' ? $div('Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents()); | |
754 | - }); | |
755 | - } | |
756 | - }; | |
757 | - | |
758 | - // Navigates to the next page/image in a set. | |
759 | - publicMethod.next = function () { | |
760 | - if (!active && $related[1] && (index < $related.length - 1 || settings.loop)) { | |
761 | - index = index < $related.length - 1 ? index + 1 : 0; | |
762 | - publicMethod.load(); | |
763 | - } | |
764 | - }; | |
765 | - | |
766 | - publicMethod.prev = function () { | |
767 | - if (!active && $related[1] && (index || settings.loop)) { | |
768 | - index = index ? index - 1 : $related.length - 1; | |
769 | - publicMethod.load(); | |
770 | - } | |
771 | - }; | |
772 | - | |
773 | - // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close(); | |
774 | - publicMethod.close = function () { | |
775 | - if (open && !closing) { | |
776 | - | |
777 | - closing = true; | |
778 | - | |
779 | - open = false; | |
780 | - | |
781 | - trigger(event_cleanup, settings.onCleanup); | |
782 | - | |
783 | - $window.unbind('.' + prefix + ' .' + event_ie6); | |
784 | - | |
785 | - $overlay.fadeTo(200, 0); | |
786 | - | |
787 | - $box.stop().fadeTo(300, 0, function () { | |
788 | - | |
789 | - $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide(); | |
790 | - | |
791 | - trigger(event_purge); | |
792 | - | |
793 | - $loaded.remove(); | |
794 | - | |
795 | - setTimeout(function () { | |
796 | - closing = false; | |
797 | - trigger(event_closed, settings.onClosed); | |
798 | - }, 1); | |
799 | - }); | |
800 | - } | |
801 | - }; | |
802 | - | |
803 | - // A method for fetching the current element ColorBox is referencing. | |
804 | - // returns a jQuery object. | |
805 | - publicMethod.element = function () { | |
806 | - return $(element); | |
807 | - }; | |
808 | - | |
809 | - publicMethod.settings = defaults; | |
810 | - | |
811 | - // Initializes ColorBox when the DOM has loaded | |
812 | - $(publicMethod.init); | |
813 | - | |
814 | -}(jQuery, document, this)); | |
815 | 0 | \ No newline at end of file |
public/javascripts/comment_form.js
... | ... | @@ -53,7 +53,7 @@ function save_comment(button) { |
53 | 53 | //Comment of reply |
54 | 54 | $('#'+ data.render_target).replaceWith(data.html); |
55 | 55 | $('#' + data.render_target).effect("highlight", {}, 3000); |
56 | - $.colorbox.close(); | |
56 | + noosfero.modal.close(); | |
57 | 57 | increment_comment_count(comment_div); |
58 | 58 | } else { |
59 | 59 | //New comment of article |
... | ... | @@ -64,7 +64,7 @@ function save_comment(button) { |
64 | 64 | }); |
65 | 65 | |
66 | 66 | page_comment_form.find('.errorExplanation').remove(); |
67 | - $.colorbox.close(); | |
67 | + noosfero.modal.close(); | |
68 | 68 | increment_comment_count(comment_div); |
69 | 69 | } |
70 | 70 | ... | ... |
... | ... | @@ -0,0 +1,7 @@ |
1 | +/*! | |
2 | + Colorbox v1.4.36 - 2014-02-01 | |
3 | + jQuery lightbox and modal window plugin | |
4 | + (c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox | |
5 | + license: http://www.opensource.org/licenses/mit-license.php | |
6 | +*/ | |
7 | +(function(e,t,i){function o(i,o,n){var r=t.createElement(i);return o&&(r.id=Z+o),n&&(r.style.cssText=n),e(r)}function n(){return i.innerHeight?i.innerHeight:e(i).height()}function r(e){var t=k.length,i=(z+e)%t;return 0>i?t+i:i}function h(e,t){return Math.round((/%/.test(e)?("x"===t?E.width():n())/100:1)*parseInt(e,10))}function l(e,t){return e.photo||e.photoRegex.test(t)}function s(e,t){return e.retinaUrl&&i.devicePixelRatio>1?t.replace(e.photoRegex,e.retinaSuffix):t}function a(e){"contains"in g[0]&&!g[0].contains(e.target)&&(e.stopPropagation(),g.focus())}function d(){var t,i=e.data(N,Y);null==i?(B=e.extend({},X),console&&console.log&&console.log("Error: cboxElement missing settings object")):B=e.extend({},i);for(t in B)e.isFunction(B[t])&&"on"!==t.slice(0,2)&&(B[t]=B[t].call(N));B.rel=B.rel||N.rel||e(N).data("rel")||"nofollow",B.href=B.href||e(N).attr("href"),B.title=B.title||N.title,"string"==typeof B.href&&(B.href=e.trim(B.href))}function c(i,o){e(t).trigger(i),lt.triggerHandler(i),e.isFunction(o)&&o.call(N)}function u(i){q||(N=i,d(),k=e(N),z=0,"nofollow"!==B.rel&&(k=e("."+et).filter(function(){var t,i=e.data(this,Y);return i&&(t=e(this).data("rel")||i.rel||this.rel),t===B.rel}),z=k.index(N),-1===z&&(k=k.add(N),z=k.length-1)),w.css({opacity:parseFloat(B.opacity),cursor:B.overlayClose?"pointer":"auto",visibility:"visible"}).show(),J&&g.add(w).removeClass(J),B.className&&g.add(w).addClass(B.className),J=B.className,B.closeButton?K.html(B.close).appendTo(y):K.appendTo("<div/>"),U||(U=$=!0,g.css({visibility:"hidden",display:"block"}),H=o(st,"LoadedContent","width:0; height:0; overflow:hidden"),y.css({width:"",height:""}).append(H),O=x.height()+C.height()+y.outerHeight(!0)-y.height(),_=b.width()+T.width()+y.outerWidth(!0)-y.width(),D=H.outerHeight(!0),A=H.outerWidth(!0),B.w=h(B.initialWidth,"x"),B.h=h(B.initialHeight,"y"),H.css({width:"",height:B.h}),Q.position(),c(tt,B.onOpen),P.add(L).hide(),g.focus(),B.trapFocus&&t.addEventListener&&(t.addEventListener("focus",a,!0),lt.one(rt,function(){t.removeEventListener("focus",a,!0)})),B.returnFocus&<.one(rt,function(){e(N).focus()})),m())}function f(){!g&&t.body&&(V=!1,E=e(i),g=o(st).attr({id:Y,"class":e.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),w=o(st,"Overlay").hide(),F=e([o(st,"LoadingOverlay")[0],o(st,"LoadingGraphic")[0]]),v=o(st,"Wrapper"),y=o(st,"Content").append(L=o(st,"Title"),S=o(st,"Current"),I=e('<button type="button"/>').attr({id:Z+"Previous"}),R=e('<button type="button"/>').attr({id:Z+"Next"}),M=o("button","Slideshow"),F),K=e('<button type="button"/>').attr({id:Z+"Close"}),v.append(o(st).append(o(st,"TopLeft"),x=o(st,"TopCenter"),o(st,"TopRight")),o(st,!1,"clear:left").append(b=o(st,"MiddleLeft"),y,T=o(st,"MiddleRight")),o(st,!1,"clear:left").append(o(st,"BottomLeft"),C=o(st,"BottomCenter"),o(st,"BottomRight"))).find("div div").css({"float":"left"}),W=o(st,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),P=R.add(I).add(S).add(M),e(t.body).append(w,g.append(v,W)))}function p(){function i(e){e.which>1||e.shiftKey||e.altKey||e.metaKey||e.ctrlKey||(e.preventDefault(),u(this))}return g?(V||(V=!0,R.click(function(){Q.next()}),I.click(function(){Q.prev()}),K.click(function(){Q.close()}),w.click(function(){B.overlayClose&&Q.close()}),e(t).bind("keydown."+Z,function(e){var t=e.keyCode;U&&B.escKey&&27===t&&(e.preventDefault(),Q.close()),U&&B.arrowKey&&k[1]&&!e.altKey&&(37===t?(e.preventDefault(),I.click()):39===t&&(e.preventDefault(),R.click()))}),e.isFunction(e.fn.on)?e(t).on("click."+Z,"."+et,i):e("."+et).live("click."+Z,i)),!0):!1}function m(){var n,r,a,u=Q.prep,f=++at;$=!0,j=!1,N=k[z],d(),c(ht),c(it,B.onLoad),B.h=B.height?h(B.height,"y")-D-O:B.innerHeight&&h(B.innerHeight,"y"),B.w=B.width?h(B.width,"x")-A-_:B.innerWidth&&h(B.innerWidth,"x"),B.mw=B.w,B.mh=B.h,B.maxWidth&&(B.mw=h(B.maxWidth,"x")-A-_,B.mw=B.w&&B.w<B.mw?B.w:B.mw),B.maxHeight&&(B.mh=h(B.maxHeight,"y")-D-O,B.mh=B.h&&B.h<B.mh?B.h:B.mh),n=B.href,G=setTimeout(function(){F.show()},100),B.inline?(a=o(st).hide().insertBefore(e(n)[0]),lt.one(ht,function(){a.replaceWith(H.children())}),u(e(n))):B.iframe?u(" "):B.html?u(B.html):l(B,n)?(n=s(B,n),j=t.createElement("img"),e(j).addClass(Z+"Photo").bind("error",function(){B.title=!1,u(o(st,"Error").html(B.imgError))}).one("load",function(){var t;f===at&&(e.each(["alt","longdesc","aria-describedby"],function(t,i){var o=e(N).attr(i)||e(N).attr("data-"+i);o&&j.setAttribute(i,o)}),B.retinaImage&&i.devicePixelRatio>1&&(j.height=j.height/i.devicePixelRatio,j.width=j.width/i.devicePixelRatio),B.scalePhotos&&(r=function(){j.height-=j.height*t,j.width-=j.width*t},B.mw&&j.width>B.mw&&(t=(j.width-B.mw)/j.width,r()),B.mh&&j.height>B.mh&&(t=(j.height-B.mh)/j.height,r())),B.h&&(j.style.marginTop=Math.max(B.mh-j.height,0)/2+"px"),k[1]&&(B.loop||k[z+1])&&(j.style.cursor="pointer",j.onclick=function(){Q.next()}),j.style.width=j.width+"px",j.style.height=j.height+"px",setTimeout(function(){u(j)},1))}),setTimeout(function(){j.src=n},1)):n&&W.load(n,B.data,function(t,i){f===at&&u("error"===i?o(st,"Error").html(B.xhrError):e(this).contents())})}var w,g,v,y,x,b,T,C,k,E,H,W,F,L,S,M,R,I,K,P,B,O,_,D,A,N,z,j,U,$,q,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1},Y="colorbox",Z="cbox",et=Z+"Element",tt=Z+"_open",it=Z+"_load",ot=Z+"_complete",nt=Z+"_cleanup",rt=Z+"_closed",ht=Z+"_purge",lt=e("<a/>"),st="div",at=0,dt={},ct=function(){function e(){clearTimeout(h)}function t(){(B.loop||k[z+1])&&(e(),h=setTimeout(Q.next,B.slideshowSpeed))}function i(){M.html(B.slideshowStop).unbind(s).one(s,o),lt.bind(ot,t).bind(it,e),g.removeClass(l+"off").addClass(l+"on")}function o(){e(),lt.unbind(ot,t).unbind(it,e),M.html(B.slideshowStart).unbind(s).one(s,function(){Q.next(),i()}),g.removeClass(l+"on").addClass(l+"off")}function n(){r=!1,M.hide(),e(),lt.unbind(ot,t).unbind(it,e),g.removeClass(l+"off "+l+"on")}var r,h,l=Z+"Slideshow_",s="click."+Z;return function(){r?B.slideshow||(lt.unbind(nt,n),n()):B.slideshow&&k[1]&&(r=!0,lt.one(nt,n),B.slideshowAuto?i():o(),M.show())}}();e.colorbox||(e(f),Q=e.fn[Y]=e[Y]=function(t,i){var o=this;if(t=t||{},f(),p()){if(e.isFunction(o))o=e("<a/>"),t.open=!0;else if(!o[0])return o;i&&(t.onComplete=i),o.each(function(){e.data(this,Y,e.extend({},e.data(this,Y)||X,t))}).addClass(et),(e.isFunction(t.open)&&t.open.call(o)||t.open)&&u(o[0])}return o},Q.position=function(t,i){function o(){x[0].style.width=C[0].style.width=y[0].style.width=parseInt(g[0].style.width,10)-_+"px",y[0].style.height=b[0].style.height=T[0].style.height=parseInt(g[0].style.height,10)-O+"px"}var r,l,s,a=0,d=0,c=g.offset();if(E.unbind("resize."+Z),g.css({top:-9e4,left:-9e4}),l=E.scrollTop(),s=E.scrollLeft(),B.fixed?(c.top-=l,c.left-=s,g.css({position:"fixed"})):(a=l,d=s,g.css({position:"absolute"})),d+=B.right!==!1?Math.max(E.width()-B.w-A-_-h(B.right,"x"),0):B.left!==!1?h(B.left,"x"):Math.round(Math.max(E.width()-B.w-A-_,0)/2),a+=B.bottom!==!1?Math.max(n()-B.h-D-O-h(B.bottom,"y"),0):B.top!==!1?h(B.top,"y"):Math.round(Math.max(n()-B.h-D-O,0)/2),g.css({top:c.top,left:c.left,visibility:"visible"}),v[0].style.width=v[0].style.height="9999px",r={width:B.w+A+_,height:B.h+D+O,top:a,left:d},t){var u=0;e.each(r,function(e){return r[e]!==dt[e]?(u=t,void 0):void 0}),t=u}dt=r,t||g.css(r),g.dequeue().animate(r,{duration:t||0,complete:function(){o(),$=!1,v[0].style.width=B.w+A+_+"px",v[0].style.height=B.h+D+O+"px",B.reposition&&setTimeout(function(){E.bind("resize."+Z,Q.position)},1),i&&i()},step:o})},Q.resize=function(e){var t;U&&(e=e||{},e.width&&(B.w=h(e.width,"x")-A-_),e.innerWidth&&(B.w=h(e.innerWidth,"x")),H.css({width:B.w}),e.height&&(B.h=h(e.height,"y")-D-O),e.innerHeight&&(B.h=h(e.innerHeight,"y")),e.innerHeight||e.height||(t=H.scrollTop(),H.css({height:"auto"}),B.h=H.height()),H.css({height:B.h}),t&&H.scrollTop(t),Q.position("none"===B.transition?0:B.speed))},Q.prep=function(i){function n(){return B.w=B.w||H.width(),B.w=B.mw&&B.mw<B.w?B.mw:B.w,B.w}function h(){return B.h=B.h||H.height(),B.h=B.mh&&B.mh<B.h?B.mh:B.h,B.h}if(U){var a,d="none"===B.transition?0:B.speed;H.empty().remove(),H=o(st,"LoadedContent").append(i),H.hide().appendTo(W.show()).css({width:n(),overflow:B.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(y),W.hide(),e(j).css({"float":"none"}),a=function(){function i(){e.support.opacity===!1&&g[0].style.removeAttribute("filter")}var n,h,a=k.length,u="frameBorder",f="allowTransparency";U&&(h=function(){clearTimeout(G),F.hide(),c(ot,B.onComplete)},L.html(B.title).add(H).show(),a>1?("string"==typeof B.current&&S.html(B.current.replace("{current}",z+1).replace("{total}",a)).show(),R[B.loop||a-1>z?"show":"hide"]().html(B.next),I[B.loop||z?"show":"hide"]().html(B.previous),ct(),B.preloading&&e.each([r(-1),r(1)],function(){var i,o,n=k[this],r=e.data(n,Y);r&&r.href?(i=r.href,e.isFunction(i)&&(i=i.call(n))):i=e(n).attr("href"),i&&l(r,i)&&(i=s(r,i),o=t.createElement("img"),o.src=i)})):P.hide(),B.iframe?(n=o("iframe")[0],u in n&&(n[u]=0),f in n&&(n[f]="true"),B.scrolling||(n.scrolling="no"),e(n).attr({src:B.href,name:(new Date).getTime(),"class":Z+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",h).appendTo(H),lt.one(ht,function(){n.src="//about:blank"}),B.fastIframe&&e(n).trigger("load")):h(),"fade"===B.transition?g.fadeTo(d,1,i):i())},"fade"===B.transition?g.fadeTo(d,0,function(){Q.position(0,a)}):Q.position(d,a)}},Q.next=function(){!$&&k[1]&&(B.loop||k[z+1])&&(z=r(1),u(k[z]))},Q.prev=function(){!$&&k[1]&&(B.loop||z)&&(z=r(-1),u(k[z]))},Q.close=function(){U&&!q&&(q=!0,U=!1,c(nt,B.onCleanup),E.unbind("."+Z),w.fadeTo(B.fadeOut||0,0),g.stop().fadeTo(B.fadeOut||0,0,function(){g.add(w).css({opacity:1,cursor:"auto"}).hide(),c(ht),H.empty().remove(),setTimeout(function(){q=!1,c(rt,B.onClosed)},1)}))},Q.remove=function(){g&&(g.stop(),e.colorbox.close(),g.stop().remove(),w.remove(),q=!1,g=null,e("."+et).removeData(Y).removeClass(et),e(t).unbind("click."+Z))},Q.element=function(){return e(N)},Q.settings=X)})(jQuery,document,window); | |
0 | 8 | \ No newline at end of file | ... | ... |
public/javascripts/lightbox.js
... | ... | @@ -1,232 +0,0 @@ |
1 | -/* | |
2 | -Created By: Chris Campbell | |
3 | -Website: http://particletree.com | |
4 | -Date: 2/1/2006 | |
5 | - | |
6 | -Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ | |
7 | -*/ | |
8 | - | |
9 | -/*-------------------------------GLOBAL VARIABLES------------------------------------*/ | |
10 | - | |
11 | -var detect = navigator.userAgent.toLowerCase(); | |
12 | -var OS,browser,version,total,thestring; | |
13 | - | |
14 | -/*-----------------------------------------------------------------------------------------------*/ | |
15 | - | |
16 | -//Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/ | |
17 | - | |
18 | -function getBrowserInfo() { | |
19 | - if (checkIt('konqueror')) { | |
20 | - browser = "Konqueror"; | |
21 | - OS = "Linux"; | |
22 | - } | |
23 | - else if (checkIt('safari')) browser = "Safari" | |
24 | - else if (checkIt('omniweb')) browser = "OmniWeb" | |
25 | - else if (checkIt('opera')) browser = "Opera" | |
26 | - else if (checkIt('webtv')) browser = "WebTV"; | |
27 | - else if (checkIt('icab')) browser = "iCab" | |
28 | - else if (checkIt('msie')) browser = "Internet Explorer" | |
29 | - else if (!checkIt('compatible')) { | |
30 | - browser = "Netscape Navigator" | |
31 | - version = detect.charAt(8); | |
32 | - } | |
33 | - else browser = "An unknown browser"; | |
34 | - | |
35 | - if (!version) version = detect.charAt(place + thestring.length); | |
36 | - | |
37 | - if (!OS) { | |
38 | - if (checkIt('linux')) OS = "Linux"; | |
39 | - else if (checkIt('x11')) OS = "Unix"; | |
40 | - else if (checkIt('mac')) OS = "Mac" | |
41 | - else if (checkIt('win')) OS = "Windows" | |
42 | - else OS = "an unknown operating system"; | |
43 | - } | |
44 | -} | |
45 | - | |
46 | -function checkIt(string) { | |
47 | - place = detect.indexOf(string) + 1; | |
48 | - thestring = string; | |
49 | - return place; | |
50 | -} | |
51 | - | |
52 | -/*-----------------------------------------------------------------------------------------------*/ | |
53 | - | |
54 | -Event.observe(window, 'load', getBrowserInfo, false); | |
55 | - | |
56 | -var lightbox = Class.create(); | |
57 | - | |
58 | -lightbox.prototype = { | |
59 | - | |
60 | - yPos : 0, | |
61 | - xPos : 0, | |
62 | - | |
63 | - initialize: function(ctrl) { | |
64 | - this.content = ctrl.href; | |
65 | - if (ctrl.id != '') { | |
66 | - this.lightbox_className = ctrl.id; | |
67 | - } | |
68 | - ctrl.onclick = function(){return false;}; | |
69 | - ctrl.lightbox = this; | |
70 | - }, | |
71 | - | |
72 | - // Turn everything on - mainly the IE fixes | |
73 | - activate: function(){ | |
74 | - if (browser == 'Internet Explorer'){ | |
75 | - this.getScroll(); | |
76 | - this.prepareIE('100%', 'hidden'); | |
77 | - this.setScroll(0,0); | |
78 | - this.hideSelects('hidden'); | |
79 | - } | |
80 | - this.hideObjectsAndEmbeds('hidden'); | |
81 | - this.displayLightbox("block"); | |
82 | - }, | |
83 | - | |
84 | - // Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox | |
85 | - prepareIE: function(height, overflow){ | |
86 | - bod = document.getElementsByTagName('body')[0]; | |
87 | - bod.style.height = height; | |
88 | - bod.style.overflow = overflow; | |
89 | - | |
90 | - htm = document.getElementsByTagName('html')[0]; | |
91 | - htm.style.height = height; | |
92 | - htm.style.overflow = overflow; | |
93 | - }, | |
94 | - | |
95 | - // In IE, select elements hover on top of the lightbox | |
96 | - hideSelects: function(visibility){ | |
97 | - selects = document.getElementsByTagName('select'); | |
98 | - for(i = 0; i < selects.length; i++) { | |
99 | - selects[i].style.visibility = visibility; | |
100 | - } | |
101 | - }, | |
102 | - | |
103 | - // In FF, objects and embeds elements hover on top of the lightbox | |
104 | - hideObjectsAndEmbeds: function(visibility){ | |
105 | - var f = function(collection) { | |
106 | - for(i = 0; i < collection.length; i++) { | |
107 | - if (collection[i].style) { | |
108 | - collection[i].style.visibility = visibility; | |
109 | - } | |
110 | - } | |
111 | - }; | |
112 | - f(document.getElementsByTagName('object')); | |
113 | - f(document.getElementsByTagName('embed')); | |
114 | - }, | |
115 | - | |
116 | - // Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ | |
117 | - getScroll: function(){ | |
118 | - if (self.pageYOffset) { | |
119 | - this.yPos = self.pageYOffset; | |
120 | - } else if (document.documentElement && document.documentElement.scrollTop){ | |
121 | - this.yPos = document.documentElement.scrollTop; | |
122 | - } else if (document.body) { | |
123 | - this.yPos = document.body.scrollTop; | |
124 | - } | |
125 | - }, | |
126 | - | |
127 | - setScroll: function(x, y){ | |
128 | - window.scrollTo(x, y); | |
129 | - }, | |
130 | - | |
131 | - displayLightbox: function(display){ | |
132 | - $('overlay').style.display = display; | |
133 | - $('lightbox').style.display = display; | |
134 | - if(display != 'none') this.loadInfo(); | |
135 | - }, | |
136 | - | |
137 | - // Begin Ajax request based off of the href of the clicked linked | |
138 | - loadInfo: function() { | |
139 | - var myAjax = new Ajax.Request( | |
140 | - this.content, | |
141 | - {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)} | |
142 | - ); | |
143 | - | |
144 | - }, | |
145 | - | |
146 | - // Display Ajax response | |
147 | - processInfo: function(response){ | |
148 | - info = "<div id='lbContent'><div id='lbBottomBG'><div id='lbTopBG'>" + response.responseText + "</div></div></div>"; | |
149 | - new Insertion.Before($('lbLoadMessage'), info) | |
150 | - if (this.lightbox_className) { | |
151 | - $('lightbox').className = "done " + this.lightbox_className; | |
152 | - } else { | |
153 | - $('lightbox').className = "done"; | |
154 | - } | |
155 | - this.actions(); | |
156 | - }, | |
157 | - | |
158 | - // Search through new links within the lightbox, and attach click event | |
159 | - actions: function(){ | |
160 | - lbActions = document.getElementsByClassName('lbAction'); | |
161 | - | |
162 | - for(i = 0; i < lbActions.length; i++) { | |
163 | - Event.observe(lbActions[i], 'click', this[lbActions[i].rel].bindAsEventListener(this), false); | |
164 | - lbActions[i].onclick = function(){return false;}; | |
165 | - } | |
166 | - | |
167 | - }, | |
168 | - | |
169 | - // Example of creating your own functionality once lightbox is initiated | |
170 | - insert: function(e){ | |
171 | - link = Event.element(e).parentNode; | |
172 | - Element.remove($('lbContent')); | |
173 | - | |
174 | - var myAjax = new Ajax.Request( | |
175 | - link.href, | |
176 | - {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)} | |
177 | - ); | |
178 | - | |
179 | - }, | |
180 | - | |
181 | - // Example of creating your own functionality once lightbox is initiated | |
182 | - deactivate: function(){ | |
183 | - Element.remove($('lbContent')); | |
184 | - | |
185 | - if (browser == "Internet Explorer"){ | |
186 | - this.setScroll(0,this.yPos); | |
187 | - this.prepareIE("auto", "auto"); | |
188 | - this.hideSelects("visible"); | |
189 | - } | |
190 | - this.hideObjectsAndEmbeds("visible"); | |
191 | - this.displayLightbox("none"); | |
192 | - } | |
193 | -} | |
194 | - | |
195 | -/*-----------------------------------------------------------------------------------------------*/ | |
196 | - | |
197 | -jQuery('.lbOn').live('click', function(event) { | |
198 | - if (jQuery('#lbLoadMessage').length == 0) | |
199 | - addLightboxMarkup(); | |
200 | - if (this.lightbox == undefined) | |
201 | - valid = new lightbox(this); | |
202 | - else { | |
203 | - removeLightboxMarkup(); | |
204 | - addLightboxMarkup(); | |
205 | - } | |
206 | - | |
207 | - this.lightbox.activate(); | |
208 | - | |
209 | - event.preventDefault(); | |
210 | - return false; | |
211 | -}); | |
212 | - | |
213 | -// Add in markup necessary to make this work. Basically two divs: | |
214 | -// Overlay holds the shadow | |
215 | -// Lightbox is the centered square that the content is put into. | |
216 | -function addLightboxMarkup() { | |
217 | - bod = document.getElementsByTagName('body')[0]; | |
218 | - overlay = document.createElement('div'); | |
219 | - overlay.id = 'overlay'; | |
220 | - lb = document.createElement('div'); | |
221 | - lb.id = 'lightbox'; | |
222 | - lb.className = 'loading'; | |
223 | - lb.innerHTML = '<div id="lbLoadMessage">' + | |
224 | - '<img src="' + noosfero_root() + '/images/2loading.gif"/>' + | |
225 | - '</div>'; | |
226 | - bod.appendChild(overlay); | |
227 | - bod.appendChild(lb); | |
228 | -} | |
229 | -function removeLightboxMarkup() { | |
230 | - Element.remove($('overlay')); | |
231 | - Element.remove($('lightbox')); | |
232 | -} |
... | ... | @@ -0,0 +1,58 @@ |
1 | +noosfero.modal = { | |
2 | + | |
3 | + watchClass: function() { | |
4 | + jQuery(function($) { | |
5 | + $(document).delegate('.modal-toggle', 'click', function() { | |
6 | + $.colorbox({ | |
7 | + href: $(this).attr('href'), | |
8 | + maxWidth: $(window).width()-50, | |
9 | + height: $(window).height()-50, | |
10 | + open: true, | |
11 | + close: 'Cancel', | |
12 | + class: 'modal', | |
13 | + onComplete: function(bt) { | |
14 | + var opt = {}, maxH = $(window).height()-50; | |
15 | + if ($('#cboxLoadedContent *:first').height() > maxH) opt.height = maxH; | |
16 | + $.colorbox.resize(opt); | |
17 | + } | |
18 | + }); | |
19 | + return false; | |
20 | + }); | |
21 | + | |
22 | + $(document).delegate('.modal-close', 'click', function() { | |
23 | + $.colorbox.close(); | |
24 | + return false; | |
25 | + }); | |
26 | + | |
27 | + }); | |
28 | + }, | |
29 | + | |
30 | + inline: function(href, options) { | |
31 | + href = jQuery(href); | |
32 | + options = jQuery.extend({ | |
33 | + inline: true, href: href, | |
34 | + onLoad: function(){ href.show(); }, | |
35 | + onCleanup: function(){ href.hide(); }, | |
36 | + }, options) | |
37 | + | |
38 | + jQuery.colorbox(options); | |
39 | + | |
40 | + return false; | |
41 | + }, | |
42 | + | |
43 | + html: function(html, options) { | |
44 | + options = jQuery.extend({ | |
45 | + html: html, | |
46 | + }, options); | |
47 | + | |
48 | + jQuery.colorbox(options); | |
49 | + }, | |
50 | + | |
51 | + close: function() { | |
52 | + jQuery.colorbox.close(); | |
53 | + }, | |
54 | + | |
55 | +}; | |
56 | + | |
57 | +noosfero.modal.watchClass(); | |
58 | + | ... | ... |
public/javascripts/report-abuse.js
public/javascripts/thickbox.js
... | ... | @@ -1,319 +0,0 @@ |
1 | -/* | |
2 | - * Thickbox 3.1 - One Box To Rule Them All. | |
3 | - * By Cody Lindley (http://www.codylindley.com) | |
4 | - * Copyright (c) 2007 cody lindley | |
5 | - * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php | |
6 | -*/ | |
7 | - | |
8 | -var tb_pathToImage = "/images/loading.gif"; | |
9 | - | |
10 | -/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ | |
11 | - | |
12 | -//on page load call tb_init | |
13 | -jQuery(document).ready(function(){ | |
14 | - tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox | |
15 | - imgLoader = new Image();// preload image | |
16 | - imgLoader.src = noosfero_root() + tb_pathToImage; | |
17 | -}); | |
18 | - | |
19 | -//add thickbox to href & area elements that have a class of .thickbox | |
20 | -function tb_init(domChunk){ | |
21 | - jQuery(domChunk).click(function(){ | |
22 | - var t = this.title || this.name || null; | |
23 | - var a = this.href || this.alt; | |
24 | - var g = this.rel || false; | |
25 | - tb_show(t,a,g); | |
26 | - this.blur(); | |
27 | - return false; | |
28 | - }); | |
29 | -} | |
30 | - | |
31 | -function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link | |
32 | - | |
33 | - try { | |
34 | - if (typeof document.body.style.maxHeight === "undefined") {//if IE 6 | |
35 | - jQuery("body","html").css({height: "100%", width: "100%"}); | |
36 | - jQuery("html").css("overflow","hidden"); | |
37 | - if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 | |
38 | - jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"); | |
39 | - jQuery("#TB_overlay").click(tb_remove); | |
40 | - } | |
41 | - }else{//all others | |
42 | - if(document.getElementById("TB_overlay") === null){ | |
43 | - jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>"); | |
44 | - jQuery("#TB_overlay").click(tb_remove); | |
45 | - } | |
46 | - } | |
47 | - | |
48 | - if(tb_detectMacXFF()){ | |
49 | - jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash | |
50 | - }else{ | |
51 | - jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity | |
52 | - } | |
53 | - | |
54 | - if(caption===null){caption="";} | |
55 | - jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page | |
56 | - jQuery('#TB_load').show();//show loader | |
57 | - | |
58 | - var baseURL; | |
59 | - if(url.indexOf("?")!==-1){ //ff there is a query string involved | |
60 | - baseURL = url.substr(0, url.indexOf("?")); | |
61 | - }else{ | |
62 | - baseURL = url; | |
63 | - } | |
64 | - | |
65 | - var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; | |
66 | - var urlType = baseURL.toLowerCase().match(urlString); | |
67 | - | |
68 | - if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images | |
69 | - | |
70 | - TB_PrevCaption = ""; | |
71 | - TB_PrevURL = ""; | |
72 | - TB_PrevHTML = ""; | |
73 | - TB_NextCaption = ""; | |
74 | - TB_NextURL = ""; | |
75 | - TB_NextHTML = ""; | |
76 | - TB_imageCount = ""; | |
77 | - TB_FoundURL = false; | |
78 | - if(imageGroup){ | |
79 | - TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get(); | |
80 | - for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { | |
81 | - var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); | |
82 | - if (!(TB_TempArray[TB_Counter].href == url)) { | |
83 | - if (TB_FoundURL) { | |
84 | - TB_NextCaption = TB_TempArray[TB_Counter].title; | |
85 | - TB_NextURL = TB_TempArray[TB_Counter].href; | |
86 | - TB_NextHTML = "<span id='TB_next'> <a href='#'>Next ></a></span>"; | |
87 | - } else { | |
88 | - TB_PrevCaption = TB_TempArray[TB_Counter].title; | |
89 | - TB_PrevURL = TB_TempArray[TB_Counter].href; | |
90 | - TB_PrevHTML = "<span id='TB_prev'> <a href='#'>< Prev</a></span>"; | |
91 | - } | |
92 | - } else { | |
93 | - TB_FoundURL = true; | |
94 | - TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); | |
95 | - } | |
96 | - } | |
97 | - } | |
98 | - | |
99 | - imgPreloader = new Image(); | |
100 | - imgPreloader.onload = function(){ | |
101 | - imgPreloader.onload = null; | |
102 | - | |
103 | - // Resizing large images - orginal by Christian Montoya edited by me. | |
104 | - var pagesize = tb_getPageSize(); | |
105 | - var x = pagesize[0] - 150; | |
106 | - var y = pagesize[1] - 150; | |
107 | - var imageWidth = imgPreloader.width; | |
108 | - var imageHeight = imgPreloader.height; | |
109 | - if (imageWidth > x) { | |
110 | - imageHeight = imageHeight * (x / imageWidth); | |
111 | - imageWidth = x; | |
112 | - if (imageHeight > y) { | |
113 | - imageWidth = imageWidth * (y / imageHeight); | |
114 | - imageHeight = y; | |
115 | - } | |
116 | - } else if (imageHeight > y) { | |
117 | - imageWidth = imageWidth * (y / imageHeight); | |
118 | - imageHeight = y; | |
119 | - if (imageWidth > x) { | |
120 | - imageHeight = imageHeight * (x / imageWidth); | |
121 | - imageWidth = x; | |
122 | - } | |
123 | - } | |
124 | - // End Resizing | |
125 | - | |
126 | - TB_WIDTH = imageWidth + 30; | |
127 | - TB_HEIGHT = imageHeight + 60; | |
128 | - jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>"); | |
129 | - | |
130 | - jQuery("#TB_closeWindowButton").click(tb_remove); | |
131 | - | |
132 | - if (!(TB_PrevHTML === "")) { | |
133 | - function goPrev(){ | |
134 | - if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);} | |
135 | - jQuery("#TB_window").remove(); | |
136 | - jQuery("body").append("<div id='TB_window'></div>"); | |
137 | - tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); | |
138 | - return false; | |
139 | - } | |
140 | - jQuery("#TB_prev").click(goPrev); | |
141 | - } | |
142 | - | |
143 | - if (!(TB_NextHTML === "")) { | |
144 | - function goNext(){ | |
145 | - jQuery("#TB_window").remove(); | |
146 | - jQuery("body").append("<div id='TB_window'></div>"); | |
147 | - tb_show(TB_NextCaption, TB_NextURL, imageGroup); | |
148 | - return false; | |
149 | - } | |
150 | - jQuery("#TB_next").click(goNext); | |
151 | - | |
152 | - } | |
153 | - | |
154 | - document.onkeydown = function(e){ | |
155 | - if (e == null) { // ie | |
156 | - keycode = event.keyCode; | |
157 | - } else { // mozilla | |
158 | - keycode = e.which; | |
159 | - } | |
160 | - if(keycode == 27){ // close | |
161 | - tb_remove(); | |
162 | - } else if(keycode == 190){ // display previous image | |
163 | - if(!(TB_NextHTML == "")){ | |
164 | - document.onkeydown = ""; | |
165 | - goNext(); | |
166 | - } | |
167 | - } else if(keycode == 188){ // display next image | |
168 | - if(!(TB_PrevHTML == "")){ | |
169 | - document.onkeydown = ""; | |
170 | - goPrev(); | |
171 | - } | |
172 | - } | |
173 | - }; | |
174 | - | |
175 | - tb_position(); | |
176 | - jQuery("#TB_load").remove(); | |
177 | - jQuery("#TB_ImageOff").click(tb_remove); | |
178 | - jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show | |
179 | - }; | |
180 | - | |
181 | - imgPreloader.src = url; | |
182 | - }else{//code to show html | |
183 | - | |
184 | - var queryString = url.replace(/^[^\?]+\??/,''); | |
185 | - var params = tb_parseQuery( queryString ); | |
186 | - | |
187 | - TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL | |
188 | - TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL | |
189 | - ajaxContentW = TB_WIDTH - 30; | |
190 | - ajaxContentH = TB_HEIGHT - 45; | |
191 | - | |
192 | - if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window | |
193 | - urlNoQuery = url.split('TB_'); | |
194 | - jQuery("#TB_iframeContent").remove(); | |
195 | - if(params['modal'] != "true"){//iframe no modal | |
196 | - jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>"); | |
197 | - }else{//iframe modal | |
198 | - jQuery("#TB_overlay").unbind(); | |
199 | - jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>"); | |
200 | - } | |
201 | - }else{// not an iframe, ajax | |
202 | - if(jQuery("#TB_window").css("display") != "block"){ | |
203 | - if(params['modal'] != "true"){//ajax no modal | |
204 | - jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>"); | |
205 | - }else{//ajax modal | |
206 | - jQuery("#TB_overlay").unbind(); | |
207 | - jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); | |
208 | - } | |
209 | - }else{//this means the window is already up, we are just loading new content via ajax | |
210 | - jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; | |
211 | - jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; | |
212 | - jQuery("#TB_ajaxContent")[0].scrollTop = 0; | |
213 | - jQuery("#TB_ajaxWindowTitle").html(caption); | |
214 | - } | |
215 | - } | |
216 | - | |
217 | - jQuery("#TB_closeWindowButton").click(tb_remove); | |
218 | - | |
219 | - if(url.indexOf('TB_inline') != -1){ | |
220 | - jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children()); | |
221 | - jQuery("#TB_window").unload(function () { | |
222 | - jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished | |
223 | - }); | |
224 | - tb_position(); | |
225 | - jQuery("#TB_load").remove(); | |
226 | - jQuery("#TB_window").css({display:"block"}); | |
227 | - }else if(url.indexOf('TB_iframe') != -1){ | |
228 | - tb_position(); | |
229 | - if(jQuery.browser.safari){//safari needs help because it will not fire iframe onload | |
230 | - jQuery("#TB_load").remove(); | |
231 | - jQuery("#TB_window").css({display:"block"}); | |
232 | - } | |
233 | - }else{ | |
234 | - jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method | |
235 | - tb_position(); | |
236 | - jQuery("#TB_load").remove(); | |
237 | - tb_init("#TB_ajaxContent a.thickbox"); | |
238 | - jQuery("#TB_window").css({display:"block"}); | |
239 | - }); | |
240 | - } | |
241 | - | |
242 | - } | |
243 | - | |
244 | - if(!params['modal']){ | |
245 | - document.onkeyup = function(e){ | |
246 | - if (e == null) { // ie | |
247 | - keycode = event.keyCode; | |
248 | - } else { // mozilla | |
249 | - keycode = e.which; | |
250 | - } | |
251 | - if(keycode == 27){ // close | |
252 | - tb_remove(); | |
253 | - } | |
254 | - }; | |
255 | - } | |
256 | - | |
257 | - } catch(e) { | |
258 | - //nothing here | |
259 | - } | |
260 | -} | |
261 | - | |
262 | -//helper functions below | |
263 | -function tb_showIframe(){ | |
264 | - jQuery("#TB_load").remove(); | |
265 | - jQuery("#TB_window").css({display:"block"}); | |
266 | -} | |
267 | - | |
268 | -function tb_remove() { | |
269 | - jQuery("#TB_imageOff").unbind("click"); | |
270 | - jQuery("#TB_closeWindowButton").unbind("click"); | |
271 | - jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); | |
272 | - jQuery("#TB_load").remove(); | |
273 | - if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 | |
274 | - jQuery("body","html").css({height: "auto", width: "auto"}); | |
275 | - jQuery("html").css("overflow",""); | |
276 | - } | |
277 | - document.onkeydown = ""; | |
278 | - document.onkeyup = ""; | |
279 | - return false; | |
280 | -} | |
281 | - | |
282 | -function tb_position() { | |
283 | -jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); | |
284 | - if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6 | |
285 | - jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); | |
286 | - } | |
287 | -} | |
288 | - | |
289 | -function tb_parseQuery ( query ) { | |
290 | - var Params = {}; | |
291 | - if ( ! query ) {return Params;}// return empty object | |
292 | - var Pairs = query.split(/[;&]/); | |
293 | - for ( var i = 0; i < Pairs.length; i++ ) { | |
294 | - var KeyVal = Pairs[i].split('='); | |
295 | - if ( ! KeyVal || KeyVal.length != 2 ) {continue;} | |
296 | - var key = unescape( KeyVal[0] ); | |
297 | - var val = unescape( KeyVal[1] ); | |
298 | - val = val.replace(/\+/g, ' '); | |
299 | - Params[key] = val; | |
300 | - } | |
301 | - return Params; | |
302 | -} | |
303 | - | |
304 | -function tb_getPageSize(){ | |
305 | - var de = document.documentElement; | |
306 | - var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; | |
307 | - var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; | |
308 | - arrayPageSize = [w,h]; | |
309 | - return arrayPageSize; | |
310 | -} | |
311 | - | |
312 | -function tb_detectMacXFF() { | |
313 | - var userAgent = navigator.userAgent.toLowerCase(); | |
314 | - if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) { | |
315 | - return true; | |
316 | - } | |
317 | -} | |
318 | - | |
319 | - |
public/stylesheets/application.css
... | ... | @@ -1901,17 +1901,6 @@ a.button.disabled, input.disabled { |
1901 | 1901 | * Block options editor floating window * |
1902 | 1902 | ****************************************/ |
1903 | 1903 | |
1904 | -/* FIXME This changes broke colorboxes all over the place. | |
1905 | - * Therefore I'm canceling them until they are properly treateda. */ | |
1906 | -#cboxLoadedContent { | |
1907 | - background: #FFF; | |
1908 | -/* box-shadow: 0 0 15px #888 inset; | |
1909 | - border-radius: 5px; | |
1910 | - border: 1px solid #777; | |
1911 | - border-left: none; | |
1912 | - border-right: none; */ | |
1913 | -} | |
1914 | - | |
1915 | 1904 | .block-config-options { |
1916 | 1905 | padding: 0px 10px 0px 30px; |
1917 | 1906 | } | ... | ... |
public/stylesheets/colorbox.css
1 | 1 | /* |
2 | - ColorBox Core Style: | |
2 | + Colorbox Core Style: | |
3 | 3 | The following CSS is consistent between example themes and should not be altered. |
4 | 4 | */ |
5 | 5 | #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} |
6 | +#cboxWrapper {max-width:none;} | |
6 | 7 | #cboxOverlay{position:fixed; width:100%; height:100%;} |
7 | 8 | #cboxMiddleLeft, #cboxBottomLeft{clear:left;} |
8 | 9 | #cboxContent{position:relative;} |
9 | -#cboxLoadedContent{overflow:auto;} | |
10 | +#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} | |
10 | 11 | #cboxTitle{margin:0;} |
11 | -#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;} | |
12 | +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} | |
12 | 13 | #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} |
13 | -.cboxPhoto{float:left; margin:auto; border:0; display:block;} | |
14 | +.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} | |
14 | 15 | .cboxIframe{width:100%; height:100%; display:block; border:0;} |
16 | +#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} | |
15 | 17 | |
16 | -/* | |
18 | +/* | |
17 | 19 | User Style: |
18 | - Change the following styles to modify the appearance of ColorBox. They are | |
20 | + Change the following styles to modify the appearance of Colorbox. They are | |
19 | 21 | ordered & tabbed in a way that represents the nesting of the generated HTML. |
20 | 22 | */ |
21 | 23 | #cboxOverlay{background:url(../images/colorbox/overlay.png) repeat 0 0;} |
22 | -#colorbox{} | |
23 | - #cboxTopLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -100px 0;} | |
24 | - #cboxTopRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -129px 0;} | |
25 | - #cboxBottomLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -100px -29px;} | |
26 | - #cboxBottomRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -129px -29px;} | |
24 | +#colorbox{outline:0;} | |
25 | + #cboxTopLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -101px 0;} | |
26 | + #cboxTopRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -130px 0;} | |
27 | + #cboxBottomLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -101px -29px;} | |
28 | + #cboxBottomRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -130px -29px;} | |
27 | 29 | #cboxMiddleLeft{width:21px; background:url(../images/colorbox/controls.png) left top repeat-y;} |
28 | 30 | #cboxMiddleRight{width:21px; background:url(../images/colorbox/controls.png) right top repeat-y;} |
29 | 31 | #cboxTopCenter{height:21px; background:url(../images/colorbox/border.png) 0 0 repeat-x;} |
30 | 32 | #cboxBottomCenter{height:21px; background:url(../images/colorbox/border.png) 0 -29px repeat-x;} |
31 | 33 | #cboxContent{background:#fff; overflow:hidden;} |
34 | + .cboxIframe{background:#fff;} | |
32 | 35 | #cboxError{padding:50px; border:1px solid #ccc;} |
33 | 36 | #cboxLoadedContent{margin-bottom:28px;} |
34 | 37 | #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;} |
35 | 38 | #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;} |
39 | + #cboxLoadingOverlay{background:url(../images/colorbox/loading_background.png) no-repeat center center;} | |
40 | + #cboxLoadingGraphic{background:url(../images/colorbox/loading.gif) no-repeat center center;} | |
41 | + | |
42 | + /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ | |
43 | + #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; } | |
44 | + | |
45 | + /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ | |
46 | + #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} | |
47 | + | |
36 | 48 | #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;} |
37 | 49 | #cboxPrevious{position:absolute; bottom:0; left:0; background:url(../images/colorbox/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;} |
38 | - #cboxPrevious.hover{background-position:-75px -25px;} | |
50 | + #cboxPrevious:hover{background-position:-75px -25px;} | |
39 | 51 | #cboxNext{position:absolute; bottom:0; left:27px; background:url(../images/colorbox/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;} |
40 | - #cboxNext.hover{background-position:-50px -25px;} | |
41 | - #cboxLoadingOverlay{background:url(../images/colorbox/loading_background.png) no-repeat center center;} | |
42 | - #cboxLoadingGraphic{background:url(../images/colorbox/loading.gif) no-repeat center center;} | |
52 | + #cboxNext:hover{background-position:-50px -25px;} | |
43 | 53 | #cboxClose{position:absolute; bottom:0; right:0; background:url(../images/colorbox/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;} |
44 | - #cboxClose.hover{background-position:-25px -25px;} | |
54 | + #cboxClose:hover{background-position:-25px -25px;} | |
45 | 55 | |
46 | 56 | /* |
47 | - The following fixes a problem where IE7+ replaces a PNG's alpha transparency with a black fill | |
48 | - when an alpha filter (opacity change) is set on the element or ancestor element. | |
57 | + The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill | |
58 | + when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9. | |
59 | + See: http://jacklmoore.com/notes/ie-transparency-problems/ | |
49 | 60 | */ |
50 | 61 | .cboxIE #cboxTopLeft, |
51 | 62 | .cboxIE #cboxTopCenter, |
... | ... | @@ -57,26 +68,3 @@ |
57 | 68 | .cboxIE #cboxMiddleRight { |
58 | 69 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); |
59 | 70 | } |
60 | - | |
61 | -/* | |
62 | - The following provides PNG transparency support for IE6 | |
63 | -*/ | |
64 | -.cboxIE6 #cboxTopLeft{background:url(../images/colorbox/ie6/borderTopLeft.png);} | |
65 | -.cboxIE6 #cboxTopCenter{background:url(../images/colorbox/ie6/borderTopCenter.png);} | |
66 | -.cboxIE6 #cboxTopRight{background:url(../images/colorbox/ie6/borderTopRight.png);} | |
67 | -.cboxIE6 #cboxBottomLeft{background:url(../images/colorbox/ie6/borderBottomLeft.png);} | |
68 | -.cboxIE6 #cboxBottomCenter{background:url(../images/colorbox/ie6/borderBottomCenter.png);} | |
69 | -.cboxIE6 #cboxBottomRight{background:url(../images/colorbox/ie6/borderBottomRight.png);} | |
70 | -.cboxIE6 #cboxMiddleLeft{background:url(../images/colorbox/ie6/borderMiddleLeft.png);} | |
71 | -.cboxIE6 #cboxMiddleRight{background:url(../images/colorbox/ie6/borderMiddleRight.png);} | |
72 | - | |
73 | -.cboxIE6 #cboxTopLeft, | |
74 | -.cboxIE6 #cboxTopCenter, | |
75 | -.cboxIE6 #cboxTopRight, | |
76 | -.cboxIE6 #cboxBottomLeft, | |
77 | -.cboxIE6 #cboxBottomCenter, | |
78 | -.cboxIE6 #cboxBottomRight, | |
79 | -.cboxIE6 #cboxMiddleLeft, | |
80 | -.cboxIE6 #cboxMiddleRight { | |
81 | - _behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')"); | |
82 | -} | ... | ... |
public/stylesheets/lightbox.css
... | ... | @@ -1,63 +0,0 @@ |
1 | -/* - - - - - - - - - - - - - - - - - - - - - | |
2 | - | |
3 | -Title : Lightbox CSS | |
4 | -Author : Kevin Hale | |
5 | -URL : http://particletree.com/features/lightbox-gone-wild/ | |
6 | - | |
7 | -Created : January 13, 2006 | |
8 | -Modified : February 1, 2006 | |
9 | - | |
10 | -- - - - - - - - - - - - - - - - - - - - - */ | |
11 | - | |
12 | -#lightbox { | |
13 | - display: none; | |
14 | - position: absolute; | |
15 | - top: 150px; | |
16 | - left: 50%; | |
17 | - z-index: 300; | |
18 | - width: 500px; | |
19 | - margin-left: -265px; | |
20 | - border: 1px solid #000; | |
21 | - text-align: left; | |
22 | - padding: 1em; | |
23 | - background: #FFF; | |
24 | -} | |
25 | - | |
26 | -#overlay{ | |
27 | - display:none; | |
28 | - position:absolute; | |
29 | - top:0; | |
30 | - left:0; | |
31 | - width:100%; | |
32 | - height:100%; | |
33 | - z-index:200; | |
34 | - background-color:#000; | |
35 | - -moz-opacity: 0.75; | |
36 | - opacity:.75; | |
37 | - filter: alpha(opacity=75); | |
38 | -} | |
39 | -#overlay[id]{ | |
40 | - position:fixed; | |
41 | -} | |
42 | - | |
43 | -#lightbox.done #lbLoadMessage{ | |
44 | - display:none; | |
45 | -} | |
46 | -#lightbox.done #lbContent{ | |
47 | - display:block; | |
48 | -} | |
49 | -#lightbox.loading #lbContent{ | |
50 | - display:none; | |
51 | -} | |
52 | -#lightbox.loading #lbLoadMessage{ | |
53 | - display:block; | |
54 | -} | |
55 | - | |
56 | -#lightbox.done img{ | |
57 | - width:100%; | |
58 | - height:100%; | |
59 | -} | |
60 | - | |
61 | -#lightbox select { | |
62 | - max-width: 100%; | |
63 | -} |
public/stylesheets/thickbox.css
... | ... | @@ -1,163 +0,0 @@ |
1 | -/* ----------------------------------------------------------------------------------------------------------------*/ | |
2 | -/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/ | |
3 | -/* ----------------------------------------------------------------------------------------------------------------*/ | |
4 | -/**{padding: 0; margin: 0;}*/ | |
5 | - | |
6 | -/* ----------------------------------------------------------------------------------------------------------------*/ | |
7 | -/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/ | |
8 | -/* ----------------------------------------------------------------------------------------------------------------*/ | |
9 | -#TB_window { | |
10 | - font: 12px Arial, Helvetica, sans-serif; | |
11 | - color: #333333; | |
12 | -} | |
13 | - | |
14 | -#TB_secondLine { | |
15 | - font: 10px Arial, Helvetica, sans-serif; | |
16 | - color:#666666; | |
17 | -} | |
18 | - | |
19 | -#TB_window a:link {color: #666666;} | |
20 | -#TB_window a:visited {color: #666666;} | |
21 | -#TB_window a:hover {color: #000;} | |
22 | -#TB_window a:active {color: #666666;} | |
23 | -#TB_window a:focus{color: #666666;} | |
24 | - | |
25 | -/* ----------------------------------------------------------------------------------------------------------------*/ | |
26 | -/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/ | |
27 | -/* ----------------------------------------------------------------------------------------------------------------*/ | |
28 | -#TB_overlay { | |
29 | - position: fixed; | |
30 | - z-index:200; | |
31 | - top: 0px; | |
32 | - left: 0px; | |
33 | - height:100%; | |
34 | - width:100%; | |
35 | -} | |
36 | - | |
37 | -.TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;} | |
38 | -.TB_overlayBG { | |
39 | - background-color:#000; | |
40 | - filter:alpha(opacity=75); | |
41 | - -moz-opacity: 0.75; | |
42 | - opacity: 0.75; | |
43 | -} | |
44 | - | |
45 | -* html #TB_overlay { /* ie6 hack */ | |
46 | - position: absolute; | |
47 | - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); | |
48 | -} | |
49 | - | |
50 | -#TB_window { | |
51 | - position: fixed; | |
52 | - background: white; | |
53 | - z-index: 202; | |
54 | - color:#000000; | |
55 | - display:none; | |
56 | - border: 1px solid #000; | |
57 | - text-align:left; | |
58 | - top:50%; | |
59 | - left:50%; | |
60 | -} | |
61 | - | |
62 | -* html #TB_window { /* ie6 hack */ | |
63 | -position: absolute; | |
64 | -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); | |
65 | -} | |
66 | - | |
67 | -#TB_window img#TB_Image { | |
68 | - display:block; | |
69 | - margin: 15px 0 0 15px; | |
70 | - border-right: 1px solid #ccc; | |
71 | - border-bottom: 1px solid #ccc; | |
72 | - border-top: 1px solid #666; | |
73 | - border-left: 1px solid #666; | |
74 | -} | |
75 | - | |
76 | -#TB_caption{ | |
77 | - height:25px; | |
78 | - padding:7px 30px 10px 25px; | |
79 | - float:left; | |
80 | -} | |
81 | - | |
82 | -#TB_closeWindow{ | |
83 | - height:25px; | |
84 | - padding:11px 25px 10px 0; | |
85 | - float:right; | |
86 | -} | |
87 | - | |
88 | -#TB_closeAjaxWindow{ | |
89 | - padding:7px 10px 5px 0; | |
90 | - margin-bottom:1px; | |
91 | - text-align:right; | |
92 | - float:right; | |
93 | -} | |
94 | - | |
95 | -#TB_ajaxWindowTitle{ | |
96 | - float:left; | |
97 | - padding:7px 0 5px 10px; | |
98 | - margin-bottom:1px; | |
99 | -} | |
100 | - | |
101 | -#TB_title{ | |
102 | - background-color:#e8e8e8; | |
103 | - height:27px; | |
104 | -} | |
105 | - | |
106 | -#TB_ajaxContent{ | |
107 | - clear:both; | |
108 | - padding:2px 15px 15px 15px; | |
109 | - overflow:auto; | |
110 | - text-align:left; | |
111 | - line-height:1.4em; | |
112 | -} | |
113 | - | |
114 | -#TB_ajaxContent.TB_modal{ | |
115 | - padding:15px; | |
116 | -} | |
117 | - | |
118 | -#TB_ajaxContent p{ | |
119 | - padding:5px 0px 5px 0px; | |
120 | -} | |
121 | - | |
122 | -#TB_load{ | |
123 | - position: fixed; | |
124 | - display:none; | |
125 | - height:13px; | |
126 | - width:208px; | |
127 | - z-index:203; | |
128 | - top: 50%; | |
129 | - left: 50%; | |
130 | - margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */ | |
131 | -} | |
132 | - | |
133 | -* html #TB_load { /* ie6 hack */ | |
134 | -position: absolute; | |
135 | -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); | |
136 | -} | |
137 | - | |
138 | -#TB_HideSelect{ | |
139 | - z-index:199; | |
140 | - position:fixed; | |
141 | - top: 0; | |
142 | - left: 0; | |
143 | - background-color:#fff; | |
144 | - border:none; | |
145 | - filter:alpha(opacity=0); | |
146 | - -moz-opacity: 0; | |
147 | - opacity: 0; | |
148 | - height:100%; | |
149 | - width:100%; | |
150 | -} | |
151 | - | |
152 | -* html #TB_HideSelect { /* ie6 hack */ | |
153 | - position: absolute; | |
154 | - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); | |
155 | -} | |
156 | - | |
157 | -#TB_iframeContent{ | |
158 | - clear:both; | |
159 | - border:none; | |
160 | - margin-bottom:-1px; | |
161 | - margin-top:1px; | |
162 | - _margin-bottom:1px; | |
163 | -} |
test/functional/cms_controller_test.rb
... | ... | @@ -638,7 +638,7 @@ class CmsControllerTest < ActionController::TestCase |
638 | 638 | |
639 | 639 | should 'display OK button on why_categorize popup' do |
640 | 640 | get :why_categorize, :profile => profile.identifier |
641 | - assert_tag :tag => 'a', :attributes => { :rel => 'deactivate'} # lightbox close button | |
641 | + assert_tag :tag => 'a', :attributes => { :rel => 'deactivate'} # modal close button | |
642 | 642 | end |
643 | 643 | |
644 | 644 | should 'display published option' do | ... | ... |
test/unit/colorbox_helper_test.rb
... | ... | @@ -1,36 +0,0 @@ |
1 | -require_relative "../test_helper" | |
2 | - | |
3 | -class ColorboxHelperTest < ActiveSupport::TestCase | |
4 | - | |
5 | - include ColorboxHelper | |
6 | - | |
7 | - should 'provide the needed files' do | |
8 | - assert File.exists?(Rails.root.join('public', 'stylesheets', 'colorbox.css')), 'colorbox.css expected to be in public/stylesheets, but not found' | |
9 | - assert File.exists?(Rails.root.join('public', 'javascripts', 'colorbox.js')), 'colorbox.js expected to be in public/javascripts, but not found' | |
10 | - end | |
11 | - | |
12 | - should 'provide link to close colorbox' do | |
13 | - expects(:button).with(:close, 'text', '#', has_entries({ :class => 'colorbox-close', :id => 'my-id' })).returns('[close-colorbox]') | |
14 | - | |
15 | - assert_equal '[close-colorbox]', colorbox_close_button('text', :id => 'my-id') | |
16 | - end | |
17 | - | |
18 | - should 'merge existing :class option in colorbox_close_button' do | |
19 | - expects(:button).with(:close, 'text', '#', has_entries({ :class => 'colorbox-close my-class', :id => 'my-id' })).returns('[close-colorbox]') | |
20 | - | |
21 | - assert_equal '[close-colorbox]', colorbox_close_button('text', :class => 'my-class', :id => 'my-id' ) | |
22 | - end | |
23 | - | |
24 | - should 'provide colorbox_button' do | |
25 | - expects(:button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'colorbox' })).returns('[button]') | |
26 | - | |
27 | - assert_equal '[button]', colorbox_button('type', 'label', { :action => 'popup'}) | |
28 | - end | |
29 | - | |
30 | - should 'provide colorbox_icon_button' do | |
31 | - expects(:icon_button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'colorbox' })).returns('[button]') | |
32 | - | |
33 | - assert_equal '[button]', colorbox_icon_button('type', 'label', { :action => 'popup'}) | |
34 | - end | |
35 | - | |
36 | -end |
test/unit/lightbox_helper_test.rb
... | ... | @@ -1,65 +0,0 @@ |
1 | -require_relative "../test_helper" | |
2 | - | |
3 | -class LightboxHelperTest < ActiveSupport::TestCase | |
4 | - | |
5 | - include LightboxHelper | |
6 | - | |
7 | - def setup | |
8 | - stubs(:_).with(anything).returns('TEXT') | |
9 | - end | |
10 | - | |
11 | - should 'provide the needed files' do | |
12 | - assert File.exists?(Rails.root.join('public', 'stylesheets', 'lightbox.css')), 'lightbox.css expected to be in public/stylesheets, but not found' | |
13 | - assert File.exists?(Rails.root.join('public', 'javascripts', 'lightbox.js')), 'lightbox.js expected to be in public/javascripts, but not found' | |
14 | - end | |
15 | - | |
16 | - should 'provide lightbox_link_to helper' do | |
17 | - expects(:link_to).with('text', { :action => 'view', :id => '1' }, has_entries({ :class => 'lbOn', :id => 'my-link' })).returns('[link]') | |
18 | - assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :id => 'my-link' }) | |
19 | - end | |
20 | - | |
21 | - should 'merge existing :class option in lightbox_link_to' do | |
22 | - expects(:link_to).with('text', { :action => 'view', :id => '1' }, has_entries({ :class => 'lbOn my-button', :id => 'my-link' })).returns('[link]') | |
23 | - assert_equal '[link]', lightbox_link_to('text', { :action => 'view', :id => '1'}, { :class => 'my-button', :id => 'my-link' }) | |
24 | - | |
25 | - end | |
26 | - | |
27 | - should 'provide link to close lightbox' do | |
28 | - expects(:button).with(:close, 'text', '#', has_entries({ :class => 'lbAction', :rel => 'deactivate', :id => 'my-id' })).returns('[close-lightbox]') | |
29 | - | |
30 | - assert_equal '[close-lightbox]', lightbox_close_button('text', :id => 'my-id') | |
31 | - end | |
32 | - | |
33 | - should 'merge existing :class option in lightbox_close_button' do | |
34 | - expects(:button).with(:close, 'text', '#', has_entries({ :class => 'lbAction my-class', :rel => 'deactivate', :id => 'my-id' })).returns('[close-lightbox]') | |
35 | - | |
36 | - assert_equal '[close-lightbox]', lightbox_close_button('text', :class => 'my-class', :id => 'my-id' ) | |
37 | - end | |
38 | - | |
39 | - should 'provide lightbox_button' do | |
40 | - expects(:button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'lbOn' })).returns('[button]') | |
41 | - | |
42 | - assert_equal '[button]', lightbox_button('type', 'label', { :action => 'popup'}) | |
43 | - end | |
44 | - | |
45 | - should 'provide lightbox_icon_button' do | |
46 | - expects(:icon_button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'lbOn' })).returns('[button]') | |
47 | - | |
48 | - assert_equal '[button]', lightbox_icon_button('type', 'label', { :action => 'popup'}) | |
49 | - end | |
50 | - | |
51 | - should 'tell if rendering inside lightbox' do | |
52 | - request = mock | |
53 | - expects(:request).returns(request) | |
54 | - request.expects(:xhr?).returns(true) | |
55 | - | |
56 | - assert lightbox? | |
57 | - end | |
58 | - | |
59 | - should 'provide lightbox_remote_button' do | |
60 | - expects(:button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'remote-lbOn' })).returns('[button]') | |
61 | - | |
62 | - assert_equal '[button]', lightbox_remote_button('type', 'label', { :action => 'popup'}) | |
63 | - end | |
64 | - | |
65 | -end |
... | ... | @@ -0,0 +1,36 @@ |
1 | +require_relative '../test_helper' | |
2 | + | |
3 | +class ModalHelperTest < ActiveSupport::TestCase | |
4 | + | |
5 | + include ModalHelper | |
6 | + | |
7 | + should 'provide the needed files' do | |
8 | + assert File.exists?(Rails.root.join('public', 'stylesheets', 'colorbox.css')), 'colorbox.css expected to be in public/stylesheets, but not found' | |
9 | + assert File.exists?(Rails.root.join('public', 'javascripts', 'jquery.colorbox-min.js')), 'jquery.colorbox-min.js expected to be in public/javascripts, but not found' | |
10 | + end | |
11 | + | |
12 | + should 'provide link to close modal' do | |
13 | + expects(:button).with(:close, 'text', '#', has_entries({ :class => 'modal-toggle modal-close', :id => 'my-id' })).returns('[close-modal]') | |
14 | + | |
15 | + assert_equal '[close-modal]', modal_close_button('text', :id => 'my-id') | |
16 | + end | |
17 | + | |
18 | + should 'merge existing :class option in modal_close_button' do | |
19 | + expects(:button).with(:close, 'text', '#', has_entries({ :class => 'modal-toggle modal-close my-class', :id => 'my-id' })).returns('[close-modal]') | |
20 | + | |
21 | + assert_equal '[close-modal]', modal_close_button('text', :class => 'my-class', :id => 'my-id' ) | |
22 | + end | |
23 | + | |
24 | + should 'provide modal_button' do | |
25 | + expects(:button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'modal-toggle' })).returns('[button]') | |
26 | + | |
27 | + assert_equal '[button]', modal_button('type', 'label', { :action => 'popup'}) | |
28 | + end | |
29 | + | |
30 | + should 'provide modal_icon_button' do | |
31 | + expects(:icon_button).with('type', 'label', { :action => 'popup'}, has_entries({ :class => 'modal-toggle' })).returns('[button]') | |
32 | + | |
33 | + assert_equal '[button]', modal_icon_button('type', 'label', { :action => 'popup'}) | |
34 | + end | |
35 | + | |
36 | +end | ... | ... |
test/unit/thickbox_helper_test.rb
... | ... | @@ -1,25 +0,0 @@ |
1 | -require_relative "../test_helper" | |
2 | - | |
3 | -class ThickboxHelperTest < ActiveSupport::TestCase | |
4 | - include ThickboxHelper | |
5 | - | |
6 | - def url_for(url) | |
7 | - url | |
8 | - end | |
9 | - | |
10 | - should 'create thickbox links correcly' do | |
11 | - expects(:link_to).with('Title', '/url#TB_inline?height=300&width=500&inlineId=inlineLoginBox&modal=true', :class => 'thickbox') | |
12 | - thickbox_inline_popup_link('Title', '/url', 'inlineLoginBox') | |
13 | - end | |
14 | - | |
15 | - should 'pass along extra options' do | |
16 | - expects(:link_to).with('Title', anything, :class => 'thickbox', :id => 'lalala', :title => 'lelele') | |
17 | - thickbox_inline_popup_link('Title', '/url', 'inlineLoginBox', :id => 'lalala', :title => 'lelele') | |
18 | - end | |
19 | - | |
20 | - should 'generate close button' do | |
21 | - expects(:button_to_function).with(:close, 'Title', 'tb_remove();').returns('[close-button]') | |
22 | - assert_equal '[close-button]', thickbox_close_button('Title') | |
23 | - end | |
24 | - | |
25 | -end |