tolaria 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,8 +26,8 @@ Tolaria.configure do |config|
26
26
  config.display_name_methods = %i[
27
27
  admin_name
28
28
  display_name
29
- title
30
29
  name
30
+ title
31
31
  label
32
32
  username
33
33
  login
@@ -36,7 +36,7 @@ module Tolaria
36
36
 
37
37
  # A factory method that registers a new model in Tolaria and configures
38
38
  # its menu and param settings. Developers should use `ActiveRecord::Base.manage_with_tolaria`
39
- def self.create(klass, icon:"file-o", permit_params:[], priority:10, category:"Settings", default_order:"id DESC", paginated:true, allowed_actions:[:index, :show, :new, :create, :edit, :update, :destroy])
39
+ def self.create(klass, icon:"file-o", permit_params:[], priority:10, category:"Settings", default_order:"id DESC", paginated:true, allowed_actions:%i[index show new create edit update destroy])
40
40
 
41
41
  managed_class = self.new
42
42
  managed_class.klass = klass
@@ -51,7 +51,7 @@ module Tolaria
51
51
  managed_class.allowed_actions = allowed_actions.freeze
52
52
 
53
53
  # Set auto-generated attributes
54
- managed_class.controller_name = "#{managed_class.model_name.name.pluralize}Controller".freeze
54
+ managed_class.controller_name = "#{managed_class.model_name.collection.camelize}Controller".freeze
55
55
  managed_class.param_key = managed_class.model_name.singular.to_sym
56
56
 
57
57
  return managed_class
@@ -2,7 +2,7 @@ module Tolaria
2
2
 
3
3
  # Returns Tolaria’s version number
4
4
  def self.version
5
- Gem::Version.new("1.0.2")
5
+ Gem::Version.new("1.1.0")
6
6
  end
7
7
 
8
8
  module VERSION
@@ -3,7 +3,7 @@
3
3
  <%= f.hint "The title of this post. The title is featured prominently across the site and used to construct the page URL. A good title is both summarizing and enticing, much like a newspaper headline." %>
4
4
 
5
5
  <%= f.label :published_at, "Publishing Date" %>
6
- <%= f.timestamp_field :published_at %>
6
+ <%= f.timestamp_field :published_at, class:"short" %>
7
7
  <%= f.hint %{
8
8
  The date this post should be published.
9
9
  Published posts with a date set in the future will be scheduled to appear on that date.
@@ -46,7 +46,7 @@ class RouterTest < ActionDispatch::IntegrationTest
46
46
  test "correctly draws uncountable routes" do
47
47
 
48
48
  ActiveSupport::Inflector.inflections do |inflect|
49
- inflect.uncountable << "pokemon"
49
+ inflect.uncountable "pokemon"
50
50
  end
51
51
 
52
52
  class ::Pokemon < ActiveRecord::Base
@@ -63,6 +63,7 @@ class RouterTest < ActionDispatch::IntegrationTest
63
63
  assert_equal "/admin/pokemon", admin_pokemon_index_path
64
64
  assert_equal "/admin/pokemon/1", admin_pokemon_path(1)
65
65
  assert_equal "/admin/pokemon/1/edit", edit_admin_pokemon_path(1)
66
+ assert Admin::PokemonController
66
67
 
67
68
  # Unseat the class so that it doesn't leak out of this test
68
69
  assert Tolaria.discard_managed_class(Pokemon), "should discard class"
@@ -70,4 +71,32 @@ class RouterTest < ActionDispatch::IntegrationTest
70
71
 
71
72
  end
72
73
 
74
+ test "correctly draws uncommon collective routes" do
75
+
76
+ ActiveSupport::Inflector.inflections do |inflect|
77
+ inflect.plural "hero", "heroes"
78
+ end
79
+
80
+ class ::BraveHero < ActiveRecord::Base
81
+ manage_with_tolaria using:{
82
+ icon: "key",
83
+ }
84
+ end
85
+
86
+ # Re-draw the routes
87
+ Rails.application.routes.draw do
88
+ Tolaria.draw_routes(self)
89
+ end
90
+
91
+ assert_equal "/admin/brave_heroes", admin_brave_heroes_path
92
+ assert_equal "/admin/brave_heroes/1", admin_brave_hero_path(1)
93
+ assert_equal "/admin/brave_heroes/1/edit", edit_admin_brave_hero_path(1)
94
+ assert Admin::BraveHeroesController
95
+
96
+ # Unseat the class so that it doesn't leak out of this test
97
+ assert Tolaria.discard_managed_class(BraveHero), "should discard class"
98
+ Object.send(:remove_const, :BraveHero)
99
+
100
+ end
101
+
73
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tolaria
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Csuhta
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-17 00:00:00.000000000 Z
12
+ date: 2015-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bcrypt
@@ -427,7 +427,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
427
427
  version: '0'
428
428
  requirements: []
429
429
  rubyforge_project:
430
- rubygems_version: 2.5.1
430
+ rubygems_version: 2.4.5.1
431
431
  signing_key:
432
432
  specification_version: 4
433
433
  summary: A Rails CMS framework for making people happy.