Permalink
Browse files

Added jQuery-UI for photo sortable support. Photos sort in-browser bu…

…t don't save.
  • Loading branch information...
1 parent 622f8b5 commit 68cfe4623872df5de2d81adc5212e6979db3df74 Dave South committed Sep 9, 2010
View
@@ -10,7 +10,8 @@ This is a demonstration application using:
Other depedencies:
* RSpec 2.0 — Works well with Mongoid
-* JQuery — Prototype replacement, required by Uploadify
+* JQuery 1.4.1 — Prototype replacement, required by Uploadify
+* jQuery-UI 1.8.4 — Used for drag and drop sorting of photos
* HAML — Much better than writing in ERB
* RemarkableMongoid — Very useful in testing standard Mongoid associations
@@ -41,6 +42,11 @@ h3. Mongoid
Mongoid is an excellent (and we think the best) ORM for MongoDB. It enables embedded documents as well as ActiveRecord style associations (called references). The documentation is good and is actively developed. It does not interfere with ActiveRecord so projects can use both in parallel.
+h3. jQuery
+
+The jQuery UJS project for Rails lists 1.4.1 as the recommended version for Rails 3.0.
+
+
h3. Amazon S3
App includes configuration to use S3 for production, :file for development, and :file without processing in test mode. See config/initializers/carrierwave.rb for details.
@@ -50,3 +56,4 @@ h3. More
* Stores photo width and height
* Stores photo orientation
+
@@ -45,4 +45,15 @@ def photo_uploadify
}.gsub(/[\n ]+/, ' ').strip.html_safe
end
+
+ def photo_sortable
+ %Q{
+ <script type="text/javascript">
+ $(function() {
+ $('#sortable').sortable();
+ $('#sortable').disableSelection();
+ });
+ </script>
+ }.gsub(/[\n ]+/, ' ').strip.html_safe
+ end
end
@@ -16,11 +16,11 @@
%br
.container
- .photos
+ .photos#sortable
%h2 Photos
- @story.photos.each do |photo|
- %p= render photo
+ = render photo
.queue
/ This division is replaced with a flash button by Uploadify
@@ -32,3 +32,8 @@
/ See application_helper.rb for this code
= photo_uploadify
+/ And more Javascript
+= javascript_include_tag 'jquery-ui.min'
+
+/ application_helper
+= photo_sortable
Oops, something went wrong.

0 comments on commit 68cfe46

Please sign in to comment.