rich 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -149,7 +149,7 @@ Rich also includes a few settings that manipulate CKEditor settings, but are a b
149
149
 
150
150
  When you run the generator a css file is created for you in <tt>app/assets/stylesheets/rich/editor.css</tt>. Use this stylesheet to define the contents of the Styles drop down in CKEditor.
151
151
 
152
- === Image configuration
152
+ === Image configuration & (re)processing
153
153
 
154
154
  The styles you define in the initializer are passed to Paperclip directly, so the syntax is identical. See https://github.com/thoughtbot/paperclip/wiki/Thumbnail-Generation for more information.
155
155
 
@@ -30,7 +30,7 @@ rich.Browser.prototype = {
30
30
  initStyles: function(opt, def) {
31
31
  opt=opt.split(',');
32
32
  $.each(opt, function(index, value) {
33
- $('#styles').append("<li class='scope' id='style-"+value+"' data-rich-style='"+value+"'>"+value+"</li>");
33
+ if(value != 'rich_thumb') $('#styles').append("<li class='scope' id='style-"+value+"' data-rich-style='"+value+"'>"+value+"</li>");
34
34
  });
35
35
 
36
36
  browser.selectStyle(def);
@@ -3,7 +3,7 @@ module Rich
3
3
 
4
4
  def thumb_for_file(file)
5
5
  if file.simplified_type == "image"
6
- file.rich_file.url(:thumb)
6
+ file.rich_file.url(:rich_thumb)
7
7
  else
8
8
  asset_path "rich/document-thumb.png"
9
9
  end
@@ -10,13 +10,12 @@ if Object.const_defined?("Rich")
10
10
  #
11
11
  # For example, the elements available in the formats
12
12
  # dropdown are defined like this:
13
- # config.editor[:formats] = ""
13
+ # config.editor[:format_tags] = "h3;p;pre"
14
14
  #
15
15
  # By default, Rich visualizes what type of element
16
16
  # you are editing. To disable this:
17
17
  # config.editor[:startupOutlineBlocks] = false
18
18
 
19
-
20
19
  # == Image styles
21
20
  #
22
21
  # Rich uses paperclip for image processing. You can
@@ -25,8 +24,8 @@ if Object.const_defined?("Rich")
25
24
  # See: https://github.com/thoughtbot/paperclip/wiki/Thumbnail-Generation
26
25
  #
27
26
  # When you change these after uploading some files,
28
- # remember to do let Paperclip re-generate these by running
29
- # rake paperclip:refresh CLASS=Rich::RichFile
27
+ # remember to re-generate your styles by running:
28
+ # rake rich:refresh_assets
30
29
  config.image_styles = {
31
30
  :thumb => "100x100#"
32
31
  }
@@ -49,36 +48,36 @@ if Object.const_defined?("Rich")
49
48
  # the unprocessed file. Make sure this style exists.
50
49
  config.default_style = :thumb
51
50
 
52
- # == Upload non-image files
53
- #
54
- # Setting this option to true will add a second Rich filebrowser icon to
55
- # the editor toolbar. In this filebrowser you can upload non-image files.
56
- # Inserting these files into your editor will result in a direct (A) link.
57
- #
58
- # Default:
59
- # config.allow_document_uploads = false
51
+ # == Upload non-image files
52
+ #
53
+ # Setting this option to true will add a second Rich filebrowser icon to
54
+ # the editor toolbar. In this filebrowser you can upload non-image files.
55
+ # Inserting these files into your editor will result in a direct (A) link.
56
+ #
57
+ # Default:
58
+ # config.allow_document_uploads = false
60
59
 
61
- # == Set allowed filetypes for non-image files
62
- #
63
- # If you want, you can restrict the types of documents that users can upload.
64
- # Default behavior is to allow any kind of file to be uploaded. You can set
65
- # the accepted types by providing an array of mimetypes to check against.
66
- # Note that for this to have any effect, you first need to enable document
67
- # uploads using the setting above.
68
- #
69
- # Default, allow any file to be uploaded:
70
- # config.allowed_document_types = :all
71
- #
72
- # Example, only allow PDF uploads:
73
- # config.allowed_document_types = ['application/pdf']
60
+ # == Set allowed filetypes for non-image files
61
+ #
62
+ # If you want, you can restrict the types of documents that users can upload.
63
+ # Default behavior is to allow any kind of file to be uploaded. You can set
64
+ # the accepted types by providing an array of mimetypes to check against.
65
+ # Note that for this to have any effect, you first need to enable document
66
+ # uploads using the setting above.
67
+ #
68
+ # Default, allow any file to be uploaded:
69
+ # config.allowed_document_types = :all
70
+ #
71
+ # Example, only allow PDF uploads:
72
+ # config.allowed_document_types = ['application/pdf']
74
73
 
75
- # == Asset insertion
76
- #
77
- # Set this to true to keep the filebrowser open after inserting an asset.
78
- # Also configurable per-use from within the filebrowser.
79
- #
80
- # Default:
81
- # config.insert_many = false
74
+ # == Asset insertion
75
+ #
76
+ # Set this to true to keep the filebrowser open after inserting an asset.
77
+ # Also configurable per-use from within the filebrowser.
78
+ #
79
+ # Default:
80
+ # config.insert_many = false
82
81
 
83
82
  # == User Authentication
84
83
  #
data/lib/rich.rb CHANGED
@@ -7,12 +7,18 @@ require "rich/engine"
7
7
 
8
8
  module Rich
9
9
 
10
- # specify desired image styles here
11
- mattr_accessor :image_styles
10
+ # configure image styles
11
+ def self.image_styles
12
+ @@image_styles.merge({ :rich_thumb => "100x100#" })
13
+ end
14
+ def self.image_styles=(image_styles)
15
+ @@image_styles = image_styles
16
+ end
12
17
  @@image_styles = {
13
18
  :thumb => "100x100#"
14
19
  }
15
20
 
21
+
16
22
  mattr_accessor :allowed_styles
17
23
  @@allowed_styles = :all
18
24
 
@@ -122,10 +128,10 @@ module Rich
122
128
  editor_options
123
129
 
124
130
  end
125
-
131
+
126
132
  def self.validate_mime_type(mime, simplified_type)
127
133
  # does the mimetype match the given simplified type?
128
- puts "matching:" + mime + " TO " + simplified_type
134
+ #puts "matching:" + mime + " TO " + simplified_type
129
135
 
130
136
  false # assume the worst
131
137
 
data/lib/rich/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rich
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rich
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bastiaan Terhorst
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-11 00:00:00 Z
18
+ date: 2012-02-12 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails