copycat 0.0.4 → 0.0.5
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.
- data/README.md +12 -2
- data/app/assets/stylesheets/copycat_engine.css +417 -38
- data/app/controllers/copycat_translations_controller.rb +22 -9
- data/app/views/copycat_translations/edit.html.erb +2 -1
- data/app/views/copycat_translations/help.html.erb +25 -0
- data/app/views/copycat_translations/{upload.html.erb → import_export.html.erb} +8 -3
- data/app/views/copycat_translations/index.html.erb +27 -17
- data/app/views/layouts/copycat.html.erb +15 -4
- data/config/routes.rb +6 -3
- data/lib/copycat/version.rb +1 -1
- data/lib/copycat.rb +7 -13
- data/spec/dummy/config/initializers/copycat.rb +2 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/{20120320143433_create_copycat_translations.copycat_engine.rb → 20120320194234_create_copycat_translations.copycat_engine.rb} +0 -0
- data/spec/dummy/db/schema.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +5429 -0
- data/spec/dummy/log/test.log +10221 -0
- data/spec/dummy/tmp/cache/assets/C19/060/sprockets%2F125436f53217b7f564aa5016d1168709 +0 -0
- data/spec/dummy/tmp/cache/assets/CB3/6E0/sprockets%2F0f4c96b04436bf7ae900561753947d4c +0 -0
- data/spec/dummy/tmp/cache/assets/DA4/EE0/sprockets%2Fcd39e3d56788faea331e0f5bac67329b +0 -0
- data/spec/dummy/tmp/pids/server.pid +1 -0
- data/spec/factories/copycat_translations.rb +1 -1
- data/spec/integration/copycat_spec.rb +197 -54
- data/spec/integration/dummy_spec.rb +63 -0
- data/spec/spec_helper.rb +1 -0
- metadata +18 -9
- data/app/views/copycat_translations/_copycat_header.html.erb +0 -9
- data/app/views/copycat_translations/readme.html.erb +0 -27
@@ -5,11 +5,22 @@
|
|
5
5
|
<%= stylesheet_link_tag "copycat_engine", :media => "all" %>
|
6
6
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
7
|
</head>
|
8
|
-
<body
|
9
|
-
<div id="
|
10
|
-
|
8
|
+
<body>
|
9
|
+
<div id="page">
|
10
|
+
<div id="header">
|
11
|
+
<h1>Copycat</h1>
|
12
|
+
<ul>
|
13
|
+
<li><%= link_to "Search", copycat_translations_path%></li>
|
14
|
+
<li><%= link_to "Import / Export", import_export_copycat_translations_path%></li>
|
15
|
+
<li><%= link_to "Help", help_copycat_translations_path%></li>
|
16
|
+
</ul>
|
17
|
+
</div>
|
18
|
+
<% if notice %>
|
19
|
+
<div id="notice">
|
20
|
+
<%= notice %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
11
23
|
<%= yield %>
|
12
24
|
</div>
|
13
|
-
|
14
25
|
</body>
|
15
26
|
</html>
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
resources :copycat_translations, :only => [:index, :edit, :update] do
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
collection do
|
4
|
+
get 'help'
|
5
|
+
get 'import_export'
|
6
|
+
get 'download'
|
7
|
+
post 'upload'
|
8
|
+
end
|
6
9
|
end
|
7
10
|
end
|
data/lib/copycat/version.rb
CHANGED
data/lib/copycat.rb
CHANGED
@@ -3,20 +3,14 @@ require "copycat/engine"
|
|
3
3
|
module CopycatImplementation
|
4
4
|
# this method overrides part of the i18n gem, lib/i18n/backend/simple.rb
|
5
5
|
def lookup(locale, key, scope = [], options = {})
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
else
|
13
|
-
return cct.value if cct
|
14
|
-
value = super(locale, key, scope, options)
|
15
|
-
if value.is_a?(String) || value.nil?
|
16
|
-
CopycatTranslation.create(locale: locale, key: key, value: value)
|
17
|
-
end
|
18
|
-
value
|
6
|
+
return super unless ActiveRecord::Base.connected? && CopycatTranslation.table_exists?
|
7
|
+
cct = CopycatTranslation.where(locale: locale, key: key).first
|
8
|
+
return cct.value if cct
|
9
|
+
value = super(locale, key, scope, options)
|
10
|
+
if value.is_a?(String) || value.nil?
|
11
|
+
CopycatTranslation.create(locale: locale, key: key, value: value)
|
19
12
|
end
|
13
|
+
value
|
20
14
|
end
|
21
15
|
end
|
22
16
|
|
@@ -1,2 +1,2 @@
|
|
1
|
-
COPYCAT_USERNAME = "
|
2
|
-
COPYCAT_PASSWORD = "
|
1
|
+
COPYCAT_USERNAME = "7abb807"
|
2
|
+
COPYCAT_PASSWORD = "e9ae6da"
|
Binary file
|
File without changes
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20120320194234) do
|
15
15
|
|
16
16
|
create_table "copycat_translations", :force => true do |t|
|
17
17
|
t.string "locale"
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|