rails-i18nterface 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4247f071313c096f5b0101c05d322d81469698be
4
- data.tar.gz: dac5a3a210a13e2d6a9c084fa943262d12f519a9
3
+ metadata.gz: c0e0d7a4246ff44ee6cc0865f2b2bcedb3ebf5fd
4
+ data.tar.gz: 8faea23f3737fc3ece301d0f153c5a85450cd327
5
5
  SHA512:
6
- metadata.gz: 89af3200a75dadecada9ff5d64c3aff54f542d27f7642eec4608775adfb2b534e422931ab051f9c3bd9bac769f05689ee301bde5f47f76c369826a767fd05a00
7
- data.tar.gz: 0ed1c842b643b7adf9040c204f1db74f1259a787d6c88c09f98e22d393427944aa598868d5e0fe2f741c1bf2ee07bbb01cbf45b502c1398d775610efd99ae357
6
+ metadata.gz: 9b936cb71327bf12884dbbd9eb6b360ee54a0d3997204b2994f94d446ffedabc1fca32bd7a5dd06af68854ca19435d43d8e1021ba69cb4e11022c6d8d1fad08c
7
+ data.tar.gz: 7b49046b1b17a6e92efe916f167083274cfeb19c92ff1d500a1806b73463ad08094ee078364812ecb3cb83c93d54448e4673fb6e1ad0e54733fee7593f20ca16
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Rails I18nterface
2
2
 
3
+ [![Dependency Status](https://gemnasium.com/mose/rails-i18nterface.png)](https://gemnasium.com/mose/rails-i18nterface)
3
4
  [![Build Status](https://secure.travis-ci.org/mose/rails-i18nterface.png?branch=master)](http://travis-ci.org/mose/rails-i18nterface)
4
5
  [![Code Climate](https://codeclimate.com/github/mose/rails-i18nterface.png)](https://codeclimate.com/github/mose/rails-i18nterface)
5
6
  [![Gem Version](https://badge.fury.io/rb/rails-i18nterface.png)](http://badge.fury.io/rb/rails-i18nterface)
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ end
7
7
  require 'bundler/setup'
8
8
 
9
9
  require "bundler/gem_tasks"
10
- Bundler::GemHelper.install_tasks
10
+ #Bundler::GemHelper.install_tasks
11
11
 
12
12
  require "rake/testtask"
13
13
 
@@ -63,20 +63,11 @@ $.domReady(function() {
63
63
  e.stopPropagation();
64
64
  key = $(this).previous().text();
65
65
  if (confirm("Are you sure you want to delete the key "+key+" from database ?")) {
66
- $.ajax({
67
- url: 'delete/'+key,
68
- method: 'delete',
69
- success: function(resp) {
70
- if (resp == error) {
71
- alert(resp.msg);
72
- } else {
73
- alert(resp);
74
- }
75
- },
76
- error: function(resp,msg) {
77
- alert("Error: " + msg);
78
- }
79
- })
66
+ var newF = document.createElement("form");
67
+ newF.action = 'delete/'+key;
68
+ newF.method = 'POST';
69
+ document.getElementsByTagName('body')[0].appendChild(newF);
70
+ newF.submit();
80
71
  }
81
72
  });
82
73
  });
@@ -481,7 +481,9 @@ div.selected{
481
481
  background-color:#ffe;
482
482
  }
483
483
 
484
-
484
+ .flash {
485
+ text-align: right;
486
+ }
485
487
  .clear {
486
488
  clear:both;
487
489
  }
@@ -20,12 +20,15 @@ module RailsI18nterface
20
20
  end
21
21
 
22
22
  def destroy
23
- term = RailsI18nterface::Translation.find_by_key(params[:key])
23
+ puts params
24
+ term = RailsI18nterface::Translation.find_by_key(params[:del])
24
25
  if term and term.destroy
25
- render json: 'ok'
26
+ flash[:success] = "Translations removed from database"
26
27
  else
27
- render json: 'error'
28
+ flash[:notice] = "Translations not found in database"
28
29
  end
30
+ params[:key] = { params[:del] => '' }
31
+ update
29
32
  end
30
33
 
31
34
  def load_db_translations
@@ -25,7 +25,7 @@
25
25
  </h1>
26
26
  <% end %>
27
27
  <% flash.each do |key, msg| %>
28
- <div id="<%= key %>"><%= msg %></div>
28
+ <div class="flash" id="<%= key %>"><%= msg %></div>
29
29
  <% end %>
30
30
  </div>
31
31
  <div id="searchbox">
data/config/routes.rb CHANGED
@@ -4,5 +4,5 @@ RailsI18nterface::Engine.routes.draw do
4
4
  put '/translate' => 'translate#update'
5
5
  get '/reload' => 'translate#reload', as: 'translate_reload'
6
6
  get '/export' => 'translate#export', as: 'translate_export'
7
- delete '/delete/*key' => 'translate#destroy', format: false
7
+ post '/delete/*del' => 'translate#destroy', format: false
8
8
  end
@@ -1,10 +1,10 @@
1
1
  require 'rails-i18nterface/engine'
2
+ require 'rails-i18nterface/utils'
2
3
  require 'rails-i18nterface/yamlfile'
3
4
  require 'rails-i18nterface/sourcefiles'
4
5
  require 'rails-i18nterface/keys'
5
6
  require 'rails-i18nterface/log'
6
7
  require 'rails-i18nterface/storage'
7
- require 'rails-i18nterface/utils'
8
8
 
9
9
  module RailsI18nterface
10
10
  end
@@ -1,17 +1,20 @@
1
1
  module RailsI18nterface
2
2
  class Log
3
+
4
+ include Utils
5
+
3
6
  attr_accessor :from_locale, :to_locale, :keys
4
7
 
5
8
  def initialize(from_locale, to_locale, keys)
6
9
  self.from_locale = from_locale
7
10
  self.to_locale = to_locale
8
- self.keys = keys
11
+ self.keys = keys.reject { |k, v| v == '' }
9
12
  end
10
13
 
11
14
  def write_to_file
12
15
  current_texts = File.exists?(file_path) ? file.read : {}
13
16
  current_texts.merge!(from_texts)
14
- file.write(current_texts)
17
+ file.write(remove_blanks(current_texts))
15
18
  end
16
19
 
17
20
  def read
@@ -1,5 +1,8 @@
1
1
  module RailsI18nterface
2
2
  class Storage
3
+
4
+ include Utils
5
+
3
6
  attr_accessor :locale
4
7
 
5
8
  def initialize(locale)
@@ -7,7 +10,7 @@ module RailsI18nterface
7
10
  end
8
11
 
9
12
  def write_to_file
10
- Yamlfile.new(file_path).write(keys)
13
+ Yamlfile.new(file_path).write(remove_blanks(keys))
11
14
  end
12
15
 
13
16
  def self.file_paths(locale)
@@ -1,3 +1,3 @@
1
1
  module RailsI18nterface
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
@@ -1654,3 +1654,54 @@ Migrating to RenameTranslationToNamespace (20130422115639)
1654
1654
   (0.3ms) ALTER TABLE "translations" RENAME TO "rails_i18nterface_translations"
1655
1655
   (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20130422115639')
1656
1656
   (157.5ms) commit transaction
1657
+ Connecting to database specified by database.yml
1658
+  (0.7ms) select sqlite_version(*)
1659
+  (184.9ms) CREATE TABLE "article" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "body" varchar(255), "created_at" datetime, "updated_at" datetime, "active" boolean DEFAULT 't')
1660
+  (150.9ms) CREATE TABLE "topics" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) 
1661
+  (158.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
1662
+  (158.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1663
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
1664
+ Migrating to CreateTranslations (20110921112044)
1665
+  (0.0ms) begin transaction
1666
+  (0.2ms) CREATE TABLE "translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "locale" varchar(255), "key" varchar(255), "value" text, "interpolations" text, "is_proc" boolean DEFAULT 'f', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
1667
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110921112044')
1668
+  (164.3ms) commit transaction
1669
+ Migrating to RenameTranslationToNamespace (20130422115639)
1670
+  (0.0ms) begin transaction
1671
+  (0.3ms) ALTER TABLE "translations" RENAME TO "rails_i18nterface_translations"
1672
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20130422115639')
1673
+  (149.2ms) commit transaction
1674
+ Connecting to database specified by database.yml
1675
+  (0.7ms) select sqlite_version(*)
1676
+  (167.2ms) CREATE TABLE "article" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "body" varchar(255), "created_at" datetime, "updated_at" datetime, "active" boolean DEFAULT 't')
1677
+  (159.4ms) CREATE TABLE "topics" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) 
1678
+  (158.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
1679
+  (142.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1680
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
1681
+ Migrating to CreateTranslations (20110921112044)
1682
+  (0.0ms) begin transaction
1683
+  (0.3ms) CREATE TABLE "translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "locale" varchar(255), "key" varchar(255), "value" text, "interpolations" text, "is_proc" boolean DEFAULT 'f', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
1684
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110921112044')
1685
+  (147.0ms) commit transaction
1686
+ Migrating to RenameTranslationToNamespace (20130422115639)
1687
+  (0.1ms) begin transaction
1688
+  (0.4ms) ALTER TABLE "translations" RENAME TO "rails_i18nterface_translations"
1689
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20130422115639')
1690
+  (148.7ms) commit transaction
1691
+ Connecting to database specified by database.yml
1692
+  (0.7ms) select sqlite_version(*)
1693
+  (157.9ms) CREATE TABLE "article" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "body" varchar(255), "created_at" datetime, "updated_at" datetime, "active" boolean DEFAULT 't')
1694
+  (142.6ms) CREATE TABLE "topics" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255) NOT NULL, "created_at" datetime, "updated_at" datetime) 
1695
+  (140.5ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
1696
+  (142.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1697
+  (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
1698
+ Migrating to CreateTranslations (20110921112044)
1699
+  (0.0ms) begin transaction
1700
+  (0.2ms) CREATE TABLE "translations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "locale" varchar(255), "key" varchar(255), "value" text, "interpolations" text, "is_proc" boolean DEFAULT 'f', "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
1701
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110921112044')
1702
+  (122.8ms) commit transaction
1703
+ Migrating to RenameTranslationToNamespace (20130422115639)
1704
+  (0.0ms) begin transaction
1705
+  (0.3ms) ALTER TABLE "translations" RENAME TO "rails_i18nterface_translations"
1706
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20130422115639')
1707
+  (107.3ms) commit transaction
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-i18nterface
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mose
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-22 00:00:00.000000000 Z
11
+ date: 2013-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: metric_fu
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rubocop
113
127
  requirement: !ruby/object:Gem::Requirement