admin_it 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9810f82e274be2d97cd49f86e4e5a8c2d9d01590
4
- data.tar.gz: 91d20c25c96419b05397c7158a98b9a8ee60658d
3
+ metadata.gz: 96f14e5a3d1ac63eac7bf189a7ed9419cd9db032
4
+ data.tar.gz: b9d171451605007606dba4b88648e4219aa291cb
5
5
  SHA512:
6
- metadata.gz: 8d7448bfe2a51c9fed2e67a0f307ec27088fdbbd348b7cf0258fe07b00804ef291bd192283352d9f05b1699a662db0d2d43c336b3180ac58f65c084edc1122d3
7
- data.tar.gz: c3b4dabbd9e5142a8bc2fbe55a5af8c95c513dad71f2e888f0adf0e05f3a557d7a54dd00b17698873b4a44d2d05ffdeea5d19205ffc338e5ae8b78997bda3572
6
+ metadata.gz: 69ab40b4721e23068f1883708de509fef76d4485da51e9fa1bbc56bcb201ed339bb2cf9c2dcf2bcd61e44750a633eb1e9179d32707c7b7d568c32823ae998f76
7
+ data.tar.gz: 149226356240bfe4fe45403ba1ce0b4c612898dacc1efeddc0ae2de2910422e5e09b6f93a14bb212dcdd9afdd5f2ab45bd7570f2639b42fa0549e581a8d55268
data/README.md CHANGED
@@ -12,6 +12,7 @@ Administrative backend for ruby projects.
12
12
 
13
13
  # Todo
14
14
 
15
+ * use_fields not working in root resource context
15
16
  * Test coverage
16
17
  * Entities editing/creating
17
18
 
@@ -21,6 +22,11 @@ Administrative backend for ruby projects.
21
22
 
22
23
  # Changes
23
24
 
25
+ ## `1.0.2`
26
+
27
+ * routes moved to config folder
28
+ * fixed issues with pundit and devise
29
+
24
30
  ## `1.0.1`
25
31
 
26
32
  * wrap_it link in Gemfile fixed
data/README_RU.md CHANGED
@@ -19,6 +19,10 @@
19
19
 
20
20
  # Изменения
21
21
 
22
+ ## `1.0.1`
23
+
24
+ * исправлена ссылка на библиотеку wrap_it
25
+
22
26
  ## `1.0.0` - пре-релиз
23
27
 
24
28
  * поддержка active_record
@@ -1,6 +1,6 @@
1
1
  - for_context ||= context
2
2
 
3
- - unless for_context.filters.empty?
3
+ - unless for_context.single? || for_context.filters.empty?
4
4
  div class="row admin-it-filters"
5
5
  ul class="nav nav-pills nav-stacked col-md-2"
6
6
  - for_context.filters.each do |filter, index|
data/config/routes.rb ADDED
@@ -0,0 +1,21 @@
1
+ AdminIt::Engine.routes.draw do
2
+ AdminIt.resources.each do |name, resource|
3
+ resources(resource.plural,
4
+ controller: "admin_it/#{name}",
5
+ except: [:index]) do
6
+ resource.collections.each do |context|
7
+ next unless context.collection?
8
+ get context.context_name, on: :collection
9
+ end
10
+ unless resource.collections.empty?
11
+ get('/', on: :collection, action: resource.default_context)
12
+ end
13
+ end
14
+ end
15
+ unless AdminIt.resources.empty?
16
+ name, resource = AdminIt.resources.first
17
+ get('/',
18
+ controller: "admin_it/#{name}",
19
+ action: resource.default_context)
20
+ end
21
+ end
@@ -2,6 +2,8 @@ module AdminIt
2
2
  module Controller
3
3
  def self.included(base)
4
4
  base.class_eval do
5
+ include Pundit if AdminIt::Env.pundit?
6
+
5
7
  attr_reader :context
6
8
  helper_method :context, :resource
7
9
  helper AdminIt::Helpers
@@ -233,7 +233,8 @@ module AdminIt
233
233
  if value.count == 0
234
234
  I18n.t('admin_it.collection.no_data')
235
235
  else
236
- context.read(value.first) + ' ...'
236
+ v = context.read(value.first)
237
+ v.nil? ? '' : context.read(value.first) + ' ...'
237
238
  end
238
239
  else
239
240
  context.read(value)
@@ -8,7 +8,6 @@ module AdminIt
8
8
  config.to_prepare do
9
9
  Rails.application.config.i18n.load_path +=
10
10
  Dir[Engine.root.join('lib', 'admin_it', 'locales', '*.yml')]
11
-
12
11
  unless File.basename($0) == "rake" && ARGV.include?("db:migrate")
13
12
  Dir[File.join(AdminIt.config.root, '**', '*.rb')].each do |file|
14
13
  require file
@@ -16,32 +15,6 @@ module AdminIt
16
15
  end
17
16
  # Assets.register(Rails.application.assets)
18
17
 
19
- # AdminIt.init
20
-
21
- Engine.routes.draw do
22
- AdminIt.resources.each do |name, resource|
23
- resources(resource.plural,
24
- controller: "admin_it/#{name}",
25
- except: [:index]) do
26
- resource.collections.each do |context|
27
- next unless context.collection?
28
- get context.context_name, on: :collection
29
- end
30
- unless resource.collections.empty?
31
- get('/', on: :collection, action: resource.default_context)
32
- end
33
- end
34
- end
35
- unless AdminIt.resources.empty?
36
- name, resource = AdminIt.resources.first
37
- get('/',
38
- controller: "admin_it/#{name}",
39
- action: resource.default_context)
40
- end
41
- end
42
-
43
- #AdminIt.compile_menu
44
-
45
18
  ActionController::Base.module_eval do
46
19
  prepend_view_path 'lib/views'
47
20
  end
@@ -14,8 +14,8 @@ module AdminIt
14
14
  end
15
15
  if field.is_a?(AdminIt::Field)
16
16
  entity = context.entity
17
+ body << html_safe(field.show(entity).to_s) if body.empty?
17
18
  field.render(entity, instance: self)
18
- body << field.show(entity).to_s if body.empty?
19
19
  end
20
20
  end
21
21
  end
@@ -1,5 +1,5 @@
1
1
  #
2
2
  module AdminIt
3
3
  # Current gem version
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admin_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Ovchinnikov
@@ -225,6 +225,7 @@ files:
225
225
  - app/views/layouts/admin_it.html.slim
226
226
  - app/views/layouts/admin_it_dialog.html.slim
227
227
  - config.ru
228
+ - config/routes.rb
228
229
  - lib/admin_it.rb
229
230
  - lib/admin_it/config.rb
230
231
  - lib/admin_it/context.rb