refinerycms 0.9.6.17 → 0.9.6.18

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.6.17
1
+ 0.9.6.18
@@ -2,7 +2,7 @@
2
2
  RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
3
3
 
4
4
  # Specified gem version of Refinery to use when vendor/plugins/refinery/lib/refinery.rb is not present.
5
- REFINERY_GEM_VERSION = '0.9.6.15' unless defined? REFINERY_GEM_VERSION
5
+ REFINERY_GEM_VERSION = '0.9.6.18' unless defined? REFINERY_GEM_VERSION
6
6
 
7
7
  # Boot Rails
8
8
  require File.join(File.dirname(__FILE__), 'boot')
data/db/seeds.rb CHANGED
@@ -7,9 +7,9 @@
7
7
  {:name => "image_thumbnails", :value => {
8
8
  :dialog_thumb => 'c106x106',
9
9
  :grid => 'c135x135',
10
- :thumb => '50x50',
11
- :medium => '225x255',
12
- :side_body => '300x500',
10
+ :thumb => '50x50>',
11
+ :medium => '225x255>',
12
+ :side_body => '300x500>',
13
13
  :preview => 'c96x96'
14
14
  }
15
15
  }].each do |setting|
@@ -649,8 +649,11 @@ var image_picker = {
649
649
  , changed: function(image) {
650
650
  $(this.options.field).val(image.id.replace("image_", ""));
651
651
 
652
- image.src = image.src.replace('_dialog_thumb', '_' + this.options.thumbnail);
653
- $(this.options.image_display).attr('src', image.src).addClass('brown_border').show();
652
+ image.src = image.src.replace('_dialog_thumb', '_' + this.options.thumbnail).replace(/\?\d*/, '');
653
+
654
+ current_image = $(this.options.image_display);
655
+ current_image.replaceWith($("<img src='"+image.src+"?"+Math.floor(Math.random() * 1000000000)+"' id='"+current_image.attr('id')+"' class='brown_border' />"));
656
+
654
657
  $(this.options.remove_image_button).show();
655
658
  $(this.options.no_image_message).hide();
656
659
  }
data/readme.md CHANGED
@@ -27,16 +27,15 @@ Unlike other content managers, Refinery is truly aimed at the end user making it
27
27
 
28
28
  ## Requirements
29
29
 
30
- Refinery runs using a number of gems which (as of Refinery version 0.9.6.14) are outlined below:
31
-
32
- * [rake >= 0.8.3](http://rubygems.org/gems/rake)
33
- * [friendly_id >= 2.3.2](http://rubygems.org/gems/friendly_id)
34
- * [will_paginate >= 2.3.11](http://rubygems.org/gems/will_paginate)
35
- * [rails >= 2.3.5](http://rubygems.org/gems/rails)
36
- * [aasm >= 2.1.3](http://rubygems.org/gems/aasm)
37
- * [unicode >= 0.1](http://rubygems.org/gems/unicode)
38
- * [hpricot >= 0.8.1](http://rubygems.org/gems/hpricot)
39
- * [slim_scrooge >= 1.0.5](http://rubygems.org/gems/slim_scrooge)
30
+ Refinery runs using a number of gems which (as of Refinery version 0.9.6.18) are outlined below:
31
+
32
+ * [friendly_id ~> 2.3.2](http://rubygems.org/gems/friendly_id)
33
+ * [will_paginate ~> 2.3.11](http://rubygems.org/gems/will_paginate)
34
+ * [rails ~> 2.3.5](http://rubygems.org/gems/rails)
35
+ * [aasm ~> 2.1.3](http://rubygems.org/gems/aasm)
36
+ * [unicode ~> 0.1](http://rubygems.org/gems/unicode)
37
+ * [hpricot ~> 0.8.1](http://rubygems.org/gems/hpricot)
38
+ * [slim_scrooge ~> 1.0.5](http://rubygems.org/gems/slim_scrooge)
40
39
 
41
40
  ### Other dependancies
42
41
 
@@ -10,7 +10,7 @@
10
10
  <div id='current_image_container_<%= randomiser %>'<%= " style='display: none'" if toggle_image_display %> style="margin-top: 10px;">
11
11
  <a id='current_image_link_<%= randomiser %>' href="<%= insert_admin_images_url(:dialog => true, :callback => "image_picker_#{randomiser}_changed", :width => 958, :height => 510) %>" style='border: 0px' title='Change <%= description.titleize %>' name='Change <%= description.titleize %>' class='dialog'>
12
12
  <% unless image.nil? -%>
13
- <%= image_fu image, nil, {:class => "brown_border", :id => "current_picked_image_#{randomiser}"} %>
13
+ <%= image_fu image, :medium, {:class => "brown_border", :id => "current_picked_image_#{randomiser}"} %>
14
14
  <% else -%>
15
15
  <img id="current_picked_image_<%= randomiser %>" class="" src="" alt="" style='display: none' />
16
16
  <% end -%>
@@ -12,10 +12,10 @@ class RefineryGenerator < Rails::Generator::NamedBase
12
12
  def manifest
13
13
  record do |m|
14
14
  # Copy controller, model and migration
15
- directories = ["vendor/plugins/#{plural_name}", "vendor/plugins/#{plural_name}/app", "vendor/plugins/#{plural_name}/app/controllers",
16
- "vendor/plugins/#{plural_name}/app/controllers/admin", "vendor/plugins/#{plural_name}/app/models", "vendor/plugins/#{plural_name}/app/views",
17
- "vendor/plugins/#{plural_name}/app/helpers", "vendor/plugins/#{plural_name}/app/views", "vendor/plugins/#{plural_name}/app/views/admin",
18
- "vendor/plugins/#{plural_name}/config", "vendor/plugins/#{plural_name}/rails"]
15
+ directories = ["#{plural_name}", "#{plural_name}/app", "#{plural_name}/app/controllers",
16
+ "#{plural_name}/app/controllers/admin", "#{plural_name}/app/models", "#{plural_name}/app/views",
17
+ "#{plural_name}/app/helpers", "#{plural_name}/app/views", "#{plural_name}/app/views/admin",
18
+ "#{plural_name}/config", "#{plural_name}/rails"].map { |d| "vendor/plugins/#{d}" }
19
19
 
20
20
  directories.each do |dir|
21
21
  m.directory dir
@@ -2,7 +2,14 @@ class <%= migration_name %> < ActiveRecord::Migration
2
2
 
3
3
  def self.up
4
4
  create_table :<%= table_name %> do |t|
5
- <% attributes.each do |attribute| -%>
5
+ <%
6
+ attributes.each do |attribute|
7
+ # turn image into what it was supposed to be which is an integer reference to an image.
8
+ if attribute.type.to_s == 'image'
9
+ attribute.type = 'integer'
10
+ attribute.name = "#{attribute.name}_id".gsub("_id_id", "_id")
11
+ end
12
+ -%>
6
13
  t.<%= attribute.type %> :<%= attribute.name %>
7
14
  <% end -%>
8
15
  t.integer :position
@@ -5,5 +5,9 @@ class <%= class_name %> < ActiveRecord::Base
5
5
 
6
6
  validates_presence_of :<%= attributes.first.name %>
7
7
  validates_uniqueness_of :<%= attributes.first.name %>
8
+
9
+ <% attributes.collect{|a| a if a.type.to_s == 'image'}.compact.uniq.each do |a| -%>
10
+ belongs_to :<%= a.name.gsub("_id", "") %><%= ", :class_name => 'Image'" unless a.name =~ /^image(_id)?$/ %>
11
+ <% end -%>
8
12
 
9
- end
13
+ end
@@ -3,7 +3,14 @@
3
3
  <% attributes.each_with_index do |attribute, index| %>
4
4
  <div class='field'>
5
5
  <%%= f.label :<%= attribute.name %> -%>
6
- <% if attribute.field_type.to_s == "text_area" -%>
6
+ <% if attribute.type.to_s == 'image' -%>
7
+ <%%= render :partial => "/shared/admin/image_picker", :locals => {
8
+ :f => f,
9
+ :field => :<%= "#{attribute.name}_id".gsub("_id_id", "_id") %>,
10
+ :image => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %>,
11
+ :toggle_image_display => false
12
+ } %>
13
+ <% elsif attribute.field_type.to_s == "text_area" -%>
7
14
  <%%= f.text_area :<%= attribute.name %>, :rows => 20, :cols => 140, :class => 'wymeditor' -%>
8
15
  <% else -%>
9
16
  <%%= f.<%= attribute.field_type -%> :<%= attribute.name -%><%= ", :class => 'larger'" if (index == 0 && attribute.field_type == :text_field) -%> -%>
@@ -11,4 +18,4 @@
11
18
  </div>
12
19
  <% end %>
13
20
  <%%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %>
14
- <%% end -%>
21
+ <%% end -%>
@@ -6,7 +6,11 @@
6
6
  <% attributes.each do |attribute| %>
7
7
  <div>
8
8
  <h3><%= attribute.name.titleize %></h3>
9
+ <% unless attribute.type.to_s == 'image' -%>
9
10
  <%%= @<%= singular_name %>.<%= attribute.name %> %>
11
+ <% else -%>
12
+ <%%= image_fu @<%= singular_name %>.<%= attribute.name %>, nil %>
13
+ <% end -%>
10
14
  </div>
11
15
  <% end %>
12
16
  <%% end %>
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 9
8
8
  - 6
9
- - 17
10
- version: 0.9.6.17
9
+ - 18
10
+ version: 0.9.6.18
11
11
  platform: ruby
12
12
  authors:
13
13
  - Resolve Digital