comfy_gallery 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. data/.document +5 -0
  2. data/.travis.yml +2 -0
  3. data/Gemfile +10 -0
  4. data/LICENSE +20 -0
  5. data/README.md +29 -0
  6. data/Rakefile +21 -0
  7. data/VERSION +1 -0
  8. data/app/assets/images/sofa_gallery/jcrop.gif +0 -0
  9. data/app/assets/images/sofa_gallery/orbit/bullets.jpg +0 -0
  10. data/app/assets/images/sofa_gallery/orbit/left-arrow.png +0 -0
  11. data/app/assets/images/sofa_gallery/orbit/loading.gif +0 -0
  12. data/app/assets/images/sofa_gallery/orbit/mask-black.png +0 -0
  13. data/app/assets/images/sofa_gallery/orbit/pause-black.png +0 -0
  14. data/app/assets/images/sofa_gallery/orbit/right-arrow.png +0 -0
  15. data/app/assets/images/sofa_gallery/orbit/rotator-black.png +0 -0
  16. data/app/assets/images/sofa_gallery/orbit/timer-black.png +0 -0
  17. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnNext.png +0 -0
  18. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png +0 -0
  19. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png +0 -0
  20. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/default_thumbnail.gif +0 -0
  21. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/loader.gif +0 -0
  22. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/sprite.png +0 -0
  23. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnNext.png +0 -0
  24. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnPrevious.png +0 -0
  25. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/contentPattern.png +0 -0
  26. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/default_thumbnail.gif +0 -0
  27. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/loader.gif +0 -0
  28. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/sprite.png +0 -0
  29. data/app/assets/images/sofa_gallery/prettyPhoto/default/default_thumb.png +0 -0
  30. data/app/assets/images/sofa_gallery/prettyPhoto/default/loader.gif +0 -0
  31. data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite.png +0 -0
  32. data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_next.png +0 -0
  33. data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_prev.png +0 -0
  34. data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_x.png +0 -0
  35. data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_y.png +0 -0
  36. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/btnNext.png +0 -0
  37. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/btnPrevious.png +0 -0
  38. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png +0 -0
  39. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png +0 -0
  40. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternRight.png +0 -0
  41. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternTop.png +0 -0
  42. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif +0 -0
  43. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/loader.gif +0 -0
  44. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/sprite.png +0 -0
  45. data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnNext.png +0 -0
  46. data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png +0 -0
  47. data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/default_thumbnail.gif +0 -0
  48. data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/loader.gif +0 -0
  49. data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/sprite.png +0 -0
  50. data/app/assets/images/sofa_gallery/prettyPhoto/light_square/btnNext.png +0 -0
  51. data/app/assets/images/sofa_gallery/prettyPhoto/light_square/btnPrevious.png +0 -0
  52. data/app/assets/images/sofa_gallery/prettyPhoto/light_square/default_thumbnail.gif +0 -0
  53. data/app/assets/images/sofa_gallery/prettyPhoto/light_square/loader.gif +0 -0
  54. data/app/assets/images/sofa_gallery/prettyPhoto/light_square/sprite.png +0 -0
  55. data/app/assets/javascripts/sofa_gallery/admin.js +72 -0
  56. data/app/assets/javascripts/sofa_gallery/application.js +15 -0
  57. data/app/assets/javascripts/sofa_gallery/jquery.jcrop.js +246 -0
  58. data/app/assets/javascripts/sofa_gallery/jquery.orbit-1.2.3.min.js +17 -0
  59. data/app/assets/javascripts/sofa_gallery/thumbnails.js +85 -0
  60. data/app/assets/stylesheets/comfy_gallery/admin.css +57 -0
  61. data/app/assets/stylesheets/comfy_gallery/application.css +67 -0
  62. data/app/assets/stylesheets/comfy_gallery/carousel.css.erb +208 -0
  63. data/app/assets/stylesheets/comfy_gallery/gallery_list.css +18 -0
  64. data/app/assets/stylesheets/comfy_gallery/jquery.jcrop.css +32 -0
  65. data/app/assets/stylesheets/comfy_gallery/reset.css +1 -0
  66. data/app/assets/stylesheets/comfy_gallery/thumbnails.css.erb +181 -0
  67. data/app/controllers/admin/gallery/base_controller.rb +3 -0
  68. data/app/controllers/admin/gallery/galleries_controller.rb +63 -0
  69. data/app/controllers/admin/gallery/photos_controller.rb +96 -0
  70. data/app/controllers/application_controller.rb +7 -0
  71. data/app/controllers/gallery/galleries_controller.rb +15 -0
  72. data/app/helpers/gallery/application_helper.rb +30 -0
  73. data/app/models/gallery/gallery.rb +19 -0
  74. data/app/models/gallery/photo.rb +78 -0
  75. data/app/views/admin/gallery/_html_head.html.erb +1 -0
  76. data/app/views/admin/gallery/_navigation.html.erb +5 -0
  77. data/app/views/admin/gallery/galleries/_form.html.erb +18 -0
  78. data/app/views/admin/gallery/galleries/edit.html.erb +5 -0
  79. data/app/views/admin/gallery/galleries/index.html.erb +40 -0
  80. data/app/views/admin/gallery/galleries/new.html.erb +5 -0
  81. data/app/views/admin/gallery/photos/_form.html.erb +16 -0
  82. data/app/views/admin/gallery/photos/crop.html.erb +64 -0
  83. data/app/views/admin/gallery/photos/edit.html.erb +5 -0
  84. data/app/views/admin/gallery/photos/index.html.erb +24 -0
  85. data/app/views/admin/gallery/photos/new.html.erb +5 -0
  86. data/app/views/gallery/_carousel.html.erb +31 -0
  87. data/app/views/gallery/_list_galleries.html.erb +26 -0
  88. data/app/views/gallery/_thumbnails.html.erb +26 -0
  89. data/app/views/gallery/galleries/index.html.erb +1 -0
  90. data/app/views/gallery/galleries/show.html.erb +7 -0
  91. data/app/views/layouts/gallery/application.html.erb +16 -0
  92. data/comfy_gallery.gemspec +177 -0
  93. data/config/application.rb +51 -0
  94. data/config/boot.rb +13 -0
  95. data/config/database.yml +16 -0
  96. data/config/environment.rb +5 -0
  97. data/config/environments/development.rb +25 -0
  98. data/config/environments/production.rb +52 -0
  99. data/config/environments/test.rb +39 -0
  100. data/config/initializers/comfy_gallery.rb +15 -0
  101. data/config/initializers/paperclip.rb +3 -0
  102. data/config/routes.rb +17 -0
  103. data/config.ru +4 -0
  104. data/db/migrate/01_create_comfy_gallery.rb +36 -0
  105. data/lib/comfy_gallery/configuration.rb +26 -0
  106. data/lib/comfy_gallery/engine.rb +22 -0
  107. data/lib/comfy_gallery/form_builder.rb +50 -0
  108. data/lib/comfy_gallery.rb +23 -0
  109. data/lib/generators/README +10 -0
  110. data/lib/generators/comfy_gallery_generator.rb +33 -0
  111. data/lib/paperclip_processors/cropper.rb +31 -0
  112. data/lib/tasks/comfy_gallery.rake +4 -0
  113. data/script/rails +6 -0
  114. data/sofa_gallery.gemspec +175 -0
  115. data/test/fixtures/files/default.jpg +0 -0
  116. data/test/fixtures/files/default.txt +1 -0
  117. data/test/fixtures/files/default2.jpg +0 -0
  118. data/test/fixtures/gallery/galleries.yml +11 -0
  119. data/test/fixtures/gallery/photos.yml +9 -0
  120. data/test/functional/admin/gallery/galleries_controller_test.rb +87 -0
  121. data/test/functional/admin/gallery/photos_controller_test.rb +234 -0
  122. data/test/functional/gallery/galleries_controller_test.rb +24 -0
  123. data/test/test_helper.rb +39 -0
  124. data/test/unit/configuration_test.rb +18 -0
  125. data/test/unit/gallery_test.rb +33 -0
  126. data/test/unit/photo_test.rb +33 -0
  127. metadata +233 -0
@@ -0,0 +1,64 @@
1
+ <% content_for :head do %>
2
+ <%= stylesheet_link_tag 'comfy_gallery/jquery.jcrop.css' %>
3
+ <%= javascript_include_tag 'comfy_gallery/jquery.jcrop.js' %>
4
+ <script type="text/javascript" charset="utf-8">
5
+ $(function(){
6
+ $('#crop_full').Jcrop({
7
+ onChange: update_full_crop,
8
+ onSelect: update_full_crop,
9
+ aspectRatio: <%= @photo.gallery.force_ratio_full?? (@photo.gallery.full_width.to_f / @photo.gallery.full_height) : 'null' %>
10
+ });
11
+
12
+ $('#crop_thumb').Jcrop({
13
+ onChange: update_thumb_crop,
14
+ onSelect: update_thumb_crop,
15
+ aspectRatio: <%= @photo.gallery.force_ratio_thumb?? (@photo.gallery.thumb_width.to_f / @photo.gallery.thumb_height) : 'null' %>
16
+ });
17
+ });
18
+
19
+
20
+ function update_full_crop(coords) {
21
+ var ratio = <%= @photo.image_geometry(:original).width %> / <%= @photo.image_geometry(:admin_full).width %>;
22
+ $('#full_crop_x').val(coords.x * ratio);
23
+ $('#full_crop_y').val(coords.y * ratio);
24
+ $('#full_crop_w').val(coords.w * ratio);
25
+ $('#full_crop_h').val(coords.h * ratio);
26
+ }
27
+
28
+ function update_thumb_crop(coords) {
29
+ var ratio = <%= @photo.image_geometry(:original).width %> / <%= @photo.image_geometry(:admin_full).width %>;
30
+ $('#thumb_crop_x').val(coords.x * ratio);
31
+ $('#thumb_crop_y').val(coords.y * ratio);
32
+ $('#thumb_crop_w').val(coords.w * ratio);
33
+ $('#thumb_crop_h').val(coords.h * ratio);
34
+ }
35
+ </script>
36
+ <% end %>
37
+
38
+ <h1> Crop Photo </h1>
39
+
40
+ <%= comfy_gallery_form_for @photo, :as => :photo, :url => { :action => :update } do |form| %>
41
+
42
+ <% if @photo.gallery.force_ratio_full? %>
43
+ <%= form.simple_field 'Full Size' do %>
44
+ <%= image_tag @photo.image.url(:admin_full), :id => 'crop_full' %>
45
+ <% end %>
46
+ <% end %>
47
+ <br />
48
+ <% if @photo.gallery.force_ratio_thumb? %>
49
+ <%= form.simple_field 'Thumbnail' do %>
50
+ <%= image_tag @photo.image.url(:admin_full), :id => 'crop_thumb' %>
51
+ <% end %>
52
+ <% end %>
53
+
54
+
55
+ <% [:full_crop_x, :full_crop_y, :full_crop_w, :full_crop_h].each do |attr| %>
56
+ <%= form.hidden_field attr, :id => attr %>
57
+ <% end %>
58
+
59
+ <% [:thumb_crop_x, :thumb_crop_y, :thumb_crop_w, :thumb_crop_h].each do |attr| %>
60
+ <%= form.hidden_field attr, :id => attr %>
61
+ <% end %>
62
+
63
+ <%= form.submit 'Crop' %>
64
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <h1>Editing Photo</h1>
2
+
3
+ <%= comfy_gallery_form_for @photo, :url => { :action => :update }, :html => { :multipart => true } do |form| %>
4
+ <%= render :partial => form %>
5
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <%= link_to 'Add new photo', new_admin_gallery_gallery_photo_path(@gallery), :class => 'big button' %>
2
+
3
+ <h1>Photos in <%=@gallery.title%></h1>
4
+
5
+ <table class='formatted'>
6
+ <tbody class='sortable'>
7
+ <% @photos.each do |photo| %>
8
+ <tr id='<%= dom_id(photo) %>'>
9
+ <td>
10
+ <%= image_tag(photo.image.url(:admin_thumb), :class => 'thumb dragger') %>
11
+ </td>
12
+ <td class='main'>
13
+ <div class='title'><%= photo.title %></div>
14
+ <div class='sublabel'><%= photo.slug %></div>
15
+ </td>
16
+ <td class='action_links'>
17
+ <%= link_to 'Crop', crop_admin_gallery_gallery_photo_path(@gallery, photo) if photo.force_aspect? %>
18
+ <%= link_to 'Edit', edit_admin_gallery_gallery_photo_path(@gallery, photo) %>
19
+ <%= link_to 'Delete', admin_gallery_gallery_photo_path(@gallery, photo), :method => :delete, :confirm => 'Are you sure?' %>
20
+ </td>
21
+ </tr>
22
+ <% end %>
23
+ </tbody>
24
+ </table>
@@ -0,0 +1,5 @@
1
+ <h1>New Photo</h1>
2
+
3
+ <%= comfy_gallery_form_for @photo, :url => {:action => :create}, :html => {:multipart => true} do |form|%>
4
+ <%= render :partial => form %>
5
+ <% end -%>
@@ -0,0 +1,31 @@
1
+ <% if @gallery %>
2
+ <!--[if IE]>
3
+ <style type="text/css">
4
+ .timer { display: none !important; }
5
+ div.caption { background:transparent; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000);zoom: 1; }
6
+ </style>
7
+ <![endif]-->
8
+ <% content_for :head do %>
9
+ <%= javascript_include_tag "comfy_gallery/jquery.orbit-1.2.3.min.js" %>
10
+ <%= stylesheet_link_tag "comfy_gallery/carousel.css" %>
11
+ <% end %>
12
+ <% content_for :doc_ready do %>
13
+ $('#featured').orbit();
14
+ <% end %>
15
+ <% if @gallery.photos.count > 0 %>
16
+ <div id="featured">
17
+ <% @gallery.photos.order(:position).each do |photo| %>
18
+ <%= image_tag(photo.image.url(:full), :alt => photo.description, :id => dom_id(photo), :"data-caption" => "##{dom_id(photo)}htmlCaption") %>
19
+ <% end %>
20
+ </div>
21
+ <% @gallery.photos.reject{|p| p.description.blank?}.each do |photo| %>
22
+ <span class="orbit-caption" id="<%=dom_id(photo)%>htmlCaption">
23
+ <%= photo.description %>
24
+ </span>
25
+ <% end %>
26
+ <% else %>
27
+ <em>No photos in this gallery.</em>
28
+ <% end %>
29
+ <% else %>
30
+ No images were found.
31
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <% if @galleries %>
2
+ <% content_for :head do %>
3
+ <%= stylesheet_link_tag "comfy_gallery/gallery_list" %>
4
+ <% end %>
5
+ <% @galleries.each do |gallery| %>
6
+ <div class="sofa_gallery">
7
+ <div class="photo_preview">
8
+ <% gallery.photos.order(:position).limit(6).each do |photo| %>
9
+ <%= image_tag(photo.image.url(:admin_thumb), :alt => photo.description) %>
10
+ <% end %>
11
+ </div>
12
+ <div class="photo_text">
13
+ <h2><%= link_to gallery.title, gallery_path(gallery) %></h2>
14
+ <p><%= gallery.description.truncate(200) %></p>
15
+ <% if (count = gallery.photos.count) > 0 %>
16
+ <%= link_to "View all #{count} photos.", gallery_path(gallery), :class => 'view_more' %>
17
+ <% else %>
18
+ <em>No photos in this gallery.</em>
19
+ <% end %>
20
+ </div>
21
+ </div>
22
+ <% end %>
23
+ <% else %>
24
+ No galleries were found.
25
+ <% end %>
26
+
@@ -0,0 +1,26 @@
1
+ <% if @gallery %>
2
+ <% content_for :head do %>
3
+ <%= stylesheet_link_tag "comfy_gallery/thumbnails.css" %>
4
+ <%= javascript_include_tag "comfy_gallery/thumbnails.js" %>
5
+ <% end %>
6
+ <ul id="<%= dom_id(@gallery)%>" class="gallery">
7
+ <h2><%= @gallery.title %></h2>
8
+ <p><%= @gallery.description %></p>
9
+ <br />
10
+ <% if @gallery.photos.count > 0 %>
11
+ <% @gallery.photos.order(:position).each do |photo| %>
12
+ <li id="<%= dom_id(photo) %>">
13
+ <div class="photo" style="width: <%= @gallery.thumb_width %>px; height: <%= @gallery.thumb_height %>px;">
14
+ <%= link_to photo.image.url(:full), :rel => "prettyPhoto[pp_gal]", :title => photo.description do %>
15
+ <%= image_tag(photo.image.url(:thumb), :alt => photo.title) %>
16
+ <% end %>
17
+ </div>
18
+ </li>
19
+ <% end %>
20
+ <% else %>
21
+ <em>No photos in this gallery.</em>
22
+ <% end %>
23
+ </ul>
24
+ <% else %>
25
+ Gallery not found.
26
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'gallery/list_galleries' %>
@@ -0,0 +1,7 @@
1
+ <% content_for :head do %>
2
+ <%= stylesheet_link_tag "comfy_gallery/gallery_list" %>
3
+ <% end %>
4
+ <div class="galleries">
5
+ <%= link_to "« View All Galleries", galleries_path %>
6
+ <%= render :partial => 'gallery/thumbnails' %>
7
+ </div>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5
+ <title>SofaGallery</title>
6
+ <%= javascript_include_tag 'sofa_gallery/application.js' %>
7
+ <%= stylesheet_link_tag 'sofa_gallery/application.css' %>
8
+ <%= yield :head %>
9
+ </head>
10
+ <body class='c_<%= params[:controller].gsub('/', '_') %> a_<%= params[:action] %>'>
11
+ <% flash.each do |type, message| %>
12
+ <div class='flash <%= type %>'><%= message %></div>
13
+ <% end %>
14
+ <%= yield %>
15
+ </body>
16
+ </html>
@@ -0,0 +1,177 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "comfy_gallery"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Oleg Khabarov", "Stephen McLeod", "The Working Group Inc."]
12
+ s.date = "2012-01-20"
13
+ s.description = ""
14
+ s.email = "oleg@twg.ca"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".travis.yml",
22
+ "Gemfile",
23
+ "LICENSE",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "app/assets/images/sofa_gallery/jcrop.gif",
28
+ "app/assets/images/sofa_gallery/orbit/bullets.jpg",
29
+ "app/assets/images/sofa_gallery/orbit/left-arrow.png",
30
+ "app/assets/images/sofa_gallery/orbit/loading.gif",
31
+ "app/assets/images/sofa_gallery/orbit/mask-black.png",
32
+ "app/assets/images/sofa_gallery/orbit/pause-black.png",
33
+ "app/assets/images/sofa_gallery/orbit/right-arrow.png",
34
+ "app/assets/images/sofa_gallery/orbit/rotator-black.png",
35
+ "app/assets/images/sofa_gallery/orbit/timer-black.png",
36
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnNext.png",
37
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png",
38
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png",
39
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/default_thumbnail.gif",
40
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/loader.gif",
41
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/sprite.png",
42
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnNext.png",
43
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnPrevious.png",
44
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_square/contentPattern.png",
45
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_square/default_thumbnail.gif",
46
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_square/loader.gif",
47
+ "app/assets/images/sofa_gallery/prettyPhoto/dark_square/sprite.png",
48
+ "app/assets/images/sofa_gallery/prettyPhoto/default/default_thumb.png",
49
+ "app/assets/images/sofa_gallery/prettyPhoto/default/loader.gif",
50
+ "app/assets/images/sofa_gallery/prettyPhoto/default/sprite.png",
51
+ "app/assets/images/sofa_gallery/prettyPhoto/default/sprite_next.png",
52
+ "app/assets/images/sofa_gallery/prettyPhoto/default/sprite_prev.png",
53
+ "app/assets/images/sofa_gallery/prettyPhoto/default/sprite_x.png",
54
+ "app/assets/images/sofa_gallery/prettyPhoto/default/sprite_y.png",
55
+ "app/assets/images/sofa_gallery/prettyPhoto/facebook/btnNext.png",
56
+ "app/assets/images/sofa_gallery/prettyPhoto/facebook/btnPrevious.png",
57
+ "app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png",
58
+ "app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png",
59
+ "app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternRight.png",
60
+ "app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternTop.png",
61
+ "app/assets/images/sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif",
62
+ "app/assets/images/sofa_gallery/prettyPhoto/facebook/loader.gif",
63
+ "app/assets/images/sofa_gallery/prettyPhoto/facebook/sprite.png",
64
+ "app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnNext.png",
65
+ "app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png",
66
+ "app/assets/images/sofa_gallery/prettyPhoto/light_rounded/default_thumbnail.gif",
67
+ "app/assets/images/sofa_gallery/prettyPhoto/light_rounded/loader.gif",
68
+ "app/assets/images/sofa_gallery/prettyPhoto/light_rounded/sprite.png",
69
+ "app/assets/images/sofa_gallery/prettyPhoto/light_square/btnNext.png",
70
+ "app/assets/images/sofa_gallery/prettyPhoto/light_square/btnPrevious.png",
71
+ "app/assets/images/sofa_gallery/prettyPhoto/light_square/default_thumbnail.gif",
72
+ "app/assets/images/sofa_gallery/prettyPhoto/light_square/loader.gif",
73
+ "app/assets/images/sofa_gallery/prettyPhoto/light_square/sprite.png",
74
+ "app/assets/javascripts/sofa_gallery/admin.js",
75
+ "app/assets/javascripts/sofa_gallery/application.js",
76
+ "app/assets/javascripts/sofa_gallery/jquery.jcrop.js",
77
+ "app/assets/javascripts/sofa_gallery/jquery.orbit-1.2.3.min.js",
78
+ "app/assets/javascripts/sofa_gallery/thumbnails.js",
79
+ "app/assets/stylesheets/comfy_gallery/admin.css",
80
+ "app/assets/stylesheets/comfy_gallery/application.css",
81
+ "app/assets/stylesheets/comfy_gallery/carousel.css.erb",
82
+ "app/assets/stylesheets/comfy_gallery/gallery_list.css",
83
+ "app/assets/stylesheets/comfy_gallery/jquery.jcrop.css",
84
+ "app/assets/stylesheets/comfy_gallery/reset.css",
85
+ "app/assets/stylesheets/comfy_gallery/thumbnails.css.erb",
86
+ "app/controllers/admin/gallery/base_controller.rb",
87
+ "app/controllers/admin/gallery/galleries_controller.rb",
88
+ "app/controllers/admin/gallery/photos_controller.rb",
89
+ "app/controllers/application_controller.rb",
90
+ "app/controllers/gallery/galleries_controller.rb",
91
+ "app/helpers/gallery/application_helper.rb",
92
+ "app/models/gallery/gallery.rb",
93
+ "app/models/gallery/photo.rb",
94
+ "app/views/admin/gallery/_html_head.html.erb",
95
+ "app/views/admin/gallery/_navigation.html.erb",
96
+ "app/views/admin/gallery/galleries/_form.html.erb",
97
+ "app/views/admin/gallery/galleries/edit.html.erb",
98
+ "app/views/admin/gallery/galleries/index.html.erb",
99
+ "app/views/admin/gallery/galleries/new.html.erb",
100
+ "app/views/admin/gallery/photos/_form.html.erb",
101
+ "app/views/admin/gallery/photos/crop.html.erb",
102
+ "app/views/admin/gallery/photos/edit.html.erb",
103
+ "app/views/admin/gallery/photos/index.html.erb",
104
+ "app/views/admin/gallery/photos/new.html.erb",
105
+ "app/views/gallery/_carousel.html.erb",
106
+ "app/views/gallery/_list_galleries.html.erb",
107
+ "app/views/gallery/_thumbnails.html.erb",
108
+ "app/views/gallery/galleries/index.html.erb",
109
+ "app/views/gallery/galleries/show.html.erb",
110
+ "app/views/layouts/gallery/application.html.erb",
111
+ "comfy_gallery.gemspec",
112
+ "config.ru",
113
+ "config/application.rb",
114
+ "config/boot.rb",
115
+ "config/database.yml",
116
+ "config/environment.rb",
117
+ "config/environments/development.rb",
118
+ "config/environments/production.rb",
119
+ "config/environments/test.rb",
120
+ "config/initializers/comfy_gallery.rb",
121
+ "config/initializers/paperclip.rb",
122
+ "config/routes.rb",
123
+ "db/migrate/01_create_comfy_gallery.rb",
124
+ "lib/comfy_gallery.rb",
125
+ "lib/comfy_gallery/configuration.rb",
126
+ "lib/comfy_gallery/engine.rb",
127
+ "lib/comfy_gallery/form_builder.rb",
128
+ "lib/generators/README",
129
+ "lib/generators/comfy_gallery_generator.rb",
130
+ "lib/paperclip_processors/cropper.rb",
131
+ "lib/tasks/comfy_gallery.rake",
132
+ "script/rails",
133
+ "sofa_gallery.gemspec",
134
+ "test/fixtures/files/default.jpg",
135
+ "test/fixtures/files/default.txt",
136
+ "test/fixtures/files/default2.jpg",
137
+ "test/fixtures/gallery/galleries.yml",
138
+ "test/fixtures/gallery/photos.yml",
139
+ "test/functional/admin/gallery/galleries_controller_test.rb",
140
+ "test/functional/admin/gallery/photos_controller_test.rb",
141
+ "test/functional/gallery/galleries_controller_test.rb",
142
+ "test/test_helper.rb",
143
+ "test/unit/configuration_test.rb",
144
+ "test/unit/gallery_test.rb",
145
+ "test/unit/photo_test.rb"
146
+ ]
147
+ s.homepage = "http://github.com/comfy/comfy-gallery"
148
+ s.licenses = ["MIT"]
149
+ s.require_paths = ["lib"]
150
+ s.rubygems_version = "1.8.10"
151
+ s.summary = "ComfyGallery is an image gallery engine for Rails 3.1 apps (and ComfortableMexicanSofa)"
152
+
153
+ if s.respond_to? :specification_version then
154
+ s.specification_version = 3
155
+
156
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
157
+ s.add_runtime_dependency(%q<rails>, [">= 3.1.0"])
158
+ s.add_runtime_dependency(%q<paperclip>, [">= 2.3.0"])
159
+ s.add_runtime_dependency(%q<jquery-rails>, [">= 1.0.14"])
160
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
161
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
162
+ else
163
+ s.add_dependency(%q<rails>, [">= 3.1.0"])
164
+ s.add_dependency(%q<paperclip>, [">= 2.3.0"])
165
+ s.add_dependency(%q<jquery-rails>, [">= 1.0.14"])
166
+ s.add_dependency(%q<sqlite3>, [">= 0"])
167
+ s.add_dependency(%q<jeweler>, [">= 0"])
168
+ end
169
+ else
170
+ s.add_dependency(%q<rails>, [">= 3.1.0"])
171
+ s.add_dependency(%q<paperclip>, [">= 2.3.0"])
172
+ s.add_dependency(%q<jquery-rails>, [">= 1.0.14"])
173
+ s.add_dependency(%q<sqlite3>, [">= 0"])
174
+ s.add_dependency(%q<jeweler>, [">= 0"])
175
+ end
176
+ end
177
+
@@ -0,0 +1,51 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module ComfyGallery
10
+ class Application < Rails::Application
11
+
12
+ require 'comfy_gallery'
13
+
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ # config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # JavaScript files you want as :defaults (application.js is always included).
37
+
38
+ # Configure the default encoding used in templates for Ruby 1.9.
39
+ config.encoding = "utf-8"
40
+
41
+ # Configure sensitive parameters which will be filtered from the log file.
42
+ config.filter_parameters += [:password]
43
+
44
+ # Enable the asset pipeline
45
+ config.assets.enabled = true
46
+
47
+ config.session_store :cookie_store, :key => '_comfy_blog_session'
48
+ config.secret_token = 'e0fef4ab56c1cace8845864fe2cb2a27f5caad72521419f87b2774785187090a654b83229bf9cef70ce475a83bfa561dbbaa2015788181ea837c456964c1e0f6'
49
+
50
+ end
51
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,16 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ ComfyGallery::Application.initialize!
@@ -0,0 +1,25 @@
1
+ defined?(ComfyGallery::Application) && ComfyGallery::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+ end
25
+
@@ -0,0 +1,52 @@
1
+ defined?(ComfyGallery::Application) && ComfyGallery::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress both stylesheets and JavaScripts
15
+ config.assets.js_compressor = :uglifier
16
+ config.assets.css_compressor = :scss
17
+
18
+ # Specifies the header that your server uses for sending files
19
+ # (comment out if your front-end server doesn't support this)
20
+ config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
21
+
22
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
23
+ # config.force_ssl = true
24
+
25
+ # See everything in the log (default is :info)
26
+ # config.log_level = :debug
27
+
28
+ # Use a different logger for distributed setups
29
+ # config.logger = SyslogLogger.new
30
+
31
+ # Use a different cache store in production
32
+ # config.cache_store = :mem_cache_store
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
38
+ # config.assets.precompile += %w( search.js )
39
+
40
+ # Disable delivery errors, bad email addresses will be ignored
41
+ # config.action_mailer.raise_delivery_errors = false
42
+
43
+ # Enable threaded mode
44
+ # config.threadsafe!
45
+
46
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
47
+ # the I18n.default_locale when a translation can not be found)
48
+ config.i18n.fallbacks = true
49
+
50
+ # Send deprecation notices to registered listeners
51
+ config.active_support.deprecation = :notify
52
+ end
@@ -0,0 +1,39 @@
1
+ defined?(ComfyGallery::Application) && ComfyGallery::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = true
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ config.action_mailer.delivery_method = :test
31
+
32
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
33
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
34
+ # like if you have constraints or database-specific column types
35
+ # config.active_record.schema_format = :sql
36
+
37
+ # Print deprecation notices to the stderr
38
+ config.active_support.deprecation = :stderr
39
+ end
@@ -0,0 +1,15 @@
1
+ ComfyGallery.configure do |config|
2
+
3
+ # Just like CMS, photos are uploaded through Paperclip and can support filesystem or s3 storage.
4
+ # config.upload_photo_options = { :storage => :filesystem }
5
+
6
+ # set the cms admin path if you have changed it for CMS
7
+ # config.admin_route_prefix = 'admin'
8
+
9
+ # Controller that should be used for admin area
10
+ # config.admin_controller = 'ApplicationController'
11
+
12
+ # Form builder
13
+ # config.form_builder = 'ComfyGallery::FormBuilder'
14
+
15
+ end
@@ -0,0 +1,3 @@
1
+ Paperclip.options[:command_path] = case Rails.env
2
+ when 'development', 'test' then "/usr/local/bin"
3
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,17 @@
1
+ Rails.application.routes.draw do
2
+
3
+ namespace :admin, :path => ComfyGallery.config.admin_route_prefix do
4
+ namespace :gallery do
5
+ resources :galleries do
6
+ resources :photos do
7
+ put :reorder, :on => :collection
8
+ get :crop, :on => :member
9
+ end
10
+ end
11
+ end
12
+ end unless ComfyGallery.config.admin_route_prefix.blank?
13
+
14
+ scope :module => :gallery do
15
+ resources :galleries, :only => [:show, :index]
16
+ end
17
+ end
data/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run ComfyGallery::Application