lolita-translation 0.0.4 → 0.1.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.
@@ -1,78 +0,0 @@
1
- <% if resource.new_record? %>
2
- <form "#"><%= t('lolita.tabs.translation.only-update') %></form>
3
- <% else %>
4
- <form "#">
5
- <div class="tab-content">
6
- <div class="field" id="field_translation_language">
7
- <label for="translation_language"><%=I18n.t("lolita.tabs.translation.fields.language")%>
8
- <div class="field-value" id="field_translation_language_value">
9
- <%= 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))" %>
10
- </div>
11
- </div>
12
-
13
- <div id="has_translations_fields" class="field" style="display: none">
14
- <% resource.class.columns_has_translations.each do |column| %>
15
- <label for="<%=column.name%>_field"><%=resource.class.human_attribute_name(column.name)%></label>
16
- <div class="fl field-value" id="<%=column.name%>_field">
17
- <% if column.type == :string %>
18
- <%= text_field_tag 'has_translations_' + column.name, nil, :class => 'txt' %>
19
- <% elsif column.type == :text %>
20
- <%= text_area_tag 'has_translations_' + column.name, nil,:rows=>20, :cols=>40 %>
21
- <% end %>
22
- </div>
23
- <% end %>
24
- </div>
25
- </div>
26
- </form>
27
- <% resource.build_nested_translations %>
28
- <%= form_for resource, :url => "/" do |form| %>
29
- <%= form.fields_for :translations do |tf| %>
30
- <div id="object_translation_fields_<%= tf.object.locale %>">
31
- <% resource.class.columns_has_translations.each do |column| %>
32
- <%= tf.hidden_field column.name, :class => column.name %>
33
- <% end %>
34
- <%= tf.hidden_field :id, :class => "id" %>
35
- <%= tf.hidden_field tf.object.class.master_id, :value => resource.id %>
36
- <%= tf.hidden_field :locale, :class => "locale" %>
37
- </div>
38
- <% end %>
39
- <% end %>
40
- <script type="text/javascript">
41
- var columns = [<%= resource.class.columns_has_translations.map{|r| "'#{r.name}'"}.join(",") %>];
42
- var blur = false;
43
- function switch_has_translations_language(select){
44
- var locale = select.val();
45
- if(locale == ""){
46
- $('#has_translations_fields').hide()
47
- }else{
48
- $.each(columns,function(i,column){
49
- var content = $('#object_translation_fields_'+locale+' .'+column).val();
50
- $('#has_translations_'+column).val(content);
51
- if($('#has_translations_'+column).get(0).tagName == 'TEXTAREA'){
52
- tinymce.EditorManager.getInstanceById('has_translations_'+column).setContent(content);
53
- $('#has_translations_'+column+'_tbl').css('width','100%').css('height','250px');
54
- $('#has_translations_'+column+'_ifr').css('width','100%').css('height','250px');
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()+' .'+column).val($(this).val())
75
- })
76
- })
77
- </script>
78
- <% end %>
@@ -1,14 +0,0 @@
1
- module Lolita
2
- module Configuration
3
- module Tab
4
- class Translation < Lolita::Configuration::Tab::Base
5
-
6
- def initialize(dbi,*args,&block)
7
- @type=:translation
8
- super
9
- end
10
-
11
- end
12
- end
13
- end
14
- end
@@ -1,60 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{lolita-translations}
8
- s.version = "0.0.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["ITHouse", "Gatis Tomsons", "Arturs Meisters"]
12
- s.date = %q{2011-08-01}
13
- s.description = %q{Translates models in Lolita}
14
- s.email = %q{support@ithouse.lv}
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.md"
18
- ]
19
- s.files = [
20
- ".document",
21
- "Gemfile",
22
- "LICENSE.txt",
23
- "Rakefile",
24
- "VERSION"
25
- ]
26
- s.homepage = %q{http://github.com/ithouse/lolita-translations}
27
- s.licenses = ["MIT"]
28
- s.require_paths = ["lib"]
29
- s.rubygems_version = %q{1.6.2}
30
- s.summary = %q{Lolita models translation plugin}
31
- s.test_files = [
32
- "spec/has_translations_spec.rb",
33
- "spec/spec_helper.rb"
34
- ]
35
-
36
- if s.respond_to? :specification_version then
37
- s.specification_version = 3
38
-
39
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
40
- s.add_runtime_dependency(%q<rails>, [">= 3.0.0"])
41
- s.add_development_dependency(%q<shoulda>, [">= 0"])
42
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
43
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
44
- s.add_development_dependency(%q<rcov>, [">= 0"])
45
- else
46
- s.add_dependency(%q<rails>, [">= 3.0.0"])
47
- s.add_dependency(%q<shoulda>, [">= 0"])
48
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
49
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
50
- s.add_dependency(%q<rcov>, [">= 0"])
51
- end
52
- else
53
- s.add_dependency(%q<rails>, [">= 3.0.0"])
54
- s.add_dependency(%q<shoulda>, [">= 0"])
55
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
56
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
57
- s.add_dependency(%q<rcov>, [">= 0"])
58
- end
59
- end
60
-