Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 6 commits
  • 12 files changed
  • 0 comments
  • 4 contributors
Dec 08, 2010
Philip Arndt Make update task delete a particular migration that causes issue. Clo…
…ses GH-314
07db817
Dec 11, 2010
Jacob Buys Fixed problems with db:migrate for a new app on Postgres by moving Ro…
…lesUsers migration before Roles migration.

It looks like the ActiveRecord postgres adapter automagically sets up relations between your tables. However, it looks like the "many" side of the association (the table with the foreign key) has to be created first, or postgres gives an error like this in the log:

PGError: ERROR:  relation "roles_users" does not exist
LINE 14: AND dep.refobjid      = '"roles_users"'::regclas...
cfece66
Dec 12, 2010
Philip Arndt Use the newer, faster image dialogue introduced in master branch. 8af2e5f
Sort file names so attribute types don't get changed before _form gen…
…eration.
1808e55
Dec 15, 2010
Uģis Ozols Add :approximate_ascii RefinerySetting and add that setting in page m…
…odel for has_friendly_id.
1c995ac
Philip Arndt Document new version 0.9.8.7 - Closes GH-320 ade7bec
8  changelog.md
Source Rendered
... ...
@@ -1,3 +1,11 @@
  1
+## 0.9.8.7 [15 December 2010]
  2
+* Fixed a problem with migration number clashes. [Philip Arndt](https://github.com/parndt)
  3
+* Fixed problems with ``db:migrate`` for a new app on Postgres. [Jacob Buys](https://github.com/wjbuys)
  4
+* Back-ported the changes made to the images dialogue which speed it up significantly. [Philip Arndt](https://github.com/parndt)
  5
+* Sort file names in the ``refinery_engine`` generator so attribute types don't get changed before ``_form.html.erb`` generation. [Phil Spitler](https://github.com/philspitler)
  6
+* Added ``approximate_ascii`` setting, defaulted to true, for pages so that characters won't appear strangely in the address bar of some web browsers. [Uģis Ozols](https://github.com/ugisozols)
  7
+* [See full list](https://github.com/resolve/refinerycms/compare/0.9.8.6...0.9.8.7)
  8
+
1 9
 ## 0.9.8.6 [3 December 2010]
2 10
 * Backported lots of functionality from 0.9.9 and later like:
3 11
 * Fixed reordering for trees and non-trees [Philip Arndt](https://github.com/parndt)
9  db/migrate/20100913234704_create_refinery_schema.rb
@@ -97,15 +97,16 @@ def self.up
97 97
       t.string   "file_ext"
98 98
     end
99 99
 
100  
-    create_table ::Role.table_name, :force => true do |t|
101  
-      t.string "title"
102  
-    end
103  
-
  100
+    # Postgres apparently requires the roles_users table to exist before creating the roles table.
104 101
     create_table ::RolesUsers.table_name, :id => false, :force => true do |t|
105 102
       t.integer "user_id"
106 103
       t.integer "role_id"
107 104
     end
108 105
 
  106
+    create_table ::Role.table_name, :force => true do |t|
  107
+      t.string "title"
  108
+    end
  109
+
109 110
     create_table ::Slug.table_name, :force => true do |t|
110 111
       t.string   "name"
111 112
       t.integer  "sluggable_id"
4  refinerycms.gemspec
@@ -2,9 +2,9 @@
2 2
 
3 3
 Gem::Specification.new do |s|
4 4
   s.name              = %q{refinerycms}
5  
-  s.version           = %q{0.9.8.6}
  5
+  s.version           = %q{0.9.8.7}
6 6
   s.description       = %q{A Ruby on Rails CMS that supports Rails 3. It's easy to extend and sticks to 'the Rails way' where possible.}
7  
-  s.date              = %q{2010-12-03}
  7
+  s.date              = %q{2010-12-15}
8 8
   s.summary           = %q{A Ruby on Rails CMS that supports Rails 3}
9 9
   s.email             = %q{info@refinerycms.com}
10 10
   s.homepage          = %q{http://refinerycms.com}
2  vendor/refinerycms/core/lib/generators/refinery_engine/refinery_engine_generator.rb
@@ -9,7 +9,7 @@ class RefineryEngineGenerator < Rails::Generators::NamedBase
9 9
 
10 10
   def generate
11 11
     unless attributes.empty?
12  
-      Dir.glob(File.expand_path('../templates/**/**', __FILE__), File::FNM_DOTMATCH).each do |path|
  12
+      Dir.glob(File.expand_path('../templates/**/**', __FILE__), File::FNM_DOTMATCH).sort.each do |path|
13 13
         # ignore directories which are created automatically by template()
14 14
         unless File.directory?(path)
15 15
           template path, plugin_path_for(path)
5  vendor/refinerycms/core/lib/tasks/refinery.rake
@@ -87,6 +87,11 @@ namespace :refinery do
87 87
     verbose = ENV["verbose"] || false
88 88
     require 'fileutils'
89 89
 
  90
+    # Clean up mistakes
  91
+    if (bad_migration = Rails.root.join('db', 'migrate', '20100913234704_add_cached_slug_to_pages.rb')).file?
  92
+      FileUtils::rm bad_migration
  93
+    end
  94
+
90 95
     # copy in any new migrations.
91 96
     FileUtils::cp Dir[Refinery.root.join("db", "migrate", "*.rb").cleanpath.to_s],
92 97
                   Rails.root.join("db", "migrate").cleanpath.to_s,
47  vendor/refinerycms/core/public/javascripts/refinery/admin.js
@@ -620,13 +620,15 @@ var page_options = {
620 620
 }
621 621
 
622 622
 var image_dialog = {
623  
-  callback: null
  623
+  initialised: false
  624
+  , callback: null
624 625
 
625 626
   , init: function(callback){
626 627
     this.callback = callback;
627 628
     this.init_tabs();
628 629
     this.init_select();
629 630
     this.init_actions();
  631
+    this.initialised = true;
630 632
     return this;
631 633
   }
632 634
 
@@ -665,41 +667,15 @@ var image_dialog = {
665 667
 
666 668
       $(img).parent().addClass('selected');
667 669
       var imageId = $(img).attr('data-id');
668  
-      var imageThumbnailSize = $('#existing_image_size_area li.selected a').attr('data-size');
  670
+      var geometry = $('#existing_image_size_area li.selected a').attr('data-geometry');
  671
+      var size = $('#existing_image_size_area li.selected a').attr('data-size');
669 672
       var resize = $("#wants_to_resize_image").is(':checked');
670 673
 
671  
-      var url = '/refinery/images/'+imageId+'/url';
672  
-      if (resize) {
673  
-        url += '?size='+imageThumbnailSize;
674  
-      }
675  
-
676  
-      var data;
677  
-      $.ajax({
678  
-        async: false,
679  
-        url: url,
680  
-        success: function (result, status, xhr) {
681  
-          if (result.error) {
682  
-            if (console && console.log) {
683  
-               console.log("Something went wrong with the image insertion!");
684  
-               console.log(result);
685  
-             }
686  
-           } else {
687  
-             data = result;
688  
-           }
689  
-         },
690  
-         error: function(xhr, txt, status) {
691  
-           if (console && console.log) {
692  
-             console.log("Something went wrong with the image insertion!");
693  
-             console.log(xhr);
694  
-             console.log(txt);
695  
-             console.log(status);
696  
-           }
697  
-         }
698  
-       });
  674
+      image_url = resize ? $(img).attr('data-' + size) : $(img).attr('data-original');
699 675
 
700 676
       if (parent) {
701 677
         if ((wym_src = parent.document.getElementById('wym_src')) != null) {
702  
-          wym_src.value = data.url
  678
+          wym_src.value = image_url;
703 679
         }
704 680
         if ((wym_title = parent.document.getElementById('wym_title')) != null) {
705 681
           wym_title.value = $(img).attr('title');
@@ -707,8 +683,9 @@ var image_dialog = {
707 683
         if ((wym_alt = parent.document.getElementById('wym_alt')) != null) {
708 684
           wym_alt.value = $(img).attr('alt');
709 685
         }
710  
-        if ((wym_size = parent.document.getElementById('wym_size')) != null) {
711  
-          wym_size.value = imageThumbnailSize.replace(/[<>=]/g, '');
  686
+        if ((wym_size = parent.document.getElementById('wym_size')) != null
  687
+            && typeof(geometry) != 'undefined') {
  688
+          wym_size.value = geometry.replace(/[<>=]/g, '');
712 689
         }
713 690
       }
714 691
     }
@@ -727,7 +704,7 @@ var image_dialog = {
727 704
   , init_actions: function(){
728 705
     var _this = this;
729 706
     $('#existing_image_area .form-actions-dialog #submit_button').click($.proxy(_this.submit_image_choice, _this));
730  
-    $('.form-actions-dialog #cancel_button').click($.proxy(close_dialog, _this));
  707
+    $('.form-actions-dialog #cancel_button').not('body.wym_iframe_body .form-actions-dialog #cancel_button').click($.proxy(close_dialog, _this));
731 708
     $('#existing_image_size_area ul li a').click(function(e) {
732 709
       $('#existing_image_size_area ul li').removeClass('selected');
733 710
       $(this).parent().addClass('selected');
@@ -753,7 +730,7 @@ var image_dialog = {
753 730
       $('#existing_image_area .form-actions a.close_dialog').click(close_dialog);
754 731
     }
755 732
   }
756  
-}
  733
+};
757 734
 
758 735
 var list_reorder = {
759 736
   initialised: false
18  vendor/refinerycms/images/app/models/image.rb
... ...
@@ -1,7 +1,7 @@
1 1
 class Image < ActiveRecord::Base
2 2
 
3 3
   # What is the max image size a user can upload
4  
-  MAX_SIZE_IN_MB = 20
  4
+  MAX_SIZE_IN_MB = 5
5 5
 
6 6
   image_accessor :image
7 7
 
@@ -40,14 +40,20 @@ def per_page(dialog = false, has_size_options = false)
40 40
         PAGES_PER_ADMIN_INDEX
41 41
       end
42 42
     end
  43
+
  44
+    def user_image_sizes
  45
+      RefinerySetting.find_or_set(:user_image_sizes, {
  46
+        :small => '110x110>',
  47
+        :medium => '225x255>',
  48
+        :large => '450x450>'
  49
+      })
  50
+    end
43 51
   end
44 52
 
45 53
   # Get a thumbnail job object given a geometry.
46 54
   def thumbnail(geometry = nil)
47  
-    if geometry.is_a?(Symbol)
48  
-      if (sizes = RefinerySetting.find_or_set(:image_thumbnails, {})) and sizes.keys.include?(geometry)
49  
-        geometry = sizes[geometry].presence
50  
-      end
  55
+    if geometry.is_a?(Symbol) and self.class.user_image_sizes.keys.include?(geometry)
  56
+      geometry = self.class.user_image_sizes[geometry].presence
51 57
     end
52 58
 
53 59
     if geometry.present? && !geometry.is_a?(Symbol)
@@ -60,7 +66,7 @@ def thumbnail(geometry = nil)
60 66
   # Returns a titleized version of the filename
61 67
   # my_file.jpg returns My File
62 68
   def title
63  
-    CGI::unescape(self.image_name).gsub(/\.\w+$/, '').titleize
  69
+    CGI::unescape(self.image_name.to_s).gsub(/\.\w+$/, '').titleize
64 70
   end
65 71
 
66 72
 end
45  vendor/refinerycms/images/app/views/admin/images/_existing_image.html.erb
... ...
@@ -1,40 +1,57 @@
1 1
 <div id='existing_image_area' class='dialog_area' <%= "style='display:none;'" if @image.errors.any? %>>
  2
+  <%= render :partial => '/shared/admin/search',
  3
+             :locals => {:url => insert_admin_images_url(params.dup.delete(:image))} %>
2 4
   <input type='hidden' name='selected_image' id='selected_image' />
3 5
   <div id='existing_image_area_content' class='clearfix'>
  6
+<% if @images.any? %>
4 7
     <ul>
5  
-      <% @images.each do |image| %>
  8
+<%
  9
+      @images.each do |image|
  10
+        thumbnail_urls = {
  11
+          :"data-original" => image.url,
  12
+          :"data-grid" => image.thumbnail('135x135#c').url
  13
+        }
  14
+        ::Image.user_image_sizes.sort_by{|key,geometry| geometry}.each do |size, pixels|
  15
+          thumbnail_urls[:"data-#{size.to_s.parameterize}"] = image.thumbnail(pixels).url
  16
+        end
  17
+-%>
6 18
         <li<%= " class='selected'" if @image_id == image.id %>>
7 19
           <%= image_fu(image, '106x106#c', {
8 20
                          :alt => image.title,
9 21
                          :title => image.title,
10 22
                          :id => "image_#{image.id}",
11 23
                          :'data-id' => image.id
12  
-                       }) -%>
  24
+                       }.merge(thumbnail_urls)) -%>
13 25
         </li>
14 26
       <% end -%>
15 27
     </ul>
  28
+<% elsif searching? %>
  29
+    <%= t('shared.admin.search.no_results') %>
  30
+<% end %>
16 31
   </div>
  32
+
17 33
   <%= images_paginator @images, from_dialog? %>
18  
-  <% unless @app_dialog %>
  34
+
  35
+  <% unless @app_dialog or @images.empty? %>
19 36
     <div id='existing_image_size_area' class='clearfix'>
20 37
       <input type='hidden' name='selected_image_size' id='selected_image_size' />
21 38
       <p>
22 39
         <input type="checkbox" id="wants_to_resize_image" name="wants_to_resize_image" value="1" checked="checked" />
23  
-        <label for='wants_to_resize_image' class='stripped'><strong><%= t('.resize_image').html_safe %></strong></label>
  40
+        <label for='wants_to_resize_image' class='stripped' style='font-weight: bold;'>
  41
+          <%= t('.resize_image') %>
  42
+        </label>
24 43
       </p>
25 44
       <ul>
26 45
         <%
27  
-          (sizes = RefinerySetting.find_or_set(:user_image_sizes, {
28  
-                     :small => '110x110>',
29  
-                     :medium => '225x255>',
30  
-                     :large => '450x450>'
31  
-                   })
32  
-          ).sort_by{|k,v| v}.each_with_index do |(size, pixels), index|
  46
+          ::Image.user_image_sizes.sort_by { |key, geometry| geometry }.each_with_index do |(size, pixels), index|
33 47
             safe_pixels = pixels.to_s.gsub(/[<>=]/, '')
  48
+            # (parndt): ' selected' if size.to_s == 'medium' is not very generic, but I
  49
+            # can't think of a decent way of making it so for even sets (e.g. 2,4,6,8,etc image sizes).
34 50
         -%>
35  
-            <li id="image_dialog_size_<%= index %>" class="image_dialog_size <%= 'selected' if size.to_s == 'medium' %>">
  51
+            <li id="image_dialog_size_<%= index %>" class="image_dialog_size<%= ' selected' if size.to_s == 'medium' %>">
36 52
               <%= link_to size.to_s, "##{size}",
37  
-                          :'data-size' => pixels,
  53
+                          :'data-geometry' => pixels,
  54
+                          :'data-size' => size.to_s.parameterize,
38 55
                           :title   => "#{size} image (#{safe_pixels})",
39 56
                           :tooltip => "#{size} image (#{safe_pixels})" %>
40 57
             </li>
@@ -42,13 +59,15 @@
42 59
       </ul>
43 60
     </div>
44 61
   <% end %>
  62
+
45 63
   <%= render :partial => "/shared/admin/form_actions",
46 64
              :locals => {
47 65
                :f => nil,
48 66
                :cancel_url => '',
49 67
                :submit_button_text => t('.button_text'),
  68
+               :hide_submit => @images.empty?,
50 69
                :hide_cancel => false,
51 70
                :hide_delete => true,
52 71
                :cancel_title => nil
53  
-             } if @app_dialog or @images.any? %>
  72
+             } if @app_dialog or @images.any? or searching? %>
54 73
 </div>
3  vendor/refinerycms/pages/app/models/page.rb
@@ -5,7 +5,8 @@ class Page < ActiveRecord::Base
5 5
 
6 6
   # Docs for friendly_id http://github.com/norman/friendly_id
7 7
   has_friendly_id :title, :use_slug => true,
8  
-                  :reserved_words => %w(index new session login logout users refinery admin images wymiframe)
  8
+                  :reserved_words => %w(index new session login logout users refinery admin images wymiframe),
  9
+                  :approximate_ascii => RefinerySetting.find_or_set(:approximate_ascii, false, :scoping => "pages")
9 10
 
10 11
   has_many :parts,
11 12
            :class_name => "PagePart",
2  vendor/refinerycms/refinery.rb
@@ -28,7 +28,7 @@ class Version
28 28
     @major = 0
29 29
     @minor = 9
30 30
     @tiny  = 8
31  
-    @build = 6
  31
+    @build = 7
32 32
 
33 33
     class << self
34 34
       attr_reader :major, :minor, :tiny, :build
1  vendor/refinerycms/settings/config/locales/en.yml
@@ -33,6 +33,7 @@ en:
33 33
           use_google_ajax_libraries: If you want to use Google's AJAX CDN then set this to true.
34 34
           use_marketable_urls: Changes urls from /pages/about to /about and automatically manages conflicts with other plugins.
35 35
           use_resource_caching: Recommended to enable this in production mode as it bundles javascript assets and stylesheet assets into single file packages to reduce the number of web requests on your site and speed it up.
  36
+          approximate_ascii: Set this to true if you use Latin characters with accents and other diacritics in page titles. It'll convert characters like ā, č, ž into a, c, z and this way those characters won't appear strangely in the address bar of some web browsers.
36 37
   activerecord:
37 38
     models:
38 39
       refinery_setting: setting
3  vendor/refinerycms/settings/config/locales/lv.yml
@@ -31,7 +31,8 @@ lv:
31 31
           theme: Ievadiet tēmas nosaukumu, kuru vēlaties izmantot. Lai šis uzstādījums nekavējoties sāktu darboties, pārliecinieties, vai tēma eksistē un tās nosaukums ir norādīts pareizi.
32 32
           use_google_ajax_libraries: Ja vēlaties izmantot Googles AJAX CDN, tad šim parametram nomainiet vērtību uz true.
33 33
           use_marketable_urls: Šī opcija maina saites no /pages/about uz /about un automātiski novērš konfliktus ar citiem spraudņiem.
34  
-          use_resource_caching: Šo opciju ieteicams iespējot produkcijas režīmā, jo tā nodrošina javascript un stylesheet failu apkopošanu vienā failu paketē, tādā veidā samazinot pieprasījumu skaitu uz Jūsu lapu un paātrinot tās darbību.
  34
+          use_resource_caching: Šo opciju ieteicams iespējot produkcijas režīmā, jo tā nodrošina javascript un stylesheet failu apkopošanu vienā failu paketē, tādā veidā samazinot pieprasījumu skaitu uz jūsu lapu un paātrinot tās darbību.
  35
+          approximate_ascii: "Ja izmantojat Latīņu burtus ar mīkstinājuma zīmēm, akcentiem utml., tad iespējojot šo uzstādījumu (vērtība: true) burti ā, č, ž u.c. tiks pārkonvertēti attiecīgi uz a, c un z, tāda veidā šie burti neizskatīsies savādi dažu parlūku adreses laukā."
35 36
   activerecord:
36 37
     models:
37 38
       refinery_setting: uzstādījums

No commit comments for this range

Something went wrong with that request. Please try again.