rhodes-translator 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,18 @@
1
- <div <%= "class=\"#{@doc_def['div_class']}\"" if @doc_def['div_class']%> >
2
- <label <%= "class=\"#{@doc_def['label_class']}\"" if @doc_def['label_class']%> ><%=@doc_def['label']%></label>
3
- <input
4
- type="checkbox"
5
- <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name'] %>
6
- <% if @doc_def['value'] %>
7
- <%= "checked" if @doc_def['value'] == 'true' %>
8
- <% else %>
9
- <%= "checked" if @doc_def['default_value'] %>
10
- <% end %>/>
11
- </div>
1
+ <div data-role="fieldcontain" <%= "class=\"#{@doc_def['field_class']}\"" if @doc_def['field_class'] %>>
2
+ <input type="checkbox"
3
+ <%= "id=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
4
+ <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name'] %>
5
+ <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class'] %>
6
+ <% if @doc_def['value'] %>
7
+ <%= "checked" if @doc_def['value'] == 'true' %>
8
+ <% else %>
9
+ <%= "checked" if @doc_def['default_value'] %>
10
+ <% end %>
11
+ <%= "disabled" if not @doc_def['editable'].nil? and not @doc_def['editable'] %>
12
+ />
13
+ <label <%= "for=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
14
+ class="fieldLabel <%= @doc_def['label_class'] || "" %>"
15
+ >
16
+ <%= @doc_def['label'] %>
17
+ </label>
18
+ </div>
@@ -1,3 +1,3 @@
1
- <div id="content">
1
+ <div data-role="content">
2
2
  <%= @content %>
3
3
  </div>
@@ -1,5 +1,6 @@
1
1
  <form
2
- <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name'] %>
2
+ <%= "id=\"#{@doc_def['id']}\"" if @doc_def['name'] %>
3
+ <%= "class=\"#{@doc_def['form_class']}\"" if @doc_def['form_class'] %>
3
4
  <%= "action=\"#{@doc_def['action']}\"" if @doc_def['action'] %>
4
5
  <%= "method=\"#{@doc_def['method']}\"" if @doc_def['method'] %> >
5
6
  <input type="hidden" name="metadata_action" value="<%= @action %>"/>
@@ -1,8 +1,33 @@
1
- <div class="toolbar">
2
- <h1 id="pageTitle">
3
- <%=@doc_def['title']%>
4
- </h1>
5
- </div>
1
+ <div data-role="page"
2
+ <%= "data-id=\"#{@doc_def['page_id']}\"" if @doc_def['page_id'] %>
3
+ <%= "class=\"#{@doc_def['page_class']}\"" if @doc_def['page_class'] %>
4
+ >
5
+ <div data-role="header" data-position="inline">
6
+ <h1><%= @doc_def["title"] %></h1>
7
+
8
+ <% if @doc_def["left_btn_text"] || @doc_def["left_btn_is_back"] %>
9
+ <a href="<%= @doc_def["left_btn_uri"] %>"
10
+ class="<%= @doc_def["left_btn_class"] || "ui-btn-left" %>"
11
+ data-icon="<%= @doc_def["left_btn_icon"] || "back" %>"
12
+ data-direction="<%= @doc_def["left_btn_direction"] || "reverse" %>"
13
+ <%= "data-rel=\"back\"" if @doc_def["left_btn_is_back"] %>
14
+ >
15
+ <%= @doc_def["left_btn_text"] || "Back" %>
16
+ </a>
17
+ <% end %>
6
18
 
7
- <div class="panel" selected="true">
8
- <%@content.each_line do |line|%><%= " " + line%><%end%></div>
19
+ <% if @doc_def["right_btn_text"] %>
20
+ <a href="<%= @doc_def["right_btn_uri"] %>"
21
+ class="<%= @doc_def["right_btn_class"] || "ui-btn-right" %>"
22
+ data-icon="<%= @doc_def["right_btn_icon"] || "arrow-r" %>"
23
+ <%= "data-direction=\"#{@doc_def["right_btn_direction"]}\"" if @doc_def["right_btn_direction"] %>
24
+ >
25
+ <%= @doc_def["right_btn_text"] %>
26
+ </a>
27
+ <% end %>
28
+ </div>
29
+
30
+ <div data-role="content">
31
+ <%@content.each_line do |line|%><%= " " + line%><%end%>
32
+ </div>
33
+ </div>
@@ -1,8 +1,15 @@
1
- <li>
2
- <label <%= "for=\"#{@doc_def['name']}\"" if @doc_def['name']%> class="fieldLabel"><%= @doc_def["label"] %></label>
1
+ <li data-role="fieldcontain" <%= "class=\"#{@doc_def['field_class']}\"" if @doc_def['field_class'] %>>
2
+ <label <%= "for=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
3
+ class="fieldLabel <%= @doc_def['label_class'] || "" %>"
4
+ >
5
+ <%= @doc_def['label'] %>
6
+ </label>
3
7
  <input type="text"
4
- <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name']%>
5
- <%= "value=\"#{@doc_def['value']}\"" if @doc_def['value']%>
6
- <%= placeholder(@doc_def["label"]) if @doc_def['label']%>
7
- />
8
- </li>
8
+ <%= "id=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
9
+ <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name'] %>
10
+ <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class'] %>
11
+ <%= "value=\"#{@doc_def['value']}\"" if @doc_def['value'] %>
12
+ <%= "disabled" if not @doc_def['editable'].nil? and not @doc_def['editable'] %>
13
+ <%= placeholder(@doc_def["label"]) if @doc_def['label']%>
14
+ />
15
+ </li>
@@ -1,4 +1,4 @@
1
- <tr>
2
- <td><%= @doc_def["label"] %></td>
3
- <td><%= @doc_def["value"] %></td>
1
+ <tr <%= "class=\"#{@doc_def['field_class']}\"" if @doc_def['field_class'] %>>
2
+ <td <%= "class=\"#{@doc_def['label_class']}\"" if @doc_def['label_class'] %>><%= @doc_def["label"] %></td>
3
+ <td <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class'] %>><%= @doc_def["value"] %></td>
4
4
  </tr>
@@ -1,4 +1,4 @@
1
- <li>
2
- <div class="itemLabel"><%= @doc_def["label"] %></div>
3
- <div class="itemValue"><%= @doc_def["value"] %></div>
1
+ <li <%= "class=\"#{@doc_def['field_class']}\"" if @doc_def['field_class'] %>>
2
+ <div class="itemLabel <%= @doc_def["label_class"] || "" %>"><%= @doc_def['label'] %></div>
3
+ <div class="itemValue <%= @doc_def["value_class"] || "" %>"><%= @doc_def['value'] %></div>
4
4
  </li>
@@ -1,6 +1,5 @@
1
1
  <li>
2
2
  <a href="<%= @doc_def["uri"] %>">
3
- <span class="title"><%= @doc_def["text"] %></span>
4
- <span class="disclosure_indicator"></span>
3
+ <%= @doc_def["text"] %>
5
4
  </a>
6
5
  </li>
@@ -1,3 +1,3 @@
1
- <ul>
1
+ <ul data-role="listview">
2
2
  <%= @content %>
3
3
  </ul>
@@ -1,2 +1,3 @@
1
- <div class="panel">
2
- <%@content.each_line do |line|%><%= " " + line%><%end%></div>
1
+ <div <%= "class=\"#{@doc_def['panel_class']}\"" if @doc_def['panel_class'] %>>
2
+ <%@content.each_line do |line|%><%= " " + line%><%end%>
3
+ </div>
@@ -1,11 +1,14 @@
1
- <div <%= "class=\"#{@doc_def['div_class']}\"" if @doc_def['div_class']%> >
2
- <label <%= "class=\"#{@doc_def['label_class']}\"" if @doc_def['label_class']%> ><%=@doc_def['label']%></label>
3
- <input
4
- type="password"
5
- <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name']%>
6
- <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class']%>
7
- <%= "value=\"#{@doc_def['value']}\"" if @doc_def['value']%>
8
- <%= "disabled" if not @doc_def['editable'].nil? and not @doc_def['editable'] %>
9
- >
10
- </input>
1
+ <div data-role="fieldcontain" <%= "class=\"#{@doc_def['field_class']}\"" if @doc_def['field_class'] %>>
2
+ <label <%= "for=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
3
+ class="fieldLabel <%= @doc_def['label_class'] || "" %>"
4
+ >
5
+ <%= @doc_def['label'] %>
6
+ </label>
7
+ <input type="password"
8
+ <%= "id=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
9
+ <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name'] %>
10
+ <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class'] %>
11
+ <%= "value=\"#{@doc_def['value']}\"" if @doc_def['value'] %>
12
+ <%= "disabled" if not @doc_def['editable'].nil? and not @doc_def['editable'] %>
13
+ />
11
14
  </div>
@@ -1,14 +1,18 @@
1
- <div <%= "class=\"#{@doc_def['div_class']}\"" if @doc_def['div_class']%> >
2
- <label <%= "class=\"#{@doc_def['label_class']}\"" if @doc_def['label_class']%> ><%=@doc_def['label']%></label>
3
- <select
4
- <%= "size=\"#{@doc_def['size']}\"" if @doc_def['size'] %>
5
- <%= "class=\"#{@doc_def['class']}\"" if @doc_def['class'] %>
6
- <%= "multiple=\"yes\"" if @doc_def['allow_multi'] %>
7
- <%= "disabled" if not @doc_def['editable'].nil? and not @doc_def['editable'] %>
8
-
1
+ <div data-role="fieldcontain" <%= "class=\"#{@doc_def['field_class']}\"" if @doc_def['field_class'] %>>
2
+ <label <%= "for=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
3
+ class="fieldLabel <%= @doc_def['label_class'] || "" %>"
9
4
  >
10
- <% @doc_def['values'].each do |value| %>
11
- <option <%= "selected=\"yes\"" if @doc_def['value'] == value %>><%= value %></option>
12
- <% end %>
13
- </select>
5
+ <%= @doc_def['label'] %>
6
+ </label>
7
+ <select
8
+ <%= "id=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
9
+ <%= "size=\"#{@doc_def['size']}\"" if @doc_def['size'] %>
10
+ <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class'] %>
11
+ <%= "multiple=\"yes\"" if @doc_def['allow_multi'] %>
12
+ <%= "disabled" if not @doc_def['editable'].nil? and not @doc_def['editable'] %>
13
+ >
14
+ <% @doc_def['values'].each do |value| %>
15
+ <option <%= "selected=\"yes\"" if @doc_def['value'] == value %>><%= value %></option>
16
+ <% end %>
17
+ </select>
14
18
  </div>
@@ -1,4 +1,4 @@
1
1
  <input type="submit"
2
- <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name']%>
3
- class="<%= @doc_def['value_class'].nil? ? "standardButton" : @doc_def['value_class'] %>"
4
- <%= "value=\"#{@doc_def['value']}\"" if @doc_def['value']%> />
2
+ <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name'] %>
3
+ <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class'] %>
4
+ <%= "value=\"#{@doc_def['value']}\"" if @doc_def['value'] %> />
@@ -1,4 +1,11 @@
1
1
  <div <%= "class=\"#{@doc_def['div_class']}\"" if @doc_def['div_class']%> >
2
- <label <%= "class=\"#{@doc_def['label_class']}\"" if @doc_def['label_class']%> ><%=@doc_def['label']%></label>
3
- <span <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class']%>><%=@doc_def['value']%></span>
2
+ <label <%= "for=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
3
+ <%="class=\"#{@doc_def['label_class']}\"" if @doc_def['label_class'] %>
4
+ >
5
+ <%= @doc_def['label'] %>
6
+ </label>
7
+ <span
8
+ <%= "id=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
9
+ <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class'] %>
10
+ ><%=@doc_def['value']%></span>
4
11
  </div>
@@ -1,10 +1,16 @@
1
+ <div data-role="fieldcontain" <%= "class=\"#{@doc_def['field_class']}\"" if @doc_def['field_class'] %>>
2
+ <label <%= "for=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
3
+ class="fieldLabel <%= @doc_def['label_class'] || "" %>"
4
+ >
5
+ <%= @doc_def['label'] %>
6
+ </label>
1
7
  <textarea
2
- type="textarea"
3
- <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name']%>
4
- <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class']%>
5
- <%= "value=\"#{@doc_def['value']}\"" if @doc_def['value']%>
6
- <%= "rows=\"#{@doc_def['rows']}\"" if @doc_def['rows']%>
7
- <%= "cols=\"#{@doc_def['cols']}\"" if @doc_def['cols']%>
8
- <%= "disabled" if not @doc_def['editable'].nil? and not @doc_def['editable'] %>
9
- >
10
- </textarea>
8
+ <%= "id=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
9
+ <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name'] %>
10
+ <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class'] %>
11
+ <%= "value=\"#{@doc_def['value']}\"" if @doc_def['value'] %>
12
+ <%= "rows=\"#{@doc_def['rows']}\"" if @doc_def['rows'] %>
13
+ <%= "cols=\"#{@doc_def['cols']}\"" if @doc_def['cols'] %>
14
+ <%= "disabled" if not @doc_def['editable'].nil? and not @doc_def['editable'] %>
15
+ ></textarea>
16
+ </div>
@@ -1,11 +1,14 @@
1
- <div <%= "class=\"#{@doc_def['div_class']}\"" if @doc_def['div_class']%> >
2
- <label <%= "class=\"#{@doc_def['label_class']}\"" if @doc_def['label_class']%> ><%=@doc_def['label']%></label>
3
- <input
4
- type="text"
5
- <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name']%>
6
- <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class']%>
7
- <%= "value=\"#{@doc_def['value']}\"" if @doc_def['value']%>
8
- <%= "disabled" if not @doc_def['editable'].nil? and not @doc_def['editable'] %>
9
- >
10
- </input>
11
- </div>
1
+ <div data-role="fieldcontain" <%= "class=\"#{@doc_def['field_class']}\"" if @doc_def['field_class'] %>>
2
+ <label <%= "for=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
3
+ class="fieldLabel <%= @doc_def['label_class'] || "" %>"
4
+ >
5
+ <%= @doc_def['label'] %>
6
+ </label>
7
+ <input type="text"
8
+ <%= "id=\"#{@doc_def['id']}\"" if @doc_def['id'] %>
9
+ <%= "name=\"#{@doc_def['name']}\"" if @doc_def['name'] %>
10
+ <%= "class=\"#{@doc_def['value_class']}\"" if @doc_def['value_class'] %>
11
+ <%= "value=\"#{@doc_def['value']}\"" if @doc_def['value'] %>
12
+ <%= "disabled" if not @doc_def['editable'].nil? and not @doc_def['editable'] %>
13
+ />
14
+ </div>
@@ -1,3 +1,4 @@
1
- <div id="<%= @doc_def["divid"].nil? ? "pageTitle" : @doc_def["divid"] %>">
1
+ <div data-role="header" data-position="inline">
2
2
  <h1><%= @doc_def["title"] %></h1>
3
+ <%= @content %>
3
4
  </div>
@@ -1,4 +1,7 @@
1
- <div id="toolbar">
2
- <a href="<%= @doc_def["lefturi"] %>"><%= @doc_def["lefttext"] %></a>
3
- <a href="<%= @doc_def["righturi"] %>"><%= @doc_def["righttext"] %></a>
4
- </div>
1
+ <% if @doc_def["left_btn_text"] || @doc_def["left_btn_is_back"] %>
2
+ <a href="<%= @doc_def["left_btn_uri"] %>"><%= @doc_def["left_btn_text"] || "Back" %></a>
3
+ <% end %>
4
+
5
+ <% if @doc_def["right_btn_text"] %>
6
+ <a href="<%= @doc_def["right_btn_uri"] %>"><%= @doc_def["right_btn_text"] %></a>
7
+ <% end %>
@@ -1,8 +1,20 @@
1
- <div id="toolbar">
2
- <div id="leftItem"
3
- class="<%= @doc_def["leftclass"].nil? ? "regularButton" : @doc_def["leftclass"] %>"
4
- ><a href="<%= @doc_def["lefturi"] %>"><%= @doc_def["lefttext"] %></a></div>
5
- <div id="rightItem"
6
- class="<%= @doc_def["rightclass"].nil? ? "regularButton" : @doc_def["rightclass"] %>"
7
- ><a href="<%= @doc_def["righturi"] %>"><%= @doc_def["righttext"] %></a></div>
8
- </div>
1
+ <% if @doc_def["left_btn_text"] || @doc_def["left_btn_is_back"] %>
2
+ <a href="<%= @doc_def["left_btn_uri"] %>"
3
+ class="<%= @doc_def["left_btn_class"] || "ui-btn-left" %>"
4
+ data-icon="<%= @doc_def["left_btn_icon"] || "back" %>"
5
+ data-direction="<%= @doc_def["left_btn_direction"] || "reverse" %>"
6
+ <%= "data-rel=\"back\"" if @doc_def["left_btn_is_back"] %>
7
+ >
8
+ <%= @doc_def["left_btn_text"] || "Back" %>
9
+ </a>
10
+ <% end %>
11
+
12
+ <% if @doc_def["right_btn_text"] %>
13
+ <a href="<%= @doc_def["right_btn_uri"] %>"
14
+ class="<%= @doc_def["right_btn_class"] || "ui-btn-right" %>"
15
+ data-icon="<%= @doc_def["right_btn_icon"] || "arrow-r" %>"
16
+ <%= "data-direction=\"#{@doc_def["right_btn_direction"]}\"" if @doc_def["right_btn_direction"] %>
17
+ >
18
+ <%= @doc_def["right_btn_text"] %>
19
+ </a>
20
+ <% end %>
@@ -1 +1,6 @@
1
- <%=@content%>
1
+ <div data-role="page"
2
+ <%= "data-id=\"#{@doc_def['page_id']}\"" if @doc_def['page_id'] %>
3
+ <%= "class=\"#{@doc_def['page_class']}\"" if @doc_def['page_class'] %>
4
+ >
5
+ <%= @content %>
6
+ </div>
@@ -29,14 +29,14 @@ describe "RhodesTranslatorHelper", :shared => true do
29
29
  'children' => [@panel2] }
30
30
 
31
31
  @view1 = { 'title' => 'View 1',
32
- 'type' => 'view',
32
+ 'type' => 'panel',
33
33
  'children' => [@panel1,@panel2] }
34
34
 
35
35
  @view2 = { 'title' => 'View 2',
36
- 'type' => 'view',
36
+ 'type' => 'panel',
37
37
  'children' => [@view1,@view1] }
38
38
  @complex = { 'title' => 'View 2',
39
- 'type' => 'view',
39
+ 'type' => 'panel',
40
40
  'children' => [@textfield,@view2,@panel3,@textfield] }
41
41
  end
42
42
 
@@ -18,17 +18,17 @@ describe "Translator" do
18
18
 
19
19
  it "should translate textfield show action" do
20
20
  expected = open(get_template('text_show.html')).read
21
- translate(@textfield).should == expected
21
+ translate(@textfield).split.join('').should == expected.split.join('')
22
22
  end
23
23
 
24
24
  it "should handle nested views" do
25
25
  expected = open(get_template('nest_show.html')).read
26
- translate(@view2).should == expected
26
+ translate(@view2).split.join('').should == expected.split.join('')
27
27
  end
28
28
 
29
29
  it "should handle complex templates" do
30
30
  expected = open(get_template('complex_show.html')).read
31
- translate(@complex).should == expected
31
+ translate(@complex).split.join('').should == expected.split.join('')
32
32
 
33
33
  end
34
34
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhodes-translator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rhomobile
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-01 00:00:00 -08:00
18
+ date: 2011-12-26 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21