rhodes 0.2.0 → 0.2.1
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/Manifest.txt +4 -1
- data/generators/rhogen.rb +40 -35
- data/generators/templates/application/index.erb +11 -0
- data/generators/templates/application/layout.erb +17 -0
- data/generators/templates/model/controller.rb +4 -4
- data/lib/builtinME.rb +63 -2
- data/lib/date/format.rb +8 -4
- data/lib/date.rb +25 -14
- data/lib/rationalME.rb +530 -0
- data/lib/rho/render.rb +46 -13
- data/lib/rho/rho.rb +26 -0
- data/lib/rho/rhocontroller.rb +14 -23
- data/lib/rho/rhoviewhelpers.rb +45 -0
- data/lib/rhodes.rb +1 -1
- data/lib/time.rb +4 -1
- data/spec/app_generator_spec.rb +9 -9
- metadata +6 -3
- data/generators/templates/application/index.html +0 -25
@@ -0,0 +1,45 @@
|
|
1
|
+
module Rho
|
2
|
+
class RhoController
|
3
|
+
|
4
|
+
def truncate(text, length)
|
5
|
+
if text
|
6
|
+
omission = '...'
|
7
|
+
l = length - omission.length
|
8
|
+
(text.length > length ? text[0...l] + omission : text).to_s
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def click_to_call(phone,description=nil)
|
13
|
+
description = phone if description.nil?
|
14
|
+
return "" if phone.nil? or phone.length == 0
|
15
|
+
"<a href=\"tel:#{phone}\" target=\"_self\">#{description}</a>"
|
16
|
+
end
|
17
|
+
|
18
|
+
def mailto(address,description=nil)
|
19
|
+
description = address if description.nil?
|
20
|
+
return "" if address.nil? or address.length == 0
|
21
|
+
"<a href=\"mailto:#{address}\" target=\"_self\">#{description}</a>"
|
22
|
+
end
|
23
|
+
|
24
|
+
def link_to(name,action,id=nil,confirm=nil)
|
25
|
+
action = action.to_s
|
26
|
+
if (action != 'delete')
|
27
|
+
"<a href=\"#{url_for(action,id)}\">#{name}</a>"
|
28
|
+
else
|
29
|
+
"<a href=\"#{url_for(action,id)}\" onclick=\""+ #if (confirm('#{confirm}')) {
|
30
|
+
"var f = document.createElement('form'); f.style.display = 'none';" +
|
31
|
+
"this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;f.submit();"+
|
32
|
+
"return false;\">#{name}</a>"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def url_for(action,id=nil)
|
37
|
+
action = action.to_s
|
38
|
+
amurl = '/'+@request['application']+'/'+@request['model']
|
39
|
+
return action if action == '/'
|
40
|
+
return amurl if action == 'create' or action == 'index'
|
41
|
+
return amurl +'/'+ (id.nil? ? action.to_s : id.to_s + '/' + action.to_s)
|
42
|
+
end
|
43
|
+
|
44
|
+
end # RhoController
|
45
|
+
end # Rho
|
data/lib/rhodes.rb
CHANGED
data/lib/time.rb
CHANGED
data/spec/app_generator_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/generator_spec_helper'
|
2
2
|
|
3
3
|
describe Rhogen::AppGenerator do
|
4
|
-
|
4
|
+
|
5
5
|
app_name = 'NeatApp'
|
6
6
|
|
7
7
|
it "should complain if no name is specified" do
|
@@ -9,25 +9,25 @@ describe Rhogen::AppGenerator do
|
|
9
9
|
@generator = Rhogen::AppGenerator.new('/tmp', {})
|
10
10
|
}.should raise_error(::Templater::TooFewArgumentsError)
|
11
11
|
end
|
12
|
-
|
13
|
-
|
12
|
+
|
13
|
+
|
14
14
|
it "should generate class_name" do
|
15
15
|
@generator = Rhogen::AppGenerator.new('/tmp', {}, 'Class-With-Hyphens')
|
16
16
|
@generator.class_name.should == 'ClassWithHyphens'
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
before do
|
20
20
|
@generator = Rhogen::AppGenerator.new('/tmp', {}, app_name)
|
21
21
|
end
|
22
|
-
|
23
|
-
it "should create application.rb and
|
24
|
-
['application.rb', 'index.
|
22
|
+
|
23
|
+
it "should create application.rb, index.erb, and layout.erb files" do
|
24
|
+
['application.rb', 'index.erb', 'layout.erb'].each do |template|
|
25
25
|
@generator.should create("/tmp/#{app_name}/#{template}")
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it "should generate valid erb templates" do
|
30
30
|
pending "need to figure out how to validate erb"
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhodes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rhomobile Dev
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-20 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -113,7 +113,8 @@ files:
|
|
113
113
|
- bin/rhogen
|
114
114
|
- generators/rhogen.rb
|
115
115
|
- generators/templates/application/application.rb
|
116
|
-
- generators/templates/application/index.
|
116
|
+
- generators/templates/application/index.erb
|
117
|
+
- generators/templates/application/layout.erb
|
117
118
|
- generators/templates/model/config.rb
|
118
119
|
- generators/templates/model/controller.rb
|
119
120
|
- generators/templates/model/edit.erb
|
@@ -128,6 +129,7 @@ files:
|
|
128
129
|
- lib/erb.rb
|
129
130
|
- lib/find.rb
|
130
131
|
- lib/rational.rb
|
132
|
+
- lib/rationalME.rb
|
131
133
|
- lib/rho.rb
|
132
134
|
- lib/rho/render.rb
|
133
135
|
- lib/rho/rho.rb
|
@@ -136,6 +138,7 @@ files:
|
|
136
138
|
- lib/rho/rhocontroller.rb
|
137
139
|
- lib/rho/rhofsconnector.rb
|
138
140
|
- lib/rho/rhosupport.rb
|
141
|
+
- lib/rho/rhoviewhelpers.rb
|
139
142
|
- lib/rho/settings_controller.rb
|
140
143
|
- lib/rhodes.rb
|
141
144
|
- lib/rhoframework.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
4
|
-
<head>
|
5
|
-
<title><%= class_name %></title>
|
6
|
-
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
|
7
|
-
<style type="text/css" media="screen">@import "/shared/js/iui/iui.css"; @import "/shared/css/rho.css";</style>
|
8
|
-
<script type="application/x-javascript" src="/shared/js/iui/iui.js"></script>
|
9
|
-
<script src="/shared/js/jquery-1.2.6.min.js"></script>
|
10
|
-
<script src="/shared/js/rho.js"></script>
|
11
|
-
</head>
|
12
|
-
<body>
|
13
|
-
<div class="toolbar">
|
14
|
-
<h1 id="pageTitle">
|
15
|
-
<script language="JavaScript">
|
16
|
-
document.write(document.title)
|
17
|
-
</script>
|
18
|
-
</h1>
|
19
|
-
<a id="backButton" class="button" href="./"></a>
|
20
|
-
</div>
|
21
|
-
<ul id="home" selected="true" title="<%= class_name %>">
|
22
|
-
<li>Something interesting here...</li>
|
23
|
-
</ul>
|
24
|
-
</body>
|
25
|
-
</html>
|