adminpanel 2.5.5 → 2.6.0

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: 76f203b13f966b54227ff89c817e91518cb6516a
4
- data.tar.gz: aa51158837bbb402b9ac73db74e6aa9a6b816aa9
3
+ metadata.gz: 07b1d664a1908016dc3c1c6edbfe94ef34d3a436
4
+ data.tar.gz: 44347730618eb5d59457e22e6a3e2f0af550e323
5
5
  SHA512:
6
- metadata.gz: 0b64dff88eda8e91884f069fa8f91f0d9e860726f2207c53b1f60aa49a09f66e72299c1e941be69af36829c1362ca6f8277eb6068549d37c8e5a1a836174c92d
7
- data.tar.gz: c2e5c520beda534386129a1b3830824731e81d2cac590b763764e6c8ded3574a3ed7d07cc2c67e4891538cf9cc567fe88cd8743d360dd897d917678fb7004066
6
+ metadata.gz: af9f53879426c218221f0ada55a0f02127b7291e8e468efe5446861fc9c4dcecf245e3d0b6a75113fca2826828579c17f378fb65570a5eceb527c530d3468ef1
7
+ data.tar.gz: 54ee0f662db63098ca3b4b0b2ede6a91f491b5c5ab0eb250657aa7a714afdb6f9e3a3342331ab44843708f2e1cbf85721384dca24f3290ef125d0af7e5703874
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # [![CoDN](http://cl.ly/image/130Q0E153d2G/codn180.png)](http://www.codn.mx "CoDN") Adminpanel
2
2
 
3
- Thank you for considering this gem, we are going to use the lastest Rails version of Rails. make sure you can use it before trying this gem out.
3
+ This gem uses use the lastest version of Rails. [Usage Docs](http://codn.github.io/adminpanel).
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/adminpanel.svg)](http://badge.fury.io/rb/adminpanel)
6
6
  [![Build Status](https://travis-ci.org/codn/adminpanel.svg?branch=master)](https://travis-ci.org/codn/adminpanel)
@@ -21,18 +21,19 @@ Run:
21
21
  rails g adminpanel:initialize
22
22
  rake db:migrate
23
23
  This create and seeds a user to the database (email: 'admin@admin.com', password: 'password').
24
-
25
- And mount the gem wherever you like!
26
-
27
- mount Adminpanel::Engine => '/panel'
28
24
 
29
25
  #### Optional
30
26
 
31
- In you application.rb
27
+ Change the path where adminpanel is mounted
32
28
 
33
- config.i18n.default_locale = :es # or :en
29
+ # routes.rb
30
+ mount Adminpanel::Engine => '/panel'
34
31
 
35
- no other language is currently supported, but pull requests are welcome.
32
+ Change the panel locale
33
+
34
+ # application.rb
35
+ # Adminpanel supported locales :en, :es (pull requests are welcome)
36
+ config.i18n.default_locale = :es
36
37
 
37
38
  ## Usage
38
39
 
@@ -40,29 +41,23 @@ To create a new resource:
40
41
  ```
41
42
  rails g adminpanel:resource product name price:float description:wysiwyg
42
43
  ```
43
- check the [Resource Generator wiki.](https://github.com/codn/adminpanel/wiki/Generator-adminpanel:resource) for more information.
44
+ check the [Resource Generator docs](http://codn.github.io/adminpanel/generator/resource) for more information.
44
45
 
45
- Make sure you [read the wiki](https://github.com/codn/adminpanel/wiki), there is the descriptions of every relevant part of the gem.
46
+ Make sure you [read the docs](http://codn.github.io/adminpanel), there is the descriptions of every relevant part of the gem.
46
47
 
47
48
  ## Dependencies
48
49
 
49
- Please make sure that you have ImageMagick -v 2.13.2 installed before trying to use the gem.
50
+ * Imagemagick
51
+ * Ruby 2.1.0+
52
+ * Rails 4.2+
50
53
 
51
54
  ## Integrated APIs
52
55
 
53
56
  Currently the integrations working are:
54
57
 
55
- * [Google Analytics Service](https://github.com/codn/adminpanel/wiki/include-Google-Analytics)
56
- * [Facebook Share Link to Wall](https://github.com/codn/adminpanel/wiki/include-Adminpanel::Facebook)
57
- * [Twitter API](https://github.com/codn/adminpanel/wiki/include-Adminpanel::Twitter)
58
- * [Instagram API](https://github.com/codn/adminpanel/wiki/include-Adminpanel::Instagram)
59
-
60
- ## Contributing
61
-
62
- 1. Fork it
63
- 2. Create your feature branch (`git checkout -b my-new-feature`)
64
- 3. Commit your changes (`git commit -am 'Add some feature'`)
65
- 4. Push to the branch (`git push origin my-new-feature`)
66
- 5. Create new Pull Request
58
+ * [Google Analytics Service](http://codn.github.io/adminpanel/module/google-analytics.html)
59
+ * [Facebook Share Link to Wall](http://codn.github.io/adminpanel/module/facebook)
60
+ * [Twitter API](http://codn.github.io/adminpanel/module/twitter)
61
+ * [Instagram API](http://codn.github.io/adminpanel/module/instagram)
67
62
 
68
63
  Any questions, errors or feature suggestions [are welcome in the issues](https://github.com/codn/adminpanel/issues/new)
@@ -27,17 +27,17 @@ module Adminpanel
27
27
  base_layout method, *args, 'text_field_original'
28
28
  end
29
29
 
30
- def file_field(method, *args)
30
+ def image_field(method, *args)
31
31
  image_input = base_layout(method, *args, 'file_field_original')
32
32
 
33
33
  if !object.nil? && !object.new_record? #if not new record
34
- "#{thumbnail_layout(name)}#{image_input}".html_safe
34
+ "#{thumbnail_layout(method)}#{image_input}".html_safe
35
35
  else
36
36
  image_input
37
37
  end
38
38
  end
39
39
 
40
- def non_image_file_field(method, *args)
40
+ def file_field(method, *args)
41
41
  file_input = base_layout(method, *args, 'file_field_original')
42
42
 
43
43
  if !object.nil? && !object.new_record? #if not new record
@@ -47,8 +47,8 @@ module Adminpanel
47
47
  end
48
48
  end
49
49
 
50
- def gallery_field(name, *args)
51
- base_layout name, *args, 'gallery_base'
50
+ def gallery_field(method, *args)
51
+ base_layout method, *args, 'gallery_base'
52
52
  end
53
53
 
54
54
  def wysiwyg_field(method, *args)
@@ -101,11 +101,11 @@ module Adminpanel
101
101
  )
102
102
  end
103
103
 
104
- def resource_select(name, *args)
105
- select name, Adminpanel.displayable_resources.map{|resource| [symbol_class(resource).display_name, resource.to_s]}, *args
104
+ def resource_select(method, *args)
105
+ select method, Adminpanel.displayable_resources.map{|resource| [symbol_class(resource).display_name, resource.to_s]}, *args
106
106
  end
107
107
 
108
- def select(name, select_options, *args)
108
+ def select(method, select_options, *args)
109
109
  options = args.extract_options!
110
110
  label = options['label']
111
111
  options.delete('label')
@@ -114,23 +114,23 @@ module Adminpanel
114
114
 
115
115
  @template.content_tag :div, class: "control-group" do
116
116
  @template.content_tag(:label, label, class: "control-label") +
117
- @template.content_tag(:div, super(name, select_options, options), class: "controls")
117
+ @template.content_tag(:div, super(method, select_options, options), class: "controls")
118
118
  end
119
119
  end
120
120
 
121
- def number_field(name, *args)
122
- base_layout( name, *args, 'number_field_original' )
121
+ def number_field(method, *args)
122
+ base_layout( method, *args, 'number_field_original' )
123
123
  end
124
124
 
125
- def password_field(name, *args)
126
- base_layout( name, *args, 'password_field_original' )
125
+ def password_field(method, *args)
126
+ base_layout( method, *args, 'password_field_original' )
127
127
  end
128
128
 
129
- def email_field(name, *args)
130
- base_layout( name, *args, 'email_field_original' )
129
+ def email_field(method, *args)
130
+ base_layout( method, *args, 'email_field_original' )
131
131
  end
132
132
 
133
- def submit(name, *args)
133
+ def submit(method, *args)
134
134
  options = args.extract_options!
135
135
 
136
136
  options.reverse_merge!(
@@ -139,11 +139,11 @@ module Adminpanel
139
139
  disable_with: I18n.t('action.submitting')
140
140
  }
141
141
  )
142
- super(name, *args << options)
142
+ super(method, *args << options)
143
143
  end
144
144
 
145
- def datepicker(name, *args)
146
- base_layout( name, *args, 'datepickerize_base' )
145
+ def datepicker(method, *args)
146
+ base_layout( method, *args, 'datepickerize_base' )
147
147
  end
148
148
 
149
149
  # def prepend_field(name, *args)
@@ -201,7 +201,7 @@ module Adminpanel
201
201
  # end
202
202
  private
203
203
 
204
- def base_layout(name, *args, input_type)
204
+ def base_layout(method, *args, input_type)
205
205
  options = args.extract_options!
206
206
  options.reverse_merge! class: 'span7'
207
207
  label = options['label']
@@ -210,12 +210,12 @@ module Adminpanel
210
210
  @template.content_tag :div, class: 'control-group' do
211
211
  @template.content_tag(:label, label, class: 'control-label') +
212
212
  @template.content_tag(:div, class: 'controls') do
213
- self.send(input_type, name, options)
213
+ self.send(input_type, method, options)
214
214
  end
215
215
  end
216
216
  end
217
217
 
218
- def datepickerize_base(name, options)
218
+ def datepickerize_base(method, options)
219
219
  options.reverse_merge! 'value' => Time.now.strftime("%d-%m-%Y")
220
220
  @template.content_tag(
221
221
  :div,
@@ -225,7 +225,7 @@ module Adminpanel
225
225
  date: options['value']
226
226
  }
227
227
  ) do
228
- text_field_original(name, options) +
228
+ text_field_original(method, options) +
229
229
  (
230
230
  @template.content_tag :span, class: 'add-on' do
231
231
  @template.content_tag :i, nil, class: 'fa fa-th'
@@ -234,21 +234,21 @@ module Adminpanel
234
234
  end
235
235
  end
236
236
 
237
- def boolean_base(name, options)
237
+ def boolean_base(method, options)
238
238
  @template.content_tag :label, class: 'checkbox' do
239
- check_box(name)
239
+ check_box(method)
240
240
  end
241
241
  end
242
242
 
243
- def gallery_base(name, options)
244
- file_field_input = file_field_original(name, options)
243
+ def gallery_base(method, options)
244
+ file_field_input = file_field_original(method, options)
245
245
  hidden_input = hidden_field(:_destroy)
246
246
  delete_button = @template.content_tag(:button, I18n.t("action.delete"), class: "btn btn-danger remove-fields")
247
247
 
248
248
  if object.nil? || object.new_record?
249
249
  "#{file_field_input}#{hidden_input}#{delete_button}".html_safe
250
250
  else
251
- "#{thumbnail_layout(name)}#{file_field_input}#{hidden_input}#{delete_button}".html_safe
251
+ "#{thumbnail_layout(method)}#{file_field_input}#{hidden_input}#{delete_button}".html_safe
252
252
  end
253
253
  end
254
254
 
@@ -28,9 +28,7 @@ module Adminpanel
28
28
  'role_id' => {
29
29
  'type' => 'select',
30
30
  'label' => I18n.t('permission.role'),
31
- 'options' => Proc.new {|object|
32
- Adminpanel::Role.all.map {|o| [o.id, o.name]}
33
- }
31
+ 'options' => Proc.new {|object| Adminpanel::Role.all }
34
32
  }
35
33
  },
36
34
  {
@@ -67,9 +67,7 @@ module Adminpanel
67
67
  {
68
68
  'role_id' => {
69
69
  'type' => 'select',
70
- 'options' => Proc.new { |user|
71
- Role.all.map { |r| [r.id, r.name] }
72
- },
70
+ 'options' => Proc.new { |user| Role.all },
73
71
  'label' => I18n.t('model.attributes.role_id')
74
72
  }
75
73
  },
@@ -3,18 +3,18 @@
3
3
  args = properties.except('options')
4
4
  collection = block.call(f.object)
5
5
  if collection.class.to_s.demodulize == 'ActiveRecord_Relation'
6
- id_method = :id
7
- label_method = :name
8
- else
9
- id_method = :first
10
- label_method = :last
6
+ properties['id_method'] ||= :id
7
+ properties['name_method'] ||= :name
8
+ collection = options_from_collection_for_select(
9
+ collection,
10
+ properties['id_method'],
11
+ properties['name_method'],
12
+ @resource_instance.send(attribute)
13
+ )
14
+
15
+ elsif ['Hash', 'Array', 'HashWithIndifferentAccess'].include? collection.class.to_s.demodulize
16
+ collection = options_for_select(collection)
11
17
  end
12
- collection = options_from_collection_for_select(
13
- collection,
14
- id_method,
15
- label_method,
16
- @resource_instance.send(attribute)
17
- )
18
18
  %>
19
19
  <%= f.select attribute, collection, { include_blank: true }, args %>
20
20
 
@@ -84,7 +84,7 @@
84
84
  </div>
85
85
  <% else %>
86
86
  <div class="widget-body row-fluid">
87
- <% @resource_instance.send(@model.gallery_relationship).each do |image|%>
87
+ <% @resource_instance.send(@model.gallery_relationship).each do |image| %>
88
88
  <%= link_to(
89
89
  image_tag( image.file_url(:thumb) ),
90
90
  image.file_url.to_s,
@@ -1,3 +1,3 @@
1
1
  module Adminpanel
2
- VERSION = '2.5.5'
2
+ VERSION = '2.6.0'
3
3
  end
@@ -19,6 +19,11 @@ module Adminpanel
19
19
  aliases: '-p',
20
20
  default: false,
21
21
  desc: 'Skip setup if true'
22
+ class_option :'skip-mount-engine',
23
+ type: :boolean,
24
+ aliases: '-engine',
25
+ default: false,
26
+ desc: 'Inject engine into routes'
22
27
 
23
28
  def create_initializer
24
29
  if !options[:'skip-setup']
@@ -32,6 +37,14 @@ module Adminpanel
32
37
  end
33
38
  end
34
39
 
40
+ def inject_engine_into_routes
41
+ if !options[:'skip-mount-engine'] && Dir.exists?(Rails.root.join('config')) && File.exists?(Rails.root.join('config', 'routes.rb'))
42
+ inject_into_file 'config/routes.rb', after: 'Rails.application.routes.draw do' do
43
+ indent "\n mount Adminpanel::Engine => '/panel'"
44
+ end
45
+ end
46
+ end
47
+
35
48
  def create_adminpanel_migration
36
49
  if !options[:'skip-migration']
37
50
  migration_template 'create_adminpanel_tables.rb', 'db/migrate/create_adminpanel_tables.rb'
@@ -79,7 +79,7 @@ module Adminpanel
79
79
  end
80
80
 
81
81
  def add_resource_to_config
82
- if setup_is_found? && is_a_resource?
82
+ if is_a_resource?
83
83
  inject_into_file 'config/initializers/adminpanel_setup.rb',
84
84
  after: 'config.displayable_resources = [' do
85
85
  indent "\n:#{pluralized_name},", 4
@@ -1,13 +1,5 @@
1
1
  module Adminpanel
2
2
  module ResourceGeneratorHelper
3
- def setup_is_found?
4
- if Dir.exists?('config') && Dir.exists?('config/initializers') && File.exists?('config/initializers/adminpanel_setup.rb')
5
- true
6
- else
7
- false
8
- end
9
- end
10
-
11
3
  def needs_name?
12
4
  fields.each do |attribute|
13
5
  return false if attribute.split(':').first == 'name'
@@ -0,0 +1,5 @@
1
+ module Adminpanel
2
+ class GalleryfilesController < Adminpanel::ApplicationController
3
+
4
+ end
5
+ end
@@ -3,27 +3,27 @@ module Adminpanel
3
3
  include Adminpanel::Base
4
4
  include Adminpanel::Sortable
5
5
 
6
- mount_uploader :file, Adminpanel::PhotoUploader
7
-
8
6
  mount_images :galleryfiles
9
7
 
8
+ mount_uploader :file, Adminpanel::PhotoUploader
9
+
10
10
  def name
11
- file
11
+ self['file']
12
12
  end
13
13
 
14
- def self.form_fields
14
+ def self.form_attributes
15
15
  [
16
16
  {
17
17
  'file' => {
18
- 'type' => 'text',
18
+ 'type' => 'file_field',
19
19
  'label' => 'file',
20
20
 
21
21
  }
22
22
  },
23
23
  {
24
24
  'galleryfiles' => {
25
- 'type' => 'adminpanel_file_fields',
26
- 'label' => 'images for this gallery'
25
+ 'type' => 'adminpanel_file_field',
26
+ 'label' => 'galleryfiels'
27
27
  }
28
28
  }
29
29
  ]
@@ -19,9 +19,8 @@ module Adminpanel
19
19
  'product_id' => {
20
20
  'type' => 'select',
21
21
  'label' => 'product_id',
22
- 'options' => Proc.new { |object|
23
- Adminpanel::Product.all.map {|o| [o.id, o.supername]}
24
- }
22
+ 'options' => Proc.new { |object| Adminpanel::Product.all },
23
+ 'name_method' => :supername
25
24
  }
26
25
  },
27
26
  ]
@@ -1,15 +1,15 @@
1
1
  one:
2
- file: hipster.jpg
2
+ file: <%= File.open(Rails.root.join("app/assets/images/hipster.jpg")) %>
3
3
  position: 1
4
4
  created_at: <%= Date.today %>
5
5
  updated_at: <%= Date.today %>
6
6
  two:
7
- file: hipster.jpg
7
+ file: <%= File.open(Rails.root.join("app/assets/images/hipster.jpg")) %>
8
8
  position: 2
9
9
  created_at: <%= Date.today %>
10
10
  updated_at: <%= Date.today %>
11
11
  three:
12
- file: hipster.jpg
12
+ file: <%= File.open(Rails.root.join("app/assets/images/hipster.jpg")) %>
13
13
  position: 3
14
14
  created_at: <%= Date.today %>
15
15
  updated_at: <%= Date.today %>
@@ -1,41 +1,41 @@
1
1
  first:
2
- file: hipster.jpg
2
+ file: <%= File.open(Rails.root.join("app/assets/images/hipster.jpg")) %>
3
3
  gallery: one
4
4
  position: 1
5
5
  created_at: <%= Date.today %>
6
6
  updated_at: <%= Date.today %>
7
7
  second:
8
- file: hipster.jpg
8
+ file: <%= File.open(Rails.root.join("app/assets/images/hipster.jpg")) %>
9
9
  gallery: one
10
10
  position: 2
11
11
  created_at: <%= Date.today %>
12
12
  updated_at: <%= Date.today %>
13
13
  third:
14
- file: hipster.jpg
14
+ file: <%= File.open(Rails.root.join("app/assets/images/hipster.jpg")) %>
15
15
  gallery: one
16
16
  position: 3
17
17
  created_at: <%= Date.today %>
18
18
  updated_at: <%= Date.today %>
19
19
  fourth:
20
- file: hipster.jpg
20
+ file: <%= File.open(Rails.root.join("app/assets/images/hipster.jpg")) %>
21
21
  gallery: one
22
22
  position: 4
23
23
  created_at: <%= Date.today %>
24
24
  updated_at: <%= Date.today %>
25
25
  fifth:
26
- file: hipster.jpg
26
+ file: <%= File.open(Rails.root.join("app/assets/images/hipster.jpg")) %>
27
27
  gallery: one
28
28
  position: 5
29
29
  created_at: <%= Date.today %>
30
30
  updated_at: <%= Date.today %>
31
31
  first_2:
32
- file: hipster.jpg
32
+ file: <%= File.open(Rails.root.join("app/assets/images/hipster.jpg")) %>
33
33
  gallery: two
34
34
  position: 1
35
35
  created_at: <%= Date.today %>
36
36
  updated_at: <%= Date.today %>
37
37
  second_2:
38
- file: hipster.jpg
38
+ file: <%= File.open(Rails.root.join("app/assets/images/hipster.jpg")) %>
39
39
  gallery: two
40
40
  position: 2
41
41
  created_at: <%= Date.today %>
@@ -7,11 +7,8 @@ class SortableGalleryUiTest < ViewCase
7
7
  teardown :teardown
8
8
 
9
9
  def test_including_draggable_td
10
- skip '😪'
11
10
  visit adminpanel.gallery_path(adminpanel_galleries(:one))
12
11
 
13
- p page.body
14
-
15
12
  # assert for sortable stuff
16
13
  assert_selector 'td.draggable.img'
17
14
  end
@@ -23,15 +23,14 @@ class SelectTest < ViewCase
23
23
  assert select_selector.find('option', text: 'Publisher')
24
24
  end
25
25
 
26
- def test_select_with_mapped_result
27
- # test select, with proc in options gives an
28
- # [['one', '1'], ['two', '2'], ...] as a repsonse (map)
26
+ def test_select_with_diffent_name_method
27
+ # test select, with a name method different than the default
29
28
  visit adminpanel.new_salesman_path
30
29
  # puts page.
31
30
  select_field = find('#salesman_product_id')
32
31
  assert select_field
33
- assert select_field.find('option', text: 'SuperProduct saved')
34
- assert select_field.find('option', text: 'SuperProduct with limit')
32
+ assert select_field.find('option', text: adminpanel_products(:first).supername)
33
+ assert select_field.find('option', text: adminpanel_products(:limit_images).supername)
35
34
  end
36
35
 
37
36
  private
@@ -29,7 +29,6 @@ class MaxImagesGalleryTest < ViewCase
29
29
  end
30
30
  visit adminpanel.edit_product_path(product)
31
31
  ## $('#add-image-link') should not be visible if max files is reached (it is reached)
32
- # assert_no_selector '#add-image-link'
33
32
 
34
33
  assert_no_selector '#add-image-link'
35
34
 
@@ -6,6 +6,15 @@ class InitializeGeneratorTest < Rails::Generators::TestCase
6
6
  destination Rails.root.join('tmp/generators')
7
7
  setup :prepare_destination
8
8
 
9
+ def after_setup
10
+ Dir.mkdir Rails.root.join('tmp', 'generators', 'config')
11
+ File.open Rails.root.join('tmp', 'generators', 'config', 'routes.rb'), 'w' do |f|
12
+ f.puts "Rails.application.routes.draw do \n"
13
+ f.puts "# lot of routes \n"
14
+ f.puts "end"
15
+ end
16
+ end
17
+
9
18
  def test_the_generation_of_initial_migration
10
19
  run_generator
11
20
  assert_migration 'db/migrate/create_adminpanel_tables'
@@ -16,13 +25,18 @@ class InitializeGeneratorTest < Rails::Generators::TestCase
16
25
  assert_file 'config/initializers/adminpanel_setup.rb'
17
26
  end
18
27
 
28
+ def test_mount_of_adminpanel
29
+ run_generator
30
+ assert_file 'config/routes.rb', /mount Adminpanel/
31
+ end
32
+
19
33
  def test_the_generation_of_the_section_uploader
20
34
  run_generator
21
35
  assert_file 'app/uploaders/adminpanel/section_uploader.rb'
22
36
  end
23
37
 
24
38
  def test_the_not_generation_of_files
25
- run_generator %w( -u true -m true -p true )
39
+ run_generator %w( -u true -m true -p true )
26
40
  assert_no_file 'config/initializers/adminpanel_setup.rb'
27
41
  assert_no_migration 'db/migrate/create_adminpanel_tables'
28
42
  assert_no_file 'app/uploaders/adminpanel/section_uploader.rb'
@@ -6,6 +6,20 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
6
6
  destination Rails.root.join('tmp/generators')
7
7
  setup :prepare_destination
8
8
 
9
+ def after_setup
10
+ Dir.mkdir Rails.root.join('tmp', 'generators', 'config')
11
+ Dir.mkdir Rails.root.join('tmp', 'generators', 'config', 'initializers')
12
+ File.open Rails.root.join('tmp', 'generators', 'config', 'initializers', 'adminpanel_setup.rb'), 'w' do |f|
13
+ f.puts "Adminpanel.setup do |config| \n"
14
+ f.puts " config.displayable_resources = [ \n"
15
+ f.puts " :users,\n"
16
+ f.puts " :permissions\n"
17
+ f.puts " end\n"
18
+ f.puts "end"
19
+ end
20
+ end
21
+
22
+
9
23
  def test_default_not_generation_of_gallery
10
24
  run_generator %w(
11
25
  post
@@ -29,19 +43,18 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
29
43
  assert_migration 'db/migrate/create_adminpanel_postfiles.rb'
30
44
  end
31
45
 
32
- # def test_initializer_update
33
- # run_generator %w(
34
- # post
35
- # name
36
- # description:wysiwyg
37
- # number:float
38
- # -g=false
39
- # )
40
- # assert_file(
41
- # 'config/adminpanel_setup.rb',
42
- # /:posts,/
43
- # )
44
- # end
46
+ def test_initializer_update
47
+ run_generator %w(
48
+ post
49
+ name
50
+ description:wysiwyg
51
+ number:float
52
+ )
53
+ assert_file(
54
+ 'config/initializers/adminpanel_setup.rb',
55
+ /:posts,/
56
+ )
57
+ end
45
58
 
46
59
  def test_controller_generation
47
60
  run_generator %w(
@@ -112,7 +125,7 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
112
125
  /class AdminPost </,
113
126
  /include Adminpanel::Base/,
114
127
  /mount_images :admin_postfiles/,
115
- # form_fields generated correctly
128
+ # form_attributes generated correctly
116
129
  /'description' => {/,
117
130
  /'type' => 'wysiwyg_field',/,
118
131
  /'name' => {/,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adminpanel
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.5
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Ramon Camacho
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-05-01 00:00:00.000000000 Z
13
+ date: 2015-06-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -634,6 +634,7 @@ files:
634
634
  - test/dummy/app/controllers/adminpanel/departments_controller.rb
635
635
  - test/dummy/app/controllers/adminpanel/file_resources_controller.rb
636
636
  - test/dummy/app/controllers/adminpanel/galleries_controller.rb
637
+ - test/dummy/app/controllers/adminpanel/galleryfiles_controller.rb
637
638
  - test/dummy/app/controllers/adminpanel/mugs_controller.rb
638
639
  - test/dummy/app/controllers/adminpanel/products_controller.rb
639
640
  - test/dummy/app/controllers/adminpanel/salesmen_controller.rb
@@ -757,6 +758,7 @@ test_files:
757
758
  - test/dummy/app/controllers/adminpanel/departments_controller.rb
758
759
  - test/dummy/app/controllers/adminpanel/file_resources_controller.rb
759
760
  - test/dummy/app/controllers/adminpanel/galleries_controller.rb
761
+ - test/dummy/app/controllers/adminpanel/galleryfiles_controller.rb
760
762
  - test/dummy/app/controllers/adminpanel/mugs_controller.rb
761
763
  - test/dummy/app/controllers/adminpanel/products_controller.rb
762
764
  - test/dummy/app/controllers/adminpanel/salesmen_controller.rb