From 51a0de3fd83a718c7ab6b59a958c378459921ab2 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Tue, 12 Jul 2011 17:59:27 -0500 Subject: [PATCH 01/16] reorder icon was getting effed when used in a multilist --- core/public/javascripts/refinery/submenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/public/javascripts/refinery/submenu.js b/core/public/javascripts/refinery/submenu.js index 8e2a329184..090faa54b1 100644 --- a/core/public/javascripts/refinery/submenu.js +++ b/core/public/javascripts/refinery/submenu.js @@ -4,7 +4,7 @@ $(document).ready(function(){ $('nav#actions.multilist > ul:not(.search_list) li a:nth(1)').parent().addClass('selected'); } - $('nav#actions.multilist > ul:not(.search_list) li > a').not('.not_a_link a').each(function(i,a){ + $('nav#actions.multilist > ul:not(.search_list) li > a').not('.not_a_link a').not('a.reorder_icon').each(function(i,a){ if ($(this).data('dialog-title') == null) { $(this).bind('click', function(){ $(this).css('background-image', "url('/images/refinery/ajax-loader.gif') !important"); From ffc2ca9fbe88d47ff57111e9807c85fd09545d6a Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Sun, 17 Jul 2011 23:02:47 +1200 Subject: [PATCH 02/16] Backport b02a7e0 from master for #807 --- db/seeds/pages.rb | 7 +++++++ pages/db/seeds/pages.rb | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/db/seeds/pages.rb b/db/seeds/pages.rb index 1c42519a12..fe33e27b0e 100644 --- a/db/seeds/pages.rb +++ b/db/seeds/pages.rb @@ -1,4 +1,11 @@ ::Page.reset_column_information +# Check whether all columns are applied yet by seo_meta. +unless !defined?(::SeoMeta) || ::SeoMeta.attributes.keys.all? { |k| + ::Page.translation_class.instance_methods.include?(k) +} + # Make pages model seo_meta because not all columns are accessible. + ::Page.translation_class.send :is_seo_meta +end page_position = -1 diff --git a/pages/db/seeds/pages.rb b/pages/db/seeds/pages.rb index 1c42519a12..fe33e27b0e 100644 --- a/pages/db/seeds/pages.rb +++ b/pages/db/seeds/pages.rb @@ -1,4 +1,11 @@ ::Page.reset_column_information +# Check whether all columns are applied yet by seo_meta. +unless !defined?(::SeoMeta) || ::SeoMeta.attributes.keys.all? { |k| + ::Page.translation_class.instance_methods.include?(k) +} + # Make pages model seo_meta because not all columns are accessible. + ::Page.translation_class.send :is_seo_meta +end page_position = -1 From 0f6324545a395997ce380e62dda0bbd6c38cc757 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Thu, 21 Jul 2011 12:01:05 +1200 Subject: [PATCH 03/16] Duostack is not accepting new apps anymore. --- ...ow to Install Refinery on Duostack.textile | 73 ------------------- 1 file changed, 73 deletions(-) delete mode 100644 doc/guides/7 - Hosting/3 - How to Install Refinery on Duostack.textile diff --git a/doc/guides/7 - Hosting/3 - How to Install Refinery on Duostack.textile b/doc/guides/7 - Hosting/3 - How to Install Refinery on Duostack.textile deleted file mode 100644 index 6024977b6f..0000000000 --- a/doc/guides/7 - Hosting/3 - How to Install Refinery on Duostack.textile +++ /dev/null @@ -1,73 +0,0 @@ -h2. How to Install Refinery on Duostack - -"Duostack":http://duostack.com is a new hosting choice for Ruby/Rails or Node.js developers. This guide will show you how to: - -* Install and deploy Refinery on the Duostack Rails hosting platform - -endprologue. - -WARNING. This guide is based on Refinery CMS 1.0.0. The automated Duostack installation shown here will not work in earlier versions of Refinery. - -h3. Starting Out - -First you need to install Refinery. To do that you need the refinerycms gem. - - -gem install refinerycms - - -Next go to "Duostack.com":http://duostack.com and click "Request Beta Access" for a free beta account (you will have to fill out a form and wait for their response to your request - make sure you mention Refinery CMS "for priority":http://twitter.com/duostack/status/26856205687201793). - -Now you've got a Duostack account, install the Duostack gem by following their instructions under "Ruby Gem": - -"Command Line Client (external link, docs.duostack.com)":http://docs.duostack.com/command-line-client#setup - -Now it's time to create your Refinery application using the built in +--duostack+ option - -WARNING: Make sure you specify an application name (+my_app_name+ below) as this is required by Duostack. - - -refinerycms myapp --duostack my_app_name - - -Watch the output for these lines - - -Creating Duostack app.. -Running: cd /path/to/app/myapp && duostack create -... -==== Launching first instances.......... done - -==== App successfully deployed to http://site-name.duostack.net - - -This will output the URL for your Duostack hosted Refinery application. Your application should now be live at http://site-name.duostack.net - -NOTE: if you already have a Refinery application that you would like to deploy then just deploy as normal according to Duostack's instructions. You do not need to run the +--duostack+ flag, as all it does is automate some things. - -h3. Adding Amazon S3 Support - -If you want to use Refinery's image and resource support you'll need to setup storage too. Create a bucket called "my_app_production" and uncomment this line in your Gemfile (this might already be done for you): - - -gem 'fog' - - -Next tell Duostack about your new S3 bucket. - - -duostack env add S3_KEY=123key S3_SECRET=456secret S3_BUCKET=my_app_production -duostack restart - - -If you have created your bucket in a region other than 'us-east-1' you need to add S3_REGION=s3region also. -That's it! Duostack will restart your site and it should be live with S3 support. - -h3. Troubleshooting - -h4. Missing a required gem - -Simply add that gem to the Gemfile. - -Otherwise, hop on to the IRC Channel and ask someone for help. Or, see if you can open the duostack logs to spot the error yourself. -Being that this is a new service it may be best to ask Duostack for assistance. \ No newline at end of file From da313821c2da94b067240be4c2ea83fbb08f6720 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Thu, 21 Jul 2011 13:26:03 -0500 Subject: [PATCH 04/16] Image fu: get the height and width in any case --- core/lib/refinery/helpers/image_helper.rb | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/core/lib/refinery/helpers/image_helper.rb b/core/lib/refinery/helpers/image_helper.rb index b7af4f8be6..2d51e1488d 100644 --- a/core/lib/refinery/helpers/image_helper.rb +++ b/core/lib/refinery/helpers/image_helper.rb @@ -25,21 +25,11 @@ def content_fu(content, thumbnail) # <%= image_fu @model.image, '200x200' %> or with no thumbnail: <%= image_fu @model.image %> def image_fu(image, geometry = nil, options={}) if image.present? - # call rails' image tag function with default alt tag. - # if any other options were supplied these are merged in and can replace the defaults. - # if the geomtry is nil, then we know the image height and width already. - # detect nil geometry or cropping presence which is where we can guess the dimensions - unless geometry.nil? or !(split_geometry = geometry.to_s.split('#')).many? or !(split_geometry = split_geometry.first.split('x')).many? - image_width, image_height = split_geometry - else - image_width = nil - image_height = nil - end - - image_tag(image.thumbnail(geometry).url, { + generated_image = image.thumbnail(geometry) + image_tag(generated_image.url, { :alt => image.respond_to?(:title) ? image.title : image.image_name, - :width => image_width, - :height => image_height + :width => generated_image.width, + :height => generated_image.height }.merge(options)) end end From eee0a8592c3551ea17a1d7881ed092c0c5ffd591 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Thu, 21 Jul 2011 14:20:01 -0500 Subject: [PATCH 05/16] Closes GH-828. Removing this code fixed this issue. Tested on zebra and tree --- core/public/javascripts/refinery/admin.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/core/public/javascripts/refinery/admin.js b/core/public/javascripts/refinery/admin.js index a01f0fe89e..57711706ac 100644 --- a/core/public/javascripts/refinery/admin.js +++ b/core/public/javascripts/refinery/admin.js @@ -989,12 +989,7 @@ var list_reorder = { } , restore_controls: function(e) { - if (list_reorder.tree && !$.browser.msie) { - list_reorder.sortable_list.add(list_reorder.sortable_list.find('ul, li, div')).draggable({ disabled: true }); - } else { - $(list_reorder.sortable_list).sortable('destroy'); - } - $(list_reorder.sortable_list).removeClass('reordering, ui-sortable'); + $(list_reorder.sortable_list).removeClass('reordering'); $('#sortable_list .actions, #site_bar, header > *:not(script)').fadeTo(250, 1); $('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul, div')).fadeTo(250, 1, function() { From d492c5c63338a493ddd73b977b11ef4674f3de34 Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Thu, 21 Jul 2011 18:02:14 -0500 Subject: [PATCH 06/16] WIP: image_fu changes --- core/lib/refinery/helpers/image_helper.rb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/core/lib/refinery/helpers/image_helper.rb b/core/lib/refinery/helpers/image_helper.rb index 2d51e1488d..064d6e03d8 100644 --- a/core/lib/refinery/helpers/image_helper.rb +++ b/core/lib/refinery/helpers/image_helper.rb @@ -25,11 +25,26 @@ def content_fu(content, thumbnail) # <%= image_fu @model.image, '200x200' %> or with no thumbnail: <%= image_fu @model.image %> def image_fu(image, geometry = nil, options={}) if image.present? + original_width = image.image_width + original_height = image.image_height + aspect_ratio = original_width / original_height + + if !geometry.nil? and geometry.match(/#$/) + new_width = geometry.split('x').first + new_height = geometry.split('x').last + elsif !geometry.nil? + new_width = geometry.split('x').first + new_height = geometry.split('x').last + new_aspect_ratio = width / height + else + new_width = original_width + new_height = original_height + end generated_image = image.thumbnail(geometry) image_tag(generated_image.url, { :alt => image.respond_to?(:title) ? image.title : image.image_name, - :width => generated_image.width, - :height => generated_image.height + :width => new_width, + :height => new_height }.merge(options)) end end From ebbd0fe06977ecf545874d7dba402bc214facddd Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 25 Jul 2011 15:45:52 +1200 Subject: [PATCH 07/16] page[:something] is no longer recommended. --- .../1 - How to change Page Parts.textile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/guides/4 - Customising your Design/1 - How to change Page Parts.textile b/doc/guides/4 - Customising your Design/1 - How to change Page Parts.textile index 6128228431..e6e2b345d8 100644 --- a/doc/guides/4 - Customising your Design/1 - How to change Page Parts.textile +++ b/doc/guides/4 - Customising your Design/1 - How to change Page Parts.textile @@ -16,7 +16,7 @@ In Refinery's backend, go to the "Settings" tab. Look for a setting called "Defa NOTE: If you don't have this setting, try creating a new page and then restarting your web server. ---- +--- - Body - Side Body @@ -26,7 +26,7 @@ Edit this YAML to have the names of the default page parts you want, click +Save Here's a sample of a site that would have three content areas on most of its pages. ---- +--- - Left Body - Middle Body - Right Body @@ -47,7 +47,7 @@ NOTE: Your "middle body" content won't show on the front end yet. You need to ou Now in your +app/views/pages/home.html.erb+ view you'll be able to put: -<%= @page[:middle_body] %> +<%= @page.content_for(:middle_body) %> to output this new content area in the view. From 3fbdc34abf3c14e54960dc1352f3e500587beb6b Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 25 Jul 2011 20:22:42 +1200 Subject: [PATCH 08/16] Figure out what the image size is going to be based on geometry string. --- core/lib/refinery/helpers/image_helper.rb | 53 ++++++++++++++++------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/core/lib/refinery/helpers/image_helper.rb b/core/lib/refinery/helpers/image_helper.rb index 064d6e03d8..9025f05b79 100644 --- a/core/lib/refinery/helpers/image_helper.rb +++ b/core/lib/refinery/helpers/image_helper.rb @@ -27,21 +27,10 @@ def image_fu(image, geometry = nil, options={}) if image.present? original_width = image.image_width original_height = image.image_height - aspect_ratio = original_width / original_height - - if !geometry.nil? and geometry.match(/#$/) - new_width = geometry.split('x').first - new_height = geometry.split('x').last - elsif !geometry.nil? - new_width = geometry.split('x').first - new_height = geometry.split('x').last - new_aspect_ratio = width / height - else - new_width = original_width - new_height = original_height - end - generated_image = image.thumbnail(geometry) - image_tag(generated_image.url, { + + new_width, new_height = image_dimensions_for_geometry(image, geometry) if geometry + + image_tag(image.thumbnail(geometry).url, { :alt => image.respond_to?(:title) ? image.title : image.image_name, :width => new_width, :height => new_height @@ -49,6 +38,40 @@ def image_fu(image, geometry = nil, options={}) end end + def image_dimensions_for_geometry(image, geometry) + geometry = geometry.to_s + aspect_ratio = nil + width = image.image_width.to_f + height = image.image_height.to_f + geometry_width, geometry_height = geometry.to_s.split(%r{\#{1,2}|\+|>|!|x}im)[0..1].map(&:to_f) + if (width * height > 0) && geometry =~ ::Dragonfly::ImageMagick::Processor::THUMB_GEOMETRY + if geometry =~ ::Dragonfly::ImageMagick::Processor::RESIZE_GEOMETRY + if geometry !~ %r{\d+x\d+>} || (geometry =~ %r{\d+x\d+>} && (width > geometry_width.to_f || height > geometry_height.to_f)) + if geometry_width > geometry_height + width = if (aspect = (width / height)) >= 1 + geometry_height * aspect + else + geometry_height / aspect + end + height = geometry_height + else + height = if (aspect = (height / width)) >= 1 + geometry_width * aspect + else + geometry_width / aspect + end + width = geometry_width + end + end + else + # cropping + width = geometry_width + height = geometry_height + end + end + + [width.to_i, height.to_i] + end end end end From e16eea5c3b3aed093512b7fa3ab3174cddcfbfbf Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 25 Jul 2011 20:24:52 +1200 Subject: [PATCH 09/16] Instead of returning an array returning an OpenStruct makes more sense. --- core/lib/refinery/helpers/image_helper.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/lib/refinery/helpers/image_helper.rb b/core/lib/refinery/helpers/image_helper.rb index 9025f05b79..e07573c3a3 100644 --- a/core/lib/refinery/helpers/image_helper.rb +++ b/core/lib/refinery/helpers/image_helper.rb @@ -1,3 +1,5 @@ +require 'ostruct' + module Refinery module Helpers module ImageHelper @@ -28,12 +30,12 @@ def image_fu(image, geometry = nil, options={}) original_width = image.image_width original_height = image.image_height - new_width, new_height = image_dimensions_for_geometry(image, geometry) if geometry + dimensions = image_dimensions_for_geometry(image, geometry) if geometry image_tag(image.thumbnail(geometry).url, { :alt => image.respond_to?(:title) ? image.title : image.image_name, - :width => new_width, - :height => new_height + :width => (dimensions.width if dimensions), + :height => (dimensions.height if dimensions) }.merge(options)) end end @@ -70,7 +72,7 @@ def image_dimensions_for_geometry(image, geometry) end end - [width.to_i, height.to_i] + OpenStruct.new(:width => width.to_i, :height => height.to_i) end end end From 646a37728cd43a58b6cd0018f892c282516c82b6 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 25 Jul 2011 20:39:37 +1200 Subject: [PATCH 10/16] Moved image_dimensions_for_geometry to an instance method on the Image model called thumbnail_dimensions. --- core/lib/refinery/helpers/image_helper.rb | 37 +---------------------- images/app/models/image.rb | 36 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/core/lib/refinery/helpers/image_helper.rb b/core/lib/refinery/helpers/image_helper.rb index e07573c3a3..7fece9c67b 100644 --- a/core/lib/refinery/helpers/image_helper.rb +++ b/core/lib/refinery/helpers/image_helper.rb @@ -30,7 +30,7 @@ def image_fu(image, geometry = nil, options={}) original_width = image.image_width original_height = image.image_height - dimensions = image_dimensions_for_geometry(image, geometry) if geometry + dimensions = image.thumbnail_dimensions(geometry) if geometry image_tag(image.thumbnail(geometry).url, { :alt => image.respond_to?(:title) ? image.title : image.image_name, @@ -39,41 +39,6 @@ def image_fu(image, geometry = nil, options={}) }.merge(options)) end end - - def image_dimensions_for_geometry(image, geometry) - geometry = geometry.to_s - aspect_ratio = nil - width = image.image_width.to_f - height = image.image_height.to_f - geometry_width, geometry_height = geometry.to_s.split(%r{\#{1,2}|\+|>|!|x}im)[0..1].map(&:to_f) - if (width * height > 0) && geometry =~ ::Dragonfly::ImageMagick::Processor::THUMB_GEOMETRY - if geometry =~ ::Dragonfly::ImageMagick::Processor::RESIZE_GEOMETRY - if geometry !~ %r{\d+x\d+>} || (geometry =~ %r{\d+x\d+>} && (width > geometry_width.to_f || height > geometry_height.to_f)) - if geometry_width > geometry_height - width = if (aspect = (width / height)) >= 1 - geometry_height * aspect - else - geometry_height / aspect - end - height = geometry_height - else - height = if (aspect = (height / width)) >= 1 - geometry_width * aspect - else - geometry_width / aspect - end - width = geometry_width - end - end - else - # cropping - width = geometry_width - height = geometry_height - end - end - - OpenStruct.new(:width => width.to_i, :height => height.to_i) - end end end end diff --git a/images/app/models/image.rb b/images/app/models/image.rb index 5fcb6a52e0..3c15544a20 100644 --- a/images/app/models/image.rb +++ b/images/app/models/image.rb @@ -66,6 +66,42 @@ def thumbnail(geometry = nil) end end + # Intelligently works out dimensions for a thumbnail of this image based on the Dragonfly geometry string. + def thumbnail_dimensions(geometry) + geometry = geometry.to_s + aspect_ratio = nil + width = self.image_width.to_f + height = self.image_height.to_f + geometry_width, geometry_height = geometry.to_s.split(%r{\#{1,2}|\+|>|!|x}im)[0..1].map(&:to_f) + if (width * height > 0) && geometry =~ ::Dragonfly::ImageMagick::Processor::THUMB_GEOMETRY + if geometry =~ ::Dragonfly::ImageMagick::Processor::RESIZE_GEOMETRY + if geometry !~ %r{\d+x\d+>} || (geometry =~ %r{\d+x\d+>} && (width > geometry_width.to_f || height > geometry_height.to_f)) + if geometry_width > geometry_height + width = if (aspect = (width / height)) >= 1 + geometry_height * aspect + else + geometry_height / aspect + end + height = geometry_height + else + height = if (aspect = (height / width)) >= 1 + geometry_width * aspect + else + geometry_width / aspect + end + width = geometry_width + end + end + else + # cropping + width = geometry_width + height = geometry_height + end + end + + OpenStruct.new(:width => width.to_i, :height => height.to_i) + end + # Returns a titleized version of the filename # my_file.jpg returns My File def title From 35fc767b30ffb5af41a60ce64e73048f776d5a73 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 25 Jul 2011 20:55:34 +1200 Subject: [PATCH 11/16] Added basic specs for thumbnail_dimensions which show a failure. --- images/spec/models/image_spec.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/images/spec/models/image_spec.rb b/images/spec/models/image_spec.rb index 3c3e6a0059..101daa15ac 100644 --- a/images/spec/models/image_spec.rb +++ b/images/spec/models/image_spec.rb @@ -69,4 +69,30 @@ end end + describe '#thumbnail_dimensions' do + it 'returns the correct dimensions for crop' do + dimensions = image.thumbnail_dimensions('200x200#ne') + dimensions.width.should == 200 + dimensions.height.should == 200 + end + + it 'returns the correct dimensions for crop' do + dimensions = image.thumbnail_dimensions('100x150#c') + dimensions.width.should == 100 + dimensions.height.should == 150 + end + + it 'returns the correct dimensions for resize' do + dimensions = image.thumbnail_dimensions('250x250>') + dimensions.width.should == 250 + dimensions.height.should == 188 + end + + it 'returns the correct dimensions for resize' do + dimensions = image.thumbnail_dimensions('600x375>') + dimensions.width.should == 500 + dimensions.height.should == 375 + end + end + end From c0ad6931f69461284d5ce89710b551a7b251025b Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 25 Jul 2011 22:00:20 +1200 Subject: [PATCH 12/16] Removed old variable --- images/app/models/image.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/images/app/models/image.rb b/images/app/models/image.rb index 3c15544a20..94a273e16d 100644 --- a/images/app/models/image.rb +++ b/images/app/models/image.rb @@ -69,7 +69,6 @@ def thumbnail(geometry = nil) # Intelligently works out dimensions for a thumbnail of this image based on the Dragonfly geometry string. def thumbnail_dimensions(geometry) geometry = geometry.to_s - aspect_ratio = nil width = self.image_width.to_f height = self.image_height.to_f geometry_width, geometry_height = geometry.to_s.split(%r{\#{1,2}|\+|>|!|x}im)[0..1].map(&:to_f) From 5c8be96b3d9263f704bb24d1952d196b98137e8b Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Mon, 25 Jul 2011 22:31:54 +1200 Subject: [PATCH 13/16] Changed the return type to a hash so that we can inline it to the image_tag options. --- core/lib/refinery/helpers/image_helper.rb | 6 ++--- images/app/models/image.rb | 2 +- images/spec/models/image_spec.rb | 30 ++++++++++++++--------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/core/lib/refinery/helpers/image_helper.rb b/core/lib/refinery/helpers/image_helper.rb index 7fece9c67b..1e43d8318d 100644 --- a/core/lib/refinery/helpers/image_helper.rb +++ b/core/lib/refinery/helpers/image_helper.rb @@ -30,13 +30,11 @@ def image_fu(image, geometry = nil, options={}) original_width = image.image_width original_height = image.image_height - dimensions = image.thumbnail_dimensions(geometry) if geometry + dimensions = (image.thumbnail_dimensions(geometry) rescue {}) image_tag(image.thumbnail(geometry).url, { :alt => image.respond_to?(:title) ? image.title : image.image_name, - :width => (dimensions.width if dimensions), - :height => (dimensions.height if dimensions) - }.merge(options)) + }.merge(dimensions).merge(options)) end end end diff --git a/images/app/models/image.rb b/images/app/models/image.rb index 94a273e16d..11b494c257 100644 --- a/images/app/models/image.rb +++ b/images/app/models/image.rb @@ -98,7 +98,7 @@ def thumbnail_dimensions(geometry) end end - OpenStruct.new(:width => width.to_i, :height => height.to_i) + {:width => width.to_i, :height => height.to_i} end # Returns a titleized version of the filename diff --git a/images/spec/models/image_spec.rb b/images/spec/models/image_spec.rb index 101daa15ac..40756c4f0a 100644 --- a/images/spec/models/image_spec.rb +++ b/images/spec/models/image_spec.rb @@ -70,28 +70,34 @@ end describe '#thumbnail_dimensions' do - it 'returns the correct dimensions for crop' do - dimensions = image.thumbnail_dimensions('200x200#ne') - dimensions.width.should == 200 - dimensions.height.should == 200 + it 'returns its own dimensions with nil geometry' do + dimensions = image.thumbnail_dimensions(nil) + dimensions[:width].should == 500 + dimensions[:height].should == 375 end it 'returns the correct dimensions for crop' do + dimensions = image.thumbnail_dimensions('200x200#ne') + dimensions[:width].should == 200 + dimensions[:height].should == 200 + dimensions = image.thumbnail_dimensions('100x150#c') - dimensions.width.should == 100 - dimensions.height.should == 150 + dimensions[:width].should == 100 + dimensions[:height].should == 150 end it 'returns the correct dimensions for resize' do dimensions = image.thumbnail_dimensions('250x250>') - dimensions.width.should == 250 - dimensions.height.should == 188 - end + dimensions[:width].should == 250 + dimensions[:height].should == 188 - it 'returns the correct dimensions for resize' do dimensions = image.thumbnail_dimensions('600x375>') - dimensions.width.should == 500 - dimensions.height.should == 375 + dimensions[:width].should == 500 + dimensions[:height].should == 375 + + dimensions = image.thumbnail_dimensions('200x150') + dimensions[:width].should == 126 + dimensions[:height].should == 150 end end From adcafd6b3c66f9ddd4cd2de7e2e2bbfd4c9197fb Mon Sep 17 00:00:00 2001 From: Lance Carlson Date: Mon, 25 Jul 2011 13:54:54 -0700 Subject: [PATCH 14/16] Edited doc/guides/7 - Hosting/2 - How to use Amazon S3 for storage.textile via GitHub --- .../7 - Hosting/2 - How to use Amazon S3 for storage.textile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/guides/7 - Hosting/2 - How to use Amazon S3 for storage.textile b/doc/guides/7 - Hosting/2 - How to use Amazon S3 for storage.textile index 286d1d66b5..63fbad41d4 100644 --- a/doc/guides/7 - Hosting/2 - How to use Amazon S3 for storage.textile +++ b/doc/guides/7 - Hosting/2 - How to use Amazon S3 for storage.textile @@ -48,6 +48,8 @@ ENV['S3_SECRET']='fill_in_your_secret_key_here' ENV['S3_BUCKET']='fill_in_your_bucket_name_here' +(Note: For Heroku, you should use config-vars to set your environment variables using Heroku's command line utility. Documentation for this can be found here: http://devcenter.heroku.com/articles/config-vars) + h3. Turning S3 on and off S3 should automatically sense that it is enabled based on these ENV variables From be511fa71e37c8073d14c33022e2d350f865acc7 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 26 Jul 2011 14:34:27 +1200 Subject: [PATCH 15/16] fixed whitespace --- lib/load_path_analyzer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/load_path_analyzer.rb b/lib/load_path_analyzer.rb index 406e6ccf71..19d9ed4361 100644 --- a/lib/load_path_analyzer.rb +++ b/lib/load_path_analyzer.rb @@ -23,4 +23,4 @@ def load_paths }.compact end -end \ No newline at end of file +end From 33a241553d5078667746c188cb2ddb115e552ed7 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Tue, 26 Jul 2011 14:35:35 +1200 Subject: [PATCH 16/16] Fixes Issue #816 where new page parts don't get added with a fully functional WYMeditor. --- core/public/javascripts/refinery/admin.js | 20 ++++++++++---------- core/public/javascripts/refinery/boot_wym.js | 5 ++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/core/public/javascripts/refinery/admin.js b/core/public/javascripts/refinery/admin.js index 57711706ac..37cd252944 100644 --- a/core/public/javascripts/refinery/admin.js +++ b/core/public/javascripts/refinery/admin.js @@ -412,7 +412,7 @@ init_tooltips = function(args){ var link_tester = { initialised: false , init: function(test_url, test_email) { - + if (!this.initialised) { this.test_url = test_url; this.test_email = test_email; @@ -482,7 +482,7 @@ var link_tester = { var link_dialog = { initialised: false , init: function(){ - + if (!this.initialised) { this.init_tabs(); this.init_resources_submit(); @@ -636,7 +636,7 @@ var link_dialog = { var page_options = { initialised: false , init: function(enable_parts, new_part_url, del_part_url){ - + if (!this.initialised) { // set the page tabs up, but ensure that all tabs are shown so that when wymeditor loads it has a proper height. page_options.tabs = $('#page-tabs'); @@ -714,17 +714,17 @@ var page_options = { }, function(data, status){ $('#submit_continue_button').remove(); // Add a new tab for the new content section. - $(data).appendTo('#page_part_editors'); + $('#page_part_editors').append(data); page_options.tabs.tabs('add', '#page_part_new_' + $('#new_page_part_index').val(), part_title); page_options.tabs.tabs('select', $('#new_page_part_index').val()); - // hook into wymedtior to instruct it to select this new tab again once it has loaded. + // hook into wymeditor to instruct it to select this new tab again once it has loaded. WYMeditor.onload_functions.push(function() { - $('#page_part_new_' + $('#new_page_part_index').val()).appendTo('#page_part_editors'); page_options.tabs.tabs('select', $('#new_page_part_index').val()); }); // turn the new textarea into a wymeditor. + $('#page_part_new_' + $('#new_page_part_index').val()).appendTo('#page_part_editors') WYMeditor.init(); // Wipe the title and increment the index counter by one. @@ -775,7 +775,7 @@ var image_dialog = { , callback: null , init: function(callback){ - + if (!this.initialised) { this.callback = callback; this.init_tabs(); @@ -896,7 +896,7 @@ var image_dialog = { var list_reorder = { initialised: false , init: function() { - + if (!this.initialised) { $('#reorder_action').click(list_reorder.enable_reordering); $('#reorder_action_done').click(list_reorder.disable_reordering); @@ -1015,7 +1015,7 @@ var image_picker = { } , init: function(new_options){ - + if (!this.initialised) { this.options = $.extend(this.options, new_options); $(this.options.picker_container).find(this.options.remove_image_button) @@ -1073,7 +1073,7 @@ var resource_picker = { , callback: null , init: function(callback) { - + if (!this.initialised) { this.callback = callback; this.initialised = true; diff --git a/core/public/javascripts/refinery/boot_wym.js b/core/public/javascripts/refinery/boot_wym.js index d388ac5f24..70e6790efb 100755 --- a/core/public/javascripts/refinery/boot_wym.js +++ b/core/public/javascripts/refinery/boot_wym.js @@ -263,8 +263,7 @@ WYMeditor.editor.prototype.loadIframe = function(iframe) { }; WYMeditor.init = function() { - wymeditor_inputs = $('.wymeditor'); - wymeditor_inputs = wymeditor_inputs.filter(function(index) { + wymeditor_inputs = $('.wymeditor').filter(function(index) { for (i=0; i < WYMeditor.INSTANCES.length; i++) { if (WYMeditor.INSTANCES[i]._element.attr('id') == $(this).attr('id')) { return false; @@ -275,7 +274,7 @@ WYMeditor.init = function() { }); wymeditor_inputs.each(function(input) { - if ((containing_field = $(this).parents('.field')).length > 0 && containing_field.get(0).style.height === '') { + if ((containing_field = $(this).parents('.field')).length > 0 && containing_field.get(0).style.height.replace('auto', '') === '') { containing_field.addClass('hide-overflow') .css('height', $(this).outerHeight() - containing_field.offset().top + $(this).offset().top + 45); }