express_translate 1.0.3 → 1.0.4
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/.rspec +1 -1
- data/Gemfile +4 -15
- data/Gemfile.lock +2 -93
- data/README.md +10 -5
- data/VERSION +1 -1
- data/app/assets/stylesheets/express_translate/application.css +2 -0
- data/app/assets/stylesheets/express_translate/express_translate.css.scss +5 -4
- data/app/assets/stylesheets/express_translate/login.scss +0 -17
- data/app/controllers/express_translate/files_controller.rb +11 -10
- data/app/views/express_translate/options/index.html.erb +63 -58
- data/app/views/layouts/express_translate/login.html.erb +2 -2
- data/config/routes.rb +3 -3
- data/express_translate.gemspec +17 -5
- data/lib/express_translate.rb +6 -12
- data/lib/generators/express_translate/templates/config/express_translate.yml +1 -1
- data/spec/controllers/account_controller_spec.rb +4 -0
- data/spec/controllers/ajax/codes_controller_spec.rb +4 -0
- data/spec/controllers/ajax/languages_controller_spec.rb +4 -0
- data/spec/controllers/ajax/packages_controller_spec.rb +4 -0
- data/spec/controllers/files_controller_spec.rb +4 -0
- data/spec/controllers/options_controller_spec.rb +4 -31
- data/spec/controllers/services_controller_spec.rb +4 -0
- data/spec/spec_helper.rb +23 -83
- metadata +57 -6
- data/.DS_Store +0 -0
- data/app/assets/javascript/express_translate/login.js +0 -15
- data/spec/rails_helper.rb +0 -0
data/.rspec
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
--color
|
|
2
|
-
--
|
|
2
|
+
--format=progress
|
data/Gemfile
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
source "http://rubygems.org"
|
|
2
|
+
# gemspec
|
|
2
3
|
# Add dependencies required to use your gem here.
|
|
3
4
|
# Example:
|
|
4
5
|
# gem "activesupport", ">= 2.3.5"
|
|
@@ -17,18 +18,6 @@ end
|
|
|
17
18
|
|
|
18
19
|
gem 'redis', '~> 3.1.0'
|
|
19
20
|
gem 'hiredis'
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
gem 'cucumber-rails', '~> 1.4.0', require: false
|
|
24
|
-
gem 'database_cleaner', "~> 1.2.0"
|
|
25
|
-
gem "launchy", '~> 2.4.2'
|
|
26
|
-
gem 'spork', '~> 1.0rc'
|
|
27
|
-
gem 'shoulda-matchers'
|
|
28
|
-
gem 'watchr'
|
|
29
|
-
gem 'rspec'
|
|
30
|
-
gem 'colored'
|
|
31
|
-
gem 'rspec_tag_matchers'
|
|
32
|
-
gem "rspec-rails", '~> 2.14.1'
|
|
33
|
-
gem 'factory_girl_rails'
|
|
34
|
-
end
|
|
21
|
+
gem 'actionpack', '>= 3.2.0'
|
|
22
|
+
gem "rspec"
|
|
23
|
+
gem "factory_girl"
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
actionmailer (3.2.15)
|
|
5
|
-
actionpack (= 3.2.15)
|
|
6
|
-
mail (~> 2.5.4)
|
|
7
4
|
actionpack (3.2.15)
|
|
8
5
|
activemodel (= 3.2.15)
|
|
9
6
|
activesupport (= 3.2.15)
|
|
@@ -17,40 +14,11 @@ GEM
|
|
|
17
14
|
activemodel (3.2.15)
|
|
18
15
|
activesupport (= 3.2.15)
|
|
19
16
|
builder (~> 3.0.0)
|
|
20
|
-
activerecord (3.2.15)
|
|
21
|
-
activemodel (= 3.2.15)
|
|
22
|
-
activesupport (= 3.2.15)
|
|
23
|
-
arel (~> 3.0.2)
|
|
24
|
-
tzinfo (~> 0.3.29)
|
|
25
|
-
activeresource (3.2.15)
|
|
26
|
-
activemodel (= 3.2.15)
|
|
27
|
-
activesupport (= 3.2.15)
|
|
28
17
|
activesupport (3.2.15)
|
|
29
18
|
i18n (~> 0.6, >= 0.6.4)
|
|
30
19
|
multi_json (~> 1.0)
|
|
31
20
|
addressable (2.3.6)
|
|
32
|
-
arel (3.0.3)
|
|
33
21
|
builder (3.0.4)
|
|
34
|
-
capybara (2.2.1)
|
|
35
|
-
mime-types (>= 1.16)
|
|
36
|
-
nokogiri (>= 1.3.3)
|
|
37
|
-
rack (>= 1.0.0)
|
|
38
|
-
rack-test (>= 0.5.4)
|
|
39
|
-
xpath (~> 2.0)
|
|
40
|
-
colored (1.2)
|
|
41
|
-
cucumber (1.3.15)
|
|
42
|
-
builder (>= 2.1.2)
|
|
43
|
-
diff-lcs (>= 1.1.3)
|
|
44
|
-
gherkin (~> 2.12)
|
|
45
|
-
multi_json (>= 1.7.5, < 2.0)
|
|
46
|
-
multi_test (>= 0.1.1)
|
|
47
|
-
cucumber-rails (1.4.1)
|
|
48
|
-
capybara (>= 1.1.2, < 3)
|
|
49
|
-
cucumber (>= 1.3.8, < 2)
|
|
50
|
-
mime-types (~> 1.16)
|
|
51
|
-
nokogiri (~> 1.5)
|
|
52
|
-
rails (>= 3, < 5)
|
|
53
|
-
database_cleaner (1.2.0)
|
|
54
22
|
descendants_tracker (0.0.4)
|
|
55
23
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
56
24
|
diff-lcs (1.2.5)
|
|
@@ -58,13 +26,8 @@ GEM
|
|
|
58
26
|
erubis (2.7.0)
|
|
59
27
|
factory_girl (4.4.0)
|
|
60
28
|
activesupport (>= 3.0.0)
|
|
61
|
-
factory_girl_rails (4.4.1)
|
|
62
|
-
factory_girl (~> 4.4.0)
|
|
63
|
-
railties (>= 3.0.0)
|
|
64
29
|
faraday (0.9.0)
|
|
65
30
|
multipart-post (>= 1.2, < 3)
|
|
66
|
-
gherkin (2.12.2)
|
|
67
|
-
multi_json (~> 1.3)
|
|
68
31
|
git (1.2.7)
|
|
69
32
|
github_api (0.11.3)
|
|
70
33
|
addressable (~> 2.3)
|
|
@@ -91,15 +54,8 @@ GEM
|
|
|
91
54
|
journey (1.0.4)
|
|
92
55
|
json (1.8.1)
|
|
93
56
|
jwt (1.0.0)
|
|
94
|
-
launchy (2.4.2)
|
|
95
|
-
addressable (~> 2.3)
|
|
96
|
-
mail (2.5.4)
|
|
97
|
-
mime-types (~> 1.16)
|
|
98
|
-
treetop (~> 1.4.8)
|
|
99
|
-
mime-types (1.25.1)
|
|
100
57
|
mini_portile (0.6.0)
|
|
101
58
|
multi_json (1.10.1)
|
|
102
|
-
multi_test (0.1.1)
|
|
103
59
|
multi_xml (0.5.5)
|
|
104
60
|
multipart-post (2.0.0)
|
|
105
61
|
nokogiri (1.6.2.1)
|
|
@@ -110,29 +66,11 @@ GEM
|
|
|
110
66
|
multi_json (~> 1.3)
|
|
111
67
|
multi_xml (~> 0.5)
|
|
112
68
|
rack (~> 1.2)
|
|
113
|
-
polyglot (0.3.5)
|
|
114
69
|
rack (1.4.5)
|
|
115
70
|
rack-cache (1.2)
|
|
116
71
|
rack (>= 0.4)
|
|
117
|
-
rack-ssl (1.3.4)
|
|
118
|
-
rack
|
|
119
72
|
rack-test (0.6.2)
|
|
120
73
|
rack (>= 1.0)
|
|
121
|
-
rails (3.2.15)
|
|
122
|
-
actionmailer (= 3.2.15)
|
|
123
|
-
actionpack (= 3.2.15)
|
|
124
|
-
activerecord (= 3.2.15)
|
|
125
|
-
activeresource (= 3.2.15)
|
|
126
|
-
activesupport (= 3.2.15)
|
|
127
|
-
bundler (~> 1.0)
|
|
128
|
-
railties (= 3.2.15)
|
|
129
|
-
railties (3.2.15)
|
|
130
|
-
actionpack (= 3.2.15)
|
|
131
|
-
activesupport (= 3.2.15)
|
|
132
|
-
rack-ssl (~> 1.3.2)
|
|
133
|
-
rake (>= 0.8.7)
|
|
134
|
-
rdoc (~> 3.4)
|
|
135
|
-
thor (>= 0.14.6, < 2.0)
|
|
136
74
|
rake (10.3.2)
|
|
137
75
|
rdoc (3.12.2)
|
|
138
76
|
json (~> 1.4)
|
|
@@ -145,17 +83,6 @@ GEM
|
|
|
145
83
|
rspec-expectations (2.14.5)
|
|
146
84
|
diff-lcs (>= 1.1.3, < 2.0)
|
|
147
85
|
rspec-mocks (2.14.6)
|
|
148
|
-
rspec-rails (2.14.2)
|
|
149
|
-
actionpack (>= 3.0)
|
|
150
|
-
activemodel (>= 3.0)
|
|
151
|
-
activesupport (>= 3.0)
|
|
152
|
-
railties (>= 3.0)
|
|
153
|
-
rspec-core (~> 2.14.0)
|
|
154
|
-
rspec-expectations (~> 2.14.0)
|
|
155
|
-
rspec-mocks (~> 2.14.0)
|
|
156
|
-
rspec_tag_matchers (1.0.0)
|
|
157
|
-
nokogiri (>= 1.4.0)
|
|
158
|
-
rspec-rails (>= 1.2.6)
|
|
159
86
|
shoulda (3.5.0)
|
|
160
87
|
shoulda-context (~> 1.0, >= 1.0.1)
|
|
161
88
|
shoulda-matchers (>= 1.4.1, < 3.0)
|
|
@@ -167,43 +94,25 @@ GEM
|
|
|
167
94
|
multi_json
|
|
168
95
|
simplecov-html (~> 0.8.0)
|
|
169
96
|
simplecov-html (0.8.0)
|
|
170
|
-
spork (1.0.0rc4)
|
|
171
97
|
sprockets (2.2.2)
|
|
172
98
|
hike (~> 1.2)
|
|
173
99
|
multi_json (~> 1.0)
|
|
174
100
|
rack (~> 1.0)
|
|
175
101
|
tilt (~> 1.1, != 1.3.0)
|
|
176
|
-
thor (0.19.1)
|
|
177
102
|
thread_safe (0.3.4)
|
|
178
103
|
tilt (1.4.1)
|
|
179
|
-
treetop (1.4.15)
|
|
180
|
-
polyglot
|
|
181
|
-
polyglot (>= 0.3.1)
|
|
182
|
-
tzinfo (0.3.39)
|
|
183
|
-
watchr (0.7)
|
|
184
|
-
xpath (2.0.0)
|
|
185
|
-
nokogiri (~> 1.3)
|
|
186
104
|
|
|
187
105
|
PLATFORMS
|
|
188
106
|
ruby
|
|
189
107
|
|
|
190
108
|
DEPENDENCIES
|
|
109
|
+
actionpack (>= 3.2.0)
|
|
191
110
|
bundler (~> 1.0)
|
|
192
|
-
|
|
193
|
-
colored
|
|
194
|
-
cucumber-rails (~> 1.4.0)
|
|
195
|
-
database_cleaner (~> 1.2.0)
|
|
196
|
-
factory_girl_rails
|
|
111
|
+
factory_girl
|
|
197
112
|
hiredis
|
|
198
113
|
jeweler (~> 2.0.1)
|
|
199
|
-
launchy (~> 2.4.2)
|
|
200
114
|
rdoc (~> 3.12)
|
|
201
115
|
redis (~> 3.1.0)
|
|
202
116
|
rspec
|
|
203
|
-
rspec-rails (~> 2.14.1)
|
|
204
|
-
rspec_tag_matchers
|
|
205
117
|
shoulda
|
|
206
|
-
shoulda-matchers
|
|
207
118
|
simplecov
|
|
208
|
-
spork (~> 1.0rc)
|
|
209
|
-
watchr
|
data/README.md
CHANGED
|
@@ -22,11 +22,15 @@ Express Translate
|
|
|
22
22
|
##Installation
|
|
23
23
|
### 1. Gemfile
|
|
24
24
|
```bash
|
|
25
|
-
gem 'express_translate', '~> 1.0.
|
|
25
|
+
gem 'express_translate', '~> 1.0.4'
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### 2. Setup
|
|
29
29
|
Run on terminal.
|
|
30
|
+
```bash
|
|
31
|
+
gem install express_translate
|
|
32
|
+
```
|
|
33
|
+
|
|
30
34
|
```bash
|
|
31
35
|
bundle install
|
|
32
36
|
```
|
|
@@ -85,11 +89,12 @@ Note: You can see before login. Account for login in config file ("/config/expre
|
|
|
85
89
|
|
|
86
90
|
### Files
|
|
87
91
|
#### Import
|
|
88
|
-
* CSV file
|
|
89
|
-
* YML file
|
|
92
|
+
* CSV file
|
|
93
|
+
* YML file
|
|
94
|
+
|
|
90
95
|
#### Export
|
|
91
|
-
* CSV file
|
|
96
|
+
* CSV file
|
|
92
97
|
|
|
93
98
|
### Application
|
|
94
99
|
Backend for Ruby on Rails
|
|
95
|
-
Get data with json (for Javascript) => Development
|
|
100
|
+
<!-- Get data with json (for Javascript) => Development -->
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.4
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
*= require_self
|
|
12
12
|
*= require ./reset
|
|
13
|
+
*= require ./animate
|
|
13
14
|
*= require ./base
|
|
14
15
|
*= require ./jquery-ui-1.10.4
|
|
15
16
|
*= require ./wSelect
|
|
@@ -17,4 +18,5 @@
|
|
|
17
18
|
*= require ./buttons
|
|
18
19
|
*= require ./express_translate
|
|
19
20
|
*= require ./styles
|
|
21
|
+
*= require ./login
|
|
20
22
|
*/
|
|
@@ -471,7 +471,7 @@ body#express_translate {
|
|
|
471
471
|
|
|
472
472
|
&:hover {
|
|
473
473
|
.btn {display:block;}
|
|
474
|
-
.code {display:
|
|
474
|
+
.code {display:block;}
|
|
475
475
|
// h2 {display:block;}
|
|
476
476
|
};
|
|
477
477
|
|
|
@@ -511,23 +511,24 @@ body#express_translate {
|
|
|
511
511
|
.code {
|
|
512
512
|
position:absolute;
|
|
513
513
|
right: 10px;
|
|
514
|
-
|
|
514
|
+
bottom: -13px;
|
|
515
515
|
z-index:4;
|
|
516
516
|
font-size:15px;
|
|
517
517
|
color:rgba(0,0,0,0.1);
|
|
518
518
|
background:#fff;
|
|
519
519
|
padding: 3px;
|
|
520
520
|
border-radius:3px;
|
|
521
|
+
display:none;
|
|
521
522
|
|
|
522
523
|
&::after{
|
|
523
524
|
content: "";
|
|
524
525
|
width:100%;
|
|
525
526
|
height:19px;
|
|
526
527
|
display:block;
|
|
527
|
-
box-shadow: 0px
|
|
528
|
+
box-shadow: 0px 1px 1px #aaa;
|
|
528
529
|
position:absolute;
|
|
529
530
|
border-radius:3px;
|
|
530
|
-
|
|
531
|
+
bottom: -5px;
|
|
531
532
|
left:0px;
|
|
532
533
|
z-index:-1;
|
|
533
534
|
background:#fff;
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
-
* listed below.
|
|
4
|
-
*
|
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
-
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
-
*
|
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
-
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
-
*
|
|
11
|
-
*= require ./reset
|
|
12
|
-
*= require ./base
|
|
13
|
-
*= require_self
|
|
14
|
-
*= require ./animate
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
1
|
body#express_translate.login_page {
|
|
19
2
|
background: #e6e6e6;
|
|
20
3
|
font-family: Tahoma, Arial;
|
|
@@ -20,27 +20,28 @@ class ExpressTranslate::FilesController < ExpressTranslate::BaseController
|
|
|
20
20
|
# Export form csv file to redis database
|
|
21
21
|
# Upload csv file
|
|
22
22
|
def import
|
|
23
|
-
|
|
24
|
-
File.open(filename, 'wb') do |file|
|
|
25
|
-
file.write(params[:file_csv].read)
|
|
26
|
-
end
|
|
27
|
-
import_csv(File.open(filename, 'r').path)
|
|
23
|
+
import_csv(get_path(params[:file_csv], "last_import.csv"))
|
|
28
24
|
render text: "Uploaded"
|
|
29
25
|
end
|
|
30
26
|
|
|
31
27
|
def import_yml
|
|
32
|
-
filename = Rails.root.join('public', "last_import.yml")
|
|
33
|
-
File.open(filename, 'wb') do |file|
|
|
34
|
-
file.write(params[:file_yml].read)
|
|
35
|
-
end
|
|
36
28
|
@list_data = []
|
|
37
|
-
lang_id = import_yml_file(
|
|
29
|
+
lang_id = import_yml_file(get_path(params[:file_yml], "last_import.yml"))
|
|
38
30
|
add_data_form_list(params["pack"], lang_id)
|
|
39
31
|
render text: "Uploaded"
|
|
40
32
|
end
|
|
41
33
|
|
|
42
34
|
private
|
|
43
35
|
|
|
36
|
+
# get Path file from Params
|
|
37
|
+
def get_path(file_params, name)
|
|
38
|
+
filename = Rails.root.join('public', name)
|
|
39
|
+
File.open(filename, 'wb') do |file|
|
|
40
|
+
file.write(file_params.read)
|
|
41
|
+
end
|
|
42
|
+
return File.open(filename, 'r').path
|
|
43
|
+
end
|
|
44
|
+
|
|
44
45
|
# Check login status when excute with files
|
|
45
46
|
def check_login_files
|
|
46
47
|
redirect_to controller: "account", action: "login" if !check_authentication
|
|
@@ -149,72 +149,77 @@
|
|
|
149
149
|
openInNewTab(window.location.origin + "/express_translate/service/" + $(event.target).attr("data") + ".json");
|
|
150
150
|
});
|
|
151
151
|
|
|
152
|
-
var
|
|
152
|
+
var objs = $(".package");
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
e.stopPropagation();
|
|
156
|
-
e.preventDefault();
|
|
157
|
-
$(this).removeClass("add_files");
|
|
158
|
-
});
|
|
154
|
+
$.each(objs, function(index, obj) {
|
|
159
155
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
156
|
+
obj = $(obj);
|
|
157
|
+
|
|
158
|
+
obj.on('dragenter', function (e){
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
e.preventDefault();
|
|
161
|
+
$(this).removeClass("add_files");
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
obj.on('dragover', function (e){
|
|
165
|
+
e.stopPropagation();
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
$(this).addClass("add_files");
|
|
168
|
+
});
|
|
165
169
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
obj.on('drop', function (e){
|
|
171
|
+
$(this).removeClass("add_files");
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
var files = e.originalEvent.dataTransfer.files;
|
|
174
|
+
handleFileUpload(files, obj);
|
|
175
|
+
});
|
|
172
176
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
obj.on('dragleave', function (e) {
|
|
178
|
+
$(this).removeClass("add_files");
|
|
179
|
+
});
|
|
176
180
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
function handleFileUpload(files, obj) {
|
|
182
|
+
obj.addClass("wait");
|
|
183
|
+
for (var i = 0; i < files.length; i++) {
|
|
184
|
+
var fd = new FormData();
|
|
185
|
+
fd.append("pack", obj.attr("data"));
|
|
186
|
+
fd.append('file_yml', files[i]);
|
|
187
|
+
sendFileToServer(fd, obj);
|
|
188
|
+
}
|
|
184
189
|
}
|
|
185
|
-
}
|
|
186
190
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
191
|
+
function sendFileToServer(formData, obj) {
|
|
192
|
+
var uploadURL ="/express_translate/import_yml";
|
|
193
|
+
var jqXHR = $.ajax({
|
|
194
|
+
xhr: function() {
|
|
195
|
+
var xhrobj = $.ajaxSettings.xhr();
|
|
196
|
+
if (xhrobj.upload) {
|
|
197
|
+
xhrobj.upload.addEventListener('progress', function(event) {
|
|
198
|
+
var percent = 0;
|
|
199
|
+
var position = event.loaded || event.position;
|
|
200
|
+
var total = event.total;
|
|
201
|
+
if (event.lengthComputable) {
|
|
202
|
+
percent = Math.ceil(position / total * 100);
|
|
203
|
+
console.log(percent)
|
|
204
|
+
}
|
|
205
|
+
}, false);
|
|
206
|
+
}
|
|
207
|
+
return xhrobj;
|
|
208
|
+
},
|
|
209
|
+
url: uploadURL,
|
|
210
|
+
type: "POST",
|
|
211
|
+
contentType:false,
|
|
212
|
+
processData: false,
|
|
213
|
+
cache: false,
|
|
214
|
+
data: formData,
|
|
215
|
+
success: function(data){
|
|
216
|
+
console.log(data)
|
|
217
|
+
// Uploaded
|
|
218
|
+
obj.removeClass("wait");
|
|
202
219
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
type: "POST",
|
|
207
|
-
contentType:false,
|
|
208
|
-
processData: false,
|
|
209
|
-
cache: false,
|
|
210
|
-
data: formData,
|
|
211
|
-
success: function(data){
|
|
212
|
-
console.log(data)
|
|
213
|
-
// Uploaded
|
|
214
|
-
obj.removeClass("wait");
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
});
|
|
218
223
|
}
|
|
219
224
|
|
|
220
225
|
runJavascriptsIndex();
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<title>Express Translate | Login</title>
|
|
5
|
-
<%= stylesheet_link_tag "express_translate/
|
|
6
|
-
<%= javascript_include_tag "express_translate/
|
|
5
|
+
<%= stylesheet_link_tag "express_translate/application", :media => "all" %>
|
|
6
|
+
<%= javascript_include_tag "express_translate/application" %>
|
|
7
7
|
<%= csrf_meta_tags %>
|
|
8
8
|
</head>
|
|
9
9
|
<body id="express_translate" class="login_page">
|
data/config/routes.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Rails.application.routes.draw do
|
|
2
2
|
scope "express_translate" do
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
get "/" => "express_translate/options#index"
|
|
4
|
+
get "/package/:packages" => "express_translate/options#languages"
|
|
5
|
+
get "/language/:package/:id" => "express_translate/options#language_detail"
|
|
6
6
|
|
|
7
7
|
get "/export" => "express_translate/files#export"
|
|
8
8
|
post "/import" => "express_translate/files#import"
|
data/express_translate.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "express_translate"
|
|
8
|
-
s.version = "1.0.
|
|
8
|
+
s.version = "1.0.4"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Karl"]
|
|
12
|
-
s.date = "2014-07-
|
|
12
|
+
s.date = "2014-07-02"
|
|
13
13
|
s.description = "longer description of your gem"
|
|
14
14
|
s.email = "karl@rubify.com"
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
|
|
|
18
18
|
"README.rdoc"
|
|
19
19
|
]
|
|
20
20
|
s.files = [
|
|
21
|
-
".DS_Store",
|
|
22
21
|
".rspec",
|
|
23
22
|
".travis.yml",
|
|
24
23
|
".watchr",
|
|
@@ -113,7 +112,6 @@ Gem::Specification.new do |s|
|
|
|
113
112
|
"app/assets/javascript/express_translate/base.js",
|
|
114
113
|
"app/assets/javascript/express_translate/bpopup.js",
|
|
115
114
|
"app/assets/javascript/express_translate/jquery-ui-1.10.4.js",
|
|
116
|
-
"app/assets/javascript/express_translate/login.js",
|
|
117
115
|
"app/assets/javascript/express_translate/translate.layout.js",
|
|
118
116
|
"app/assets/javascript/express_translate/wSelect.js",
|
|
119
117
|
"app/assets/stylesheets/.DS_Store",
|
|
@@ -221,8 +219,13 @@ Gem::Specification.new do |s|
|
|
|
221
219
|
"node_modules/redis/test-unref.js",
|
|
222
220
|
"node_modules/redis/test.js",
|
|
223
221
|
"spec/.rspec",
|
|
222
|
+
"spec/controllers/account_controller_spec.rb",
|
|
223
|
+
"spec/controllers/ajax/codes_controller_spec.rb",
|
|
224
|
+
"spec/controllers/ajax/languages_controller_spec.rb",
|
|
225
|
+
"spec/controllers/ajax/packages_controller_spec.rb",
|
|
226
|
+
"spec/controllers/files_controller_spec.rb",
|
|
224
227
|
"spec/controllers/options_controller_spec.rb",
|
|
225
|
-
"spec/
|
|
228
|
+
"spec/controllers/services_controller_spec.rb",
|
|
226
229
|
"spec/spec_helper.rb",
|
|
227
230
|
"test/helper.rb",
|
|
228
231
|
"test/test_express_translate.rb"
|
|
@@ -239,6 +242,9 @@ Gem::Specification.new do |s|
|
|
|
239
242
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
240
243
|
s.add_runtime_dependency(%q<redis>, ["~> 3.1.0"])
|
|
241
244
|
s.add_runtime_dependency(%q<hiredis>, [">= 0"])
|
|
245
|
+
s.add_runtime_dependency(%q<actionpack>, [">= 3.2.0"])
|
|
246
|
+
s.add_runtime_dependency(%q<rspec>, [">= 0"])
|
|
247
|
+
s.add_runtime_dependency(%q<factory_girl>, [">= 0"])
|
|
242
248
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
|
243
249
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
|
244
250
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
|
@@ -247,6 +253,9 @@ Gem::Specification.new do |s|
|
|
|
247
253
|
else
|
|
248
254
|
s.add_dependency(%q<redis>, ["~> 3.1.0"])
|
|
249
255
|
s.add_dependency(%q<hiredis>, [">= 0"])
|
|
256
|
+
s.add_dependency(%q<actionpack>, [">= 3.2.0"])
|
|
257
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
|
258
|
+
s.add_dependency(%q<factory_girl>, [">= 0"])
|
|
250
259
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
251
260
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
|
252
261
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
|
@@ -256,6 +265,9 @@ Gem::Specification.new do |s|
|
|
|
256
265
|
else
|
|
257
266
|
s.add_dependency(%q<redis>, ["~> 3.1.0"])
|
|
258
267
|
s.add_dependency(%q<hiredis>, [">= 0"])
|
|
268
|
+
s.add_dependency(%q<actionpack>, [">= 3.2.0"])
|
|
269
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
|
270
|
+
s.add_dependency(%q<factory_girl>, [">= 0"])
|
|
259
271
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
260
272
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
|
261
273
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
data/lib/express_translate.rb
CHANGED
|
@@ -13,6 +13,7 @@ require 'seeds/accounts_seed'
|
|
|
13
13
|
|
|
14
14
|
# Lib
|
|
15
15
|
require 'redis'
|
|
16
|
+
require 'rails'
|
|
16
17
|
|
|
17
18
|
# Main module for my gem
|
|
18
19
|
module ExpressTranslate
|
|
@@ -24,7 +25,7 @@ module ExpressTranslate
|
|
|
24
25
|
@url = ""
|
|
25
26
|
|
|
26
27
|
# Change language locals for I18N
|
|
27
|
-
# lang: is a code of language want to change for backend
|
|
28
|
+
# @lang: is a code of language want to change for backend
|
|
28
29
|
def language(lang)
|
|
29
30
|
I18n.locale = "#{YAML.load_file(Rails.root.to_s + '/config/express_translate.yml')['package']['id']}#{lang}"
|
|
30
31
|
end
|
|
@@ -34,7 +35,9 @@ module ExpressTranslate
|
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
def self.config
|
|
37
|
-
|
|
38
|
+
file_name = Rails.root.to_s + "/config/express_translate.yml"
|
|
39
|
+
file_name = File.exist?(file_name) ? file_name : self.root + "/lib/generators/express_translate/templates/config/express_translate.yml"
|
|
40
|
+
return YAML.load_file(file_name)
|
|
38
41
|
end
|
|
39
42
|
|
|
40
43
|
def self.seeds
|
|
@@ -66,16 +69,7 @@ module ExpressTranslate
|
|
|
66
69
|
class Engine < Rails::Engine
|
|
67
70
|
TRANSLATION_STORE = Redis.new
|
|
68
71
|
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::KeyValue.new(TRANSLATION_STORE), I18n.backend)
|
|
72
|
+
I18n.enforce_available_locales = false
|
|
69
73
|
I18n.locale = "been"
|
|
70
|
-
|
|
71
|
-
config.generators do |g|
|
|
72
|
-
g.test_framework :rspec, fixture: true
|
|
73
|
-
g.fixture_replacement :factory_girl, dir: 'spec/factories'
|
|
74
|
-
g.view_specs false
|
|
75
|
-
g.helper_specs false
|
|
76
|
-
g.stylesheets = false
|
|
77
|
-
g.javascripts = false
|
|
78
|
-
g.helper = false
|
|
79
|
-
end
|
|
80
74
|
end
|
|
81
75
|
end
|
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
# get 'index'
|
|
6
|
-
# response.should be_success
|
|
7
|
-
# end
|
|
8
|
-
#
|
|
9
|
-
# it "returns Ruby comment only if query search string is Ruby" do
|
|
10
|
-
# get 'index', q: 'ruby'
|
|
11
|
-
# response.should be_success
|
|
12
|
-
#
|
|
13
|
-
# comments = json(response.body)
|
|
14
|
-
# contents = comments.collect{|c| c[:content]}
|
|
15
|
-
# contents.should include("Ruby")
|
|
16
|
-
# contents.should_not include("Rails")
|
|
17
|
-
# end
|
|
18
|
-
#
|
|
19
|
-
# it "returns a comment by its id" do
|
|
20
|
-
# get 'show', id: @comment_a.id
|
|
21
|
-
# response.should be_success
|
|
22
|
-
#
|
|
23
|
-
# comment = json(response.body)
|
|
24
|
-
# comment[:content].should == @comment_a.content
|
|
25
|
-
# end
|
|
26
|
-
#
|
|
27
|
-
# end
|
|
28
|
-
#
|
|
29
|
-
# end
|
|
30
|
-
#
|
|
31
|
-
#
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
describe ExpressTranslate::OptionsController do
|
|
3
|
+
|
|
4
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,90 +1,30 @@
|
|
|
1
|
-
require 'simplecov'
|
|
2
|
-
SimpleCov.start
|
|
3
|
-
|
|
4
1
|
require 'rubygems'
|
|
5
|
-
require '
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
Bundler.setup
|
|
9
|
-
require 'active_support'
|
|
2
|
+
require 'factory_girl'
|
|
3
|
+
# require 'express_translate'
|
|
4
|
+
|
|
10
5
|
require 'action_pack'
|
|
11
|
-
require 'action_view'
|
|
12
6
|
require 'action_controller'
|
|
13
|
-
require 'action_dispatch'
|
|
14
|
-
require 'rspec/autorun'
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# Requires supporting files with custom matchers and macros, etc,
|
|
18
|
-
# in ./support/ and its subdirectories in alphabetic order.
|
|
19
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each {|f| require f}
|
|
20
|
-
|
|
21
|
-
#uncomment the following line to use spork with the debugger
|
|
22
|
-
#require 'spork/ext/ruby-debug'
|
|
23
|
-
|
|
24
|
-
Spork.prefork do
|
|
25
|
-
# Loading more in this block will cause your tests to run faster. However,
|
|
26
|
-
# if you change any configuration or code from libraries loaded here, you'll
|
|
27
|
-
# need to restart spork for it take effect.
|
|
28
|
-
|
|
29
|
-
# include ActionView::Helpers::FormHelper
|
|
30
|
-
# include ActionView::Helpers::FormTagHelper
|
|
31
|
-
# include ActionView::Helpers::FormOptionsHelper
|
|
32
|
-
# include ActionView::Helpers::UrlHelper
|
|
33
|
-
# include ActionView::Helpers::TagHelper
|
|
34
|
-
|
|
35
|
-
module RubifyDashboardSpecHelper
|
|
36
|
-
|
|
37
|
-
def mock_everything
|
|
38
|
-
@fred = Author.create({name: "Fred"})
|
|
39
|
-
@post = Post.create({title: "New Title", content: "Some Content", author_id: @fred.id})
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def self.included(base)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
Spork.each_run do
|
|
48
|
-
# This code will be run each time you run your specs.
|
|
49
|
-
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# --- Instructions ---
|
|
53
|
-
# Sort the contents of this file into a Spork.prefork and a Spork.each_run
|
|
54
|
-
# block.
|
|
55
|
-
#
|
|
56
|
-
# The Spork.prefork block is run only once when the spork server is started.
|
|
57
|
-
# You typically want to place most of your (slow) initializer code in here, in
|
|
58
|
-
# particular, require'ing any 3rd-party gems that you don't normally modify
|
|
59
|
-
# during development.
|
|
60
|
-
#
|
|
61
|
-
# The Spork.each_run block is run each time you run your specs. In case you
|
|
62
|
-
# need to load files that tend to change during development, require them here.
|
|
63
|
-
# With Rails, your application modules are loaded automatically, so sometimes
|
|
64
|
-
# this block can remain empty.
|
|
65
|
-
#
|
|
66
|
-
# Note: You can modify files loaded *from* the Spork.each_run block without
|
|
67
|
-
# restarting the spork server. However, this file itself will not be reloaded,
|
|
68
|
-
# so if you change any of the code inside the each_run block, you still need to
|
|
69
|
-
# restart the server. In general, if you have non-trivial code in this file,
|
|
70
|
-
# it's advisable to move it into a separate file so you can easily edit it
|
|
71
|
-
# without restarting spork. (For example, with RSpec, you could move
|
|
72
|
-
# non-trivial code into a file spec/support/my_helper.rb, making sure that the
|
|
73
|
-
# spec/support/* files are require'd from inside the each_run block.)
|
|
74
|
-
#
|
|
75
|
-
# Any code that is left outside the two blocks will be run during preforking
|
|
76
|
-
# *and* during each_run -- that's probably not what you want.
|
|
77
|
-
#
|
|
78
|
-
# These instructions should self-destruct in 10 seconds. If they don't, feel
|
|
79
|
-
# free to delete them.
|
|
80
7
|
|
|
81
|
-
|
|
8
|
+
require_relative '../lib/express_translate'
|
|
9
|
+
require_relative '../lib/express_translate/database_management'
|
|
10
|
+
require_relative '../lib/express_translate/express_translate_model'
|
|
11
|
+
require_relative '../lib/express_translate/language_detail_management'
|
|
12
|
+
require_relative '../lib/express_translate/package_management'
|
|
13
|
+
require_relative '../lib/express_translate/languages_management'
|
|
14
|
+
require_relative '../lib/express_translate/account_management'
|
|
15
|
+
|
|
16
|
+
require_relative '../app/controllers/express_translate/base_controller'
|
|
17
|
+
require_relative '../app/controllers/express_translate/ajax/codes_controller'
|
|
18
|
+
require_relative '../app/controllers/express_translate/ajax/languages_controller'
|
|
19
|
+
require_relative '../app/controllers/express_translate/ajax/packages_controller'
|
|
20
|
+
require_relative '../app/controllers/express_translate/account_controller'
|
|
21
|
+
require_relative '../app/controllers/express_translate/files_controller'
|
|
22
|
+
require_relative '../app/controllers/express_translate/options_controller'
|
|
23
|
+
require_relative '../app/controllers/express_translate/services_controller'
|
|
24
|
+
|
|
25
|
+
include ExpressTranslate
|
|
82
26
|
|
|
83
27
|
RSpec.configure do |config|
|
|
84
|
-
config.
|
|
85
|
-
|
|
86
|
-
end
|
|
87
|
-
config.after(:all) do
|
|
88
|
-
DeferredGarbageCollection.reconsider unless ENV["DEFER_GC"] == "false"
|
|
89
|
-
end
|
|
28
|
+
config.include FactoryGirl::Syntax::Methods
|
|
29
|
+
# Rails.env = "test"
|
|
90
30
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: express_translate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-07-
|
|
12
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: redis
|
|
@@ -43,6 +43,54 @@ dependencies:
|
|
|
43
43
|
- - ! '>='
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
45
|
version: '0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: actionpack
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ! '>='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 3.2.0
|
|
54
|
+
type: :runtime
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 3.2.0
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
name: rspec
|
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - ! '>='
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
type: :runtime
|
|
71
|
+
prerelease: false
|
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
+
none: false
|
|
74
|
+
requirements:
|
|
75
|
+
- - ! '>='
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
- !ruby/object:Gem::Dependency
|
|
79
|
+
name: factory_girl
|
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
82
|
+
requirements:
|
|
83
|
+
- - ! '>='
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: '0'
|
|
86
|
+
type: :runtime
|
|
87
|
+
prerelease: false
|
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
90
|
+
requirements:
|
|
91
|
+
- - ! '>='
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
46
94
|
- !ruby/object:Gem::Dependency
|
|
47
95
|
name: shoulda
|
|
48
96
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -132,7 +180,6 @@ extra_rdoc_files:
|
|
|
132
180
|
- README.md
|
|
133
181
|
- README.rdoc
|
|
134
182
|
files:
|
|
135
|
-
- .DS_Store
|
|
136
183
|
- .rspec
|
|
137
184
|
- .travis.yml
|
|
138
185
|
- .watchr
|
|
@@ -227,7 +274,6 @@ files:
|
|
|
227
274
|
- app/assets/javascript/express_translate/base.js
|
|
228
275
|
- app/assets/javascript/express_translate/bpopup.js
|
|
229
276
|
- app/assets/javascript/express_translate/jquery-ui-1.10.4.js
|
|
230
|
-
- app/assets/javascript/express_translate/login.js
|
|
231
277
|
- app/assets/javascript/express_translate/translate.layout.js
|
|
232
278
|
- app/assets/javascript/express_translate/wSelect.js
|
|
233
279
|
- app/assets/stylesheets/.DS_Store
|
|
@@ -335,8 +381,13 @@ files:
|
|
|
335
381
|
- node_modules/redis/test-unref.js
|
|
336
382
|
- node_modules/redis/test.js
|
|
337
383
|
- spec/.rspec
|
|
384
|
+
- spec/controllers/account_controller_spec.rb
|
|
385
|
+
- spec/controllers/ajax/codes_controller_spec.rb
|
|
386
|
+
- spec/controllers/ajax/languages_controller_spec.rb
|
|
387
|
+
- spec/controllers/ajax/packages_controller_spec.rb
|
|
388
|
+
- spec/controllers/files_controller_spec.rb
|
|
338
389
|
- spec/controllers/options_controller_spec.rb
|
|
339
|
-
- spec/
|
|
390
|
+
- spec/controllers/services_controller_spec.rb
|
|
340
391
|
- spec/spec_helper.rb
|
|
341
392
|
- test/helper.rb
|
|
342
393
|
- test/test_express_translate.rb
|
|
@@ -355,7 +406,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
355
406
|
version: '0'
|
|
356
407
|
segments:
|
|
357
408
|
- 0
|
|
358
|
-
hash:
|
|
409
|
+
hash: -640192603405105460
|
|
359
410
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
360
411
|
none: false
|
|
361
412
|
requirements:
|
data/.DS_Store
DELETED
|
Binary file
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
-
// listed below.
|
|
3
|
-
//
|
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
-
//
|
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
-
// the compiled file.
|
|
9
|
-
//
|
|
10
|
-
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
|
11
|
-
// GO AFTER THE REQUIRES BELOW.
|
|
12
|
-
//
|
|
13
|
-
//= require jquery
|
|
14
|
-
//= require jquery_ujs
|
|
15
|
-
//= require express_translate/base
|
data/spec/rails_helper.rb
DELETED
|
File without changes
|