qwer 0.1.1 → 0.1.3
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 +4 -4
- data/.idea/.rakeTasks +7 -0
- data/.idea/misc.xml +14 -0
- data/.idea/modules.xml +8 -0
- data/.idea/qwer.iml +162 -0
- data/lib/qwer.rb +41 -5
- data/lib/qwer/layout_helper.rb +28 -0
- data/lib/qwer/translater.rb +37 -0
- data/lib/qwer/version.rb +1 -1
- data/qwer-0.1.1.gem +0 -0
- data/qwer.gemspec +3 -0
- metadata +37 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6b40b603e5c2a2da893b6cc89b246cde193b9f14
|
|
4
|
+
data.tar.gz: b9fc369245768b2e85578aade0a668af175befe7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a685c749ce8a4d801029f562fd9b57cf35d27d8a0966b34eb6d0cd53babd521128d5023dd7da7dcd43d478ddfe8d989bb63275ec4122f0fafc675fc6dfffbe0
|
|
7
|
+
data.tar.gz: 2112b5091646bafa76133a9c7a6717a477d06eb3a95ae33a6f2f5c7b0b9b6012bb7c8011a0b0e92ba6d5193c5c97a01d568e969958c011a163f9c70318c0fcc8
|
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build qwer-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install qwer-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install qwer-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push qwer-0.1.0.gem to Rubygems" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/misc.xml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
|
4
|
+
<OptionsSetting value="true" id="Add" />
|
|
5
|
+
<OptionsSetting value="true" id="Remove" />
|
|
6
|
+
<OptionsSetting value="true" id="Checkout" />
|
|
7
|
+
<OptionsSetting value="true" id="Update" />
|
|
8
|
+
<OptionsSetting value="true" id="Status" />
|
|
9
|
+
<OptionsSetting value="true" id="Edit" />
|
|
10
|
+
<ConfirmationsSetting value="0" id="Add" />
|
|
11
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.3.1" project-jdk-type="RUBY_SDK" />
|
|
14
|
+
</project>
|
data/.idea/modules.xml
ADDED
data/.idea/qwer.iml
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
|
4
|
+
<configuration default="false" name="Qwer qwer 测试 方法 sayhi: qwer" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
|
5
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
|
6
|
+
<module name="qwer" />
|
|
7
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
|
8
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
|
9
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
10
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
11
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
|
12
|
+
<envs>
|
|
13
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
|
14
|
+
</envs>
|
|
15
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
|
16
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
17
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
|
18
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
19
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
20
|
+
</COVERAGE_PATTERN>
|
|
21
|
+
</EXTENSION>
|
|
22
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
|
23
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/qwer_spec.rb" />
|
|
24
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
|
25
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
|
26
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="Qwer qwer 测试 方法 sayhi" />
|
|
27
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
|
28
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
|
29
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
|
30
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
|
31
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
|
32
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
|
33
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
|
34
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
|
35
|
+
<method />
|
|
36
|
+
</configuration>
|
|
37
|
+
<configuration default="false" name="qiniu_util" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
|
|
38
|
+
<module name="qwer" />
|
|
39
|
+
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
|
40
|
+
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/lib/qwer" />
|
|
41
|
+
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
42
|
+
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
43
|
+
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
|
44
|
+
<envs />
|
|
45
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
|
46
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
47
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
|
48
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
49
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
50
|
+
</COVERAGE_PATTERN>
|
|
51
|
+
</EXTENSION>
|
|
52
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/lib/qwer/qiniu_util.rb" />
|
|
53
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
|
54
|
+
<method />
|
|
55
|
+
</configuration>
|
|
56
|
+
<configuration default="false" name="qwer" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
|
|
57
|
+
<module name="qwer" />
|
|
58
|
+
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
|
59
|
+
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/lib" />
|
|
60
|
+
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
61
|
+
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
62
|
+
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
|
63
|
+
<envs />
|
|
64
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
|
65
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
66
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
|
67
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
68
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
69
|
+
</COVERAGE_PATTERN>
|
|
70
|
+
</EXTENSION>
|
|
71
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/lib/qwer.rb" />
|
|
72
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
|
73
|
+
<method />
|
|
74
|
+
</configuration>
|
|
75
|
+
<configuration default="false" name="Qwer qwer 测试 测试: qwer" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
|
76
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
|
77
|
+
<module name="qwer" />
|
|
78
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
|
79
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
|
80
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
81
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
82
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
|
83
|
+
<envs>
|
|
84
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
|
85
|
+
</envs>
|
|
86
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
|
87
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
88
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
|
89
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
90
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
91
|
+
</COVERAGE_PATTERN>
|
|
92
|
+
</EXTENSION>
|
|
93
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
|
94
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/qwer_spec.rb" />
|
|
95
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
|
96
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
|
97
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="Qwer qwer 测试 测试" />
|
|
98
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
|
99
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
|
100
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
|
101
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
|
102
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
|
103
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
|
104
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
|
105
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
|
106
|
+
<method />
|
|
107
|
+
</configuration>
|
|
108
|
+
<configuration default="false" name="layout_helper" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
|
|
109
|
+
<module name="qwer" />
|
|
110
|
+
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
|
111
|
+
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/spec/qwer" />
|
|
112
|
+
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
113
|
+
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
114
|
+
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
|
115
|
+
<envs />
|
|
116
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
|
117
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
118
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
|
119
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
120
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
121
|
+
</COVERAGE_PATTERN>
|
|
122
|
+
</EXTENSION>
|
|
123
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/qwer/layout_helper.rb" />
|
|
124
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
|
125
|
+
<method />
|
|
126
|
+
</configuration>
|
|
127
|
+
</component>
|
|
128
|
+
<component name="NewModuleRootManager">
|
|
129
|
+
<content url="file://$MODULE_DIR$" />
|
|
130
|
+
<orderEntry type="inheritedJdk" />
|
|
131
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
132
|
+
<orderEntry type="library" scope="PROVIDED" name="actionview (v5.0.1, rbenv: 2.3.1) [gem]" level="application" />
|
|
133
|
+
<orderEntry type="library" scope="PROVIDED" name="activemodel (v5.0.1, rbenv: 2.3.1) [gem]" level="application" />
|
|
134
|
+
<orderEntry type="library" scope="PROVIDED" name="activerecord (v5.0.1, rbenv: 2.3.1) [gem]" level="application" />
|
|
135
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.0.1, rbenv: 2.3.1) [gem]" level="application" />
|
|
136
|
+
<orderEntry type="library" scope="PROVIDED" name="arel (v7.1.4, rbenv: 2.3.1) [gem]" level="application" />
|
|
137
|
+
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.2, rbenv: 2.3.1) [gem]" level="application" />
|
|
138
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.13.6, rbenv: 2.3.1) [gem]" level="application" />
|
|
139
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.0.4, rbenv: 2.3.1) [gem]" level="application" />
|
|
140
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, rbenv: 2.3.1) [gem]" level="application" />
|
|
141
|
+
<orderEntry type="library" scope="PROVIDED" name="erubis (v2.7.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
142
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.7.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
143
|
+
<orderEntry type="library" scope="PROVIDED" name="kaminari (v1.0.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
144
|
+
<orderEntry type="library" scope="PROVIDED" name="kaminari-actionview (v1.0.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
145
|
+
<orderEntry type="library" scope="PROVIDED" name="kaminari-activerecord (v1.0.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
146
|
+
<orderEntry type="library" scope="PROVIDED" name="kaminari-core (v1.0.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
147
|
+
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.0.3, rbenv: 2.3.1) [gem]" level="application" />
|
|
148
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.1.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
149
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.10.1, rbenv: 2.3.1) [gem]" level="application" />
|
|
150
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.7.0.1, rbenv: 2.3.1) [gem]" level="application" />
|
|
151
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.2, rbenv: 2.3.1) [gem]" level="application" />
|
|
152
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.0.3, rbenv: 2.3.1) [gem]" level="application" />
|
|
153
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, rbenv: 2.3.1) [gem]" level="application" />
|
|
154
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.5.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
155
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.5.4, rbenv: 2.3.1) [gem]" level="application" />
|
|
156
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.5.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
157
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.5.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
158
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.5.0, rbenv: 2.3.1) [gem]" level="application" />
|
|
159
|
+
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.5, rbenv: 2.3.1) [gem]" level="application" />
|
|
160
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.2, rbenv: 2.3.1) [gem]" level="application" />
|
|
161
|
+
</component>
|
|
162
|
+
</module>
|
data/lib/qwer.rb
CHANGED
|
@@ -1,10 +1,46 @@
|
|
|
1
1
|
require "qwer/version"
|
|
2
|
+
require 'qwer/translater'
|
|
2
3
|
|
|
3
4
|
module Qwer
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
class Tmodel
|
|
6
|
+
|
|
7
|
+
# 初始化
|
|
8
|
+
# page_size: 单页记录数
|
|
9
|
+
# page: 当前页数
|
|
10
|
+
def initialize(page_size, page)
|
|
11
|
+
@page_size = page_size
|
|
12
|
+
@page = page
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# 查询项创建
|
|
16
|
+
# params: 对表单的设置
|
|
17
|
+
# action: 表单action地址 | 必须
|
|
18
|
+
# charset: 设置字符集 | 默认值 UTF-8 | 可选
|
|
19
|
+
# new: 设置【新增】地址 | 可选
|
|
8
20
|
|
|
21
|
+
# data: 要查询的内容
|
|
22
|
+
# args : 其他参数
|
|
23
|
+
def table_seach(params, data,*args)
|
|
24
|
+
html_str = Translater.table_search(params, data)
|
|
25
|
+
html_str.html_safe
|
|
26
|
+
end
|
|
9
27
|
|
|
10
|
-
|
|
28
|
+
# 数据表创建
|
|
29
|
+
# table_head: 表头数据
|
|
30
|
+
# datas: 数据
|
|
31
|
+
# dname: 数据名称
|
|
32
|
+
# args: 其他参数
|
|
33
|
+
def table_data(table_head, dname, datas, *args)
|
|
34
|
+
html_str = Translater.table_data(table_head, dname, datas, *args)
|
|
35
|
+
html_str.html_safe
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# 分页
|
|
39
|
+
# 使用kaminary分页
|
|
40
|
+
# datas 查询的数据
|
|
41
|
+
def pager(datas)
|
|
42
|
+
html_str = "共#{datas.total_count}条 #{datas.total_pages}页#{paginate @companies}"
|
|
43
|
+
html_str.html_safe
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
module Qwer
|
|
4
|
+
require "qwer/version"
|
|
5
|
+
|
|
6
|
+
module Qwer
|
|
7
|
+
# Your code goes here...
|
|
8
|
+
def self.sayhi
|
|
9
|
+
puts "hello world"
|
|
10
|
+
end
|
|
11
|
+
module Helpers
|
|
12
|
+
def table_seach
|
|
13
|
+
'<h5 class="page-header">查询条件</h5>'
|
|
14
|
+
'<div class="dataTables_wrapper form-inline">
|
|
15
|
+
<div>
|
|
16
|
+
<form class="pjax-form" id="user_search" action="/users" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="✓">
|
|
17
|
+
<label class="control-label" for="q_邮箱:">邮箱:</label>
|
|
18
|
+
<input class="form-control" type="search" name="q[email_cont]" id="q_email_cont">
|
|
19
|
+
<a class="btn btn-success green" href="/users/new">新增</a>
|
|
20
|
+
<button type="submit" class="btn btn-info" data-toggle="modal" data-target="#search_model">查询</button>
|
|
21
|
+
</form>
|
|
22
|
+
</div>
|
|
23
|
+
</div>'
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Qwer
|
|
2
|
+
class Translater
|
|
3
|
+
def self.table_search(form_params, data_params)
|
|
4
|
+
html_str = "<form class='pjax-form' id='' action='#{form_params[:action]}' accept-charset='#{form_params[:charset] ||= 'UTF-8' }' method='#{form_params[:method]}'>
|
|
5
|
+
<input name='utf8' type='hidden' value='✓'>"
|
|
6
|
+
|
|
7
|
+
data_params.reject { |key, value| html_str += "<label class='control-label'>#{value}:</label><input class='form-control' type='search' name='#{key}' id='q_#{key}'>" }
|
|
8
|
+
|
|
9
|
+
html_str += "<a class='btn btn-success green' href='#{form_params[:new]}'>新增</a>" if form_params[:new]
|
|
10
|
+
html_str += "<button type='submit' class='btn btn-info' data-toggle='modal' data-target='#search_model'>查询</button> </form>"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.table_data(table_head, dname, datas, *args)
|
|
14
|
+
html_str = "<table class='table table-striped table-hover' id='editable-sample'><thead><tr><th>#</th>"
|
|
15
|
+
table_head.reject { |key, value| html_str += "<th>#{value}</th>" }
|
|
16
|
+
html_str += "<th>操作</th></tr></thead><tbody>"
|
|
17
|
+
datas.each_with_index do |data, index|
|
|
18
|
+
tr_html = "<tr>"
|
|
19
|
+
tr_html += "<td>#{sequence index}</td>"
|
|
20
|
+
table_head.reject { |key, value| tr_html += "<td>#{data["#{key}"]}</td>" }
|
|
21
|
+
tr_html += "<td>
|
|
22
|
+
<a class='label label-success' href='/#{dname}/#{data.id.to_s}/edit'>编辑</a>
|
|
23
|
+
<a data-confirm='确认要删除这条数据吗?' class='label label-danger' rel='nofollow' data-method='delete' href='/#{dname}/#{data.id.to_s}'>删除</a>
|
|
24
|
+
</td>"
|
|
25
|
+
tr_html += "</tr>"
|
|
26
|
+
html_str += tr_html
|
|
27
|
+
end
|
|
28
|
+
html_str += "</tbody></table>"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def self.sequence(index)
|
|
34
|
+
(@page.to_i - 1) * @page_size.to_i + index + 1
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/lib/qwer/version.rb
CHANGED
data/qwer-0.1.1.gem
ADDED
|
Binary file
|
data/qwer.gemspec
CHANGED
|
@@ -32,4 +32,7 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
|
|
33
33
|
spec.add_development_dependency "bundler", "~> 1.13"
|
|
34
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.5.0"
|
|
36
|
+
spec.add_development_dependency "kaminari", "~> 1.0.0"
|
|
37
|
+
|
|
35
38
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: qwer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- lidejian@skio.cn
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-02-
|
|
11
|
+
date: 2017-02-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -38,6 +38,34 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 3.5.0
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 3.5.0
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: kaminari
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 1.0.0
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 1.0.0
|
|
41
69
|
description: "'this is my first gem'"
|
|
42
70
|
email:
|
|
43
71
|
- lidejian
|
|
@@ -46,6 +74,10 @@ extensions: []
|
|
|
46
74
|
extra_rdoc_files: []
|
|
47
75
|
files:
|
|
48
76
|
- ".gitignore"
|
|
77
|
+
- ".idea/.rakeTasks"
|
|
78
|
+
- ".idea/misc.xml"
|
|
79
|
+
- ".idea/modules.xml"
|
|
80
|
+
- ".idea/qwer.iml"
|
|
49
81
|
- ".idea/vcs.xml"
|
|
50
82
|
- CODE_OF_CONDUCT.md
|
|
51
83
|
- Gemfile
|
|
@@ -55,7 +87,10 @@ files:
|
|
|
55
87
|
- bin/console
|
|
56
88
|
- bin/setup
|
|
57
89
|
- lib/qwer.rb
|
|
90
|
+
- lib/qwer/layout_helper.rb
|
|
91
|
+
- lib/qwer/translater.rb
|
|
58
92
|
- lib/qwer/version.rb
|
|
93
|
+
- qwer-0.1.1.gem
|
|
59
94
|
- qwer.gemspec
|
|
60
95
|
homepage: https://www.baidu.com
|
|
61
96
|
licenses:
|