administrate 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of administrate might be problematic. Click here for more details.

Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/administrate/components/date_time_picker.js +4 -1
  3. data/app/assets/stylesheets/administrate/_sidebar.scss +4 -0
  4. data/app/assets/stylesheets/administrate/components/_attributes.scss +2 -0
  5. data/app/assets/stylesheets/administrate/components/_form.scss +1 -0
  6. data/app/assets/stylesheets/administrate/components/_header.scss +5 -1
  7. data/app/controllers/administrate/application_controller.rb +1 -1
  8. data/app/helpers/administrate/application_helper.rb +12 -0
  9. data/app/views/administrate/application/_sidebar.html.erb +1 -1
  10. data/app/views/administrate/application/edit.html.erb +7 -1
  11. data/app/views/administrate/application/index.html.erb +10 -6
  12. data/app/views/administrate/application/new.html.erb +3 -1
  13. data/app/views/administrate/application/show.html.erb +7 -5
  14. data/app/views/fields/belongs_to/_form.html.erb +1 -1
  15. data/app/views/fields/has_many/_form.html.erb +2 -2
  16. data/app/views/fields/has_many/_index.html.erb +1 -1
  17. data/app/views/fields/polymorphic/_index.html.erb +1 -1
  18. data/app/views/fields/polymorphic/_show.html.erb +1 -1
  19. data/config/locales/administrate.da.yml +23 -0
  20. data/config/locales/administrate.de.yml +23 -0
  21. data/config/locales/administrate.en.yml +2 -2
  22. data/config/locales/administrate.es.yml +23 -0
  23. data/config/locales/administrate.fr.yml +23 -0
  24. data/config/locales/administrate.nl.yml +23 -0
  25. data/config/locales/administrate.pl.yml +2 -2
  26. data/config/locales/administrate.pt-BR.yml +24 -0
  27. data/config/locales/administrate.ru.yml +2 -2
  28. data/config/locales/administrate.sv.yml +23 -0
  29. data/config/locales/administrate.vi.yml +23 -0
  30. data/config/locales/administrate.zh-CN.yml +2 -2
  31. data/config/locales/administrate.zh-TW.yml +2 -2
  32. data/lib/administrate/base_dashboard.rb +18 -0
  33. data/lib/administrate/fields/belongs_to.rb +5 -1
  34. data/lib/administrate/fields/has_many.rb +4 -0
  35. data/lib/administrate/fields/polymorphic.rb +5 -0
  36. data/lib/administrate/page/base.rb +2 -4
  37. data/lib/administrate/page/collection.rb +1 -1
  38. data/lib/administrate/search.rb +7 -3
  39. data/lib/administrate/version.rb +1 -1
  40. data/lib/generators/administrate/install/install_generator.rb +9 -1
  41. data/lib/generators/administrate/install/templates/application_controller.rb +12 -10
  42. metadata +13 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b6aee79ccfd9cf4056bd3c531db50a181e4d9cc
4
- data.tar.gz: 9a44fee6bbe7975e58509295d36a260cab4cc129
3
+ metadata.gz: 2ed47c9f36d7d10aba73c04f003cc35472305e63
4
+ data.tar.gz: 3e5642c6eaf135a0ff333f7e563c14a90458bf8c
5
5
  SHA512:
6
- metadata.gz: ba14d87d4b00302aedbf6e24a195178591f16b59830d17036c2d1376f51b55cccd538d0425d1fc35e4fadb0bf6740b0b4faaade4c94f5eaefffe3c46dad00ef4
7
- data.tar.gz: 1221ee23052b1331a345b9358aafffd5b14d9a9cb2c4344e58d0364df2568b8f3b92cd574c76708d0b2ccfeb6a4a5133bd25427aa60303cc58945f72f04055aa
6
+ metadata.gz: ea86641653105a36577715e4937d0a337aa4f4ddf143a2130a0f0e24c14da4eea92cc6ea642aa98c9bcf6b053256c6031d9cf326fc1f12ae5483cb6731f6a292
7
+ data.tar.gz: bf9a63397b90fbbe6e1a5bcb77f55c6eebadcc6d4fd67d4edfa4146bcce79c3b9e4b79d106cce98e1394d87e965be3ba4237ef2238e95f725d5fa2e8de761946
@@ -1,3 +1,6 @@
1
1
  $(function () {
2
- $(".datetimepicker").datetimepicker({ format: "YYYY-MM-DD HH:mm:ss" });
2
+ $(".datetimepicker").datetimepicker({
3
+ debug: false,
4
+ format: "YYYY-MM-DD HH:mm:ss",
5
+ });
3
6
  });
@@ -11,6 +11,10 @@
11
11
  padding-top: $base-spacing;
12
12
  transition: color 0.05s linear;
13
13
 
14
+ &:last-child {
15
+ padding-bottom: $base-spacing;
16
+ }
17
+
14
18
  &--active {
15
19
  color: $blue;
16
20
  font-weight: $bold-font-weight;
@@ -3,10 +3,12 @@
3
3
  @include span-columns(2 of 12);
4
4
  margin-top: 0;
5
5
  text-align: right;
6
+ clear: left;
6
7
  }
7
8
 
8
9
  .preserve-whitespace {
9
10
  white-space: pre;
11
+ word-wrap: break-word;
10
12
  }
11
13
 
12
14
  .attribute-data {
@@ -36,5 +36,6 @@
36
36
  [type="checkbox"],
37
37
  [type="radio"] {
38
38
  margin: $small-spacing 0 ($base-spacing + $form-input-padding);
39
+ width: auto;
39
40
  }
40
41
  }
@@ -1,5 +1,5 @@
1
1
  .header {
2
- align-items: flex-end;
2
+ align-items: baseline;
3
3
  display: flex;
4
4
  justify-content: space-between;
5
5
  margin-bottom: $base-spacing * 2;
@@ -7,4 +7,8 @@
7
7
  &-heading {
8
8
  margin-top: 0;
9
9
  }
10
+
11
+ &-actions {
12
+ margin-left: $base-spacing;
13
+ }
10
14
  }
@@ -8,7 +8,7 @@ module Administrate
8
8
  page = Administrate::Page::Collection.new(dashboard, order: order)
9
9
 
10
10
  render locals: {
11
- resources: resources.page(params[:page]).per(records_per_page),
11
+ resources: resources,
12
12
  search_term: search_term,
13
13
  page: page,
14
14
  }
@@ -4,5 +4,17 @@ module Administrate
4
4
  locals.merge!(field: field)
5
5
  render locals: locals, partial: field.to_partial_path
6
6
  end
7
+
8
+ def display_resource_name(resource_name)
9
+ resource_name.
10
+ to_s.
11
+ classify.
12
+ constantize.
13
+ model_name.
14
+ human(
15
+ count: 0,
16
+ default: resource_name.to_s.pluralize.titleize,
17
+ )
18
+ end
7
19
  end
8
20
  end
@@ -11,7 +11,7 @@ as defined by the DashboardManifest.
11
11
  <% DashboardManifest::DASHBOARDS.each do |resource| %>
12
12
  <li>
13
13
  <%= link_to(
14
- resource.to_s.titleize,
14
+ display_resource_name(resource),
15
15
  [Administrate::NAMESPACE, resource],
16
16
  class: "sidebar__link sidebar__link--#{nav_link_state(resource)}"
17
17
  ) %>
@@ -19,7 +19,13 @@ It displays a header, and renders the `_form` partial to do the heavy lifting.
19
19
 
20
20
  <header class="header">
21
21
  <h1 class="header-heading"><%= content_for(:title) %></h1>
22
- <%= link_to "Show #{page.resource}", [Administrate::NAMESPACE, page.resource], class: "button" %>
22
+ <div class="header-actions">
23
+ <%= link_to(
24
+ "Show #{page.page_title}",
25
+ [Administrate::NAMESPACE, page.resource],
26
+ class: "button",
27
+ ) %>
28
+ </div>
23
29
  </header>
24
30
 
25
31
  <%= render "form", page: page %>
@@ -21,7 +21,9 @@ It renders the `_table` partial to display details about the resources.
21
21
  [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Table
22
22
  %>
23
23
 
24
- <% content_for(:title) { page.resource_name.pluralize.titleize } %>
24
+ <% content_for(:title) do %>
25
+ <%= display_resource_name(page.resource_name) %>
26
+ <% end %>
25
27
 
26
28
  <% content_for(:search) do %>
27
29
  <form class="search">
@@ -43,11 +45,13 @@ It renders the `_table` partial to display details about the resources.
43
45
 
44
46
  <header class="header">
45
47
  <h1 class="header-heading"><%= content_for(:title) %></h1>
46
- <%= link_to(
47
- "New #{page.resource_name.titleize.downcase}",
48
- [:new, Administrate::NAMESPACE, page.resource_name],
49
- class: "button",
50
- ) %>
48
+ <div class="header-actions">
49
+ <%= link_to(
50
+ "New #{page.resource_name.titleize.downcase}",
51
+ [:new, Administrate::NAMESPACE, page.resource_name],
52
+ class: "button",
53
+ ) %>
54
+ </div>
51
55
  </header>
52
56
 
53
57
  <%= render "collection", collection_presenter: page, resources: resources %>
@@ -19,7 +19,9 @@ to do the heavy lifting.
19
19
 
20
20
  <header class="header">
21
21
  <h1 class="header-heading"><%= content_for(:title) %></h1>
22
- <%= link_to 'Back', :back, class: "button" %>
22
+ <div class="header-actions">
23
+ <%= link_to 'Back', :back, class: "button" %>
24
+ </div>
23
25
  </header>
24
26
 
25
27
  <%= render 'form', page: page %>
@@ -20,11 +20,13 @@ as well as a link to its edit page.
20
20
 
21
21
  <header class="header">
22
22
  <h1 class="header-heading"><%= content_for(:title) %></h1>
23
- <%= link_to(
24
- "Edit",
25
- [:edit, Administrate::NAMESPACE, page.resource],
26
- class: "button",
27
- ) %>
23
+ <div class="header-actions">
24
+ <%= link_to(
25
+ "Edit",
26
+ [:edit, Administrate::NAMESPACE, page.resource],
27
+ class: "button",
28
+ ) %>
29
+ </div>
28
30
  </header>
29
31
 
30
32
  <dl>
@@ -18,5 +18,5 @@ that displays all possible records to associate with.
18
18
 
19
19
  <%= f.label field.permitted_attribute %>
20
20
  <%= f.select(field.permitted_attribute) do %>
21
- <%= options_for_select(field.associated_resource_options) %>
21
+ <%= options_for_select(field.associated_resource_options, field.selected_option) %>
22
22
  <% end %>
@@ -19,8 +19,8 @@ and is augmented with [Selectize].
19
19
  [Selectize]: http://brianreavis.github.io/selectize.js
20
20
  %>
21
21
 
22
- <%= f.label field.attribute_key %>
22
+ <%= f.label field.attribute_key, field.attribute %>
23
23
 
24
24
  <%= f.select(field.attribute_key, nil, {}, multiple: true) do %>
25
- <%= options_for_select(field.associated_resource_options) %>
25
+ <%= options_for_select(field.associated_resource_options, field.selected_options) %>
26
26
  <% end %>
@@ -16,4 +16,4 @@ as a count of how many objects are associated through the relationship.
16
16
  [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/HasMany
17
17
  %>
18
18
 
19
- <%= pluralize(field.data.count, field.attribute.to_s.humanize.downcase) %>
19
+ <%= pluralize(field.data.size, field.attribute.to_s.humanize.downcase) %>
@@ -19,6 +19,6 @@ By default, the relationship is rendered as a link to the associated object.
19
19
  <% if field.data %>
20
20
  <%= link_to(
21
21
  field.display_associated_resource,
22
- polymorphic_path([:admin, field.data])
22
+ [Administrate::NAMESPACE, field.data]
23
23
  ) %>
24
24
  <% end %>
@@ -19,6 +19,6 @@ By default, the relationship is rendered as a link to the associated object.
19
19
  <% if field.data %>
20
20
  <%= link_to(
21
21
  field.display_associated_resource,
22
- [:admin, field.data],
22
+ [Administrate::NAMESPACE, field.data],
23
23
  ) %>
24
24
  <% end %>
@@ -0,0 +1,23 @@
1
+ ---
2
+ da:
3
+ administrate:
4
+ actions:
5
+ confirm: Er du sikker?
6
+ destroy: Slet
7
+ edit: Rediger
8
+ show: Vis
9
+ controller:
10
+ create:
11
+ success: "%{resource} blev oprettet."
12
+ destroy:
13
+ success: "%{resource} er nu slettet."
14
+ update:
15
+ success: "%{resource} blev opdateret."
16
+ fields:
17
+ has_many:
18
+ more: "Viser %{count} af %{total_count}"
19
+ none: Ingen
20
+ polymorphic:
21
+ not_supported: "Formularer med polymorphic relationships er ikke understøttede."
22
+ has_one:
23
+ not_supported: "Formularer med has_one associationer er ikke understøttede."
@@ -0,0 +1,23 @@
1
+ ---
2
+ de:
3
+ administrate:
4
+ actions:
5
+ confirm: Sind sie sicher?
6
+ destroy: Löschen
7
+ edit: Editieren
8
+ show: Anzeigen
9
+ controller:
10
+ create:
11
+ success: "%{resource} wurde erfolgreich erstellt."
12
+ destroy:
13
+ success: "%{resource} wurde erfolgreich gelöscht."
14
+ update:
15
+ success: "%{resource} wurde erfolgreich aktualisiert."
16
+ fields:
17
+ has_many:
18
+ more: "%{count} von %{total_count}"
19
+ none: Keine
20
+ polymorphic:
21
+ not_supported: Polymorphe Beziehungen werden nicht unterstützt.
22
+ has_one:
23
+ not_supported: HasOne-beziehungen werden nicht unterstützt.
@@ -18,6 +18,6 @@ en:
18
18
  more: Showing %{count} of %{total_count}
19
19
  none: None
20
20
  polymorphic:
21
- not_supported: Polymorphic relationship forms are not supported yet. Sorry!
21
+ not_supported: Polymorphic relationship forms are not supported.
22
22
  has_one:
23
- not_supported: HasOne relationship forms are not supported yet. Sorry!
23
+ not_supported: HasOne relationship forms are not supported.
@@ -0,0 +1,23 @@
1
+ ---
2
+ es:
3
+ administrate:
4
+ actions:
5
+ confirm: ¿Estás seguro?
6
+ destroy: Destruir
7
+ edit: Editar
8
+ show: Mostrar
9
+ controller:
10
+ create:
11
+ success: "%{resource} fue creado exitosamente."
12
+ destroy:
13
+ success: "%{resource} fue destruido exitosamente."
14
+ update:
15
+ success: "%{resource} fue actualizado exitosamente."
16
+ fields:
17
+ has_many:
18
+ more: Mostrando %{count} de %{total_count}
19
+ none: Ninguno
20
+ polymorphic:
21
+ not_supported: Los formularios con relaciones polimórficas no están soportados.
22
+ has_one:
23
+ not_supported: Los formularios con relaciones HasOne no están soportados.
@@ -0,0 +1,23 @@
1
+ ---
2
+ fr:
3
+ administrate:
4
+ actions:
5
+ confirm: Êtes-vous sûr ?
6
+ destroy: Supprimer
7
+ edit: Modifier
8
+ show: Détails
9
+ controller:
10
+ create:
11
+ success: "%{resource} a été correctement créé(e)."
12
+ destroy:
13
+ success: "%{resource} a été correctement supprimé(e)."
14
+ update:
15
+ success: "%{resource} a été correctement modifié(e)."
16
+ fields:
17
+ has_many:
18
+ more: "%{count} sur %{total_count}"
19
+ none: Aucun
20
+ polymorphic:
21
+ not_supported: Les relations polymorphiques dans les formulaires ne sont pas supportées.
22
+ has_one:
23
+ not_supported: Les relations HasOne dans les formulaires ne sont pas supportées.
@@ -0,0 +1,23 @@
1
+ ---
2
+ nl:
3
+ administrate:
4
+ actions:
5
+ confirm: Weet u het zeker?
6
+ destroy: Verwijder
7
+ edit: Bewerk
8
+ show: Toon
9
+ controller:
10
+ create:
11
+ success: "%{resource} was succesvol aangemaakt."
12
+ destroy:
13
+ success: "%{resource} was succesvol verwijderd."
14
+ update:
15
+ success: "%{resource} was succesvol geupdated."
16
+ fields:
17
+ has_many:
18
+ more: Resultaat %{count} van %{total_count}
19
+ none: Geen
20
+ polymorphic:
21
+ not_supported: Polymorphische relaties formulieren worden niet ondersteund.
22
+ has_one:
23
+ not_supported: HasOne relaties formulieren worden niet ondersteund.
@@ -18,6 +18,6 @@ pl:
18
18
  more: Wyświetlanie %{count} z %{total_count}
19
19
  none: Brak
20
20
  polymorphic:
21
- not_supported: Relacje polimorficzne nie są jeszcze obsługiwane. Przepraszamy!
21
+ not_supported: Relacje polimorficzne nie są obsługiwane.
22
22
  has_one:
23
- not_supported: Relacje jeden-do-jednego nie są jeszcze obsługiwane. Przepraszamy!
23
+ not_supported: Relacje jeden-do-jednego nie są obsługiwane.
@@ -0,0 +1,24 @@
1
+ # encoding: UTF-8
2
+ ---
3
+ pt-BR:
4
+ administrate:
5
+ actions:
6
+ confirm: Você tem certeza?
7
+ destroy: Deletar
8
+ edit: Editar
9
+ show: Visualizar
10
+ controller:
11
+ create:
12
+ success: "%{resource} foi criado com sucesso."
13
+ destroy:
14
+ success: "%{resource} foi deletado com sucesso."
15
+ update:
16
+ success: "%{resource} foi atualizado com sucesso."
17
+ fields:
18
+ has_many:
19
+ more: "Exibindo %{count} de %{total_count}"
20
+ none: Nenhum
21
+ polymorphic:
22
+ not_supported: Relações polimórmficas nos formulários não são suportadas.
23
+ has_one:
24
+ not_supported: Relações um para muitos nos formulários não são suportadas.
@@ -18,6 +18,6 @@ ru:
18
18
  more: "%{count} из %{total_count}"
19
19
  none: Нет
20
20
  polymorphic:
21
- not_supported: Полиморфные отношения в формах не поддерживаются. Извините!
21
+ not_supported: Полиморфные отношения в формах не поддерживаются.
22
22
  has_one:
23
- not_supported: HasOne отношения в формах не поддерживаются. Извините!
23
+ not_supported: HasOne отношения в формах не поддерживаются.
@@ -0,0 +1,23 @@
1
+ ---
2
+ sv:
3
+ administrate:
4
+ actions:
5
+ confirm: Är du säker?
6
+ destroy: Ta bort
7
+ edit: Ändra
8
+ show: Visa
9
+ controller:
10
+ create:
11
+ success: "%{resource} har skapats."
12
+ destroy:
13
+ success: "%{resource} har tagits bort."
14
+ update:
15
+ success: "%{resource} har uppdaterats."
16
+ fields:
17
+ has_many:
18
+ more: "%{count} av %{total_count}"
19
+ none: Inga
20
+ polymorphic:
21
+ not_supported: Formulär med polymorfiska relationer stöds inte.
22
+ has_one:
23
+ not_supported: Formulär med HasOne relationer stöds inte.
@@ -0,0 +1,23 @@
1
+ ---
2
+ vi:
3
+ administrate:
4
+ actions:
5
+ confirm: Bạn có chắc không?
6
+ destroy: Xóa
7
+ edit: Sửa
8
+ show: Xem
9
+ controller:
10
+ create:
11
+ success: "%{resource} đã được tạo thành công."
12
+ destroy:
13
+ success: "%{resource} đã được xóa thành công."
14
+ update:
15
+ success: "%{resource} đã được cập nhật thành công."
16
+ fields:
17
+ has_many:
18
+ more: "%{count} trên %{total_count}"
19
+ none: Không
20
+ polymorphic:
21
+ not_supported: Quan hệ Polymorphic chưa được hỗ trợ.
22
+ has_one:
23
+ not_supported: Quan hệ HasOne chưa được hỗ trợ.
@@ -18,6 +18,6 @@ zh-CN:
18
18
  more: 显示所有 %{total_count} 中 %{count} 条
19
19
  none: 无
20
20
  polymorphic:
21
- not_supported: 对不起,Polymorphic 关系暂不支持!
21
+ not_supported: Polymorphic 关系暂不支持
22
22
  has_one:
23
- not_supported: 对不起,HasOne 关系暂不支持!
23
+ not_supported: HasOne 关系暂不支持.
@@ -18,6 +18,6 @@ zh-TW:
18
18
  more: 顯示 %{total_count} 筆中的 %{count} 筆資料
19
19
  none: 無
20
20
  polymorphic:
21
- not_supported: 很抱歉,表單尚未支援 Polymorphic 關聯。
21
+ not_supported: 表單尚未支援 Polymorphic 關聯。
22
22
  has_one:
23
- not_supported: 很抱歉,表單尚未支援 HasOne 關聯。
23
+ not_supported: 表單尚未支援 HasOne 關聯。
@@ -18,6 +18,18 @@ module Administrate
18
18
  self.class::ATTRIBUTE_TYPES
19
19
  end
20
20
 
21
+ def attribute_type_for(attribute_name)
22
+ attribute_types.fetch(attribute_name) do
23
+ fail attribute_not_found_message(attribute_name)
24
+ end
25
+ end
26
+
27
+ def attribute_types_for(attribute_names)
28
+ attribute_names.each_with_object({}) do |name, attributes|
29
+ attributes[name] = attribute_type_for(name)
30
+ end
31
+ end
32
+
21
33
  def form_attributes
22
34
  self.class::FORM_ATTRIBUTES
23
35
  end
@@ -39,5 +51,11 @@ module Administrate
39
51
  def display_resource(resource)
40
52
  "#{resource.class} ##{resource.id}"
41
53
  end
54
+
55
+ private
56
+
57
+ def attribute_not_found_message(attr)
58
+ "Attribute #{attr} could not be found in #{self.class}::ATTRIBUTE_TYPES"
59
+ end
42
60
  end
43
61
  end
@@ -12,11 +12,15 @@ module Administrate
12
12
  end
13
13
 
14
14
  def associated_resource_options
15
- candidate_resources.map do |resource|
15
+ [nil] + candidate_resources.map do |resource|
16
16
  [display_candidate_resource(resource), resource.id]
17
17
  end
18
18
  end
19
19
 
20
+ def selected_option
21
+ data && data.id
22
+ end
23
+
20
24
  private
21
25
 
22
26
  def candidate_resources
@@ -24,6 +24,10 @@ module Administrate
24
24
  end
25
25
  end
26
26
 
27
+ def selected_options
28
+ data && data.map(&:id)
29
+ end
30
+
27
31
  def limit
28
32
  options.fetch(:limit, DEFAULT_LIMIT)
29
33
  end
@@ -3,6 +3,11 @@ require_relative "associative"
3
3
  module Administrate
4
4
  module Field
5
5
  class Polymorphic < Associative
6
+ protected
7
+
8
+ def associated_dashboard
9
+ "#{data.class.name}Dashboard".constantize.new
10
+ end
6
11
  end
7
12
  end
8
13
  end
@@ -15,10 +15,8 @@ module Administrate
15
15
 
16
16
  def attribute_field(dashboard, resource, attribute_name, page)
17
17
  value = get_attribute_value(resource, attribute_name)
18
-
19
- dashboard.
20
- attribute_types[attribute_name].
21
- new(attribute_name, value, page)
18
+ field = dashboard.attribute_type_for(attribute_name)
19
+ field.new(attribute_name, value, page)
22
20
  end
23
21
 
24
22
  def get_attribute_value(resource, attribute_name)
@@ -14,7 +14,7 @@ module Administrate
14
14
  end
15
15
 
16
16
  def attribute_types
17
- dashboard.attribute_types.slice(*attribute_names)
17
+ dashboard.attribute_types_for(attribute_names)
18
18
  end
19
19
 
20
20
  def ordered_html_class(attr)
@@ -26,9 +26,13 @@ module Administrate
26
26
  end
27
27
 
28
28
  def search_attributes
29
- resolver.dashboard_class::ATTRIBUTE_TYPES.select do |_, type|
30
- type.searchable?
31
- end.keys
29
+ attribute_types.keys.select do |attribute|
30
+ attribute_types[attribute].searchable?
31
+ end
32
+ end
33
+
34
+ def attribute_types
35
+ resolver.dashboard_class::ATTRIBUTE_TYPES
32
36
  end
33
37
 
34
38
  attr_reader :resolver, :term
@@ -1,3 +1,3 @@
1
1
  module Administrate
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -40,6 +40,10 @@ module Administrate
40
40
  puts "WARNING: Unable to generate a dashboard for #{invalid_model}."
41
41
  puts " It is not connected to a database table."
42
42
  end
43
+
44
+ unnamed_constants.each do |invalid_model|
45
+ puts "NOTICE: Skipping dynamically generated model #{invalid_model}."
46
+ end
43
47
  end
44
48
 
45
49
  private
@@ -63,7 +67,7 @@ module Administrate
63
67
  end
64
68
 
65
69
  def invalid_database_models
66
- models_without_tables + namespaced_models
70
+ models_without_tables + namespaced_models + unnamed_constants
67
71
  end
68
72
 
69
73
  def models_without_tables
@@ -74,6 +78,10 @@ module Administrate
74
78
  database_models.select { |model| model.to_s.include?("::") }
75
79
  end
76
80
 
81
+ def unnamed_constants
82
+ ActiveRecord::Base.descendants.reject { |d| d.name == d.to_s }
83
+ end
84
+
77
85
  def dashboard_routes
78
86
  File.read(routes_file_path)
79
87
  end
@@ -4,16 +4,18 @@
4
4
  #
5
5
  # If you want to add pagination or other controller-level concerns,
6
6
  # you're free to overwrite the RESTful controller actions.
7
- class Admin::ApplicationController < Administrate::ApplicationController
8
- before_filter :authenticate_admin
7
+ module Admin
8
+ class ApplicationController < Administrate::ApplicationController
9
+ before_filter :authenticate_admin
9
10
 
10
- def authenticate_admin
11
- # TODO Add authentication logic here.
12
- end
11
+ def authenticate_admin
12
+ # TODO Add authentication logic here.
13
+ end
13
14
 
14
- # Override this value to specify the number of elements to display at a time
15
- # on index pages. Defaults to 20.
16
- # def records_per_page
17
- # params[:per_page] || 20
18
- # end
15
+ # Override this value to specify the number of elements to display at a time
16
+ # on index pages. Defaults to 20.
17
+ # def records_per_page
18
+ # params[:per_page] || 20
19
+ # end
20
+ end
19
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grayson Wright
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-12 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autoprefixer-rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.5
33
+ version: 0.0.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.5
40
+ version: 0.0.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: inline_svg
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -266,9 +266,17 @@ files:
266
266
  - app/views/fields/text/_show.html.erb
267
267
  - app/views/layouts/administrate/application.html.erb
268
268
  - config/i18n-tasks.yml
269
+ - config/locales/administrate.da.yml
270
+ - config/locales/administrate.de.yml
269
271
  - config/locales/administrate.en.yml
272
+ - config/locales/administrate.es.yml
273
+ - config/locales/administrate.fr.yml
274
+ - config/locales/administrate.nl.yml
270
275
  - config/locales/administrate.pl.yml
276
+ - config/locales/administrate.pt-BR.yml
271
277
  - config/locales/administrate.ru.yml
278
+ - config/locales/administrate.sv.yml
279
+ - config/locales/administrate.vi.yml
272
280
  - config/locales/administrate.zh-CN.yml
273
281
  - config/locales/administrate.zh-TW.yml
274
282
  - config/routes.rb
@@ -342,7 +350,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
350
  version: '0'
343
351
  requirements: []
344
352
  rubyforge_project:
345
- rubygems_version: 2.4.5
353
+ rubygems_version: 2.4.5.1
346
354
  signing_key:
347
355
  specification_version: 4
348
356
  summary: A Rails engine for creating super-flexible admin dashboards