sunrise-cms 0.5.0.rc2 → 0.5.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/CHANGELOG.rdoc +7 -0
  2. data/README.md +123 -0
  3. data/app/assets/javascripts/sunrise/application.js +1 -2
  4. data/app/assets/javascripts/sunrise/jquery.ddmenu.js.coffee +9 -0
  5. data/app/assets/{stylesheets/sunrise/ie.css → javascripts/sunrise/redactor.js} +0 -0
  6. data/app/assets/stylesheets/sunrise/customize.css +63 -1
  7. data/app/assets/stylesheets/sunrise/main.css +7 -7
  8. data/app/views/layouts/sunrise/application.html.erb +0 -4
  9. data/app/views/sunrise/manager/buttons/_delete.html.erb +5 -0
  10. data/app/views/sunrise/manager/buttons/_edit.html.erb +5 -0
  11. data/app/views/sunrise/manager/buttons/_export.html.erb +5 -0
  12. data/app/views/sunrise/manager/buttons/_new.html.erb +5 -0
  13. data/app/views/sunrise/manager/buttons/_sort.html.erb +20 -0
  14. data/app/views/sunrise/shared/_panel.html.erb +32 -49
  15. data/app/views/sunrise/shared/_toolbar.html.erb +10 -48
  16. data/config/locales/sunrise/en.yml +3 -0
  17. data/config/locales/sunrise/ru.yml +4 -0
  18. data/config/locales/sunrise/uk.yml +4 -0
  19. data/lib/generators/sunrise/templates/config/seeds.rb +2 -3
  20. data/lib/sunrise/config/list.rb +5 -0
  21. data/lib/sunrise/config.rb +4 -0
  22. data/lib/sunrise/version.rb +1 -1
  23. data/spec/dummy/app/models/sunrise/sunrise_post.rb +3 -1
  24. data/spec/dummy/config/application.rb +4 -0
  25. data/spec/dummy/log/development.log +150 -0
  26. data/spec/dummy/log/test.log +7881 -0
  27. data/spec/dummy/tmp/cache/assets/C7B/190/sprockets%2F37b103f4623089af1456b90830fe941c +0 -0
  28. data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  29. data/spec/dummy/tmp/cache/assets/D13/C60/sprockets%2F2dedb8177c20286c4259c1d58c5646cc +0 -0
  30. data/spec/dummy/tmp/cache/assets/D21/5D0/sprockets%2Fe2c4f946939f2d7d0b42d86383755cae +0 -0
  31. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  32. data/spec/dummy/tmp/cache/assets/D3E/F40/sprockets%2F25a167c7563d6fe8ec6b13ec1ac09274 +0 -0
  33. data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  34. data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  35. data/spec/dummy/tmp/cache/assets/D66/D60/sprockets%2F74fff4cd40e651309f6a03b2acc63a93 +0 -0
  36. data/spec/dummy/tmp/cache/assets/D6A/A70/sprockets%2F88c982cf93bc6d8f73d7a3968bb769e7 +0 -0
  37. data/spec/dummy/tmp/cache/assets/D96/A50/sprockets%2F5f2f70550f68122b1cacdcab9a45ed67 +0 -0
  38. data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  39. data/spec/dummy/tmp/cache/assets/DDE/270/sprockets%2F0dd428ae1aed245ab1c713f6f0aabb06 +0 -0
  40. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  41. data/spec/tmp/config/application.rb +4 -0
  42. data/spec/tmp/db/seeds.rb +2 -3
  43. metadata +40 -7
  44. data/README.rdoc +0 -90
  45. data/app/views/sunrise/shared/_head.html.erb +0 -22
  46. data/vendor/assets/javascripts/jquery.fancybox-1.3.4.pack.js +0 -46
@@ -2,6 +2,10 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
4
 
5
+ unless defined?(SUNRISE_ORM)
6
+ SUNRISE_ORM = (ENV["SUNRISE_ORM"] || :active_record).to_sym
7
+ end
8
+
5
9
  if defined?(Bundler)
6
10
  # If you precompile assets before deploying to production, use this line
7
11
  Bundler.require(*Rails.groups(:assets => %w(development test)))
data/spec/tmp/db/seeds.rb CHANGED
@@ -2,15 +2,14 @@
2
2
 
3
3
  def insert_user
4
4
  User.truncate!
5
- Role.truncate!
6
5
  password = Rails.env.production? ? Devise.friendly_token : (1..9).to_a.join
7
6
 
8
7
  admin = User.new do |u|
9
8
  u.name = "Administrator"
10
- u.email = 'dev@example.com'
9
+ u.email = 'dev@fodojo.com'
11
10
  u.password = password
12
11
  u.password_confirmation = password
13
- u.login = = 'admin' if u.respond_to?(:login)
12
+ u.login = 'admin' if u.respond_to?(:login)
14
13
  u.role_type = RoleType.admin
15
14
  end
16
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunrise-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.rc2
4
+ version: 0.5.0.rc3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-08 00:00:00.000000000 Z
13
+ date: 2013-01-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -353,7 +353,7 @@ email: galeta.igor@gmail.com
353
353
  executables: []
354
354
  extensions: []
355
355
  extra_rdoc_files:
356
- - README.rdoc
356
+ - README.md
357
357
  - CHANGELOG.rdoc
358
358
  files:
359
359
  - app/views/layouts/sunrise/application.html.erb
@@ -371,7 +371,6 @@ files:
371
371
  - app/views/sunrise/shared/_panel.html.erb
372
372
  - app/views/sunrise/shared/_available_locales.html.erb
373
373
  - app/views/sunrise/shared/_locale.html.erb
374
- - app/views/sunrise/shared/_head.html.erb
375
374
  - app/views/sunrise/shared/_parent.html.erb
376
375
  - app/views/sunrise/manager/_header_new.html.erb
377
376
  - app/views/sunrise/manager/table/_record.html.erb
@@ -386,6 +385,11 @@ files:
386
385
  - app/views/sunrise/manager/tree/index.html.erb
387
386
  - app/views/sunrise/manager/_field.html.erb
388
387
  - app/views/sunrise/manager/new.html.erb
388
+ - app/views/sunrise/manager/buttons/_export.html.erb
389
+ - app/views/sunrise/manager/buttons/_new.html.erb
390
+ - app/views/sunrise/manager/buttons/_sort.html.erb
391
+ - app/views/sunrise/manager/buttons/_delete.html.erb
392
+ - app/views/sunrise/manager/buttons/_edit.html.erb
389
393
  - app/views/sunrise/manager/edit.html.erb
390
394
  - app/views/sunrise/manager/thumbs/_record.html.erb
391
395
  - app/views/sunrise/manager/thumbs/index.html.erb
@@ -398,11 +402,11 @@ files:
398
402
  - app/views/kaminari/sunrise/_prev_page.html.erb
399
403
  - app/views/kaminari/sunrise/_paginator.html.erb
400
404
  - app/views/kaminari/sunrise/_page.html.erb
401
- - app/assets/stylesheets/sunrise/ie.css
402
405
  - app/assets/stylesheets/sunrise/application.css
403
406
  - app/assets/stylesheets/sunrise/main.css
404
407
  - app/assets/stylesheets/sunrise/customize.css
405
408
  - app/assets/javascripts/sunrise/jquery.pagination.js.coffee
409
+ - app/assets/javascripts/sunrise/redactor.js
406
410
  - app/assets/javascripts/sunrise/jquery.lang-tabs.js.coffee
407
411
  - app/assets/javascripts/sunrise/application.js
408
412
  - app/assets/javascripts/sunrise/manage.js.coffee
@@ -613,13 +617,12 @@ files:
613
617
  - vendor/assets/javascripts/jquery.tmpl.min.js
614
618
  - vendor/assets/javascripts/chosen.jquery.js
615
619
  - vendor/assets/javascripts/jquery.cookie.js
616
- - vendor/assets/javascripts/jquery.fancybox-1.3.4.pack.js
617
620
  - vendor/assets/javascripts/datepicker/jquery.ui.datepicker-uk.js
618
621
  - vendor/assets/javascripts/datepicker/jquery-ui-i18n.js
619
622
  - vendor/assets/javascripts/datepicker/jquery.ui.datepicker-ru.js
620
623
  - MIT-LICENSE
621
624
  - Rakefile
622
- - README.rdoc
625
+ - README.md
623
626
  - CHANGELOG.rdoc
624
627
  - spec/tmp/spec/support/helpers/controller_macros.rb
625
628
  - spec/tmp/spec/spec_helper.rb
@@ -665,6 +668,20 @@ files:
665
668
  - spec/dummy/tmp/capybara/capybara-201301081227579661067565.html
666
669
  - spec/dummy/tmp/capybara/capybara-20130108123318606876035.html
667
670
  - spec/dummy/tmp/capybara/capybara-201301081227579425051336.html
671
+ - spec/dummy/tmp/cache/assets/D13/C60/sprockets%2F2dedb8177c20286c4259c1d58c5646cc
672
+ - spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
673
+ - spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
674
+ - spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
675
+ - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
676
+ - spec/dummy/tmp/cache/assets/D66/D60/sprockets%2F74fff4cd40e651309f6a03b2acc63a93
677
+ - spec/dummy/tmp/cache/assets/D6A/A70/sprockets%2F88c982cf93bc6d8f73d7a3968bb769e7
678
+ - spec/dummy/tmp/cache/assets/D96/A50/sprockets%2F5f2f70550f68122b1cacdcab9a45ed67
679
+ - spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
680
+ - spec/dummy/tmp/cache/assets/D3E/F40/sprockets%2F25a167c7563d6fe8ec6b13ec1ac09274
681
+ - spec/dummy/tmp/cache/assets/C7B/190/sprockets%2F37b103f4623089af1456b90830fe941c
682
+ - spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
683
+ - spec/dummy/tmp/cache/assets/DDE/270/sprockets%2F0dd428ae1aed245ab1c713f6f0aabb06
684
+ - spec/dummy/tmp/cache/assets/D21/5D0/sprockets%2Fe2c4f946939f2d7d0b42d86383755cae
668
685
  - spec/dummy/Rakefile
669
686
  - spec/dummy/public/500.html
670
687
  - spec/dummy/public/favicon.ico
@@ -684,6 +701,7 @@ files:
684
701
  - spec/dummy/app/helpers/application_helper.rb
685
702
  - spec/dummy/app/controllers/application_controller.rb
686
703
  - spec/dummy/app/controllers/welcome_controller.rb
704
+ - spec/dummy/log/development.log
687
705
  - spec/dummy/log/test.log
688
706
  - spec/dummy/config/database.yml
689
707
  - spec/dummy/config/routes.rb
@@ -819,6 +837,20 @@ test_files:
819
837
  - spec/dummy/tmp/capybara/capybara-201301081227579661067565.html
820
838
  - spec/dummy/tmp/capybara/capybara-20130108123318606876035.html
821
839
  - spec/dummy/tmp/capybara/capybara-201301081227579425051336.html
840
+ - spec/dummy/tmp/cache/assets/D13/C60/sprockets%2F2dedb8177c20286c4259c1d58c5646cc
841
+ - spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
842
+ - spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
843
+ - spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
844
+ - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
845
+ - spec/dummy/tmp/cache/assets/D66/D60/sprockets%2F74fff4cd40e651309f6a03b2acc63a93
846
+ - spec/dummy/tmp/cache/assets/D6A/A70/sprockets%2F88c982cf93bc6d8f73d7a3968bb769e7
847
+ - spec/dummy/tmp/cache/assets/D96/A50/sprockets%2F5f2f70550f68122b1cacdcab9a45ed67
848
+ - spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
849
+ - spec/dummy/tmp/cache/assets/D3E/F40/sprockets%2F25a167c7563d6fe8ec6b13ec1ac09274
850
+ - spec/dummy/tmp/cache/assets/C7B/190/sprockets%2F37b103f4623089af1456b90830fe941c
851
+ - spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
852
+ - spec/dummy/tmp/cache/assets/DDE/270/sprockets%2F0dd428ae1aed245ab1c713f6f0aabb06
853
+ - spec/dummy/tmp/cache/assets/D21/5D0/sprockets%2Fe2c4f946939f2d7d0b42d86383755cae
822
854
  - spec/dummy/Rakefile
823
855
  - spec/dummy/public/500.html
824
856
  - spec/dummy/public/favicon.ico
@@ -838,6 +870,7 @@ test_files:
838
870
  - spec/dummy/app/helpers/application_helper.rb
839
871
  - spec/dummy/app/controllers/application_controller.rb
840
872
  - spec/dummy/app/controllers/welcome_controller.rb
873
+ - spec/dummy/log/development.log
841
874
  - spec/dummy/log/test.log
842
875
  - spec/dummy/config/database.yml
843
876
  - spec/dummy/config/routes.rb
data/README.rdoc DELETED
@@ -1,90 +0,0 @@
1
- = Sunrise CMS
2
-
3
- Open source mini content management system for programmers.
4
-
5
- == Instructions
6
-
7
- === ActiveRecord
8
-
9
- rails new [PROJECT_NAME] -d mysql -T -m https://raw.github.com/gist/2700424
10
-
11
- === Mongoid
12
-
13
- gem "mongoid"
14
- gem "bson_ext"
15
- gem "mongoid_nested_set"
16
- gem "carrierwave-mongoid", :require => "carrierwave/mongoid"
17
- gem "mongoid_nested_set"
18
- gem "mongoid-history"
19
-
20
- rails g sunrise:install --orm=mongoid
21
-
22
- == Export data
23
-
24
- === XML, JSON, CSV
25
-
26
- GET /manage/users/export.xml
27
- GET /manage/users/export.csv
28
-
29
- === JSON
30
-
31
- GET /manage/users/export.json
32
-
33
- For more info look at jbuilder https://rubygems.org/gems/jbuilder.
34
-
35
- === Excel
36
-
37
- gem "ruby2xlsx", "~> 0.0.1"
38
-
39
- GET /manage/users/export.xlsx
40
-
41
- == Usage
42
-
43
- Just create class:
44
-
45
- class SunriseProduct < Sunrise::AbstractModel
46
- self.resource_name = "Product"
47
-
48
- list :thumbs do
49
- scope { Product.includes(:picture) }
50
- preview { lambda { |product| product.picture.try(:url, :thumb) } }
51
-
52
- field :title
53
- field :price
54
- field :total_stock
55
- end
56
-
57
- show do
58
- field :title
59
- field :price
60
- field :total_stock
61
- field :sort_order
62
- field :is_visible
63
- end
64
-
65
- edit do
66
- field :title
67
- field :price
68
- field :total_stock
69
- field :notes
70
-
71
- group :sidebar, :holder => :sidebar do
72
- field :sale_limit_id, :collection => lambda { SaleLimit.all }, :include_blank => false
73
- field :sort_order
74
- field :is_visible, :boolean => true
75
- end
76
-
77
- group :bottom, :holder => :bottom do
78
- nested_attributes :variants do
79
- field :size
80
- field :total_stock
81
- field :item_model_id, :collection => lambda { ItemModel.all }, :include_blank => false
82
- end
83
-
84
- field :picture, :as => :uploader
85
- end
86
- end
87
- end
88
-
89
-
90
- Copyright (c) 2012 Fodojo, released under the MIT license
@@ -1,22 +0,0 @@
1
- <div class="head">
2
- <%= link_to image_tag("sunrise/minimise_but.gif", :title=>t('manage.go_site')), , :class=>"minimaze" %>
3
- <div class="logo"><%=raw t('manage.title') %></div>
4
-
5
- <div class="main-menu">
6
- <ul>
7
- TODO:
8
- </ul>
9
- </div>
10
-
11
- <div class="user">
12
- <div class="user-info">
13
- <div class="info">
14
- <%= link_to current_user.name, edit_path(:model_name => current_user.class.name, :id => current_user.id), :class=>"name" %>
15
- <%= link_to t('manage.exit'), "destroy_user_session_path", :class=>"exit", :method => :delete %>
16
- </div>
17
- </div>
18
-
19
- <div class="user-foto">
20
- </div>
21
- </div>
22
- </div>
@@ -1,46 +0,0 @@
1
- /*
2
- * FancyBox - jQuery Plugin
3
- * Simple and fancy lightbox alternative
4
- *
5
- * Examples and documentation at: http://fancybox.net
6
- *
7
- * Copyright (c) 2008 - 2010 Janis Skarnelis
8
- * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
- *
10
- * Version: 1.3.4 (11/11/2010)
11
- * Requires: jQuery v1.3+
12
- *
13
- * Dual licensed under the MIT and GPL licenses:
14
- * http://www.opensource.org/licenses/mit-license.php
15
- * http://www.gnu.org/licenses/gpl.html
16
- */
17
-
18
- ;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
19
- F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
20
- c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
21
- false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
22
- function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
23
- '"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
24
- "function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
25
- ";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
26
- opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
27
- d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
28
- y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
29
- i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
30
- f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
31
- 37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
32
- s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
33
- f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
34
- j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
35
- "image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
36
- 10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
37
- b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
38
- 0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
39
- 1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
40
- true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
41
- b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
42
- d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
43
- D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
44
- b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
45
- b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
46
- easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);