copycat 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. data/README.md +12 -2
  2. data/app/assets/stylesheets/copycat_engine.css +417 -38
  3. data/app/controllers/copycat_translations_controller.rb +22 -9
  4. data/app/views/copycat_translations/edit.html.erb +2 -1
  5. data/app/views/copycat_translations/help.html.erb +25 -0
  6. data/app/views/copycat_translations/{upload.html.erb → import_export.html.erb} +8 -3
  7. data/app/views/copycat_translations/index.html.erb +27 -17
  8. data/app/views/layouts/copycat.html.erb +15 -4
  9. data/config/routes.rb +6 -3
  10. data/lib/copycat/version.rb +1 -1
  11. data/lib/copycat.rb +7 -13
  12. data/spec/dummy/config/initializers/copycat.rb +2 -2
  13. data/spec/dummy/db/development.sqlite3 +0 -0
  14. data/spec/dummy/db/migrate/{20120320143433_create_copycat_translations.copycat_engine.rb → 20120320194234_create_copycat_translations.copycat_engine.rb} +0 -0
  15. data/spec/dummy/db/schema.rb +1 -1
  16. data/spec/dummy/db/test.sqlite3 +0 -0
  17. data/spec/dummy/log/development.log +5429 -0
  18. data/spec/dummy/log/test.log +10221 -0
  19. data/spec/dummy/tmp/cache/assets/C19/060/sprockets%2F125436f53217b7f564aa5016d1168709 +0 -0
  20. data/spec/dummy/tmp/cache/assets/CB3/6E0/sprockets%2F0f4c96b04436bf7ae900561753947d4c +0 -0
  21. data/spec/dummy/tmp/cache/assets/DA4/EE0/sprockets%2Fcd39e3d56788faea331e0f5bac67329b +0 -0
  22. data/spec/dummy/tmp/pids/server.pid +1 -0
  23. data/spec/factories/copycat_translations.rb +1 -1
  24. data/spec/integration/copycat_spec.rb +197 -54
  25. data/spec/integration/dummy_spec.rb +63 -0
  26. data/spec/spec_helper.rb +1 -0
  27. metadata +18 -9
  28. data/app/views/copycat_translations/_copycat_header.html.erb +0 -9
  29. 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 class="copycat">
9
- <div id="copycat">
10
- <%= render :partial => "copycat_header" %>
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
- get 'readme', :on => :collection
4
- get 'upload', :on => :collection
5
- post 'import_yaml', :on => :collection
3
+ collection do
4
+ get 'help'
5
+ get 'import_export'
6
+ get 'download'
7
+ post 'upload'
8
+ end
6
9
  end
7
10
  end
@@ -1,3 +1,3 @@
1
1
  module Copycat
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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
- begin
7
- cct = CopycatTranslation.where(locale: locale, key: key).first
8
- rescue ActiveRecord::StatementInvalid
9
- raise if CopycatTranslation.table_exists?
10
- #assert Rails is initializing for the purpose of running the copycat_translations migration
11
- super
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 = "cb0ae97"
2
- COPYCAT_PASSWORD = "301f624"
1
+ COPYCAT_USERNAME = "7abb807"
2
+ COPYCAT_PASSWORD = "e9ae6da"
Binary file
@@ -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 => 20120320143433) do
14
+ ActiveRecord::Schema.define(:version => 20120320194234) do
15
15
 
16
16
  create_table "copycat_translations", :force => true do |t|
17
17
  t.string "locale"
Binary file