web_translate_it 1.7.0.5 → 1.7.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/history.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## Version 1.7.0.6 / 2010-09-23
2
+
3
+ * Makes `wti server` load much faster for projects having a lot of files.
4
+ * The web interface now displays before_pull and after_pull hooks to facilitate debugging.
5
+ * Ability to do `wti pull -l` from the web interface to update server faster.
6
+
1
7
  ## Version 1.7.0.5 / 2010-09-04
2
8
 
3
9
  * Fixes to make wti compatible with Ruby 1.9.2.
@@ -51,6 +51,19 @@ p {
51
51
  margin: 1em 0;
52
52
  }
53
53
 
54
+ .update {
55
+ background-color: #DFF2BF;
56
+ border: 2px solid #4F8A10;
57
+ padding: 5px;
58
+ width: 300px;
59
+ line-height: 30px;
60
+ text-align: center;
61
+ }
62
+
63
+ select, input {
64
+ font-size: 16px;
65
+ }
66
+
54
67
  a {
55
68
  color: #00a;
56
69
  }
@@ -15,9 +15,7 @@ module WebTranslateIt
15
15
 
16
16
  helpers do
17
17
  def wti_root
18
- root = request.path
19
- root = "" if root == "/"
20
- root
18
+ ""
21
19
  end
22
20
 
23
21
  def highlight(value, expected)
@@ -28,15 +26,26 @@ module WebTranslateIt
28
26
  end
29
27
 
30
28
  get '/' do
31
- erb :index, :locals => { :config => config }
29
+ erb :index, :locals => { :config => config, :locale => "" }
32
30
  end
33
31
 
34
- post '/pull' do
32
+ get '/:locale' do
33
+ erb :index, :locals => { :config => config, :locale => params[:locale] }
34
+ end
35
+
36
+ post '/pull/' do
35
37
  `#{config.before_pull}` if config.before_pull
36
38
  `wti pull`
37
39
  `#{config.after_pull}` if config.after_pull
38
40
  redirect "/"
39
41
  end
42
+
43
+ post '/pull/:locale' do
44
+ `#{config.before_pull}` if config.before_pull
45
+ `wti pull -l #{params[:locale]}`
46
+ `#{config.after_pull}` if config.after_pull
47
+ redirect "/#{params[:locale]}"
48
+ end
40
49
 
41
50
  def initialize(*args)
42
51
  super
@@ -113,14 +113,7 @@ module WebTranslateIt
113
113
  puts "\nFile #{self.file_path} doesn't exist!"
114
114
  end
115
115
  end
116
-
117
- def committed?
118
- Dir.chdir(File.dirname(file_path)) do
119
- system "git status | grep 'modified: #{File.basename(file_path)}' > /dev/null"
120
- end
121
- ! $?.success?
122
- end
123
-
116
+
124
117
  def exists?
125
118
  File.exists?(file_path)
126
119
  end
@@ -12,33 +12,34 @@
12
12
  </div>
13
13
 
14
14
  <div id="home">
15
- <h1>Language File Status</h1>
16
- <table>
17
- <thead>
18
- <tr>
19
- <th>File Name</th>
20
- <th>Locale</th>
21
- <th>Exists</th>
22
- <th>Committed</th>
23
- <th>New Version Available</th>
24
- </tr>
25
- </thead>
26
- <tbody>
27
- <% config.files.each do |file| %>
28
- <tr>
29
- <td><%= file.file_path %></td>
30
- <td><%= file.locale.upcase %></td>
31
- <td><%= highlight(file.exists?, true) %></td>
32
- <td><%= highlight(file.committed?, true) %></td>
33
- <td><%= highlight(file.modified_remotely?, false) %></td>
34
- </tr>
35
- <% end %>
36
- </tbody>
37
- </table>
15
+ <h1>Update</h1>
38
16
 
39
- <form method="post" action="<%= wti_root %>/pull">
40
- <input type="submit" value="Get new translations" />
41
- </form>
17
+ <div class="update">
18
+ Download files update for
19
+ <select name="locale" onchange="window.location=this.value;">
20
+ <option value="/" <%= "selected='true'" if locale == "" %>>All locales</option>
21
+ <% config.target_locales.each do |l| %>
22
+ <option value="/<%= l %>" <%= "selected='true'" if locale == l %>><%= l.upcase %></option>
23
+ <% end %>
24
+ </select>
25
+ <form method="post" action="<%= wti_root %>/pull/<%= locale %>">
26
+ <input type="submit" value="Update" onclick="if (window.hiddenCommit) { window.hiddenCommit.setAttribute('value', this.value); }else { hiddenCommit = document.createElement('input');hiddenCommit.type = 'hidden';hiddenCommit.value = this.value;hiddenCommit.name = this.name;this.form.appendChild(hiddenCommit); }this.setAttribute('originalValue', this.value);this.disabled = true;this.value='Please wait…';result = (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit());if (result == false) { this.value = this.getAttribute('originalValue');this.disabled = false; }return result;" />
27
+ </form>
28
+ <div class="clear"></div>
29
+ </div>
30
+
31
+ <% if config.before_pull %>
32
+ <p>
33
+ This command will be executed before pulling files:
34
+ <code><%= config.before_pull %></code>
35
+ </p>
36
+ <% end %>
37
+ <% if config.after_pull %>
38
+ <p>
39
+ This command will be executed after pulling files:
40
+ <code><%= config.after_pull %></code>
41
+ </p>
42
+ <% end %>
42
43
  </div>
43
44
 
44
45
  <div class="footer">
data/version.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 1
3
3
  :minor: 7
4
4
  :tiny: 0
5
- :patch: 5
5
+ :patch: 6
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 107
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 7
8
9
  - 0
9
- - 5
10
- version: 1.7.0.5
10
+ - 6
11
+ version: 1.7.0.6
11
12
  platform: ruby
12
13
  authors:
13
14
  - "\xC3\x89douard Bri\xC3\xA8re"
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-08-04 00:00:00 +02:00
19
+ date: 2010-08-23 00:00:00 +02:00
19
20
  default_executable: wti
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
@@ -26,6 +27,7 @@ dependencies:
26
27
  requirements:
27
28
  - - ~>
28
29
  - !ruby/object:Gem::Version
30
+ hash: 15
29
31
  segments:
30
32
  - 1
31
33
  - 0
@@ -40,6 +42,7 @@ dependencies:
40
42
  requirements:
41
43
  - - ~>
42
44
  - !ruby/object:Gem::Version
45
+ hash: 19
43
46
  segments:
44
47
  - 0
45
48
  - 1
@@ -55,6 +58,7 @@ dependencies:
55
58
  requirements:
56
59
  - - ~>
57
60
  - !ruby/object:Gem::Version
61
+ hash: 15
58
62
  segments:
59
63
  - 1
60
64
  - 0
@@ -69,6 +73,7 @@ dependencies:
69
73
  requirements:
70
74
  - - ">="
71
75
  - !ruby/object:Gem::Version
76
+ hash: 13
72
77
  segments:
73
78
  - 1
74
79
  - 2
@@ -133,6 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
138
  requirements:
134
139
  - - ">="
135
140
  - !ruby/object:Gem::Version
141
+ hash: 3
136
142
  segments:
137
143
  - 0
138
144
  version: "0"
@@ -141,6 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
147
  requirements:
142
148
  - - ">="
143
149
  - !ruby/object:Gem::Version
150
+ hash: 3
144
151
  segments:
145
152
  - 0
146
153
  version: "0"