rails_importer 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 960482940d9658460f988cc0ebb40b48ae004205
4
- data.tar.gz: 6633a7b469898d1450be8189729a3763ae4db22d
3
+ metadata.gz: 8a076fef5b4f87f3cf1b9008206e1155b444d150
4
+ data.tar.gz: e6690a47e75330cfa4588996ccc02a203144eed8
5
5
  SHA512:
6
- metadata.gz: 7c0591bd134f1e8dbde0179f701ea07ebbbce4ef6978f292d789509e05ac6a0bcc09de3e14f2f7585ae5ba441702ba1984e69edb20ae486e205498e65f0797a0
7
- data.tar.gz: 3e5c4469e487e6c5384f948d1583a8ac86f9154a33393655021957a20745f5f0eae0da799043b0bb359a20302fe460e6291392044e724f91765bbbcdfcea73f9
6
+ metadata.gz: f636dfdbec9ea7a0532e3b999b303ea3d40681ca5f04a39acee60c8bb90b112a081a70f32c92806494cb626ee56a27fb20acc277489544c5d0689e669c9cc281
7
+ data.tar.gz: 2664bcb16ebe6cf4e86b67b67f6f0deb4abb8afa6b1ab6727e4b58bf23706dff84c1a7ecac6cc181d82db022373b96fdea17b94af221396154e5497a7f83c563
@@ -8,7 +8,7 @@
8
8
  functionality, or improves on an existing feature.
9
9
  * `[UI]`: Non-breaking changes to the default user interface (HTML/CSS).
10
10
  * `[BUGFIX]`: Fixes a bug with a non-breaking change.
11
- * `[COMPAT]`: Compatibility improvements - changes to make Administrate more
11
+ * `[COMPAT]`: Compatibility improvements - changes to make Rails Importer more
12
12
  compatible with different dependency versions.
13
13
  * `[I18n]`: Internationalization. Changes to translations or localizations.
14
14
  * `[OPTIM]`: Optimization or performance increase.
@@ -16,9 +16,14 @@
16
16
 
17
17
  ## Changes
18
18
 
19
+ ### 0.2.1 (August 30, 2016)
20
+
21
+ * [FEATURE] Add possibility to inherit `RailsImporter::ImportsController` from custom controller class
22
+ using gem initializer.
23
+
19
24
  ### 0.2.0 (February 18, 2016)
20
25
 
21
- * [FEATURE] Add sample file link to import form which downloads a pre-defined sample file for each importer
26
+ * [FEATURE] Add sample file link to import form which downloads a pre-defined sample file for each importer.
22
27
 
23
28
  ### 0.1.0 (February 12, 2016)
24
29
 
data/README.md CHANGED
@@ -100,6 +100,16 @@ The `importer_key` param is used to determine which importer class must be used.
100
100
 
101
101
  Routes described above are handled by the `RailsImporter::ImportsController` controller. If you need custom logic, you can override it.
102
102
 
103
+ This controller inherits from standard `ApplicationController`. If you need to inherit from a particular controller (for example if you have a namespaced controller like `Admin::ApplicationController`), you can set this inside the initializer:
104
+
105
+ ```ruby
106
+ # config/initializers/rails_importer.rb
107
+
108
+ RailsImporter.setup do |config|
109
+ config.parent_controller_class = Admin::ApplicationController
110
+ end
111
+ ```
112
+
103
113
  Besides that, the `after_import_path` controller method is used to redirect after successful imports. It defaults to `root_path`, but you can override it if you wish a custom path:
104
114
 
105
115
  ```ruby
@@ -1,5 +1,5 @@
1
1
  module RailsImporter
2
- class ImportsController < ::ApplicationController
2
+ class ImportsController < RailsImporter.parent_controller_class
3
3
  before_filter :set_importer_class
4
4
 
5
5
  def new
@@ -8,7 +8,7 @@ module RailsImporter
8
8
  end
9
9
 
10
10
  protected
11
-
11
+
12
12
  def context
13
13
  router_name = RailsImporter.router_name
14
14
  context = router_name ? send(router_name) : self
@@ -7,10 +7,16 @@ module RailsImporter
7
7
  mattr_accessor :router_name
8
8
  @@router_name = :main_app
9
9
 
10
+ mattr_accessor :parent_controller_class
11
+
10
12
  def setup
11
13
  yield self if block_given?
12
14
  end
13
15
 
16
+ def parent_controller_class
17
+ @@parent_controller_class || ::ApplicationController
18
+ end
19
+
14
20
  def importer_class(importer_key)
15
21
  @@importers.select{|i| i.key.to_s == importer_key.to_s}.first
16
22
  end
@@ -1,3 +1,3 @@
1
1
  module RailsImporter
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastián Vicencio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-18 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails