rails_admin_globalize_field 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails_admin_globalize_field/version.rb +1 -1
- data/rails_admin_globalize_field.gemspec +4 -5
- data/spec/dummy/Gemfile +3 -3
- data/spec/dummy/app/models/admin/note.rb +4 -0
- data/spec/dummy/config/initializers/rails_admin.rb +3 -0
- data/spec/dummy/db/schema.rb +1 -1
- data/spec/field_spec.rb +33 -32
- metadata +3 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 330004f96a0fb99c7dd6d7b0f77cb512e2f31fd1
|
4
|
+
data.tar.gz: 1a5990869c087522f633ead99400a93145501cb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a2ca1d49ba5aaa391e3364bae21d0f73eca49adc33512fe2ea4dd313158823dd580a0bccca68510375957ac23f3ff5da0caa09c505b1fa6423d3ae53f8f09dc
|
7
|
+
data.tar.gz: b24d404ecc186e0c59c378910e0ae3dcb7a51964c44608d482a8355df01c91110f5c4cc324fffaff2f3cdae4affad4b6dd80a9d85b4fa80f804bbf52e36db08a
|
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "rails_admin_globalize_field"
|
8
8
|
spec.version = RailsAdminGlobalizeField::VERSION
|
9
9
|
spec.authors = ["Andrew Volozhanin"]
|
10
|
-
spec.email = ["
|
10
|
+
spec.email = ["scarfacedeb@gmail.com"]
|
11
11
|
spec.description = %q{Adds tabbed interface and custom field type for globalize translations to Rails_admin}
|
12
12
|
spec.summary = %q{Tabbed interface and custom field type for globalize translations for Rails_admin}
|
13
13
|
spec.homepage = ""
|
@@ -18,11 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "rails", ">= 4.
|
21
|
+
spec.add_dependency "rails", ">= 4.2"
|
22
22
|
spec.add_dependency 'rails_admin', '>= 0.6.2'
|
23
23
|
|
24
|
-
|
25
|
-
spec.add_dependency 'globalize', '>= 4.0', '< 5.0'
|
24
|
+
spec.add_dependency 'globalize', '>= 5.0'
|
26
25
|
|
27
26
|
spec.add_development_dependency "bundler", "~> 1.3"
|
28
27
|
spec.add_development_dependency "rake"
|
@@ -32,4 +31,4 @@ Gem::Specification.new do |spec|
|
|
32
31
|
spec.add_development_dependency 'rspec-rails', '~> 3.0'
|
33
32
|
spec.add_development_dependency 'capybara', '~> 2.4'
|
34
33
|
spec.add_development_dependency 'poltergeist', '~> 1.5'
|
35
|
-
end
|
34
|
+
end
|
data/spec/dummy/Gemfile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'rails',
|
3
|
+
gem 'rails', "~> 4.2"
|
4
4
|
gem 'sqlite3'
|
5
5
|
|
6
|
-
gem 'globalize',
|
6
|
+
gem 'globalize', "~> 5.0"
|
7
7
|
gem 'rails_admin', '~> 0.6'
|
8
8
|
|
9
|
-
gem 'rails_admin_globalize_field', path: '../../'
|
9
|
+
gem 'rails_admin_globalize_field', path: '../../'
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -20,7 +20,7 @@ ActiveRecord::Schema.define do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
create_table :admin_note_translations, force: true do |t|
|
23
|
-
t.integer :
|
23
|
+
t.integer :admin_note_id, null: false
|
24
24
|
t.string :locale, null: false
|
25
25
|
t.string :title, null: false
|
26
26
|
t.timestamps null: false
|
data/spec/field_spec.rb
CHANGED
@@ -2,54 +2,55 @@ require 'spec_helper'
|
|
2
2
|
require 'pry'
|
3
3
|
|
4
4
|
RSpec.describe RailsAdmin::Config::Fields::Types::GlobalizeTabs do
|
5
|
+
let(:translated_page) {
|
6
|
+
Page.create!(
|
7
|
+
slug: '2001',
|
8
|
+
image: 'poster.png',
|
9
|
+
title: '2001: Space odyssey',
|
10
|
+
content: '<p>Visionary</p>'
|
11
|
+
)
|
12
|
+
}
|
13
|
+
let(:note) { Admin::Note.create(title: 'Fix bug with namespaces', image: 'urgent.png') }
|
14
|
+
|
5
15
|
it 'renders all available locales as tabs' do
|
6
16
|
visit '/page/new'
|
7
17
|
expect(find('.globalize_tabs_type').find('.nav-tabs')).to have_content 'en cz ru'
|
8
18
|
end
|
9
19
|
|
10
|
-
|
11
|
-
|
12
|
-
Page.create!(
|
13
|
-
slug: '2001',
|
14
|
-
image: 'poster.png',
|
15
|
-
title: '2001: Space odyssey',
|
16
|
-
content: '<p>Visionary</p>'
|
17
|
-
)
|
18
|
-
}
|
19
|
-
|
20
|
-
def perform
|
20
|
+
describe 'localized data in correct tab' do
|
21
|
+
it 'renders the default locale' do
|
21
22
|
visit "/page/#{translated_page.id}/edit"
|
23
|
+
within(".localized-pane-en-page-#{translated_page.id}") do
|
24
|
+
expect(find_field('Title').value).to eq('2001: Space odyssey')
|
25
|
+
expect(find_field('Content')).to have_content('<p>Visionary</p>')
|
26
|
+
end
|
22
27
|
end
|
23
28
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
expect(find_field('Content')).to have_content('<p>Visionary</p>')
|
30
|
-
end
|
29
|
+
it 'renders cz locale' do
|
30
|
+
Globalize.with_locale(:cz) do
|
31
|
+
translated_page.title = '2001: Vesmírná odysea'
|
32
|
+
translated_page.content = '<p>Vizionář</p>'
|
33
|
+
translated_page.save!
|
31
34
|
end
|
32
35
|
|
33
|
-
|
34
|
-
Globalize.with_locale(:cz) do
|
35
|
-
translated_page.title = '2001: Vesmírná odysea'
|
36
|
-
translated_page.content = '<p>Vizionář</p>'
|
37
|
-
translated_page.save!
|
38
|
-
end
|
39
|
-
|
40
|
-
perform
|
36
|
+
visit "/page/#{translated_page.id}/edit"
|
41
37
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
38
|
+
within(".localized-pane-cz-page-#{translated_page.id}") do
|
39
|
+
expect(find_field('Title').value).to eq('2001: Vesmírná odysea')
|
40
|
+
expect(find_field('Content')).to have_content('<p>Vizionář</p>')
|
46
41
|
end
|
47
42
|
end
|
48
43
|
end
|
49
44
|
|
50
45
|
it 'works correctly with namespaced models' do
|
51
|
-
note = Admin::Note.create(title: 'Fix bug with namespaces', image: 'urgent.png')
|
52
46
|
visit "/admin~note/#{note.id}/edit"
|
53
47
|
expect(page).to have_css(".localized-pane-en-admin-note-#{note.id}")
|
54
48
|
end
|
55
|
-
|
49
|
+
|
50
|
+
it 'allows to set custom label name for translated attribute' do
|
51
|
+
visit "/admin~note/#{note.id}/edit"
|
52
|
+
within(".localized-pane-en-admin-note-#{note.id}") do
|
53
|
+
expect(find('#admin_note_translations_attributes_0_title_field')).to have_content('Custom note title')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,23 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_globalize_field
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Volozhanin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '4.0'
|
20
|
-
- - "<"
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: '4.2'
|
23
20
|
type: :runtime
|
@@ -25,9 +22,6 @@ dependencies:
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '4.0'
|
30
|
-
- - "<"
|
31
25
|
- !ruby/object:Gem::Version
|
32
26
|
version: '4.2'
|
33
27
|
- !ruby/object:Gem::Dependency
|
@@ -49,9 +43,6 @@ dependencies:
|
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
45
|
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '4.0'
|
54
|
-
- - "<"
|
55
46
|
- !ruby/object:Gem::Version
|
56
47
|
version: '5.0'
|
57
48
|
type: :runtime
|
@@ -59,9 +50,6 @@ dependencies:
|
|
59
50
|
version_requirements: !ruby/object:Gem::Requirement
|
60
51
|
requirements:
|
61
52
|
- - ">="
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '4.0'
|
64
|
-
- - "<"
|
65
53
|
- !ruby/object:Gem::Version
|
66
54
|
version: '5.0'
|
67
55
|
- !ruby/object:Gem::Dependency
|
@@ -179,7 +167,7 @@ dependencies:
|
|
179
167
|
description: Adds tabbed interface and custom field type for globalize translations
|
180
168
|
to Rails_admin
|
181
169
|
email:
|
182
|
-
-
|
170
|
+
- scarfacedeb@gmail.com
|
183
171
|
executables: []
|
184
172
|
extensions: []
|
185
173
|
extra_rdoc_files: []
|