bootsy 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- Copyright 2012 YOURNAME
1
+ Copyright 2012 Volmer Soares
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  Bootsy
2
2
  ==========
3
+ [![Build Status](https://secure.travis-ci.org/volmer/bootsy.png?branch=master)](http://travis-ci.org/volmer/bootsy)
3
4
 
4
5
  *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
6
 
data/Rakefile CHANGED
@@ -20,8 +20,19 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
23
+ Bundler::GemHelper.install_tasks
23
24
 
25
+ require "cucumber/rake/task"
26
+ require 'rspec/core/rake_task'
24
27
 
28
+ task :default => [:spec,:run]
25
29
 
26
- Bundler::GemHelper.install_tasks
30
+ RSpec::Core::RakeTask.new(:spec)
31
+
32
+ Cucumber::Rake::Task.new(:run) do |t|
33
+ t.cucumber_opts = ["-t","~@pending","features --format pretty","-s"]
34
+ end
27
35
 
36
+ Cucumber::Rake::Task.new(:wip) do |t|
37
+ t.cucumber_opts = ["-t","@wip","features"]
38
+ end
@@ -2,4 +2,4 @@
2
2
  //= require bootsy/wysihtml5
3
3
  //= require bootsy/bootstrap-wysihtml5
4
4
  //= require bootsy/bootsy
5
- //= require_directory ../bootsy/locales
5
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require_tree .
3
+ */
@@ -21,13 +21,15 @@ module Bootsy
21
21
  @gallery = find_gallery
22
22
  @gallery.save! unless @gallery.persisted?
23
23
  @image = @gallery.images.new params[:image]
24
+ @images = @gallery.images
24
25
 
25
26
  respond_to do |format|
26
- if @image.save
27
- @images = @gallery.images
27
+ if @image.save
28
28
  format.js
29
29
  format.json { render json: @image, status: :created, location: @image }
30
30
  else
31
+ pp @image.errors
32
+ format.js
31
33
  format.json { render json: @image.errors, status: :unprocessable_entity }
32
34
  end
33
35
  end
@@ -19,4 +19,4 @@
19
19
 
20
20
  <hr />
21
21
 
22
- <%= render 'bootsy/images/new', {image: gallery.images.new } %>
22
+ <%= render 'bootsy/images/new', {image: (defined?(image) && image.errors.any?) ? image : gallery.images.new } %>
@@ -1,3 +1,3 @@
1
1
  $('input.bootsy_image_gallery_id').val("<%= @gallery.id %>");
2
- $('#bootsy_image_gallery div.modal-body').html("<%= j render 'bootsy/images/index', {images: @images, gallery: @gallery}%>");
2
+ $('#bootsy_image_gallery div.modal-body').html("<%= j render 'bootsy/images/index', {images: @images, gallery: @gallery, image: @image}%>");
3
3
  $('#bootsy_image_gallery a.refresh_btn').hide();
@@ -2,6 +2,8 @@ require 'carrierwave'
2
2
  require 'remotipart'
3
3
  require 'bootsy/engine'
4
4
  require 'bootsy/media_container'
5
+ require 'bootsy/form_helper'
6
+ require 'bootsy/form_builder'
5
7
  require 'bootsy/core_ext'
6
8
 
7
9
  module Bootsy
@@ -7,9 +7,5 @@ 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
14
10
  end
15
11
  end
@@ -1,34 +1,2 @@
1
- module Bootsy
2
- module FormHelper
3
- def bootsy_area object, method, options = {}
4
-
5
- resource = options[:resource]
6
- options.delete :resource
7
-
8
- if resource.nil? && (object.nil? || object.is_a?(String) || object.is_a?(Array) || object.is_a?(Symbol))
9
- raise 'Bootsy area needs a model or a resource as its option'
10
- end
11
-
12
- object_name = object.class.name.underscore
13
-
14
- output = self.render 'bootsy/images/modal', {resource: resource || object}
15
- output += self.text_area object_name, method, options.merge({:class => 'bootsy_text_area'}){|key, oldval, newval| "#{oldval} #{newval}"}
16
- if resource.nil? || (resource == object)
17
- output += self.hidden_field object_name, :bootsy_image_gallery_id, :class => 'bootsy_image_gallery_id'
18
- end
19
- output
20
- end
21
-
22
- def self.included arg
23
- ActionView::Helpers::FormBuilder.send :include, Bootsy::FormBuilder
24
- end
25
- end
26
- end
27
-
28
- module Bootsy::FormBuilder
29
- def bootsy_area method, options = {}
30
- @template.bootsy_area @object, method, options
31
- end
32
- end
33
-
34
- ActionView::Helpers::FormHelper.send :include, Bootsy::FormHelper
1
+ ActionView::Helpers::FormHelper.send :include, Bootsy::FormHelper
2
+ ActionView::Helpers::FormBuilder.send :include, Bootsy::FormBuilder
@@ -0,0 +1,7 @@
1
+ module Bootsy
2
+ module FormBuilder
3
+ def bootsy_area method, options = {}
4
+ @template.bootsy_area @object, method, options
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,22 @@
1
+ module Bootsy
2
+ module FormHelper
3
+ def bootsy_area object, method, options = {}
4
+
5
+ resource = options[:resource]
6
+ options.delete :resource
7
+
8
+ unless resource.kind_of?(MediaContainer) || (resource.nil? && object.kind_of?(MediaContainer))
9
+ raise ArgumentError, 'Bootsy area needs a model or a resource as its option'
10
+ end
11
+
12
+ object_name = object.class.name.underscore
13
+
14
+ output = self.render 'bootsy/images/modal', {resource: resource || object}
15
+ output += self.text_area object_name, method, options.merge({:class => 'bootsy_text_area'}){|key, oldval, newval| "#{oldval} #{newval}"}
16
+ if resource.nil? || (resource == object)
17
+ output += self.hidden_field object_name, :bootsy_image_gallery_id, :class => 'bootsy_image_gallery_id'
18
+ end
19
+ output
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module Bootsy
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,12 @@
1
+ Description:
2
+ Adds Bootsy routes, locale and assets to your application.
3
+
4
+ Example:
5
+ rails generate bootsy:install
6
+
7
+ This will create:
8
+ route mount Bootsy::Engine => '/bootsy', as: 'bootsy'
9
+ create config/locales/bootsy.en.yml
10
+ insert app/assets/javascripts/application.js
11
+ insert app/assets/stylesheets/application.css
12
+
@@ -0,0 +1,36 @@
1
+ module Bootsy
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root __FILE__
5
+
6
+ def add_routes
7
+ route "mount Bootsy::Engine => '/bootsy', as: 'bootsy'"
8
+ end
9
+
10
+ def copy_locale
11
+ copy_file "../../../../config/locales/en.yml", "config/locales/bootsy.en.yml"
12
+ end
13
+
14
+ def add_assets
15
+
16
+ [{original: 'app/assets/javascripts/application.js',
17
+ skip_if: 'require bootsy',
18
+ content: "//= require bootsy\n",
19
+ position: {before: '//= require_tree .'}},
20
+ {original: 'app/assets/stylesheets/application.css',
21
+ skip_if: 'require bootsy',
22
+ content: "*= require bootsy\n",
23
+ position: {before: '*/'}}]. each do |params|
24
+
25
+ if File.binread(params[:original]).include?(params[:skip_if])
26
+ say_status 'skipped', "insert into #{params[:original]}", :yellow
27
+ else
28
+ insert_into_file params[:original], params[:content], params[:position]
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+ end
36
+ 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.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-17 00:00:00.000000000 Z
12
+ date: 2012-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mini_magick
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '3.4'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: '3.4'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: carrierwave
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 0.6.2
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: 0.6.2
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: remotipart
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: 1.0.2
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,13 +58,13 @@ dependencies:
58
58
  requirements:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 1.0.2
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rails
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ~>
67
+ - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: 3.2.6
70
70
  type: :development
@@ -72,7 +72,7 @@ dependencies:
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - ~>
75
+ - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: 3.2.6
78
78
  - !ruby/object:Gem::Dependency
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: 1.3.6
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: 1.3.6
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: rspec-rails
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
- version: '0'
101
+ version: 2.11.0
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: 2.11.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: factory_girl_rails
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ! '>='
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 3.5.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ! '>='
124
124
  - !ruby/object:Gem::Version
125
- version: '0'
125
+ version: 3.5.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: database_cleaner
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ! '>='
132
132
  - !ruby/object:Gem::Version
133
- version: '0'
133
+ version: 0.8.0
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ! '>='
140
140
  - !ruby/object:Gem::Version
141
- version: '0'
141
+ version: 0.8.0
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: cucumber-rails
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +146,7 @@ dependencies:
146
146
  requirements:
147
147
  - - ! '>='
148
148
  - !ruby/object:Gem::Version
149
- version: '0'
149
+ version: 1.2.1
150
150
  type: :development
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ dependencies:
154
154
  requirements:
155
155
  - - ! '>='
156
156
  - !ruby/object:Gem::Version
157
- version: '0'
157
+ version: 1.2.1
158
158
  description: Bootsy is a WYSIWIG editor for Rails applications based on WYSIHTML5
159
159
  and Twitter Bootstrap. It integrates images uploads using CarrierWave, as an image
160
160
  gallery scoped in models of your application.
@@ -165,39 +165,42 @@ extensions: []
165
165
  extra_rdoc_files: []
166
166
  files:
167
167
  - app/uploaders/bootsy/image_uploader.rb
168
- - app/helpers/bootsy/application_helper.rb
169
- - app/views/bootsy/images/_index.html.erb
170
168
  - app/views/bootsy/images/index.js.erb
169
+ - app/views/bootsy/images/_index.html.erb
171
170
  - app/views/bootsy/images/destroy.js.erb
172
171
  - app/views/bootsy/images/create.js.erb
173
- - app/views/bootsy/images/_new.html.erb
174
172
  - app/views/bootsy/images/_modal.html.erb
175
- - app/assets/stylesheets/bootsy/bootstrap-wysihtml5.css
176
- - app/assets/stylesheets/bootsy/application.css
173
+ - app/views/bootsy/images/_new.html.erb
174
+ - app/controllers/bootsy/application_controller.rb
175
+ - app/controllers/bootsy/images_controller.rb
176
+ - app/helpers/bootsy/application_helper.rb
177
+ - app/assets/javascripts/bootsy.js
177
178
  - app/assets/javascripts/bootsy/locales/bootstrap-wysihtml5.pt-BR.js
178
179
  - app/assets/javascripts/bootsy/wysihtml5.js
179
- - app/assets/javascripts/bootsy/application.js
180
180
  - app/assets/javascripts/bootsy/bootstrap-wysihtml5.js
181
181
  - app/assets/javascripts/bootsy/bootsy.js.erb
182
- - app/controllers/bootsy/application_controller.rb
183
- - app/controllers/bootsy/images_controller.rb
184
- - config/locales/pt-BR.yml
182
+ - app/assets/stylesheets/bootsy.css
183
+ - app/assets/stylesheets/bootsy/bootstrap-wysihtml5.css
185
184
  - config/locales/en.yml
186
- - config/cucumber.yml
187
- - config/bootsy.yml
185
+ - config/locales/pt-BR.yml
188
186
  - config/routes.rb
187
+ - config/bootsy.yml
188
+ - config/cucumber.yml
189
189
  - db/migrate/20120624171333_create_bootsy_images.rb
190
190
  - db/migrate/20120628124845_create_bootsy_image_galleries.rb
191
- - lib/generators/install_generator.rb
192
- - lib/tasks/cucumber.rake
193
- - lib/tasks/bootsy_tasks.rake
191
+ - lib/generators/bootsy/install_generator.rb
192
+ - lib/generators/bootsy/USAGE
194
193
  - lib/bootsy.rb
195
- - lib/bootsy/version.rb
196
- - lib/bootsy/engine.rb
194
+ - lib/tasks/bootsy_tasks.rake
195
+ - lib/tasks/cucumber.rake
196
+ - lib/bootsy/form_helper.rb
197
197
  - lib/bootsy/media_container.rb
198
- - lib/bootsy/core_ext.rb
199
- - lib/bootsy/activerecord/image.rb
198
+ - lib/bootsy/version.rb
200
199
  - lib/bootsy/activerecord/image_gallery.rb
200
+ - lib/bootsy/activerecord/image.rb
201
+ - lib/bootsy/core_ext.rb
202
+ - lib/bootsy/form_builder.rb
203
+ - lib/bootsy/engine.rb
201
204
  - MIT-LICENSE
202
205
  - Rakefile
203
206
  - README.md
@@ -215,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
218
  version: '0'
216
219
  segments:
217
220
  - 0
218
- hash: 792521922030323784
221
+ hash: -1387219841281359177
219
222
  required_rubygems_version: !ruby/object:Gem::Requirement
220
223
  none: false
221
224
  requirements:
@@ -224,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
227
  version: '0'
225
228
  segments:
226
229
  - 0
227
- hash: 792521922030323784
230
+ hash: -1387219841281359177
228
231
  requirements: []
229
232
  rubyforge_project:
230
233
  rubygems_version: 1.8.24
@@ -1,4 +0,0 @@
1
- /*
2
- *= require bootsy/bootstrap-wysihtml5
3
- *= require_tree .
4
- */
@@ -1,27 +0,0 @@
1
- module Bootsy
2
- module Generators
3
- class InstallGenerator < Rails::Generators::Base
4
-
5
- desc "Copy Bootsy config and locale files to your application."
6
-
7
-
8
- def add_routes
9
- insert_into_file "config/routes.rb", " mount Bootsy::Engine => '/bootsy', as: 'bootsy'\n", after: "Rails.application.routes.draw do\n"
10
- end
11
-
12
-
13
- def copy_config
14
- copy_file "../../config/bootsy.yml", "config/bootsy.yml"
15
- end
16
-
17
- def copy_locale
18
- copy_file "../../config/locales/en.yml", "config/locales/bootsy.en.yml"
19
- end
20
-
21
- def add_assets
22
- insert_into_file "app/assets/javascripts/application.js", "//= require bootsy/application\n", after: "jquery_ujs\n"
23
- insert_into_file "app/assets/stylesheets/application.css", "*= require bootsy/application\n", after: "require_self\n"
24
- end
25
- end
26
- end
27
- end