lit 0.2.6 → 0.3.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 +5 -13
- data/README.md +93 -12
- data/Rakefile +1 -0
- data/app/assets/javascripts/lit/application.js +1 -2
- data/app/assets/javascripts/lit/{bootstrap.js.coffee → backend/bootstrap.js.coffee} +0 -0
- data/app/assets/javascripts/lit/{dashboard.js → backend/dashboard.js} +0 -0
- data/app/assets/javascripts/lit/{jquery-te-1.4.0.min.js → backend/jquery-te-1.4.0.min.js} +0 -0
- data/app/assets/javascripts/lit/{localizations.js.coffee → backend/localizations.js.coffee} +2 -0
- data/app/assets/javascripts/lit/backend/sources.js.coffee +24 -0
- data/app/assets/javascripts/lit/lit_frontend.js +103 -0
- data/app/assets/javascripts/lit/mousetrap.js +1044 -0
- data/app/assets/stylesheets/lit/application.css +7 -1
- data/app/assets/stylesheets/lit/{jquery-te-1.4.0.css.scss → backend/jquery-te-1.4.0.css.scss} +0 -0
- data/app/assets/stylesheets/lit/lit_frontend.css +86 -0
- data/app/controllers/lit/api/v1/base_controller.rb +1 -1
- data/app/controllers/lit/application_controller.rb +7 -3
- data/app/controllers/lit/concerns/request_info_store.rb +16 -0
- data/app/controllers/lit/concerns/request_keys_store.rb +16 -0
- data/app/controllers/lit/incomming_localizations_controller.rb +2 -2
- data/app/controllers/lit/locales_controller.rb +1 -1
- data/app/controllers/lit/localization_keys_controller.rb +22 -9
- data/app/controllers/lit/localizations_controller.rb +19 -6
- data/app/controllers/lit/sources_controller.rb +11 -1
- data/app/helpers/lit/frontend_helper.rb +71 -0
- data/app/helpers/lit/localization_keys_helper.rb +5 -0
- data/app/helpers/lit/sources_helper.rb +3 -0
- data/app/jobs/lit/synchronize_source_job.rb +11 -0
- data/app/models/lit/localization.rb +17 -10
- data/app/models/lit/localization_key.rb +6 -2
- data/app/models/lit/source.rb +4 -3
- data/app/views/layouts/lit/application.html.erb +6 -6
- data/app/views/lit/incomming_localizations/index.html.erb +22 -17
- data/app/views/lit/localization_keys/_localization_row.html.erb +1 -1
- data/app/views/lit/localization_keys/index.html.erb +27 -8
- data/app/views/lit/localizations/_form.html.erb +5 -5
- data/app/views/lit/localizations/_previous_versions_rows.html.erb +1 -1
- data/app/views/lit/localizations/edit.js.erb +2 -2
- data/app/views/lit/localizations/previous_versions.js.erb +1 -1
- data/app/views/lit/localizations/update.js.erb +2 -2
- data/config/routes.rb +12 -12
- data/db/migrate/20180101010101_lit_create_lit_locales.rb +16 -0
- data/db/migrate/20180101010102_lit_create_lit_localization_keys.rb +18 -0
- data/db/migrate/20180101010103_lit_create_lit_localizations.rb +24 -0
- data/db/migrate/20180101010104_lit_add_is_completed_and_is_starred_to_localization_keys.rb +17 -0
- data/db/migrate/20180101010105_lit_add_is_hidden_to_locales.rb +12 -0
- data/db/migrate/20180101010106_lit_create_lit_localization_versions.rb +20 -0
- data/db/migrate/20180101010107_lit_create_lit_sources.rb +19 -0
- data/db/migrate/20180101010108_lit_create_lit_incomming_localizations.rb +34 -0
- data/db/migrate/20180101010109_lit_add_sync_complete_to_lit_sources.rb +12 -0
- data/lib/generators/lit/install/templates/initializer.rb +17 -6
- data/lib/generators/lit/install_generator.rb +0 -7
- data/lib/lit.rb +15 -8
- data/lib/lit/adapters/hash_storage.rb +4 -0
- data/lib/lit/adapters/redis_storage.rb +9 -3
- data/lib/lit/cache.rb +126 -70
- data/lib/lit/engine.rb +20 -1
- data/lib/lit/i18n_backend.rb +66 -26
- data/lib/lit/version.rb +1 -1
- data/lib/tasks/lit_tasks.rake +21 -3
- metadata +67 -43
- data/app/assets/stylesheets/lit/dashboard.css +0 -4
- data/config/database.yml +0 -8
- data/db/migrate/20121103144612_create_lit_locales.rb +0 -9
- data/db/migrate/20121103174049_create_lit_localization_keys.rb +0 -10
- data/db/migrate/20121103182106_create_lit_localizations.rb +0 -15
- data/db/migrate/20121225112100_add_is_completed_and_is_starred_to_localization_keys.rb +0 -6
- data/db/migrate/20130511111904_add_is_hidden_to_locales.rb +0 -5
- data/db/migrate/20130921071304_create_lit_localization_versions.rb +0 -11
- data/db/migrate/20130923162141_create_lit_sources.rb +0 -12
- data/db/migrate/20130924151910_create_lit_incomming_localizations.rb +0 -21
@@ -6,7 +6,10 @@ module Lit
|
|
6
6
|
## SCOPES
|
7
7
|
scope :changed, proc { where(is_changed: true) }
|
8
8
|
# @HACK: dirty, find a way to round date to full second
|
9
|
-
scope :after, proc { |dt|
|
9
|
+
scope :after, proc { |dt|
|
10
|
+
where('updated_at >= ?', dt + 1.second)
|
11
|
+
.where('is_changed = true')
|
12
|
+
}
|
10
13
|
|
11
14
|
## ASSOCIATIONS
|
12
15
|
belongs_to :locale
|
@@ -25,7 +28,7 @@ module Lit
|
|
25
28
|
|
26
29
|
## BEFORE & AFTER
|
27
30
|
with_options if: :translated_value_changed? do |o|
|
28
|
-
o.before_update :
|
31
|
+
o.before_update :update_should_mark_localization_key_completed
|
29
32
|
o.before_update :create_version
|
30
33
|
end
|
31
34
|
after_update :mark_localization_key_completed
|
@@ -39,7 +42,7 @@ module Lit
|
|
39
42
|
end
|
40
43
|
|
41
44
|
def get_value
|
42
|
-
|
45
|
+
is_changed? && !translated_value.nil? ? translated_value : default_value
|
43
46
|
end
|
44
47
|
|
45
48
|
def value
|
@@ -60,21 +63,25 @@ module Lit
|
|
60
63
|
|
61
64
|
def update_default_value(value)
|
62
65
|
return true if persisted? && default_value == value
|
63
|
-
|
64
|
-
|
66
|
+
if persisted?
|
67
|
+
update_column(:default_value, value)
|
68
|
+
else
|
69
|
+
self.default_value = value
|
70
|
+
save!
|
71
|
+
end
|
65
72
|
end
|
66
73
|
|
67
74
|
private
|
68
75
|
|
69
|
-
def
|
70
|
-
return if
|
71
|
-
|
72
|
-
self[:is_changed] = true
|
76
|
+
def update_should_mark_localization_key_completed
|
77
|
+
return if translated_value == translated_value_was
|
73
78
|
@should_mark_localization_key_completed = true
|
74
79
|
end
|
75
80
|
|
76
81
|
def mark_localization_key_completed
|
77
|
-
|
82
|
+
return if !instance_variable_defined?(:@should_mark_localization_key_completed) || \
|
83
|
+
@should_mark_localization_key_completed
|
84
|
+
localization_key.mark_completed!
|
78
85
|
end
|
79
86
|
|
80
87
|
def create_version
|
@@ -7,7 +7,11 @@ module Lit
|
|
7
7
|
scope :not_completed, proc { where(is_completed: false) }
|
8
8
|
scope :starred, proc { where(is_starred: true) }
|
9
9
|
scope :ordered, proc { order('localization_key asc') }
|
10
|
-
scope :after, proc { |dt|
|
10
|
+
scope :after, proc { |dt|
|
11
|
+
joins(:localizations)
|
12
|
+
.where('lit_localization_keys.updated_at >= ?', dt)
|
13
|
+
.where('lit_localizations.is_changed = true')
|
14
|
+
}
|
11
15
|
|
12
16
|
## ASSOCIATIONS
|
13
17
|
has_many :localizations, dependent: :destroy
|
@@ -62,7 +66,7 @@ module Lit
|
|
62
66
|
end
|
63
67
|
|
64
68
|
def self.search(options = {})
|
65
|
-
options = options.reverse_merge(default_search_options)
|
69
|
+
options = options.to_h.reverse_merge(default_search_options).with_indifferent_access
|
66
70
|
s = self
|
67
71
|
if options[:order] && order_options.include?(options[:order])
|
68
72
|
column, order = options[:order].split(' ')
|
data/app/models/lit/source.rb
CHANGED
@@ -48,12 +48,13 @@ module Lit
|
|
48
48
|
unless il.is_duplicate?(r['value'])
|
49
49
|
il.save!
|
50
50
|
IncommingLocalization.where(id: il.id).
|
51
|
-
update_all
|
51
|
+
update_all(translated_value: r['value'])
|
52
52
|
end
|
53
53
|
end
|
54
54
|
last_change = get_last_change
|
55
55
|
last_change = DateTime.parse(last_change) unless last_change.nil?
|
56
56
|
touch_last_updated_at(last_change)
|
57
|
+
update_column(:sync_complete, true)
|
57
58
|
save
|
58
59
|
end
|
59
60
|
end
|
@@ -89,8 +90,8 @@ module Lit
|
|
89
90
|
http = Net::HTTP.new(uri.host, uri.port)
|
90
91
|
http.use_ssl = (uri.port == 443)
|
91
92
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
92
|
-
res = http.start do |
|
93
|
-
|
93
|
+
res = http.start do |http_started|
|
94
|
+
http_started.request(req)
|
94
95
|
end
|
95
96
|
if res.is_a?(Net::HTTPSuccess)
|
96
97
|
result = JSON.parse(res.body)
|
@@ -5,12 +5,12 @@
|
|
5
5
|
<meta charset="utf-8" />
|
6
6
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
8
|
-
<%= stylesheet_link_tag
|
9
|
-
<%= stylesheet_link_tag
|
10
|
-
<%= stylesheet_link_tag
|
11
|
-
<%= stylesheet_link_tag
|
12
|
-
<%= javascript_include_tag
|
13
|
-
<%= javascript_include_tag
|
8
|
+
<%= stylesheet_link_tag '//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css', media: 'all' %>
|
9
|
+
<%= stylesheet_link_tag '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', media: 'all' %>
|
10
|
+
<%= stylesheet_link_tag '//netdna.bootstrapcdn.com/bootswatch/3.0.3/yeti/bootstrap.min.css', media: 'all' %>
|
11
|
+
<%= stylesheet_link_tag 'lit/application', media: 'all' %>
|
12
|
+
<%= javascript_include_tag 'lit/application' %>
|
13
|
+
<%= javascript_include_tag '//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js' %>
|
14
14
|
<%= csrf_meta_tags %>
|
15
15
|
</head>
|
16
16
|
<body class="<%= params[:controller] %>">
|
@@ -1,15 +1,20 @@
|
|
1
1
|
<h1>Incomming localizations</h1>
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
<input type="hidden" id="source_id" value="<%= @source.id %>">
|
3
|
+
<div class="container">
|
4
|
+
<div class="row inline-headers">
|
5
|
+
<h4 class="<%= source_loading_class(@source) %>">Synchronization in progress, please wait. The page will refresh automatically when done.</h2>
|
6
|
+
<span class="pull-right">
|
7
|
+
<%= link_to accept_all_source_incomming_localizations_path(@source), :class=>"btn btn-success btn-sm", :data=>{:confirm=>t('lit.common.you_sure', :default=>"Are you sure?")} do %>
|
8
|
+
<%= t('lit.common.accept_all', :default=>"Accept all") %>
|
9
|
+
<% end %>
|
10
|
+
<%= link_to reject_all_source_incomming_localizations_path(@source), :class=>"btn btn-danger btn-sm", :method=>:post, :data=>{:confirm=>t('lit.common.you_sure', :default=>"Are you sure?")} do %>
|
11
|
+
<%= t('lit.common.reject_all', :default=>"Reject all") %>
|
12
|
+
<% end %>
|
13
|
+
</span>
|
14
|
+
</div>
|
11
15
|
</div>
|
12
16
|
|
17
|
+
|
13
18
|
<table class="table table-bordered table-striped incomming-localizations-table">
|
14
19
|
<tr>
|
15
20
|
<th>Current value</th>
|
@@ -26,20 +31,20 @@
|
|
26
31
|
<tr data-id="<%= il.id %>">
|
27
32
|
<td>
|
28
33
|
<% if il.localization %>
|
29
|
-
<%= render :
|
34
|
+
<%= render partial: '/lit/localization_keys/localization_row', locals: {localization: il.localization.get_value} %>
|
30
35
|
<% end %>
|
31
36
|
</td>
|
32
37
|
<Td>
|
33
|
-
<%= render :
|
38
|
+
<%= render partial: '/lit/localization_keys/localization_row', locals: {localization: il.get_value} %>
|
34
39
|
</td>
|
35
40
|
<td>
|
36
|
-
<%= link_to accept_source_incomming_localization_path(@source, il), :
|
37
|
-
<%= draw_icon
|
38
|
-
<%= t('lit.common.accept', :
|
41
|
+
<%= link_to accept_source_incomming_localization_path(@source, il, format: :js), class: 'btn btn-success btn-sm', remote: true do %>
|
42
|
+
<%= draw_icon 'check', class: 'icon-white' %>
|
43
|
+
<%= t('lit.common.accept', default: 'Accept') %>
|
39
44
|
<% end %>
|
40
|
-
<%= link_to source_incomming_localization_path(@source, il), :
|
41
|
-
<%= draw_icon
|
42
|
-
<%= t('lit.common.reject', :default=>"Reject") %>
|
45
|
+
<%= link_to source_incomming_localization_path(@source, il, format: :js), class: 'btn btn-danger btn-sm', remote: true, method: delete, data: {confirm: I18n.t('lit.common.you_sure', default: 'Are you sure?')} do %>
|
46
|
+
<%= draw_icon 'times', class: "icon-white" %>
|
47
|
+
<%= I18n.t('lit.common.reject', :default=>"Reject") %>
|
43
48
|
<% end %>
|
44
49
|
</td>
|
45
50
|
</tr>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
</ul>
|
7
7
|
<% else %>
|
8
8
|
<% if localization.nil? %>
|
9
|
-
<em title="<%= t('.value_not_yet_translated', default: 'Value not yet translated') %>">null</em>
|
9
|
+
<em title="<%= I18n.t('.value_not_yet_translated', default: 'Value not yet translated') %>">null</em>
|
10
10
|
<% else %>
|
11
11
|
<%= localization %>
|
12
12
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<h3><%= t('.header', :
|
1
|
+
<h3><%= I18n.t('.header', default: 'Localization keys') %></h3>
|
2
2
|
<% available_locales = I18n.backend.available_locales %>
|
3
3
|
|
4
4
|
<table class="table">
|
@@ -8,10 +8,15 @@
|
|
8
8
|
<strong><%= lk.localization_key %></strong>
|
9
9
|
<span class="badge"><%= Lit.init.cache.get_global_hits_counter(lk.localization_key) %></span>
|
10
10
|
<div class="localization_keys_options">
|
11
|
-
|
11
|
+
<% if Lit.store_request_info %>
|
12
|
+
<%= link_to '#', class: 'request_info_link title', title: 'Show / hide request' do %>
|
13
|
+
<%= draw_icon 'link' %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<%= link_to lit.star_localization_key_path(lk), remote: true, class: 'star_icon title', title: 'Star / unstar translation key' do %>
|
12
17
|
<%= draw_icon lk.is_starred? ? 'star' : 'star-o' %>
|
13
18
|
<% end %>
|
14
|
-
<%= link_to lit.localization_key_path(lk), :
|
19
|
+
<%= link_to lit.localization_key_path(lk), method: :delete, data: {confirm: t('lit.common.you_sure', default: "Are you sure?")}, remote: true, title: 'Delete translation key', class: 'title' do %>
|
15
20
|
<%= draw_icon 'trash-o' %>
|
16
21
|
<% end %>
|
17
22
|
</div>
|
@@ -20,15 +25,15 @@
|
|
20
25
|
<%- available_locales.each do |locale| %>
|
21
26
|
<%- localization = localization_for(locale, lk) %>
|
22
27
|
<tr>
|
23
|
-
<td class="localization_row" data-id="<%= localization.id%>" data-edit="<%= edit_localization_key_localization_path(lk, localization) %>" data-editing=0 data-content="">
|
24
|
-
<%= render :
|
28
|
+
<td class="localization_row" data-id="<%= localization.id%>" data-edit="<%= edit_localization_key_localization_path(lk, localization, format: :js) %>" data-editing=0 data-content="">
|
29
|
+
<%= render partial: 'localization_row', locals: {localization: Lit.init.cache["#{locale}.#{lk.localization_key}"]} %>
|
25
30
|
</td>
|
26
31
|
<td class="locale_row">
|
27
32
|
<%= image_tag "lit/famfamfam_flags/#{locale[0,2]}.png" %>
|
28
33
|
<%= locale %>
|
29
34
|
<% if localization %>
|
30
|
-
<%= link_to lit.previous_versions_localization_key_localization_path(lk, localization), :
|
31
|
-
<%= draw_icon 'random', :
|
35
|
+
<%= link_to lit.previous_versions_localization_key_localization_path(lk, localization, format: :js), class: "show_prev_versions #{'hidden' unless has_versions?(localization)}", remote: true do %>
|
36
|
+
<%= draw_icon 'random', title: I18n.t('lit.common.previous_versions', default: 'Previous versions') %>
|
32
37
|
<% end %>
|
33
38
|
<% end %>
|
34
39
|
</td>
|
@@ -37,6 +42,19 @@
|
|
37
42
|
<td colspan="2" class="localization_versions"></td>
|
38
43
|
</tr>
|
39
44
|
<% end %>
|
45
|
+
<% if Lit.store_request_info %>
|
46
|
+
<tr class="hidden request_info_row">
|
47
|
+
<td colspan="2">
|
48
|
+
<strong>Translation key recently displayed on following pages:</strong>
|
49
|
+
<ul>
|
50
|
+
<% Lit.init.cache.get_request_info(lk.localization_key).split(' ').reverse.each do |l| %>
|
51
|
+
<li><%= link_to l, l %></li>
|
52
|
+
<% end %>
|
53
|
+
</ul>
|
54
|
+
<em>Note: you might not have access to those pages!</em>
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<% end %>
|
40
58
|
</table>
|
41
59
|
</div>
|
42
60
|
</td>
|
@@ -47,6 +65,8 @@
|
|
47
65
|
<% if defined?(Kaminari) %>
|
48
66
|
<%= paginate @localization_keys, :theme=>"lit" %>
|
49
67
|
<% end %>
|
68
|
+
|
69
|
+
|
50
70
|
<% content_for(:sidebar) do %>
|
51
71
|
<div class="well">
|
52
72
|
<%= form_tag '', :class=>"form-search", :method=>:get do |f| %>
|
@@ -105,4 +125,3 @@
|
|
105
125
|
</ul>
|
106
126
|
</div>
|
107
127
|
<% end %>
|
108
|
-
|
@@ -1,13 +1,13 @@
|
|
1
|
-
<%= form_for
|
1
|
+
<%= form_for @localization, url: lit.localization_key_localization_path(@localization_key, @localization, format: :js), html: {remote: true} do |f| %>
|
2
2
|
<%- f.label :translated_value %>
|
3
3
|
<% if @localization.translated_value.is_a?(Array) %>
|
4
4
|
<ul style="list-style: none;">
|
5
5
|
<% @localization.translated_value.each do |l| %>
|
6
|
-
<li><%= text_field_tag 'localization[translated_value][]', l, :
|
6
|
+
<li><%= text_field_tag 'localization[translated_value][]', l, class: 'form-control input-xlarge' %></li>
|
7
7
|
<% end %>
|
8
8
|
</ul>
|
9
9
|
<% else %>
|
10
|
-
<%= f.text_area :translated_value, :
|
10
|
+
<%= f.text_area :translated_value, size: '40x2', class: 'form-control input-xxlarge' %>
|
11
11
|
<% if allow_wysiwyg_editor?(@localization_key.localization_key) %>
|
12
12
|
<br />
|
13
13
|
<label>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<% end %>
|
18
18
|
<% end %>
|
19
19
|
|
20
|
-
<button class="btn btn-primary btn-sm" type="submit"><%= t('lit.common.update', :
|
21
|
-
<button class="btn btn-default btn-sm cancel" type="reset"><%= t('lit.common.cancel', :
|
20
|
+
<button class="btn btn-primary btn-sm" type="submit"><%= I18n.t('lit.common.update', default: "Update") %></button>
|
21
|
+
<button class="btn btn-default btn-sm cancel" type="reset"><%= I18n.t('lit.common.cancel', default: 'Cancel') %></button>
|
22
22
|
<% end %>
|
23
23
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<% @versions.each do |v| %>
|
8
8
|
<tr>
|
9
9
|
<td>
|
10
|
-
<%= render :partial=>"/lit/localization_keys/localization_row", :locals=>{:localization=>v.translated_value} %>
|
10
|
+
<%= render :partial=>"/lit/localization_keys/localization_row", formats: ['html'], :locals=>{:localization=>v.translated_value} %>
|
11
11
|
</td>
|
12
12
|
<td><%= I18n.l v.created_at, format: :long %></td>
|
13
13
|
</tr>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
var $row = $('td.localization_row[data-id="<%= @localization.id %>"]');
|
2
2
|
$row.data('editing', 1);
|
3
|
-
$row.html("<%= ejs render(:
|
3
|
+
$row.html("<%= ejs render(partial: 'form', formats: ['html']) %>");
|
4
4
|
$row.find('textarea').focus();
|
5
5
|
<% if @localization.full_key.ends_with?('_html') -%>
|
6
6
|
$row.find('.wysiwyg_switch').click();
|
7
|
-
<% end %>
|
7
|
+
<% end %>
|
@@ -1,3 +1,3 @@
|
|
1
1
|
var row = $('.localization_versions_row[data-id="<%= @localization.id %>"]');
|
2
2
|
row.removeClass('hidden');
|
3
|
-
row.children('td').html("<%= j render(:partial=>'previous_versions_rows', :locals=>{:localization=>@localization, :versions=>@versions}) %>");
|
3
|
+
row.children('td').html("<%= j render(:partial=>'previous_versions_rows', formats: ['html'], :locals=>{:localization=>@localization, :versions=>@versions}) %>");
|
@@ -1,4 +1,4 @@
|
|
1
1
|
var $row = $('td.localization_row[data-id="<%= @localization.id %>"]');
|
2
2
|
$row.data('editing', 0);
|
3
|
-
$row.html("<%= ejs render(:partial=>"/lit/localization_keys/localization_row", :locals=>{:localization=>@localization.translated_value }) %>");
|
4
|
-
$row.siblings().find('.show_prev_versions').removeClass('hidden');
|
3
|
+
$row.html("<%= ejs render(:partial=>"/lit/localization_keys/localization_row", formats: ['html'], :locals=>{:localization=>@localization.translated_value }) %>");
|
4
|
+
$row.siblings().find('.show_prev_versions').removeClass('hidden');
|
data/config/routes.rb
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
Lit::Engine.routes.draw do
|
2
|
-
|
3
|
-
|
4
2
|
if Lit.api_enabled
|
5
3
|
namespace :api do
|
6
4
|
namespace :v1 do
|
7
5
|
get '/last_change' => 'localizations#last_change'
|
8
|
-
resources :locales, :
|
9
|
-
resources :localization_keys, :
|
10
|
-
resources :localizations, :
|
11
|
-
get 'last_change', :
|
6
|
+
resources :locales, only: [:index]
|
7
|
+
resources :localization_keys, only: [:index]
|
8
|
+
resources :localizations, only: [:index] do
|
9
|
+
get 'last_change', on: :collection
|
12
10
|
end
|
13
11
|
end
|
14
12
|
end
|
15
13
|
end
|
16
|
-
resources :locales, :
|
17
|
-
put :hide, :
|
14
|
+
resources :locales, only: [:index, :destroy] do
|
15
|
+
put :hide, on: :member
|
18
16
|
end
|
19
|
-
resources :localization_keys, :
|
17
|
+
resources :localization_keys, only: [:index, :destroy] do
|
20
18
|
member do
|
21
19
|
get :star
|
22
20
|
end
|
23
21
|
collection do
|
24
22
|
get :starred
|
23
|
+
get :find_localization
|
25
24
|
end
|
26
|
-
resources :localizations, :
|
25
|
+
resources :localizations, only: [:edit, :update, :show] do
|
27
26
|
member do
|
28
27
|
get :previous_versions
|
29
28
|
end
|
@@ -32,9 +31,10 @@ Lit::Engine.routes.draw do
|
|
32
31
|
resources :sources do
|
33
32
|
member do
|
34
33
|
get :synchronize
|
34
|
+
get :sync_complete
|
35
35
|
put :touch
|
36
36
|
end
|
37
|
-
resources :incomming_localizations, :
|
37
|
+
resources :incomming_localizations, only: [:index, :destroy] do
|
38
38
|
member do
|
39
39
|
get :accept
|
40
40
|
end
|
@@ -45,5 +45,5 @@ Lit::Engine.routes.draw do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
root :
|
48
|
+
root to: 'dashboard#index'
|
49
49
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class LitCreateLitLocales < Rails::VERSION::MAJOR >= 5 ?
|
2
|
+
ActiveRecord::Migration[4.2] :
|
3
|
+
ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
return if table_exists?(:lit_locales)
|
6
|
+
create_table :lit_locales do |t|
|
7
|
+
t.string :locale
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def down
|
14
|
+
drop_table :lit_locales
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class LitCreateLitLocalizationKeys < Rails::VERSION::MAJOR >= 5 ?
|
2
|
+
ActiveRecord::Migration[4.2] :
|
3
|
+
ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
return if table_exists?(:lit_localization_keys)
|
6
|
+
create_table :lit_localization_keys do |t|
|
7
|
+
t.string :localization_key
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
add_index :lit_localization_keys, :localization_key, unique: true
|
12
|
+
end
|
13
|
+
|
14
|
+
def down
|
15
|
+
remove_index :lit_localization_keys, :localization_key
|
16
|
+
drop_table :lit_localization_keys
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class LitCreateLitLocalizations < Rails::VERSION::MAJOR >= 5 ?
|
2
|
+
ActiveRecord::Migration[4.2] :
|
3
|
+
ActiveRecord::Migration
|
4
|
+
def up
|
5
|
+
return if table_exists?(:lit_localizations)
|
6
|
+
create_table :lit_localizations do |t|
|
7
|
+
t.integer :locale_id
|
8
|
+
t.integer :localization_key_id
|
9
|
+
t.text :default_value
|
10
|
+
t.text :translated_value
|
11
|
+
t.boolean :is_changed, default: false
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
|
16
|
+
add_index :lit_localizations, :locale_id
|
17
|
+
add_index :lit_localizations, :localization_key_id
|
18
|
+
end
|
19
|
+
|
20
|
+
def down
|
21
|
+
remove_index :lit_localizations, :locale_id
|
22
|
+
remove_index :lit_localizations, :localization_key_id
|
23
|
+
end
|
24
|
+
end
|