bootsy 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Bootsy
2
2
  ==========
3
3
 
4
- *Bootsy* is a WYSIWYG solution for Rails based on [Bootstrap-wysihtml5](https://github.com/jhollingworth/bootstrap-wysihtml5) which includes image uploads via [Carrierwave](https://github.com/jnicklas/carrierwave).
4
+ *Bootsy* is a WYSIWYG solution for Rails based on [Bootstrap-wysihtml5](https://github.com/jhollingworth/bootstrap-wysihtml5) which includes image uploads via [CarrierWave](https://github.com/jnicklas/carrierwave).
5
5
 
6
6
 
7
7
  ## Requirements
@@ -71,7 +71,7 @@ Bootsy defines some i18n keys. The english translation is automatically added to
71
71
 
72
72
  ## Mongoid support
73
73
 
74
- Par default, Bootsy only supports ActiveRecord. A [Mongoid support](https://github.com/volmer/bootsy-mongoid) is currently in development.
74
+ Par default, Bootsy only supports ActiveRecord. In order to use Bootsy with Mongoid, please use [bootsy-mongoid](https://github.com/volmer/bootsy-mongoid) instead.
75
75
 
76
76
 
77
77
  ## License
@@ -1,4 +1,5 @@
1
1
  //= require jquery.remotipart
2
2
  //= require bootsy/wysihtml5
3
3
  //= require bootsy/bootstrap-wysihtml5
4
- //= require bootsy/bootsy
4
+ //= require bootsy/bootsy
5
+ //= require_directory ../bootsy/locales
@@ -26,7 +26,7 @@
26
26
  "<a class='btn' data-wysihtml5-command='insertUnorderedList' title='" + locale.lists.unordered + "'><i class='icon-list'></i></a>" +
27
27
  "<a class='btn' data-wysihtml5-command='insertOrderedList' title='" + locale.lists.ordered + "'><i class='icon-th-list'></i></a>" +
28
28
  "<a class='btn' data-wysihtml5-command='Outdent' title='" + locale.lists.outdent + "'><i class='icon-indent-right'></i></a>" +
29
- "<a class='btn' data-wysihtml5-command='Indent' title='" + locale.lists.indered + "'><i class='icon-indent-left'></i></a>" +
29
+ "<a class='btn' data-wysihtml5-command='Indent' title='" + locale.lists.indent + "'><i class='icon-indent-left'></i></a>" +
30
30
  "</div>" +
31
31
  "</li>",
32
32
  "link": "<li>" +
@@ -36,7 +36,7 @@ $(document).ready(function(){
36
36
  bootsyRefreshGallery(element);
37
37
  });
38
38
 
39
- wysihtml5Editor = $('textarea.bootsy_text_area').wysihtml5({"image": false, "imageUpload": true, imageUploadCallback: bootsyOpenImageGallery}).data("wysihtml5").editor;
39
+ wysihtml5Editor = $('textarea.bootsy_text_area').wysihtml5({"image": false, "imageUpload": true, imageUploadCallback: bootsyOpenImageGallery, locale: "<%= I18n.default_locale %>"}).data("wysihtml5").editor;
40
40
 
41
41
  element.on('hide', function() {
42
42
  wysihtml5Editor.currentView.element.focus();
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Brazilian portuguese translation for bootstrap-wysihtml5
3
+ */
4
+ (function($){
5
+ $.fn.wysihtml5.locale["pt-BR"] = {
6
+ font_styles: {
7
+ normal: "Texto normal",
8
+ h1: "Título 1",
9
+ h2: "Título 2"
10
+ },
11
+ emphasis: {
12
+ bold: "Negrito",
13
+ italic: "Itálico",
14
+ underline: "Sublinhado"
15
+ },
16
+ lists: {
17
+ unordered: "Lista",
18
+ ordered: "Lista numerada",
19
+ outdent: "Remover indentação",
20
+ indent: "Indentar"
21
+ },
22
+ link: {
23
+ insert: "Inserir link",
24
+ cancel: "Cancelar"
25
+ },
26
+ image: {
27
+ insert: "Inserir imagem",
28
+ cancel: "Cancelar"
29
+ },
30
+ html: {
31
+ edit: "Editar HTML"
32
+ }
33
+ };
34
+ }(jQuery));
@@ -1,7 +1,7 @@
1
1
  require_dependency "bootsy/application_controller"
2
2
 
3
3
  module Bootsy
4
- class ImagesController < ApplicationController
4
+ class ImagesController < Bootsy::ApplicationController
5
5
  # GET /images
6
6
  # GET /images.json
7
7
  def index
@@ -1,8 +1,12 @@
1
1
  module Bootsy
2
2
  module ApplicationHelper
3
3
  def refresh_btn gallery, collection
4
- gallery = nil unless gallery.nil? || gallery.persisted?
5
- link_to t('bootsy.refresh'), [bootsy, gallery, collection], remote: true, :class => 'btn btn-mini refresh_btn'
4
+ link_to t('bootsy.refresh'), [bootsy, resource_or_nil(gallery), collection], remote: true, :class => 'btn btn-mini refresh_btn'
5
+ end
6
+
7
+ def resource_or_nil resource
8
+ resource = nil unless resource.nil? || resource.persisted?
9
+ resource
6
10
  end
7
11
  end
8
12
  end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ module Bootsy
3
+ class ImageUploader < CarrierWave::Uploader::Base
4
+
5
+ include CarrierWave::MiniMagick
6
+
7
+ include Sprockets::Helpers::RailsHelper
8
+ include Sprockets::Helpers::IsolatedHelper
9
+
10
+ storage :file
11
+
12
+
13
+ def store_dir
14
+ "uploads/#{model.class.to_s.underscore}/#{model.id}"
15
+ end
16
+
17
+ # Process files as they are uploaded:
18
+ process :resize_to_limit => [940, 940]
19
+
20
+ version :large do
21
+ process :resize_to_fit => [600, 600]
22
+ end
23
+
24
+ version :medium do
25
+ process :resize_to_fit => [300, 300]
26
+ end
27
+
28
+ version :small do
29
+ process :resize_to_fit => [160, 160]
30
+ end
31
+
32
+ version :thumb do
33
+ process :resize_to_fill => [60, 60]
34
+ end
35
+
36
+ def extension_white_list
37
+ %w(jpg jpeg gif png)
38
+ end
39
+ end
40
+ end
@@ -1,6 +1,6 @@
1
1
  <h3><%= t 'bootsy.image.new' %></h3>
2
2
 
3
- <%= form_for [bootsy, (image.image_gallery || Bootsy::ImageGallery), image], remote: true, html: {:class => 'bootsy'} do |f| %>
3
+ <%= form_for [bootsy, resource_or_nil(image.image_gallery), image], remote: true, html: {:class => 'bootsy'} do |f| %>
4
4
  <% if image.errors.any? %>
5
5
  <div id="error_explanation">
6
6
  <h2><%= pluralize(image.errors.count, "error") %> prohibited this image from being saved:</h2>
@@ -0,0 +1,8 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
5
+ %>
6
+ default: <%= std_opts %> features
7
+ wip: --tags @wip:3 --wip features
8
+ rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
@@ -7,5 +7,9 @@ module Bootsy
7
7
  attr_accessible :image_file
8
8
 
9
9
  validates_presence_of :image_file, :image_gallery_id
10
+
11
+ def pau
12
+ 'pica'
13
+ end
10
14
  end
11
15
  end
@@ -6,7 +6,7 @@ module Bootsy
6
6
  options.delete :resource
7
7
 
8
8
  if resource.nil? && (object.nil? || object.is_a?(String) || object.is_a?(Array) || object.is_a?(Symbol))
9
- raise PedroError
9
+ raise 'Bootsy area needs a model or a resource as its option'
10
10
  end
11
11
 
12
12
  object_name = object.class.name.underscore
data/lib/bootsy/engine.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module Bootsy
2
- class Engine < ::Rails::Engine
2
+ class Engine < Rails::Engine
3
+
3
4
  isolate_namespace Bootsy
4
5
 
5
6
  config.generators do |g|
@@ -12,5 +13,19 @@ module Bootsy
12
13
  helper Bootsy::ApplicationHelper
13
14
  end
14
15
  end
16
+
17
+ config.after_initialize do
18
+ if defined?(BOOTSY_ORM)
19
+ orm = BOOTSY_ORM
20
+ else
21
+ orm = :activerecord
22
+ end
23
+
24
+
25
+ case orm
26
+ when :activerecord
27
+ Dir[File.expand_path('../activerecord/*.rb', __FILE__)].each {|f| require f }
28
+ end
29
+ end
15
30
  end
16
31
  end
@@ -1,3 +1,3 @@
1
1
  module Bootsy
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,65 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+
7
+
8
+ unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
9
+
10
+ vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
11
+ $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
12
+
13
+ begin
14
+ require 'cucumber/rake/task'
15
+
16
+ namespace :cucumber do
17
+ Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
18
+ t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
19
+ t.fork = true # You may get faster startup if you set this to false
20
+ t.profile = 'default'
21
+ end
22
+
23
+ Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
24
+ t.binary = vendored_cucumber_bin
25
+ t.fork = true # You may get faster startup if you set this to false
26
+ t.profile = 'wip'
27
+ end
28
+
29
+ Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
30
+ t.binary = vendored_cucumber_bin
31
+ t.fork = true # You may get faster startup if you set this to false
32
+ t.profile = 'rerun'
33
+ end
34
+
35
+ desc 'Run all features'
36
+ task :all => [:ok, :wip]
37
+
38
+ task :statsetup do
39
+ require 'rails/code_statistics'
40
+ ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
41
+ ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
42
+ end
43
+ end
44
+ desc 'Alias for cucumber:ok'
45
+ task :cucumber => 'cucumber:ok'
46
+
47
+ task :default => :cucumber
48
+
49
+ task :features => :cucumber do
50
+ STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
51
+ end
52
+
53
+ # In case we don't have ActiveRecord, append a no-op task that we can depend upon.
54
+ task 'db:test:prepare' do
55
+ end
56
+
57
+ task :stats => 'cucumber:statsetup'
58
+ rescue LoadError
59
+ desc 'cucumber rake task not available (cucumber not installed)'
60
+ task :cucumber do
61
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
62
+ end
63
+ end
64
+
65
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootsy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,26 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-13 00:00:00.000000000 Z
12
+ date: 2012-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 3.2.6
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 3.2.6
30
- - !ruby/object:Gem::Dependency
31
- name: jquery-rails
15
+ name: mini_magick
32
16
  requirement: !ruby/object:Gem::Requirement
33
17
  none: false
34
18
  requirements:
@@ -44,7 +28,7 @@ dependencies:
44
28
  - !ruby/object:Gem::Version
45
29
  version: '0'
46
30
  - !ruby/object:Gem::Dependency
47
- name: mini_magick
31
+ name: carrierwave
48
32
  requirement: !ruby/object:Gem::Requirement
49
33
  none: false
50
34
  requirements:
@@ -60,7 +44,7 @@ dependencies:
60
44
  - !ruby/object:Gem::Version
61
45
  version: '0'
62
46
  - !ruby/object:Gem::Dependency
63
- name: carrierwave
47
+ name: remotipart
64
48
  requirement: !ruby/object:Gem::Requirement
65
49
  none: false
66
50
  requirements:
@@ -76,21 +60,21 @@ dependencies:
76
60
  - !ruby/object:Gem::Version
77
61
  version: '0'
78
62
  - !ruby/object:Gem::Dependency
79
- name: remotipart
63
+ name: rails
80
64
  requirement: !ruby/object:Gem::Requirement
81
65
  none: false
82
66
  requirements:
83
- - - ! '>='
67
+ - - ~>
84
68
  - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :runtime
69
+ version: 3.2.6
70
+ type: :development
87
71
  prerelease: false
88
72
  version_requirements: !ruby/object:Gem::Requirement
89
73
  none: false
90
74
  requirements:
91
- - - ! '>='
75
+ - - ~>
92
76
  - !ruby/object:Gem::Version
93
- version: '0'
77
+ version: 3.2.6
94
78
  - !ruby/object:Gem::Dependency
95
79
  name: sqlite3
96
80
  requirement: !ruby/object:Gem::Requirement
@@ -124,23 +108,23 @@ dependencies:
124
108
  - !ruby/object:Gem::Version
125
109
  version: '0'
126
110
  - !ruby/object:Gem::Dependency
127
- name: shoulda-matchers
111
+ name: factory_girl_rails
128
112
  requirement: !ruby/object:Gem::Requirement
129
113
  none: false
130
114
  requirements:
131
- - - ~>
115
+ - - ! '>='
132
116
  - !ruby/object:Gem::Version
133
- version: '1.0'
117
+ version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
121
  none: false
138
122
  requirements:
139
- - - ~>
123
+ - - ! '>='
140
124
  - !ruby/object:Gem::Version
141
- version: '1.0'
125
+ version: '0'
142
126
  - !ruby/object:Gem::Dependency
143
- name: factory_girl_rails
127
+ name: database_cleaner
144
128
  requirement: !ruby/object:Gem::Requirement
145
129
  none: false
146
130
  requirements:
@@ -156,7 +140,7 @@ dependencies:
156
140
  - !ruby/object:Gem::Version
157
141
  version: '0'
158
142
  - !ruby/object:Gem::Dependency
159
- name: database_cleaner
143
+ name: cucumber-rails
160
144
  requirement: !ruby/object:Gem::Requirement
161
145
  none: false
162
146
  requirements:
@@ -172,7 +156,7 @@ dependencies:
172
156
  - !ruby/object:Gem::Version
173
157
  version: '0'
174
158
  description: Bootsy is a WYSIWIG editor for Rails applications based on WYSIHTML5
175
- and Twitter Bootstrap. It integrates images uploads using Carrierwave, as an image
159
+ and Twitter Bootstrap. It integrates images uploads using CarrierWave, as an image
176
160
  gallery scoped in models of your application.
177
161
  email:
178
162
  - lrvolmer@gmail.com
@@ -180,9 +164,8 @@ executables: []
180
164
  extensions: []
181
165
  extra_rdoc_files: []
182
166
  files:
183
- - app/uploaders/image_uploader.rb
167
+ - app/uploaders/bootsy/image_uploader.rb
184
168
  - app/helpers/bootsy/application_helper.rb
185
- - app/helpers/bootsy/images_helper.rb
186
169
  - app/views/bootsy/images/_index.html.erb
187
170
  - app/views/bootsy/images/index.js.erb
188
171
  - app/views/bootsy/images/destroy.js.erb
@@ -191,27 +174,30 @@ files:
191
174
  - app/views/bootsy/images/_modal.html.erb
192
175
  - app/assets/stylesheets/bootsy/bootstrap-wysihtml5.css
193
176
  - app/assets/stylesheets/bootsy/application.css
177
+ - app/assets/javascripts/bootsy/locales/bootstrap-wysihtml5.pt-BR.js
194
178
  - app/assets/javascripts/bootsy/wysihtml5.js
195
179
  - app/assets/javascripts/bootsy/application.js
196
180
  - app/assets/javascripts/bootsy/bootstrap-wysihtml5.js
197
- - app/assets/javascripts/bootsy/bootsy.js
198
- - app/models/bootsy/image.rb
199
- - app/models/bootsy/image_gallery.rb
181
+ - app/assets/javascripts/bootsy/bootsy.js.erb
200
182
  - app/controllers/bootsy/application_controller.rb
201
183
  - app/controllers/bootsy/images_controller.rb
202
184
  - config/locales/pt-BR.yml
203
185
  - config/locales/en.yml
186
+ - config/cucumber.yml
204
187
  - config/bootsy.yml
205
188
  - config/routes.rb
206
189
  - db/migrate/20120624171333_create_bootsy_images.rb
207
190
  - db/migrate/20120628124845_create_bootsy_image_galleries.rb
208
191
  - lib/generators/install_generator.rb
192
+ - lib/tasks/cucumber.rake
209
193
  - lib/tasks/bootsy_tasks.rake
210
194
  - lib/bootsy.rb
211
195
  - lib/bootsy/version.rb
212
196
  - lib/bootsy/engine.rb
213
197
  - lib/bootsy/media_container.rb
214
198
  - lib/bootsy/core_ext.rb
199
+ - lib/bootsy/activerecord/image.rb
200
+ - lib/bootsy/activerecord/image_gallery.rb
215
201
  - MIT-LICENSE
216
202
  - Rakefile
217
203
  - README.md
@@ -229,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
215
  version: '0'
230
216
  segments:
231
217
  - 0
232
- hash: -2628595835958805564
218
+ hash: 792521922030323784
233
219
  required_rubygems_version: !ruby/object:Gem::Requirement
234
220
  none: false
235
221
  requirements:
@@ -238,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
224
  version: '0'
239
225
  segments:
240
226
  - 0
241
- hash: -2628595835958805564
227
+ hash: 792521922030323784
242
228
  requirements: []
243
229
  rubyforge_project:
244
230
  rubygems_version: 1.8.24
@@ -1,4 +0,0 @@
1
- module Bootsy
2
- module ImagesHelper
3
- end
4
- end
@@ -1,39 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class ImageUploader < CarrierWave::Uploader::Base
4
-
5
- include CarrierWave::MiniMagick
6
-
7
- include Sprockets::Helpers::RailsHelper
8
- include Sprockets::Helpers::IsolatedHelper
9
-
10
- storage :file
11
-
12
-
13
- def store_dir
14
- "uploads/#{model.class.to_s.underscore}/#{model.id}"
15
- end
16
-
17
- # Process files as they are uploaded:
18
- process :resize_to_limit => [940, 940]
19
-
20
- version :large do
21
- process :resize_to_fit => [600, 600]
22
- end
23
-
24
- version :medium do
25
- process :resize_to_fit => [300, 300]
26
- end
27
-
28
- version :small do
29
- process :resize_to_fit => [160, 160]
30
- end
31
-
32
- version :thumb do
33
- process :resize_to_fill => [60, 60]
34
- end
35
-
36
- def extension_white_list
37
- %w(jpg jpeg gif png)
38
- end
39
- end