adminpanel 2.6.1 → 3.0.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 +4 -4
- data/.travis.yml +1 -1
- data/adminpanel.gemspec +6 -6
- data/app/assets/images/adminpanel/magnifier.png +0 -0
- data/app/assets/javascripts/adminpanel/bootstrap-data-confirm.coffee.erb +142 -0
- data/app/assets/javascripts/adminpanel/dom-filter.coffee +15 -0
- data/app/assets/javascripts/adminpanel/dropzone.js +1728 -0
- data/app/assets/javascripts/adminpanel/filter-side-menu.coffee +4 -0
- data/app/assets/javascripts/adminpanel/gallery.js.coffee.erb +79 -0
- data/app/assets/javascripts/adminpanel/realm.js +0 -3
- data/app/assets/stylesheets/adminpanel/_search-input.scss.erb +11 -0
- data/app/assets/stylesheets/adminpanel/bootstrap.css.erb +1 -1
- data/app/assets/stylesheets/adminpanel/dropzone.css +515 -0
- data/app/assets/stylesheets/adminpanel/theme.css.scss.erb +1 -1
- data/app/controllers/adminpanel/analytics_controller.rb +7 -51
- data/app/controllers/adminpanel/application_controller.rb +1 -0
- data/app/controllers/adminpanel/roles_controller.rb +4 -1
- data/app/controllers/adminpanel/sections_controller.rb +1 -7
- data/app/controllers/concerns/adminpanel/facebook_actions.rb +3 -0
- data/app/controllers/concerns/adminpanel/gallery_actions.rb +31 -0
- data/app/controllers/concerns/adminpanel/rest_actions.rb +4 -1
- data/app/helpers/adminpanel/analytics_helper.rb +8 -18
- data/app/helpers/adminpanel/application_helper.rb +10 -2
- data/app/helpers/adminpanel/router_helper.rb +6 -2
- data/app/helpers/adminpanel/shared_pages_helper.rb +5 -3
- data/app/models/adminpanel/analytic.rb +4 -0
- data/app/models/adminpanel/image.rb +31 -0
- data/app/models/adminpanel/sectionfile.rb +1 -3
- data/app/models/concerns/adminpanel/base.rb +51 -7
- data/app/models/concerns/adminpanel/sortable_gallery.rb +12 -17
- data/app/views/adminpanel/analytics/_header.html.erb +1 -1
- data/app/views/adminpanel/form/_adminpanel_file_field.html.erb +27 -23
- data/app/views/adminpanel/icons/_delete.html.erb +1 -0
- data/app/views/adminpanel/sections/edit.html.erb +1 -12
- data/app/views/adminpanel/shared/_form_fields.html.erb +1 -0
- data/app/views/adminpanel/templates/destroy.js.erb +3 -0
- data/app/views/adminpanel/templates/index.html.erb +4 -4
- data/app/views/adminpanel/templates/show.html.erb +57 -52
- data/app/views/layouts/adminpanel/_side_menu.html.erb +18 -3
- data/config/initializers/adminpanel/assets.rb +4 -0
- data/config/locales/en.yml +24 -9
- data/config/locales/es.yml +18 -33
- data/config/routes.rb +10 -5
- data/lib/adminpanel/version.rb +1 -1
- data/lib/generators/adminpanel/gallery/gallery_generator.rb +0 -8
- data/lib/generators/adminpanel/gallery/templates/gallery_template.rb +7 -18
- data/lib/generators/adminpanel/gallery/templates/uploader.rb +1 -1
- data/lib/generators/adminpanel/initialize/templates/create_adminpanel_tables.rb +9 -5
- data/lib/generators/adminpanel/resource/resource_generator.rb +12 -16
- data/lib/generators/adminpanel/resource/resource_generator_helper.rb +23 -16
- data/test/dummy/.gitignore +2 -2
- data/test/dummy/app/controllers/adminpanel/products_controller.rb +1 -1
- data/test/dummy/app/models/adminpanel/galleryfile.rb +1 -13
- data/test/dummy/app/models/adminpanel/photo.rb +2 -9
- data/test/dummy/app/models/adminpanel/product.rb +1 -0
- data/test/dummy/config/initializers/carrierwave.rb +5 -0
- data/test/dummy/db/schema.rb +10 -18
- data/test/dummy/test/fixtures/adminpanel/galleries.yml +3 -3
- data/test/dummy/test/fixtures/adminpanel/images.yml +60 -0
- data/test/dummy/test/fixtures/adminpanel/products.yml +2 -2
- data/test/dummy/test/fixtures/{dog fries.png → attachments/dog-fries.png} +0 -0
- data/test/dummy/test/fixtures/attachments/hipster.jpg +0 -0
- data/test/dummy/test/fixtures/attachments/thumb_hipster.jpg +0 -0
- data/test/features/shared/form/belongs_to_remote_test.rb +1 -4
- data/test/features/shared/form/resource_field_test.rb +1 -1
- data/test/features/shared/resource/edit_test.rb +2 -5
- data/test/features/shared/resource/new_test.rb +5 -2
- data/test/features/shared/ui/dropzone_element_generation_test.rb +27 -0
- data/test/features/shared/ui/filtering_test.rb +29 -0
- data/test/generators/gallery_generator_test.rb +0 -10
- data/test/generators/resource_generator_test.rb +30 -6
- data/test/helpers/shared_pages_helper_test.rb +22 -43
- data/test/models/adminpanel/image_test.rb +31 -0
- data/test/models/adminpanel/sortable_gallery_unit_test.rb +8 -8
- data/test/support/view_case.rb +2 -2
- metadata +53 -43
- data/app/assets/images/adminpanel/dialogs.png +0 -0
- data/app/assets/images/adminpanel/icons-big.png +0 -0
- data/app/assets/images/adminpanel/icons-small.png +0 -0
- data/app/assets/images/adminpanel/select2.png +0 -0
- data/app/assets/images/adminpanel/select2x2.png +0 -0
- data/app/assets/images/adminpanel/toolbar.png +0 -0
- data/app/assets/javascripts/adminpanel/jquery.knob.js +0 -652
- data/app/assets/javascripts/adminpanel/jquery.masonry.min.js +0 -10
- data/app/assets/javascripts/adminpanel/jquery.slimscroll.min.js +0 -14
- data/app/views/adminpanel/analytics/_fb_statistic_widget.html.erb +0 -63
- data/app/views/adminpanel/analytics/fb.html.erb +0 -106
- data/test/dummy/config/carrierwave.rb +0 -6
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/fixtures/adminpanel/galleryfiles.yml +0 -42
- data/test/features/shared/ui/max_images_gallery_test.rb +0 -51
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
first:
|
|
2
|
+
file: <%= File.open(Rails.root.join("test", "fixtures", 'attachments', 'dog-fries.png')) %>
|
|
3
|
+
type: Adminpanel::Galleryfile
|
|
4
|
+
position: 1
|
|
5
|
+
model: one(Adminpanel::Gallery)
|
|
6
|
+
created_at: <%= Date.today %>
|
|
7
|
+
updated_at: <%= Date.today %>
|
|
8
|
+
second:
|
|
9
|
+
file: <%= File.open(Rails.root.join("test", "fixtures", 'attachments', 'dog-fries.png')) %>
|
|
10
|
+
type: Adminpanel::Galleryfile
|
|
11
|
+
model: one(Adminpanel::Gallery)
|
|
12
|
+
position: 2
|
|
13
|
+
created_at: <%= Date.today %>
|
|
14
|
+
updated_at: <%= Date.today %>
|
|
15
|
+
third:
|
|
16
|
+
file: <%= File.open(Rails.root.join("test", "fixtures", 'attachments', 'dog-fries.png')) %>
|
|
17
|
+
type: Adminpanel::Galleryfile
|
|
18
|
+
model: one(Adminpanel::Gallery)
|
|
19
|
+
position: 3
|
|
20
|
+
created_at: <%= Date.today %>
|
|
21
|
+
updated_at: <%= Date.today %>
|
|
22
|
+
fourth:
|
|
23
|
+
file: <%= File.open(Rails.root.join("test", "fixtures", 'attachments', 'dog-fries.png')) %>
|
|
24
|
+
type: Adminpanel::Galleryfile
|
|
25
|
+
model: one(Adminpanel::Gallery)
|
|
26
|
+
position: 4
|
|
27
|
+
created_at: <%= Date.today %>
|
|
28
|
+
updated_at: <%= Date.today %>
|
|
29
|
+
fifth:
|
|
30
|
+
file: <%= File.open(Rails.root.join("test", "fixtures", 'attachments', 'dog-fries.png')) %>
|
|
31
|
+
type: Adminpanel::Galleryfile
|
|
32
|
+
model: one(Adminpanel::Gallery)
|
|
33
|
+
position: 5
|
|
34
|
+
created_at: <%= Date.today %>
|
|
35
|
+
updated_at: <%= Date.today %>
|
|
36
|
+
first_2:
|
|
37
|
+
file: <%= File.open(Rails.root.join("test", "fixtures", 'attachments', 'dog-fries.png')) %>
|
|
38
|
+
type: Adminpanel::Galleryfile
|
|
39
|
+
model: two(Adminpanel::Gallery)
|
|
40
|
+
position: 1
|
|
41
|
+
created_at: <%= Date.today %>
|
|
42
|
+
updated_at: <%= Date.today %>
|
|
43
|
+
second_2:
|
|
44
|
+
file: <%= File.open(Rails.root.join("test", "fixtures", 'attachments', 'dog-fries.png')) %>
|
|
45
|
+
type: Adminpanel::Galleryfile
|
|
46
|
+
model: two(Adminpanel::Gallery)
|
|
47
|
+
position: 2
|
|
48
|
+
created_at: <%= Date.today %>
|
|
49
|
+
updated_at: <%= Date.today %>
|
|
50
|
+
unassigned:
|
|
51
|
+
type: Adminpanel::Galleryfile
|
|
52
|
+
created_at: <%= Date.yesterday %>
|
|
53
|
+
updated_at: <%= Date.yesterday %>
|
|
54
|
+
first_product_photo:
|
|
55
|
+
file: <%= File.open(Rails.root.join("test", "fixtures", 'attachments', 'dog-fries.png')) %>
|
|
56
|
+
type: Adminpanel::Photo
|
|
57
|
+
model: first(Adminpanel::Product)
|
|
58
|
+
position: 1
|
|
59
|
+
created_at: <%= Date.today %>
|
|
60
|
+
updated_at: <%= Date.today %>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
first:
|
|
2
2
|
name: "Product saved"
|
|
3
|
-
price: 123.45
|
|
3
|
+
price: "123.45"
|
|
4
4
|
description: lorem ipsum dolor sit amec
|
|
5
5
|
created_at: <%= Date.today %>
|
|
6
6
|
updated_at: <%= Date.today %>
|
|
@@ -8,7 +8,7 @@ first:
|
|
|
8
8
|
|
|
9
9
|
limit_images:
|
|
10
10
|
name: Product with limit
|
|
11
|
-
price: 123.45
|
|
11
|
+
price: "123.45"
|
|
12
12
|
description: lorem ipsum dolor sit amec
|
|
13
13
|
created_at: <%= Date.today %>
|
|
14
14
|
updated_at: <%= Date.today %>
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
@@ -24,10 +24,7 @@ class BelongsToRemoteTest < ViewCase
|
|
|
24
24
|
fill_in 'product_description', with: 'remote description lorem'
|
|
25
25
|
fill_in 'product_price', with: '12.3'
|
|
26
26
|
submit_modal 'Agregar Producto'
|
|
27
|
-
|
|
28
|
-
# assert_equal 'remote_product', remote_product.name
|
|
29
|
-
# assert_equal 'remote descrpition lorem', remote_product.description
|
|
30
|
-
# assert_equal '12.3', remote_product.price
|
|
27
|
+
|
|
31
28
|
assert_xpath("//option[contains(text(), 'remote product' )]")
|
|
32
29
|
end
|
|
33
30
|
|
|
@@ -12,7 +12,7 @@ class ResourceFieldTest < ViewCase
|
|
|
12
12
|
|
|
13
13
|
assert selector.find('option', text: 'Categoria')
|
|
14
14
|
assert selector.find('option', text: 'Producto')
|
|
15
|
-
assert selector.find('option', text: '
|
|
15
|
+
assert selector.find('option', text: 'Analytics')
|
|
16
16
|
assert selector.find('option', text: 'Usuario')
|
|
17
17
|
assert selector.find('option', text: 'Rol')
|
|
18
18
|
assert selector.find('option', text: 'Permiso')
|
|
@@ -6,11 +6,9 @@ class EditTest < ViewCase
|
|
|
6
6
|
setup :visit_adminpanel_new_product_path
|
|
7
7
|
teardown :teardown
|
|
8
8
|
|
|
9
|
-
def test_shared_new_page_messages
|
|
10
|
-
assert_button("Actualizar #{adminpanel_products(:first).name}")
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
def test_submitting_with_same_information
|
|
10
|
+
sleep 0.2
|
|
11
|
+
assert_button("Actualizar #{adminpanel_products(:first).name}")
|
|
14
12
|
click_button("Actualizar #{adminpanel_products(:first).name}")
|
|
15
13
|
assert_content( adminpanel_products(:first).name )
|
|
16
14
|
assert_content( adminpanel_products(:first).price )
|
|
@@ -21,7 +19,6 @@ class EditTest < ViewCase
|
|
|
21
19
|
fill_in 'product_price', with: ''
|
|
22
20
|
click_button("Actualizar #{adminpanel_products(:first).name}")
|
|
23
21
|
assert_content('Producto no pudo guardarse debido a 2 errores')
|
|
24
|
-
saved_product = Adminpanel::Product.last
|
|
25
22
|
end
|
|
26
23
|
|
|
27
24
|
protected
|
|
@@ -10,13 +10,16 @@ class NewTest < ViewCase
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def test_submitting_with_invalid_information
|
|
13
|
+
sleep 0.2
|
|
13
14
|
click_button('Agregar Producto')
|
|
14
15
|
assert_content('Producto no pudo guardarse debido a 3 errores')
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
def test_submitting_with_valid_information
|
|
18
|
-
fill_in 'product_name', :
|
|
19
|
-
fill_in 'product_price', :
|
|
19
|
+
fill_in 'product_name', with: 'product name'
|
|
20
|
+
fill_in 'product_price', with: '855.5'
|
|
21
|
+
|
|
22
|
+
|
|
20
23
|
page.execute_script(
|
|
21
24
|
%Q(
|
|
22
25
|
$('#product_description').data('wysihtml5').editor.setValue('que pepsi');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class DropzoneElementGenerationTest < ViewCase
|
|
4
|
+
fixtures :all
|
|
5
|
+
|
|
6
|
+
setup :sign_in
|
|
7
|
+
|
|
8
|
+
test "rendering the form should display the dropzone element" do
|
|
9
|
+
visit adminpanel.new_product_path
|
|
10
|
+
|
|
11
|
+
assert_selector '#photo_dropzone'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
test "render the form should add a hidden input for each existing photos" do
|
|
15
|
+
product = adminpanel_products(:first)
|
|
16
|
+
visit adminpanel.edit_product_path(product)
|
|
17
|
+
|
|
18
|
+
assert_selector '#photo_dropzone'
|
|
19
|
+
assert_selector "input[type='hidden'][name='product[photo_ids][]']", count: product.photos.count
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
protected
|
|
23
|
+
def sign_in
|
|
24
|
+
visit adminpanel.signin_path
|
|
25
|
+
login
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class FilteringTest < ViewCase
|
|
4
|
+
fixtures :all
|
|
5
|
+
|
|
6
|
+
setup :sign_in
|
|
7
|
+
|
|
8
|
+
def test_input_is_present
|
|
9
|
+
assert_selector '#search-input'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_filters_all_elements_when_nothing_matched
|
|
13
|
+
fill_in 'search-input', with: 'abcdeffj nothing matches this'
|
|
14
|
+
# 1 since search-input is inside an .accordion-group
|
|
15
|
+
assert_selector '.accordion-group', count: 1
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def test_filter_to_only_matched_element
|
|
19
|
+
fill_in 'search-input', with: 'pRODuct'
|
|
20
|
+
# 2 since search-input is inside an .accordion-group
|
|
21
|
+
assert_selector '.accordion-group', count: 2
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
protected
|
|
25
|
+
def sign_in
|
|
26
|
+
visit adminpanel.signin_path
|
|
27
|
+
login
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -8,11 +8,6 @@ class GalleryGeneratorTest < Rails::Generators::TestCase
|
|
|
8
8
|
|
|
9
9
|
def test_the_generation_of_the_productfiles_migration
|
|
10
10
|
run_generator ['Product']
|
|
11
|
-
assert_migration(
|
|
12
|
-
'db/migrate/create_adminpanel_productfiles.rb',
|
|
13
|
-
/t.integer :product_id/,
|
|
14
|
-
/create_table :adminpanel_productfiles/
|
|
15
|
-
)
|
|
16
11
|
assert_file(
|
|
17
12
|
'app/models/adminpanel/productfile.rb',
|
|
18
13
|
/mount_uploader :file, ProductfileUploader/
|
|
@@ -24,11 +19,6 @@ class GalleryGeneratorTest < Rails::Generators::TestCase
|
|
|
24
19
|
|
|
25
20
|
def test_the_generation_of_the_snake_cases_migration
|
|
26
21
|
run_generator ['snake_case']
|
|
27
|
-
assert_migration(
|
|
28
|
-
'db/migrate/create_adminpanel_snake_casefiles.rb',
|
|
29
|
-
/t.integer :snake_case_id/,
|
|
30
|
-
/create_table :adminpanel_snake_casefiles/
|
|
31
|
-
)
|
|
32
22
|
assert_file(
|
|
33
23
|
'app/models/adminpanel/snake_casefile.rb',
|
|
34
24
|
/mount_uploader :file, SnakeCasefileUploader/
|
|
@@ -41,7 +41,6 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
|
|
|
41
41
|
--no-skip-gallery
|
|
42
42
|
)
|
|
43
43
|
assert_file 'app/models/adminpanel/postfile.rb'
|
|
44
|
-
assert_migration 'db/migrate/create_adminpanel_postfiles.rb'
|
|
45
44
|
end
|
|
46
45
|
|
|
47
46
|
def test_initializer_update
|
|
@@ -94,6 +93,27 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
|
|
|
94
93
|
)
|
|
95
94
|
end
|
|
96
95
|
|
|
96
|
+
def test_multiple_files
|
|
97
|
+
run_generator %w(
|
|
98
|
+
fily_resource
|
|
99
|
+
pdf1:file
|
|
100
|
+
pdf2:file
|
|
101
|
+
pdf3:file
|
|
102
|
+
img1:image
|
|
103
|
+
)
|
|
104
|
+
assert_file(
|
|
105
|
+
'app/models/adminpanel/fily_resource.rb',
|
|
106
|
+
/'pdf1' => {/,
|
|
107
|
+
/'pdf2' => {/,
|
|
108
|
+
/'pdf3' => {/,
|
|
109
|
+
/mount_uploader :pdf1, FilyResourcePdf1Uploader/,
|
|
110
|
+
/mount_uploader :pdf2, FilyResourcePdf2Uploader/,
|
|
111
|
+
/mount_uploader :pdf3, FilyResourcePdf3Uploader/,
|
|
112
|
+
/mount_uploader :img1, FilyResourceImg1Uploader/,
|
|
113
|
+
/'type' => 'file_field'/,
|
|
114
|
+
)
|
|
115
|
+
end
|
|
116
|
+
|
|
97
117
|
def test_model_generation
|
|
98
118
|
run_generator %w(
|
|
99
119
|
post
|
|
@@ -115,7 +135,8 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
|
|
|
115
135
|
description:wysiwyg
|
|
116
136
|
number:float
|
|
117
137
|
flag:boolean
|
|
118
|
-
avatar:
|
|
138
|
+
avatar:image
|
|
139
|
+
user:belongs_to
|
|
119
140
|
quantity:integer
|
|
120
141
|
date:datepicker
|
|
121
142
|
categories:has_many
|
|
@@ -136,10 +157,12 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
|
|
|
136
157
|
/'flag' => {/,
|
|
137
158
|
/'type' => 'boolean',/,
|
|
138
159
|
/'avatar' => {/,
|
|
139
|
-
/'type' => '
|
|
160
|
+
/'type' => 'image_field',/,
|
|
140
161
|
/'quantity' => {/,
|
|
141
162
|
/'type' => 'number_field',/,
|
|
142
163
|
/'date' => {/,
|
|
164
|
+
/'user_id' => {/,
|
|
165
|
+
/Adminpanel::User.all/,
|
|
143
166
|
/'type' => 'date',/,
|
|
144
167
|
/'admin_postfiles' => {/,
|
|
145
168
|
/'type' => 'adminpanel_file_field',/,
|
|
@@ -187,19 +210,20 @@ class ResourceGeneratorTest < Rails::Generators::TestCase
|
|
|
187
210
|
def test_generating_with_single_attachment_file
|
|
188
211
|
run_generator %w(
|
|
189
212
|
monkey
|
|
190
|
-
avatar:
|
|
213
|
+
avatar:image
|
|
214
|
+
user:belongs_to
|
|
191
215
|
)
|
|
192
216
|
assert_file(
|
|
193
217
|
'app/models/adminpanel/monkey.rb',
|
|
194
218
|
/def name/,
|
|
195
219
|
/mount_uploader :avatar, MonkeyAvatarUploader/,
|
|
196
220
|
/'avatar' => {/,
|
|
197
|
-
/'type' => '
|
|
221
|
+
/'type' => 'image_field'/
|
|
198
222
|
)
|
|
199
223
|
assert_file(
|
|
200
224
|
'app/uploaders/adminpanel/monkey_avatar_uploader.rb',
|
|
201
225
|
/class MonkeyAvatarUploader </
|
|
202
|
-
|
|
226
|
+
)
|
|
203
227
|
end
|
|
204
228
|
|
|
205
229
|
def test_that_runs_without_errors
|
|
@@ -35,14 +35,10 @@ class SharedPagesHelperTest < ActionView::TestCase
|
|
|
35
35
|
def test_string_in_field_value
|
|
36
36
|
test_object = adminpanel_test_objects(:first)
|
|
37
37
|
attribute = 'name'
|
|
38
|
-
properties = {
|
|
39
|
-
'type' => 'text_field',
|
|
40
|
-
'label' => 'name'
|
|
41
|
-
}
|
|
42
38
|
assert_equal(
|
|
43
39
|
'John Doe',
|
|
44
40
|
field_value(
|
|
45
|
-
|
|
41
|
+
'text_field',
|
|
46
42
|
attribute,
|
|
47
43
|
test_object
|
|
48
44
|
),
|
|
@@ -53,14 +49,10 @@ class SharedPagesHelperTest < ActionView::TestCase
|
|
|
53
49
|
def test_boolean_in_field_value
|
|
54
50
|
test_object = adminpanel_test_objects(:first)
|
|
55
51
|
attribute = 'boolean'
|
|
56
|
-
properties = {
|
|
57
|
-
'type' => 'boolean',
|
|
58
|
-
'label' => 'boolean'
|
|
59
|
-
}
|
|
60
52
|
assert_equal(
|
|
61
53
|
I18n.t('action.is_true'),
|
|
62
54
|
field_value(
|
|
63
|
-
|
|
55
|
+
'boolean',
|
|
64
56
|
attribute,
|
|
65
57
|
test_object
|
|
66
58
|
),
|
|
@@ -72,17 +64,10 @@ class SharedPagesHelperTest < ActionView::TestCase
|
|
|
72
64
|
@model = Adminpanel::Salesman # simulating salesman controller
|
|
73
65
|
test_object = adminpanel_salesmen(:one)
|
|
74
66
|
attribute = 'product_id'
|
|
75
|
-
properties = {
|
|
76
|
-
'type' => 'select',
|
|
77
|
-
'label' => 'product',
|
|
78
|
-
'model' => Proc.new { |object|
|
|
79
|
-
Adminpanel::Product.all
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
67
|
assert_equal(
|
|
83
68
|
'Product saved',
|
|
84
69
|
field_value(
|
|
85
|
-
|
|
70
|
+
'select',
|
|
86
71
|
attribute,
|
|
87
72
|
test_object
|
|
88
73
|
)
|
|
@@ -92,13 +77,6 @@ class SharedPagesHelperTest < ActionView::TestCase
|
|
|
92
77
|
def test_has_many_in_field_value
|
|
93
78
|
test_object = adminpanel_test_objects(:first)
|
|
94
79
|
attribute = 'category_ids'
|
|
95
|
-
properties = {
|
|
96
|
-
'type' => 'checkbox',
|
|
97
|
-
'label' => 'checkbox label',
|
|
98
|
-
'options' => Proc.new { |object|
|
|
99
|
-
Adminpanel::Category.all
|
|
100
|
-
},
|
|
101
|
-
}
|
|
102
80
|
assert_equal(
|
|
103
81
|
content_tag(:ul, nil) do
|
|
104
82
|
content_tag(:li, nil, class: 'priority-low') do
|
|
@@ -109,7 +87,7 @@ class SharedPagesHelperTest < ActionView::TestCase
|
|
|
109
87
|
end
|
|
110
88
|
end,
|
|
111
89
|
field_value(
|
|
112
|
-
|
|
90
|
+
'checkbox',
|
|
113
91
|
attribute,
|
|
114
92
|
test_object
|
|
115
93
|
),
|
|
@@ -120,17 +98,10 @@ class SharedPagesHelperTest < ActionView::TestCase
|
|
|
120
98
|
def test_enum_in_field_value
|
|
121
99
|
test_object = adminpanel_permissions(:publish)
|
|
122
100
|
attribute = 'action'
|
|
123
|
-
properties = {
|
|
124
|
-
'type' => 'enum_field',
|
|
125
|
-
'label' => 'hasmany',
|
|
126
|
-
'options' => Proc.new { |object|
|
|
127
|
-
Adminpanel::Category.all
|
|
128
|
-
},
|
|
129
|
-
}
|
|
130
101
|
assert_equal(
|
|
131
102
|
'Publicar en Redes Sociales',
|
|
132
103
|
field_value(
|
|
133
|
-
|
|
104
|
+
'enum_field',
|
|
134
105
|
attribute,
|
|
135
106
|
test_object
|
|
136
107
|
),
|
|
@@ -141,25 +112,33 @@ class SharedPagesHelperTest < ActionView::TestCase
|
|
|
141
112
|
def test_file_field_in_field_value
|
|
142
113
|
test_object = adminpanel_galleries(:one)
|
|
143
114
|
attribute = 'file'
|
|
144
|
-
properties = {
|
|
145
|
-
'type' => 'file_field',
|
|
146
|
-
'label' => 'file'
|
|
147
|
-
}
|
|
148
115
|
assert_equal(
|
|
149
|
-
|
|
116
|
+
test_object[attribute],
|
|
117
|
+
field_value(
|
|
118
|
+
'file_field',
|
|
119
|
+
attribute,
|
|
120
|
+
test_object
|
|
121
|
+
)
|
|
122
|
+
)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def test_image_field_in_field_value
|
|
126
|
+
test_object = adminpanel_galleries(:one)
|
|
127
|
+
attribute = 'file'
|
|
128
|
+
assert_equal(
|
|
129
|
+
content_tag(:ul) {
|
|
150
130
|
image_tag(
|
|
151
131
|
test_object.send(
|
|
152
132
|
"#{attribute}_url",
|
|
153
133
|
:thumb
|
|
154
134
|
)
|
|
155
135
|
)
|
|
156
|
-
|
|
136
|
+
},
|
|
157
137
|
field_value(
|
|
158
|
-
|
|
138
|
+
'image_field',
|
|
159
139
|
attribute,
|
|
160
140
|
test_object
|
|
161
|
-
)
|
|
162
|
-
'regex didn\'t matched :('
|
|
141
|
+
)
|
|
163
142
|
)
|
|
164
143
|
end
|
|
165
144
|
|