lathe 0.0.3 → 0.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.
@@ -2,6 +2,9 @@ module <%=app_path.camelize%>
2
2
  class <%=app_class%>Controller < MiniApps::BaseController
3
3
  def show
4
4
  #手机端的webview请求会请求此controller
5
+ service = MiniAppStudy::Service.new
6
+ inst = service.find_instance_by_id(params[:id])
7
+ @model = service.dump_to_hash(inst,false)
5
8
  render_base
6
9
  end
7
10
  end
@@ -1,5 +1,5 @@
1
1
  module <%=package%>
2
- class <%=app_class%> < MiniApp
2
+ class Servicje < MiniApp
3
3
 
4
4
  #处理miniapp创建的请求
5
5
  # * *Args* :
@@ -42,8 +42,11 @@ module <%=package%>
42
42
  #package = {:object_id=>instance.id,:description=>instance.title,:created_at=>instance.created_at.to_i,:updated_at=>instance.updated_at.to_i}
43
43
  end
44
44
 
45
- #返回当前miniapp对应的json
46
- def dump_to_hash(instance)
45
+ #返回当前miniapp对应的JSON对象
46
+ # * *Args* :
47
+ # - +instance+ -> <%=app_class%>Model实例
48
+ # - +include_ref+ -> 是否需要包括references,默认是需要包含的,只有当需要单独请求这一个miniapp对象的json时,需要填充整个model对象,比如,json对象中存在user_id,同时也需要填充user对象,确保前端解析时存在该实体对象。
49
+ # def dump_to_hash(instance,include_ref=true)
47
50
  {
48
51
  :api_url=>"/#{API::prefix}/#{API::versions[0]}/mmodules/<%=app_name%>/#{instance.id}",
49
52
  :m_url=>"/mini_apps/<%=app_name%>/#{id}",
@@ -3,7 +3,7 @@
3
3
 
4
4
  en:
5
5
  ft:
6
- miniapp:
6
+ mini_app:
7
7
  <%=app_name%>:
8
- filter: "<%=app_name%>"
9
- text: "post <%=app_name%>"
8
+ text: "<%=app_name%>"
9
+ app_text: "post <%=app_name%>"
@@ -3,7 +3,7 @@
3
3
 
4
4
  zh-CN:
5
5
  ft:
6
- miniapp:
6
+ mini_app:
7
7
  <%=app_name%>:
8
- filter: "<%=app_name%>"
9
- text: "发布 <%=app_name%>"
8
+ text: "<%=app_name%>"
9
+ app_text: "发布 <%=app_name%>"
@@ -2,7 +2,7 @@ class AddTypeTo<%=package%> < ActiveRecord::Migration
2
2
  def change
3
3
 
4
4
  MiniApp.where(:name=>"<%=app_name%>").delete_all
5
- mini_app = <%=package%>::<%=app_class%>.new(:name=>"<%=app_name%>", :order_number=>90)
5
+ mini_app = <%=package%>::Service.new(:name=>"<%=app_name%>", :order_number=>90)
6
6
  mini_app.save!
7
7
 
8
8
  end
data/lib/lathe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lathe
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lathe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.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: 2013-09-07 00:00:00.000000000 Z
12
+ date: 2013-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -63,8 +63,8 @@ files:
63
63
  - lib/lathe/generators/mini_app/app/controllers/%app_path%/%app_name%_controller.rb.tt
64
64
  - lib/lathe/generators/mini_app/app/helpers/%app_path%/application_helper.rb
65
65
  - lib/lathe/generators/mini_app/app/mailers/.empty_directory
66
- - lib/lathe/generators/mini_app/app/models/%app_path%/%app_name%.rb.tt
67
66
  - lib/lathe/generators/mini_app/app/models/%app_path%/%app_name%_model.rb.tt
67
+ - lib/lathe/generators/mini_app/app/models/%app_path%/service.rb.tt
68
68
  - lib/lathe/generators/mini_app/app/views/layouts/%app_path%/.empty_directory
69
69
  - lib/lathe/generators/mini_app/config/.empty_directory
70
70
  - lib/lathe/generators/mini_app/config/locales/fontend.en.yml.tt