lolita-translation 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -5
- data/Gemfile +9 -9
- data/LICENSE.txt +20 -20
- data/README.md +44 -33
- data/Rakefile +53 -53
- data/VERSION +1 -1
- data/app/views/components/lolita/configuration/tab/translation/_display.html.erb +78 -76
- data/config/locales/en.yml +9 -8
- data/config/locales/lv.yml +9 -0
- data/lib/generators/lolita_translation/USAGE +8 -8
- data/lib/generators/lolita_translation/has_translations_generator.rb +8 -8
- data/lib/lolita-translation.rb +11 -11
- data/lib/lolita-translation/configuration/tab/translation.rb +13 -13
- data/lib/lolita-translation/has_translations.rb +294 -294
- data/lib/lolita-translation/rails.rb +4 -4
- data/lib/lolita-translation/string.rb +18 -18
- data/lib/tasks/has_translations_tasks.rake +4 -4
- data/lolita-translation.gemspec +3 -3
- data/lolita-translations.gemspec +60 -60
- data/spec/has_translations_spec.rb +43 -43
- data/spec/spec.opts +2 -2
- data/spec/spec_helper.rb +98 -98
- metadata +14 -14
- data/app/views/lolita/has_translations/_tab.html.erb +0 -78
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolita-translation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,12 +11,12 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2011-08-
|
14
|
+
date: 2011-08-10 00:00:00.000000000 +03:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|
19
|
-
requirement: &
|
19
|
+
requirement: &75726130 !ruby/object:Gem::Requirement
|
20
20
|
none: false
|
21
21
|
requirements:
|
22
22
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: 3.0.0
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *75726130
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: shoulda
|
30
|
-
requirement: &
|
30
|
+
requirement: &75725890 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -35,10 +35,10 @@ dependencies:
|
|
35
35
|
version: '0'
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *75725890
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: bundler
|
41
|
-
requirement: &
|
41
|
+
requirement: &75725650 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ~>
|
@@ -46,10 +46,10 @@ dependencies:
|
|
46
46
|
version: 1.0.0
|
47
47
|
type: :development
|
48
48
|
prerelease: false
|
49
|
-
version_requirements: *
|
49
|
+
version_requirements: *75725650
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: jeweler
|
52
|
-
requirement: &
|
52
|
+
requirement: &75725410 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
55
55
|
- - ~>
|
@@ -57,10 +57,10 @@ dependencies:
|
|
57
57
|
version: 1.5.2
|
58
58
|
type: :development
|
59
59
|
prerelease: false
|
60
|
-
version_requirements: *
|
60
|
+
version_requirements: *75725410
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rcov
|
63
|
-
requirement: &
|
63
|
+
requirement: &75725170 !ruby/object:Gem::Requirement
|
64
64
|
none: false
|
65
65
|
requirements:
|
66
66
|
- - ! '>='
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
version: '0'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
|
-
version_requirements: *
|
71
|
+
version_requirements: *75725170
|
72
72
|
description: Translates models in Lolita
|
73
73
|
email: support@ithouse.lv
|
74
74
|
executables: []
|
@@ -84,8 +84,8 @@ files:
|
|
84
84
|
- Rakefile
|
85
85
|
- VERSION
|
86
86
|
- app/views/components/lolita/configuration/tab/translation/_display.html.erb
|
87
|
-
- app/views/lolita/has_translations/_tab.html.erb
|
88
87
|
- config/locales/en.yml
|
88
|
+
- config/locales/lv.yml
|
89
89
|
- lib/generators/lolita_translation/USAGE
|
90
90
|
- lib/generators/lolita_translation/has_translations_generator.rb
|
91
91
|
- lib/lolita-translation.rb
|
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
segments:
|
117
117
|
- 0
|
118
|
-
hash:
|
118
|
+
hash: -90868109
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
none: false
|
121
121
|
requirements:
|
@@ -1,78 +0,0 @@
|
|
1
|
-
<% if @object.new_record? %>
|
2
|
-
<p>Tulkošana iespējama tikai eksistējošiem ierakstiem.</p>
|
3
|
-
<% else %>
|
4
|
-
<div class="managed-create-line">
|
5
|
-
<span class="brick"><%= t "fields.language" %></span>
|
6
|
-
<div class="fl">
|
7
|
-
<%= select_tag :has_translations_locale, options_for_select([""] + I18n.available_locales.clone.delete_if{|l| l == I18n.default_locale}), :onchange => "switch_has_translations_language($(this))" %>
|
8
|
-
</div>
|
9
|
-
</div>
|
10
|
-
<div id="has_translations_fields" style="display: none">
|
11
|
-
<% @object.class.columns_has_translations.each do |column| %>
|
12
|
-
<div class="managed-create-line">
|
13
|
-
<span class="brick"><%= @object.class.human_attribute_name(column.name) %></span>
|
14
|
-
<div class="fl">
|
15
|
-
<% if column.type == :string %>
|
16
|
-
<%= text_field_tag 'has_translations_' + column.name, nil, :class => 'txt' %>
|
17
|
-
<% elsif column.type == :text %>
|
18
|
-
<%= text_area_tag 'has_translations_' + column.name, nil, :class => "textarea" %>
|
19
|
-
<script type="text/javascript">
|
20
|
-
tinyMCE.execCommand('mceRemoveControl', false,'has_translations_<%= column.name %>');
|
21
|
-
tinyMCE.execCommand('mceAddControl', false,'has_translations_<%= column.name %>');
|
22
|
-
</script>
|
23
|
-
<br /><br />
|
24
|
-
<% end %>
|
25
|
-
</div>
|
26
|
-
</div>
|
27
|
-
<% end %>
|
28
|
-
</div>
|
29
|
-
<div class="clear"></div>
|
30
|
-
<div></div>
|
31
|
-
<% @object.build_nested_translations %>
|
32
|
-
<% object_form.fields_for :translations do |tf| %>
|
33
|
-
<div id="object_translation_fields_<%= tf.object.locale %>">
|
34
|
-
<% @object.class.columns_has_translations.each do |column| %>
|
35
|
-
<%= tf.hidden_field column.name, :class => column.name %>
|
36
|
-
<% end %>
|
37
|
-
<%= tf.hidden_field :id, :class => "id" %>
|
38
|
-
<%= tf.hidden_field tf.object.class.master_id, :value => @object.id %>
|
39
|
-
<%= tf.hidden_field :locale, :class => "locale" %>
|
40
|
-
</div>
|
41
|
-
<% end %>
|
42
|
-
<script type="text/javascript">
|
43
|
-
var columns = <%= @object.class.columns_has_translations.map(&:name).inspect %>;
|
44
|
-
var blur = false;
|
45
|
-
function switch_has_translations_language(select){
|
46
|
-
var locale = select.val();
|
47
|
-
if(locale == ""){
|
48
|
-
$('#has_translations_fields').hide()
|
49
|
-
}else{
|
50
|
-
$.each(columns,function(i,column){
|
51
|
-
var content = $('#object_translation_fields_'+locale+' .'+column).val();
|
52
|
-
$('#has_translations_'+column).val(content);
|
53
|
-
if($('#has_translations_'+column).get(0).tagName == 'TEXTAREA'){
|
54
|
-
tinymce.EditorManager.getInstanceById('has_translations_'+column).setContent(content);
|
55
|
-
}
|
56
|
-
});
|
57
|
-
$('#has_translations_fields').show()
|
58
|
-
}
|
59
|
-
if(!blur){
|
60
|
-
$.each($('#has_translations_fields textarea'), function(i,area){
|
61
|
-
var item = $(area);
|
62
|
-
var tiny_editor = tinymce.EditorManager.getInstanceById(item.attr("id"));
|
63
|
-
tinymce.dom.Event.add(tiny_editor.getWin(), "blur", function(){
|
64
|
-
var textarea = $(tinymce.EditorManager.getInstanceById(item.attr("id")).getElement());
|
65
|
-
tiny_editor.save();
|
66
|
-
textarea.blur();
|
67
|
-
});
|
68
|
-
});
|
69
|
-
blur = true;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
$.each(columns,function(i,column){
|
73
|
-
$('#has_translations_'+column).blur(function(){
|
74
|
-
$('#object_translation_fields_'+$("#has_translations_locale").val()+' .'+$(this).attr("name").split("_")[2]).val($(this).val())
|
75
|
-
})
|
76
|
-
})
|
77
|
-
</script>
|
78
|
-
<% end %>
|