lathe 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lathe/generators/mini_app/app/assets/javascripts/%app_path%/app/templates/mobile/mini_apps/%app_name%/show.js.dust.tt +1 -1
- data/lib/lathe/generators/mini_app/app/assets/javascripts/%app_path%/app/views/mini_apps/%app_name%/show.js.tt +0 -1
- data/lib/lathe/generators/mini_app/app/controllers/%app_path%/%app_name%_controller.rb.tt +2 -2
- data/lib/lathe/generators/mini_app/app/models/%app_path%/service.rb.tt +3 -3
- data/lib/lathe/version.rb +1 -1
- metadata +1 -1
@@ -1,8 +1,8 @@
|
|
1
|
-
module <%=
|
1
|
+
module <%=package%>
|
2
2
|
class <%=app_class%>Controller < MiniApps::BaseController
|
3
3
|
def show
|
4
4
|
#手机端的webview请求会请求此controller
|
5
|
-
service =
|
5
|
+
service = <%=package%>::Service.new
|
6
6
|
inst = service.find_instance_by_id(params[:id])
|
7
7
|
@model = service.dump_to_hash(inst,false)
|
8
8
|
render_base
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module <%=package%>
|
2
|
-
class
|
2
|
+
class Service < MiniApp
|
3
3
|
|
4
4
|
#处理miniapp创建的请求
|
5
5
|
# * *Args* :
|
@@ -46,10 +46,10 @@ module <%=package%>
|
|
46
46
|
# * *Args* :
|
47
47
|
# - +instance+ -> <%=app_class%>Model实例
|
48
48
|
# - +include_ref+ -> 是否需要包括references,默认是需要包含的,只有当需要单独请求这一个miniapp对象的json时,需要填充整个model对象,比如,json对象中存在user_id,同时也需要填充user对象,确保前端解析时存在该实体对象。
|
49
|
-
|
49
|
+
def dump_to_hash(instance,include_ref=true)
|
50
50
|
{
|
51
51
|
:api_url=>"/#{API::prefix}/#{API::versions[0]}/mmodules/<%=app_name%>/#{instance.id}",
|
52
|
-
:m_url=>"/mini_apps/<%=app_name%>/#{id}",
|
52
|
+
:m_url=>"/mini_apps/<%=app_name%>/#{instance.id}",
|
53
53
|
:title=>instance.title
|
54
54
|
}
|
55
55
|
end
|
data/lib/lathe/version.rb
CHANGED