diff --git a/CHANGELOG.md b/CHANGELOG.md index 18065e6918..db516850eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,15 @@ ### Upcoming Release +### 0.2.0 (April 20, 2016) + +* [#476] [CHANGE] Extract `Administrate::Field::Image` into its own gem. + Users who have image fields in their dashboards + should add to their `Gemfile`: + ```ruby + gem "administrate-field-image" + ``` + ### 0.1.5 (April 1, 2016) * [master] [BUGFIX] Protect from CSRF attacks [CVE-2016-3098] diff --git a/Gemfile b/Gemfile index 400a47d620..e8098ce35a 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ ruby "2.2.3" gemspec +gem "administrate-field-image" gem "delayed_job_active_record" gem "high_voltage" gem "markdown-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 3e5c694dbc..7c3ef9704d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - administrate (0.1.5) + administrate (0.2.0) autoprefixer-rails (~> 6.0) datetime_picker_rails (~> 0.0.7) jquery-rails (~> 4.0) @@ -52,6 +52,9 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.3.8) + administrate-field-image (0.0.2) + administrate (>= 0.2.0.rc1, < 0.3.0) + rails (~> 4.2) ammeter (1.1.3) activesupport (>= 3.0) railties (>= 3.0) @@ -152,7 +155,7 @@ GEM mime-types (2.99.1) mini_portile2 (2.0.0) minitest (5.8.4) - momentjs-rails (2.11.0) + momentjs-rails (2.11.1) railties (>= 3.1) multi_json (1.11.2) neat (1.7.4) @@ -280,6 +283,7 @@ PLATFORMS DEPENDENCIES administrate! + administrate-field-image ammeter appraisal awesome_print diff --git a/README.md b/README.md index d6f14c7f40..5cecce9f66 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Add Administrate to your Gemfile: ```ruby # Gemfile -gem "administrate", "~> 0.1.5" +gem "administrate", "~> 0.2.0" ``` Re-bundle, then run the installer: diff --git a/app/views/fields/image/_form.html.erb b/app/views/fields/image/_form.html.erb deleted file mode 100644 index 18712a711a..0000000000 --- a/app/views/fields/image/_form.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -<%# -# Image Form Partial - -This partial renders an input element for image attributes. -By default, the input is a text field for the image's URL. - -## Local variables: - -- `f`: - A Rails form generator, used to help create the appropriate input fields. -- `field`: - An instance of [Administrate::Field::Image][1]. - A wrapper around the image url pulled from the database. - -[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image -%> - -
- <%= f.label field.attribute %> -
-
- <%= f.text_field field.attribute %> -
diff --git a/app/views/fields/image/_index.html.erb b/app/views/fields/image/_index.html.erb deleted file mode 100644 index a02b714c70..0000000000 --- a/app/views/fields/image/_index.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<%# -# Image Index Partial - -This partial renders an image attribute -to be displayed on a resource's index page. - -By default, the attribute is rendered as an image tag. - -## Local variables: - -- `field`: - An instance of [Administrate::Field::Image][1]. - A wrapper around the image url pulled from the database. - -[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image -%> - -<%= image_tag field.data %> diff --git a/app/views/fields/image/_show.html.erb b/app/views/fields/image/_show.html.erb deleted file mode 100644 index 52a7892389..0000000000 --- a/app/views/fields/image/_show.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<%# -# Image Show Partial - -This partial renders an image attribute, -to be displayed on a resource's show page. - -By default, the attribute is rendered as an image tag. - -## Local variables: - -- `field`: - An instance of [Administrate::Field::Image][1]. - A wrapper around the image url pulled from the database. - -[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image -%> - -<%= image_tag field.data %> diff --git a/docs/customizing_dashboards.md b/docs/customizing_dashboards.md index 7f48367482..c0e9c9bd0d 100644 --- a/docs/customizing_dashboards.md +++ b/docs/customizing_dashboards.md @@ -57,7 +57,6 @@ specify, including: - `Field::Email` - `Field::HasMany` - `Field::HasOne` -- `Field::Image` - `Field::Number` - `Field::Polymorphic` - `Field::Select` diff --git a/gemfiles/bourbon_5.gemfile b/gemfiles/bourbon_5.gemfile index fe28f5ac09..a957d5c40e 100644 --- a/gemfiles/bourbon_5.gemfile +++ b/gemfiles/bourbon_5.gemfile @@ -4,6 +4,7 @@ source "https://rubygems.org" ruby "2.2.3" +gem "administrate-field-image" gem "delayed_job_active_record" gem "high_voltage" gem "markdown-rails" diff --git a/gemfiles/sass_3_4.gemfile b/gemfiles/sass_3_4.gemfile index 9dad4967ff..0776fcafa4 100644 --- a/gemfiles/sass_3_4.gemfile +++ b/gemfiles/sass_3_4.gemfile @@ -4,6 +4,7 @@ source "https://rubygems.org" ruby "2.2.3" +gem "administrate-field-image" gem "delayed_job_active_record" gem "high_voltage" gem "markdown-rails" diff --git a/lib/administrate/field/image.rb b/lib/administrate/field/image.rb deleted file mode 100644 index 3589634926..0000000000 --- a/lib/administrate/field/image.rb +++ /dev/null @@ -1,8 +0,0 @@ -require_relative "base" - -module Administrate - module Field - class Image < Field::Base - end - end -end diff --git a/lib/administrate/version.rb b/lib/administrate/version.rb index 0ef54f3892..cd59f90b15 100644 --- a/lib/administrate/version.rb +++ b/lib/administrate/version.rb @@ -1,3 +1,3 @@ module Administrate - VERSION = "0.1.5".freeze + VERSION = "0.2.0".freeze end diff --git a/spec/lib/fields/image_spec.rb b/spec/lib/fields/image_spec.rb deleted file mode 100644 index 52b79e39d6..0000000000 --- a/spec/lib/fields/image_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require "administrate/field/image" - -describe Administrate::Field::Image do - describe "#to_partial_path" do - it "returns a partial based on the page being rendered" do - page = :show - field = Administrate::Field::Image.new(:image, "/a.jpg", page) - - path = field.to_partial_path - - expect(path).to eq("/fields/image/#{page}") - end - end -end