weui-rails 0.2.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d44f6d186a2720f2220d2dd174dbfcff2d78fcd6
4
- data.tar.gz: 67490d107d56e9b554efc8825d751654ee943263
3
+ metadata.gz: e5d011270224175413dd9a12ba42cb7b75f7b507
4
+ data.tar.gz: 6e895b792594d2f82c3b74e2872cf72215da9aef
5
5
  SHA512:
6
- metadata.gz: 004a7d50bd9771a42a9527d4b89e0c4670ea7607422eea52a65def3a48f546bf6172ccd1fa61b53e9a6a2e36c5226e5b8735451531acb1f2038729db8b45b6b6
7
- data.tar.gz: 12e49ddc05dcb6cbaa16a44a7896526286bed030492175e217ff76d09e8763775f77513042c75e9d2be316e65c3e492a3a2bb4cb6d1c84bea8fb81df5f14e94f
6
+ metadata.gz: e217a08d8ae9a06bba37002b9235cc64999eb323e401f433a71f54d6be605943ff0035c64b34c12fd2e89cda746182c5c1288a9204ec0bc286e0e1945889805e
7
+ data.tar.gz: 24dbe6ec1d70fa739c946f476d06fb03b016ad36867066b048c6e0261a22a79380615862d3d7cb83c348b263cc13f7796a176a61fd3850e7104edabebd13af2f
data/README.md CHANGED
@@ -41,10 +41,10 @@ app/views/layouts/wechat.html.erb
41
41
  <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
42
42
  <title>WeUI</title>
43
43
  <%= stylesheet_link_tag 'weui-rails', media: 'all' %>
44
+ <script src="http://cdnjs.gtimg.com/cdnjs/libs/zepto/1.1.4/zepto.min.js"></script>
44
45
  </head>
45
46
  <body ontouchstart>
46
47
  <%= yield %>
47
- <script src="http://cdnjs.gtimg.com/cdnjs/libs/zepto/1.1.4/zepto.min.js"></script>
48
48
  </body>
49
49
  </html>
50
50
  ```
@@ -54,7 +54,8 @@ config/routes.rb
54
54
  ```ruby
55
55
  resource :wechat, only: [:show, :create] do
56
56
  collection do
57
- get :buttons
57
+ get :message_box
58
+ get :direct_message_box
58
59
  end
59
60
  end
60
61
  ```
@@ -64,34 +65,19 @@ app/controllers/wechats_controller.rb
64
65
  ```ruby
65
66
  class WechatsController < ActionController::Base
66
67
  layout 'wechat'
67
- def buttons
68
+ def message_box
69
+ end
70
+
71
+ def direct_message_box
72
+ render 'weui/message_box', locals: { title: 'Weui', description: 'directly render in controller' }
68
73
  end
69
74
  end
70
75
  ```
71
76
 
72
- app/views/wechats/buttons.html.erb
77
+ app/views/wechats/message_box.html.erb
73
78
 
74
79
  ```erb
75
- <div class="page">
76
- <div class="hd">
77
- <h1 class="page_title">Button</h1>
78
- </div>
79
- <div class="bd spacing">
80
- <a href="javascript:;" class="weui_btn weui_btn_primary">按钮</a>
81
- <a href="javascript:;" class="weui_btn weui_btn_disabled weui_btn_primary">按钮</a>
82
- <a href="javascript:;" class="weui_btn weui_btn_warn">确认</a>
83
- <a href="javascript:;" class="weui_btn weui_btn_disabled weui_btn_warn">确认</a>
84
- <a href="javascript:;" class="weui_btn weui_btn_default">按钮</a>
85
- <a href="javascript:;" class="weui_btn weui_btn_disabled weui_btn_default">按钮</a>
86
- <div class="button_sp_area">
87
- <a href="javascript:;" class="weui_btn weui_btn_plain_default">按钮</a>
88
- <a href="javascript:;" class="weui_btn weui_btn_plain_primary">按钮</a>
89
-
90
- <a href="javascript:;" class="weui_btn weui_btn_mini weui_btn_primary">按钮</a>
91
- <a href="javascript:;" class="weui_btn weui_btn_mini weui_btn_default">按钮</a>
92
- </div>
93
- </div>
94
- </div>
80
+ <%= weui_message_box 'Title', 'Description', 'weui_icon_warn' -%>
95
81
  ```
96
82
 
97
83
  ## More example
@@ -0,0 +1,19 @@
1
+ <div class="page">
2
+ <div class="weui_msg">
3
+ <div class="weui_icon_area"><i class="weui_icon_msg <%= icon_style -%>"></i></div>
4
+ <div class="weui_text_area">
5
+ <h2 class="weui_msg_title"><%= title -%></h2>
6
+ <p class="weui_msg_desc"><%= description -%></p>
7
+ </div>
8
+ <div class="weui_opr_area">
9
+ <p class="weui_btn_area">
10
+ <a href="javascript:wx.closeWindow();" class="weui_btn weui_btn_primary"><%= button_text -%></a>
11
+ </p>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ <script type="application/javascript">
16
+ wx.ready(function() {
17
+ wx.hideOptionMenu();
18
+ });
19
+ </script>
@@ -0,0 +1,4 @@
1
+ <%= render partial: 'weui/message_box',
2
+ locals: { title: title, description: description,
3
+ icon_style: defined?(icon_style) ? icon_style : 'weui_icon_warn',
4
+ button_text: defined?(button_text) ? button_text : '确定' } -%>
data/lib/weui-rails.rb CHANGED
@@ -1,9 +1,17 @@
1
1
  require 'autoprefixer-rails'
2
2
  require 'weui-rails/version'
3
+ require 'weui-rails/helpers/weui_message_box'
3
4
 
4
5
  module Weui
5
6
  module Rails
6
7
  class Engine < ::Rails::Engine
7
8
  end
9
+
10
+ # Make Weui helpers available in Rails applications.
11
+ class Railtie < ::Rails::Railtie
12
+ initializer 'weui.add_helpers' do
13
+ ActionView::Base.send :include, Weui::Helpers
14
+ end
15
+ end
8
16
  end
9
17
  end
@@ -0,0 +1,9 @@
1
+ module Weui
2
+ module Helpers
3
+ def weui_message_box(title, description, icon_style = 'weui_icon_warn', button_text = '确定')
4
+ render partial: 'weui/message_box',
5
+ locals: { title: title, description: description,
6
+ icon_style: icon_style, button_text: button_text }
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Weui
2
2
  module Rails
3
- VERSION = '0.2.2.1'
3
+ VERSION = '0.2.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weui-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Guo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-01 00:00:00.000000000 Z
11
+ date: 2016-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -50,7 +50,10 @@ files:
50
50
  - LICENSE
51
51
  - README.md
52
52
  - Rakefile
53
+ - app/views/weui/_message_box.html.erb
54
+ - app/views/weui/message_box.html.erb
53
55
  - lib/weui-rails.rb
56
+ - lib/weui-rails/helpers/weui_message_box.rb
54
57
  - lib/weui-rails/version.rb
55
58
  - vendor/assets/stylesheets/_weui.scss
56
59
  - vendor/assets/stylesheets/base/fn.scss