repres-bootstrap 1.1 → 1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 009f026957d47d559302d2f8808d85247d581af4
4
- data.tar.gz: 69e13e0bafc68b16dd7d16f6b74fa9ebdd83efd3
3
+ metadata.gz: 390ec8fee400b93c2ce818b38fb703ff9da3df4f
4
+ data.tar.gz: ba1031a334964d10aaf38d9b17c219bd8bdc085d
5
5
  SHA512:
6
- metadata.gz: 262509153624c6369b6bb388677222c1d46dd261b6367ea30fa53986b7d62319046ab293add1c0b671ba8c38936bbec28c814013e4d2b9ed613a91741a264c21
7
- data.tar.gz: c9a78694fe944c60338f260e75df372d2c19dfd31d67124c87dbba4521a0e6f709e0dc79c1f1b6bcb10d2f0c18edda8946193579662a3925a066f358ca0a0edc
6
+ metadata.gz: 1a7972ff9a34818d87d243404e51ec56407f3e5f94db910b7ded5dd65b66b2294cc37880c6473652079c51b7ba4d92e60553bc5ec47880a4b74c8f15651b31d3
7
+ data.tar.gz: cd1ccae0fbd4599c0c41bbf075c2fa2eb64ee6046f5a0caf9d486601cf2935035a9134ed17cd98a6edae45b315c6623ac063af44234b3813fbfdee743a2373f8
data/README.md CHANGED
@@ -24,6 +24,7 @@ gem 'repres-bootstrap'
24
24
  ## Include the Helper in your Application Controller before Render the Style or Script with the helper methods
25
25
  ```ruby
26
26
  include Repres::Bootstrap::ApplicationHelper
27
+ include Repres::Bootstrap::FormHelper
27
28
  ```
28
29
 
29
30
 
@@ -202,3 +203,10 @@ Here are more options:
202
203
  - input_accept: The HTML 5 attribute for the file input tag.
203
204
  - input_data: The HTML 5 Data attribute for the input tag.
204
205
  - error_hidden: Determines whether the error message block should be shown if the field has any error.
206
+
207
+ - disabled: the disabled attribute of a HTML input tag.
208
+ - maxlength: the maxlength attribute of a HTML input tag.
209
+ - placeholder: the placeholder attribute of a HTML input tag.
210
+ - readonly: the readonly attribute of a HTML input tag.
211
+ - required: the required attribute of a HTML input tag.
212
+ - rows: the rows of a HTML Text Area
@@ -1,10 +1,16 @@
1
1
  module Repres::Bootstrap::ApplicationHelper
2
2
 
3
+ #extend Repres::Bootstrap::FormHelper
4
+
3
5
  def bootstrap_form_field(options = {})
6
+ warn 'Repres::Bootstrap::ApplicationHelper#bootstrap_form_field is deprecated and will be removed in the future, please use Repres::Bootstrap::FormHelper#bootstrap_form_field instead.'
7
+ #super options
4
8
  render partial: 'repres/bootstrap/form_field', locals: { options: options }
5
9
  end
6
10
 
7
11
  def bootstrap_form_select_box(options = {})
12
+ warn 'Repres::Bootstrap::ApplicationHelper#bootstrap_form_select_box is deprecated and will be removed in the future, please use Repres::Bootstrap::FormHelper#bootstrap_form_select_box instead.'
13
+ #super options
8
14
  render partial: 'repres/bootstrap/form_select_box', locals: { options: options }
9
15
  end
10
16
 
@@ -16,4 +22,9 @@ module Repres::Bootstrap::ApplicationHelper
16
22
  render partial: 'repres/bootstrap/style', locals: { options: options }
17
23
  end
18
24
 
25
+ #class << self
26
+ # deprecate bootstrap_form_field: :'Repres::Bootstrap::ApplicationHelper.bootstrap_form_field', deprecator: ActiveSupport::Deprecation.new('2.0', 'repres-bootstrap')
27
+ # deprecate bootstrap_form_select_box: :'Repres::Bootstrap::ApplicationHelper.bootstrap_form_select_box', deprecator: ActiveSupport::Deprecation.new('2.0', 'repres-bootstrap')
28
+ #end
29
+
19
30
  end
@@ -0,0 +1,11 @@
1
+ module Repres::Bootstrap::FormHelper
2
+
3
+ def bootstrap_form_field(options = {})
4
+ render partial: 'repres/bootstrap/form_field', locals: { options: options }
5
+ end
6
+
7
+ def bootstrap_form_select_box(options = {})
8
+ render partial: 'repres/bootstrap/form_select_box', locals: { options: options }
9
+ end
10
+
11
+ end
@@ -38,6 +38,7 @@
38
38
  data: input_data
39
39
  }
40
40
  input_options[:input_accept] = options[:input_accept] if options[:input_accept].present?
41
+ input_options[:rows] = options[:rows] if options[:rows].present?
41
42
 
42
43
  error_hidden = options[:error_hidden]
43
44
  %>
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate platform Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,320 @@
1
+ # rails generate repres:bootstrap:platform administration --version 2
2
+
3
+ class Repres::Bootstrap::PlatformGenerator < Rails::Generators::NamedBase
4
+
5
+ # https://github.com/erikhuda/thor/blob/master/lib/thor/base.rb#L273
6
+ class_option :version, type: :numeric, required: false, default: 1, desc: 'a positive integer, the default value is 1'
7
+
8
+ source_root File.expand_path('../templates', __FILE__)
9
+
10
+ def generate_platform
11
+
12
+ puts "file_name = #{file_name.inspect}"
13
+ puts "file_path = #{file_path.inspect}"
14
+ puts "namespace = #{namespace.inspect}"
15
+ puts "class_name = #{class_name.inspect}"
16
+ puts "class_path = #{class_path.inspect}"
17
+ puts "human_name = #{human_name.inspect}"
18
+ puts "options = #{options.inspect}"
19
+
20
+ puts '---- ----'
21
+ puts "class_options = #{self.class.class_options.inspect}"
22
+
23
+ @platform_name = file_name.downcase
24
+ @version_number = options['version'].to_i
25
+
26
+ #generate_route
27
+ #generate_concern
28
+ #generate_controller
29
+ #generate_layout_view
30
+ generate_shared_view
31
+
32
+ end
33
+
34
+ def define_namespace(content)
35
+ content.gsub! /PlatformModuleName/, platform_module_name
36
+ content.gsub! /VersionModuleName/, version_module_name
37
+ content.gsub! /platform_name/, platform_name
38
+ content.gsub! /version_name/, version_name
39
+ content
40
+ end
41
+
42
+ # concern
43
+ #
44
+ # app/controllers/concerns/priviledge_protection.rb
45
+ #
46
+ def generate_concern
47
+ copy_file 'app/controllers/concerns/priviledge_protection.rb'
48
+ end
49
+
50
+ # controller
51
+ #
52
+ # app/controllers/platform/version/privileged_controller.rb
53
+ # app/controllers/platform/version/dashboards_controller.rb
54
+ #
55
+ def generate_controller
56
+ copy_file('app/controllers/privileged_controller.rb', "app/controllers/#{platform_name}/#{version_name}/privileged_controller.rb") { |content| define_namespace content }
57
+ copy_file('app/controllers/dashboards_controller.rb', "app/controllers/#{platform_name}/#{version_name}/dashboards_controller.rb") { |content| define_namespace content }
58
+ end
59
+
60
+ # helper
61
+ #
62
+ # app/helpers/administration/v1/helper.rb
63
+ #
64
+ def generate_helper
65
+ end
66
+
67
+ # layout_view
68
+ #
69
+ # app/views/layouts/platform/version.html.erb
70
+ #
71
+ def generate_layout_view
72
+ copy_file('app/views/layouts/platform.html.erb', "app/views/layouts/#{platform_name}/#{version_name}.html.erb") { |content| define_namespace content }
73
+ end
74
+
75
+ # shared_view
76
+ #
77
+ # app/views/shared/
78
+ # app/views/platform/version/shared/_script.html.erb
79
+ # app/views/platform/version/shared/_style.html.erb
80
+ #
81
+ def generate_shared_view
82
+ empty_directory 'app/views/shared'
83
+ copy_file('app/views/shared/_script.html.erb', "app/views/#{platform_name}/#{version_name}/shared/_script.html.erb") { |content| define_namespace content }
84
+ copy_file('app/views/shared/_style.html.erb', "app/views/#{platform_name}/#{version_name}/shared/_style.html.erb") { |content| define_namespace content }
85
+ end
86
+
87
+ # route
88
+ #
89
+ # config/routes.rb
90
+ #
91
+ def generate_route
92
+ source = File.expand_path find_in_source_paths('config/routes.rb')
93
+ File.open(source, 'rb') do |f|
94
+ #route f.read.to_s.strip.gsub(/platform_name/, platform_name).gsub(/version_name/, version_name)
95
+ route define_namespace(f.read.to_s.strip)
96
+ end
97
+ #File.open(Pathname.new(self.class.source_root).join('config', 'routes.rb'), 'r') do |f|
98
+ # route f.read.to_s.strip.gsub(/platform_name/, platform_name).gsub(/version_name/, version_name)
99
+ #end
100
+ end
101
+
102
+ # Administration
103
+ def platform_module_name
104
+ @platform_name.capitalize
105
+ end
106
+
107
+ # administration
108
+ def platform_name
109
+ @platform_name
110
+ end
111
+
112
+ # Administration::V1
113
+ def platform_version_module_name
114
+ "#{platform_module_name}::#{version_module_name}"
115
+ end
116
+
117
+ # V1
118
+ def version_module_name
119
+ "V#{version_number}"
120
+ end
121
+
122
+ # v1
123
+ def version_name
124
+ "v#{version_number}"
125
+ end
126
+
127
+ # 1
128
+ def version_number
129
+ @version_number
130
+ end
131
+
132
+ private :define_namespace, :generate_concern, :generate_controller,
133
+ :generate_helper, :generate_layout_view, :generate_shared_view, :generate_route,
134
+ :platform_module_name, :platform_name, :platform_version_module_name,
135
+ :version_module_name, :version_name, :version_number
136
+
137
+ end
138
+
139
+
140
+ =begin install or application
141
+
142
+ ROADMAP.md
143
+ # Picasso 线路图
144
+ ## v1.0
145
+
146
+ CHANGELOG.md
147
+ # Picasso 变更日志
148
+ ## v1.0
149
+
150
+ DEPLOYMENT.md
151
+ # Picasso 发布手册
152
+
153
+
154
+
155
+ ## 环境变量
156
+
157
+ ### 基础安全钥匙
158
+ 引用文件: __config/secrets.yml__
159
+ - __XXXXXX_SECRET_KEY_BASE__ 基础安全钥匙。开发和测试模式下,已经生成128个字符的随机字符串,生产环境则无缺省值,需要在Web服务器中配置。一旦Web应用上线,则不能修改。
160
+
161
+ ### 数据库
162
+ 引用文件: __config/database.yml__
163
+ - __XXXXXX_DATABASE_HOST__ 数据库服务器的主机IP或域名。尽量用内网IP避免消耗公网流量。缺省为 'localhost'。
164
+ - __XXXXXX_DATABASE_PORT__ 数据库服务器的端口号。缺省为 5432。
165
+ - __XXXXXX_DATABASE_POOL__ 数据库服务器的连接池的数量。所有连接到同一台数据库服务器的连接池数量的总和,应比数据库服务器允许的最大连接数小 1。缺省为 200。
166
+ - __XXXXXX_DATABASE_NAME__ 连接的数据库名称。缺省为 'xxxxxx' 。
167
+ - __XXXXXX_DATABASE_ADAPTER__ 连接数据库服务器的驱动名称。缺省为 'postgresql' 。
168
+ - __XXXXXX_DATABASE_ENCODING__ 连接数据库服务器的字符编码集。缺省为 'unicode' 。
169
+ - __XXXXXX_DATABASE_USERNAME__ 连接数据库服务器的用户名。缺省为 'developer' 。
170
+ - __XXXXXX_DATABASE_PASSWORD__ 连接数据库服务器的密码。缺省为 'password' 。
171
+
172
+ ### 分页
173
+ 引用文件: __config/application.rb__
174
+ - __XXXXXX_PER_PAGE__ Web UI 的列表的每页条数的缺省值,缺省值为10。
175
+ - __XXXXXX_DOSSER_PER_PAGE__ Dosser API 的列表的每页条数的缺省值,缺省值为5。
176
+
177
+ ### Swagger Web API 文档
178
+ 引用文件: __config/initializers/swagger_engine.rb__
179
+ - __XXXXXX_SWAGGER_USERNAME__ Swagger交互式文档系统的用户名,缺省值为 swagger。
180
+ - __XXXXXX_SWAGGER_PASSWORD__ Swagger交互式文档系统的密码,缺省值为 xxxxxx。
181
+
182
+ ### 主服务
183
+ 引用文件: __config/application.rb__
184
+ - __XXXXXX_PICASSO_ADMINISTRATION_PORTAL_DOSSER_LINK__ 位置跟踪微能力的系统管理平台的门户链接。缺省值为 http://xxxxxx.alpha/administration-api/v1/portals/~.json 。
185
+ - __XXXXXX_PICASSO_GOVERNANCE_PORTAL_DOSSER_LINK__ 位置跟踪微能力的行政管理平台的门户链接。缺省值为 http://xxxxxx.alpha/governance-api/v1/portals/~.json 。
186
+ - __XXXXXX_PICASSO_PRACTITION_PORTAL_DOSSER_LINK__ 位置跟踪微能力的从业人员平台的门户链接。缺省值为 http://xxxxxx.alpha/practition-api/v1/portals/~.json 。
187
+
188
+ ## 发布指令
189
+
190
+ ### v1.0
191
+ 1. bundle exec rake db:create
192
+ 2. bundle exec rake db:migrate
193
+ 3. bundle exec rake db:seed
194
+ 4. bundle exec rake assets:precompile
195
+
196
+ =end
197
+
198
+
199
+
200
+ =begin interface == bootstrap
201
+
202
+ route
203
+
204
+ namespace :administration do
205
+ namespace :v1 do
206
+ resources :dashboards, only: :show
207
+ end
208
+ end
209
+
210
+ concern
211
+
212
+ ? app/controllers/concerns/priviledge_protection.rb
213
+
214
+ controller
215
+
216
+ app/controllers/administration/v1/privileged_controller.rb
217
+ class Administration::V1::PrivilegedController < ApplicationController
218
+ layout 'administration/v1'
219
+ ? include PriviledgeProtection
220
+ helper Administration::V1::Helper
221
+ end
222
+
223
+ app/controllers/administration/v1/dashboards_controller.rb
224
+ class Administration::V1::DashboardsController < Administration::V1::PrivilegedController
225
+ def show
226
+ ? redirect_to administration_profiles_path(Unidom::Common::SELF)
227
+ end
228
+ end
229
+
230
+ layout_view
231
+
232
+ app/views/layouts/administration/v1.html.erb
233
+
234
+ shared_view
235
+
236
+ app/views/shared/
237
+ app/views/administration/v1/shared/
238
+ app/views/administration/v1/shared/_script.html.erb
239
+ app/views/administration/v1/shared/_style.html.erb
240
+
241
+ helper
242
+
243
+ app/helpers/administration/v1/helper.rb
244
+ module Administration::V1::Helper
245
+ end
246
+
247
+ image
248
+
249
+ app/assets/images/administration/v1/
250
+
251
+ shared_image
252
+
253
+ app/assets/images/shared/
254
+
255
+ style
256
+
257
+ app/assets/stylesheets/administration/v1/
258
+
259
+ shared_style
260
+
261
+ app/assets/stylesheets/shared/
262
+ app/assets/stylesheets/administration/v1/shared/
263
+
264
+ script
265
+
266
+ app/assets/javascripts/administration/v1/
267
+
268
+ shared_script
269
+
270
+ app/assets/javascripts/shared/
271
+ app/assets/javascripts/administration/v1/shared/
272
+
273
+ =end
274
+
275
+
276
+
277
+ =begin interface == swagger
278
+
279
+ gem
280
+
281
+ swagger
282
+
283
+ route
284
+
285
+ scope '/administration-api/v1', module: 'administration/dosser/v1', as: 'administration_dosser_v1' do
286
+ resources :portals, only: :show
287
+ end
288
+
289
+ controller
290
+
291
+ app/controllers/administration/dosser/v1/presentation_controller.rb
292
+ class Administration::Dosser::V1::PresentationController < ApplicationController
293
+ clear_helpers
294
+ include Repres::Dosser::Concerns::ResourcePresentation
295
+ layout nil
296
+ end
297
+
298
+ app/controllers/administration/dosser/v1/portals_controller.rb
299
+ class Administration::Dosser::V1::::PortalsController < Administration::Dosser::V1::PresentationController
300
+ def show
301
+ self.criteria = { id: params[:id] }
302
+ render_ok collection: [
303
+ {
304
+ name: 'XX系统',
305
+ links: [
306
+ { rel: 'self', href: administration_dosser_v1_portal_url( Unidom::Common::SELF, format: request.format.symbol) },
307
+ { rel: 'canonial', href: administration_dosser_v1_portal_url( Unidom::Common::SELF, format: :json ) },
308
+ { rel: 'alternate', href: administration_dosser_v1_portal_url( Unidom::Common::SELF, format: :xml ) },
309
+ { rel: 'dosser/{action}/{resource}', href: administration_dosser_v1_{resources}_url( format: request.format.symbol) }
310
+ ]
311
+ }
312
+ ]
313
+ end
314
+ end
315
+
316
+ swagger
317
+
318
+ lib/swagger/administration_api_v1.json
319
+
320
+ =end
@@ -0,0 +1,22 @@
1
+ module PriviledgeProtection
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ # include VisitorSession
8
+
9
+ before_action :protect_priviledge!
10
+
11
+ def protect_priviledge!
12
+
13
+ # The #legal_session? method & the #new_session_path method could be
14
+ # implemented in the Visitor Session concern or controller.
15
+ #
16
+ # redirect_to(new_session_path) and return unless legal_session?
17
+
18
+ end
19
+
20
+ end
21
+
22
+ end
@@ -0,0 +1,7 @@
1
+ class PlatformModuleName::VersionModuleName::DashboardsController < PlatformModuleName::VersionModuleName::PrivilegedController
2
+
3
+ def show
4
+ # redirect_to administration_profiles_path(Unidom::Common::SELF)
5
+ end
6
+
7
+ end
@@ -0,0 +1,9 @@
1
+ class PlatformModuleName::VersionModuleName::PrivilegedController < ApplicationController
2
+
3
+ layout 'platform_name/version_name'
4
+
5
+ include PriviledgeProtection
6
+
7
+ helper PlatformModuleName::VersionModuleName::Helper
8
+
9
+ end
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html lang='zh-CN'>
4
+ <head>
5
+
6
+ <%= yield :meta %>
7
+
8
+ <title><%= yield :title %></title>
9
+
10
+ <%= hyper_text_style :'animate.css' => true, :buttons => true, :'font-awesome' => true %>
11
+ <%= bootstrap_style :bootstrap => true, :'bootstrap-theme' => true, :'bootstrap-datepicker' => true, :'bootstrap-table' => true, :'bootstrap-fileinput' => true %>
12
+ <%= render partial: 'shared/style' %>
13
+ <%= render partial: 'platform_name/version_name/shared/style' %>
14
+
15
+ <%= yield :style %>
16
+
17
+ <%= csrf_meta_tags %>
18
+
19
+ </head>
20
+ <body>
21
+
22
+ <%= yield %>
23
+
24
+ <%= hyper_text_script jquery: true, modernizr: true %>
25
+ <%= bootstrap_script :bootstrap => true, :'bootstrap-datepicker' => true, :'bootstrap-fileinput' => true, :'bootstrap-table' => true, :buttons => true %>
26
+ <%= render partial: 'shared/script' %>
27
+ <%= render partial: 'platform_name/version_name/shared/script' %>
28
+
29
+ <%= javascript_include_tag 'application' %>
30
+ <%= yield :script %>
31
+
32
+ </body>
33
+ </html>
@@ -0,0 +1,5 @@
1
+ namespace :platform_name do
2
+ namespace :version_name do
3
+ resources :dashboards, only: :show
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  module Repres
2
2
  module Bootstrap
3
- VERSION = '1.1'.freeze
3
+ VERSION = '1.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repres-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -54,12 +54,22 @@ files:
54
54
  - app/assets/stylesheets/repres/bootstrap/application.css
55
55
  - app/controllers/repres/bootstrap/application_controller.rb
56
56
  - app/helpers/repres/bootstrap/application_helper.rb
57
+ - app/helpers/repres/bootstrap/form_helper.rb
57
58
  - app/views/layouts/repres/bootstrap/application.html.erb
58
59
  - app/views/repres/bootstrap/_form_field.html.erb
59
60
  - app/views/repres/bootstrap/_form_select_box.html.erb
60
61
  - app/views/repres/bootstrap/_script.html.erb
61
62
  - app/views/repres/bootstrap/_style.html.erb
62
63
  - config/routes.rb
64
+ - lib/generators/repres/bootstrap/platform/USAGE
65
+ - lib/generators/repres/bootstrap/platform/platform_generator.rb
66
+ - lib/generators/repres/bootstrap/platform/templates/app/controllers/concerns/priviledge_protection.rb
67
+ - lib/generators/repres/bootstrap/platform/templates/app/controllers/dashboards_controller.rb
68
+ - lib/generators/repres/bootstrap/platform/templates/app/controllers/privileged_controller.rb
69
+ - lib/generators/repres/bootstrap/platform/templates/app/views/layouts/platform.html.erb
70
+ - lib/generators/repres/bootstrap/platform/templates/app/views/shared/_script.html.erb
71
+ - lib/generators/repres/bootstrap/platform/templates/app/views/shared/_style.html.erb
72
+ - lib/generators/repres/bootstrap/platform/templates/config/routes.rb
63
73
  - lib/repres/bootstrap.rb
64
74
  - lib/repres/bootstrap/engine.rb
65
75
  - lib/repres/bootstrap/version.rb