rails_ship 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +165 -20
  3. data/README.md +4 -8
  4. data/app/{views/ship/admin/home/index.html.erb → assets/config/rails_ship_manifest.js} +0 -0
  5. data/app/models/rails_ship/address.rb +13 -0
  6. data/app/models/rails_ship/area.rb +65 -0
  7. data/app/models/rails_ship/shipment.rb +8 -0
  8. data/config/routes.rb +0 -64
  9. data/lib/rails_ship/engine.rb +0 -17
  10. data/lib/rails_ship/version.rb +3 -0
  11. data/lib/rails_ship.rb +5 -2
  12. data/lib/tasks/rails_ship_tasks.rake +4 -0
  13. metadata +29 -185
  14. data/app/controllers/ship/admin/addresses_controller.rb +0 -48
  15. data/app/controllers/ship/admin/base_controller.rb +0 -5
  16. data/app/controllers/ship/admin/home_controller.rb +0 -8
  17. data/app/controllers/ship/admin/packages_controller.rb +0 -43
  18. data/app/controllers/ship/admin/trade_items_controller.rb +0 -72
  19. data/app/controllers/ship/driver/base_controller.rb +0 -9
  20. data/app/controllers/ship/driver/favorites_controller.rb +0 -39
  21. data/app/controllers/ship/my/addresses_controller.rb +0 -58
  22. data/app/controllers/ship/my/base_controller.rb +0 -5
  23. data/app/controllers/ship/my/cars_controller.rb +0 -54
  24. data/app/controllers/ship/my/drivers_controller.rb +0 -38
  25. data/app/controllers/ship/my/favorites_controller.rb +0 -40
  26. data/app/controllers/ship/my/lines_controller.rb +0 -71
  27. data/app/controllers/ship/my/locations_controller.rb +0 -60
  28. data/app/controllers/ship/my/packages_controller.rb +0 -53
  29. data/app/controllers/ship/my/principal_addresses_controller.rb +0 -26
  30. data/app/controllers/ship/panel/base_controller.rb +0 -5
  31. data/app/controllers/ship/panel/lines_controller.rb +0 -53
  32. data/app/controllers/ship/panel/similars_controller.rb +0 -61
  33. data/app/jobs/ship/car_ocr_job.rb +0 -11
  34. data/app/jobs/ship/driver_ocr_job.rb +0 -11
  35. data/app/jobs/ship/location_geo_job.rb +0 -10
  36. data/app/models/ship/address.rb +0 -7
  37. data/app/models/ship/car.rb +0 -5
  38. data/app/models/ship/driver.rb +0 -5
  39. data/app/models/ship/ext/order.rb +0 -7
  40. data/app/models/ship/ext/trade_item.rb +0 -11
  41. data/app/models/ship/ext/user.rb +0 -15
  42. data/app/models/ship/favorite.rb +0 -5
  43. data/app/models/ship/line.rb +0 -5
  44. data/app/models/ship/line_similar.rb +0 -5
  45. data/app/models/ship/location.rb +0 -5
  46. data/app/models/ship/model/address.rb +0 -10
  47. data/app/models/ship/model/car.rb +0 -34
  48. data/app/models/ship/model/driver.rb +0 -45
  49. data/app/models/ship/model/favorite.rb +0 -14
  50. data/app/models/ship/model/line.rb +0 -28
  51. data/app/models/ship/model/line_similar.rb +0 -16
  52. data/app/models/ship/model/location.rb +0 -53
  53. data/app/models/ship/model/package.rb +0 -28
  54. data/app/models/ship/model/packaged.rb +0 -29
  55. data/app/models/ship/model/shipment.rb +0 -22
  56. data/app/models/ship/model/shipping.rb +0 -9
  57. data/app/models/ship/package.rb +0 -6
  58. data/app/models/ship/packaged.rb +0 -5
  59. data/app/models/ship/shipment.rb +0 -5
  60. data/app/models/ship.rb +0 -11
  61. data/app/views/admin/_ship_nav.html.erb +0 -11
  62. data/app/views/panel/_ship_nav.html.erb +0 -10
  63. data/app/views/ship/admin/addresses/_address.html.erb +0 -24
  64. data/app/views/ship/admin/addresses/_edit_form.html.erb +0 -3
  65. data/app/views/ship/admin/addresses/_form.html.erb +0 -9
  66. data/app/views/ship/admin/addresses/index.html.erb +0 -36
  67. data/app/views/ship/admin/base/_nav.html.erb +0 -3
  68. data/app/views/ship/admin/packages/_button.html.erb +0 -0
  69. data/app/views/ship/admin/packages/_edit_form.html.erb +0 -4
  70. data/app/views/ship/admin/packages/_filter_form.html.erb +0 -9
  71. data/app/views/ship/admin/packages/_form.html.erb +0 -5
  72. data/app/views/ship/admin/packages/_index_tbody.html.erb +0 -8
  73. data/app/views/ship/admin/packages/_index_thead.html.erb +0 -5
  74. data/app/views/ship/admin/packages/_new_form.html.erb +0 -4
  75. data/app/views/ship/admin/packages/_show_table.html.erb +0 -16
  76. data/app/views/ship/admin/packages/index.html.erb +0 -5
  77. data/app/views/ship/admin/rallies/_filter.html.erb +0 -7
  78. data/app/views/ship/admin/rallies/_form.html+phone.erb +0 -17
  79. data/app/views/ship/admin/rallies/_show_table.html+phone.erb +0 -24
  80. data/app/views/ship/admin/rallies/_show_table.html.erb +0 -12
  81. data/app/views/ship/admin/rallies/index.html+phone.erb +0 -26
  82. data/app/views/ship/admin/rallies/show.html.erb +0 -26
  83. data/app/views/ship/admin/trade_items/_filter.html.erb +0 -9
  84. data/app/views/ship/admin/trade_items/_form.html.erb +0 -7
  85. data/app/views/ship/admin/trade_items/_show_table.html.erb +0 -24
  86. data/app/views/ship/admin/trade_items/index.html.erb +0 -51
  87. data/app/views/ship/driver/favorites/_button.html+phone.erb +0 -4
  88. data/app/views/ship/driver/favorites/_edit_form.html.erb +0 -4
  89. data/app/views/ship/driver/favorites/_filter_form.html+phone.erb +0 -14
  90. data/app/views/ship/driver/favorites/_filter_form.html.erb +0 -9
  91. data/app/views/ship/driver/favorites/_form.html.erb +0 -3
  92. data/app/views/ship/driver/favorites/_index_tbody.html.erb +0 -6
  93. data/app/views/ship/driver/favorites/_index_thead.html.erb +0 -3
  94. data/app/views/ship/driver/favorites/_index_tr.html.erb +0 -4
  95. data/app/views/ship/driver/favorites/_new_form.html.erb +0 -4
  96. data/app/views/ship/driver/favorites/_show_table.html.erb +0 -8
  97. data/app/views/ship/driver/favorites/index.html.erb +0 -5
  98. data/app/views/ship/my/addresses/_edit_form.html.erb +0 -21
  99. data/app/views/ship/my/addresses/_form.html.erb +0 -23
  100. data/app/views/ship/my/addresses/index.html.erb +0 -44
  101. data/app/views/ship/my/cars/_edit_form.html.erb +0 -6
  102. data/app/views/ship/my/cars/_filter_form.html.erb +0 -9
  103. data/app/views/ship/my/cars/_index_tbody.html.erb +0 -3
  104. data/app/views/ship/my/cars/_index_thead.html.erb +0 -4
  105. data/app/views/ship/my/cars/_new_form.html.erb +0 -4
  106. data/app/views/ship/my/cars/_show_table.html.erb +0 -16
  107. data/app/views/ship/my/cars/create.turbo_stream.erb +0 -1
  108. data/app/views/ship/my/cars/index.html+phone.erb +0 -19
  109. data/app/views/ship/my/cars/index.html.erb +0 -5
  110. data/app/views/ship/my/cars/new.html.erb +0 -25
  111. data/app/views/ship/my/drivers/_edit_form.html.erb +0 -6
  112. data/app/views/ship/my/drivers/_form.html.erb +0 -4
  113. data/app/views/ship/my/drivers/_index_tbody.html.erb +0 -3
  114. data/app/views/ship/my/drivers/_index_thead.html.erb +0 -4
  115. data/app/views/ship/my/drivers/_new_form.html.erb +0 -4
  116. data/app/views/ship/my/drivers/_show_table.html.erb +0 -12
  117. data/app/views/ship/my/drivers/_uploader.html.erb +0 -22
  118. data/app/views/ship/my/drivers/edit.html.erb +0 -20
  119. data/app/views/ship/my/drivers/show.html.erb +0 -33
  120. data/app/views/ship/my/favorites/_button.html+phone.erb +0 -4
  121. data/app/views/ship/my/favorites/_edit_form.html.erb +0 -4
  122. data/app/views/ship/my/favorites/_filter_form.html+phone.erb +0 -14
  123. data/app/views/ship/my/favorites/_filter_form.html.erb +0 -9
  124. data/app/views/ship/my/favorites/_form.html.erb +0 -3
  125. data/app/views/ship/my/favorites/_index_tbody.html.erb +0 -6
  126. data/app/views/ship/my/favorites/_index_thead.html.erb +0 -3
  127. data/app/views/ship/my/favorites/_new_form.html.erb +0 -4
  128. data/app/views/ship/my/favorites/_show_table.html.erb +0 -8
  129. data/app/views/ship/my/favorites/index.html.erb +0 -5
  130. data/app/views/ship/my/lines/_edit_form.html.erb +0 -4
  131. data/app/views/ship/my/lines/_filter_form.html.erb +0 -1
  132. data/app/views/ship/my/lines/_form.html.erb +0 -3
  133. data/app/views/ship/my/lines/_index_tbody.html.erb +0 -6
  134. data/app/views/ship/my/lines/_index_tr.html.erb +0 -4
  135. data/app/views/ship/my/lines/_item_field.html.erb +0 -8
  136. data/app/views/ship/my/lines/_item_location.html.erb +0 -13
  137. data/app/views/ship/my/lines/_new_form.html.erb +0 -15
  138. data/app/views/ship/my/lines/_select/_tab_bar.html.erb +0 -10
  139. data/app/views/ship/my/lines/_select.html.erb +0 -10
  140. data/app/views/ship/my/lines/_show/_index_tbody.html.erb +0 -6
  141. data/app/views/ship/my/lines/_show/_index_tr.html+phone.erb +0 -6
  142. data/app/views/ship/my/lines/_show_table.html.erb +0 -9
  143. data/app/views/ship/my/lines/add.turbo_stream.erb +0 -1
  144. data/app/views/ship/my/lines/index.html.erb +0 -5
  145. data/app/views/ship/my/lines/new.html.erb +0 -1
  146. data/app/views/ship/my/lines/requirement.html.erb +0 -5
  147. data/app/views/ship/my/lines/select.turbo_stream.erb +0 -1
  148. data/app/views/ship/my/lines/show.html+phone.erb +0 -30
  149. data/app/views/ship/my/locations/_edit_form.html.erb +0 -4
  150. data/app/views/ship/my/locations/_filter_form.html.erb +0 -9
  151. data/app/views/ship/my/locations/_form.html.erb +0 -6
  152. data/app/views/ship/my/locations/_index_tbody.html.erb +0 -5
  153. data/app/views/ship/my/locations/_index_thead.html.erb +0 -6
  154. data/app/views/ship/my/locations/_new_form.html.erb +0 -4
  155. data/app/views/ship/my/locations/_show_table.html.erb +0 -20
  156. data/app/views/ship/my/locations/index.html.erb +0 -5
  157. data/app/views/ship/my/packages/index.html.erb +0 -31
  158. data/app/views/ship/my/principal_addresses/index.html+phone.erb +0 -32
  159. data/app/views/ship/my/principal_addresses/plans.html+phone.erb +0 -23
  160. data/app/views/ship/my/principal_addresses/show.html+phone.erb +0 -27
  161. data/app/views/ship/panel/base/_nav.html.erb +0 -3
  162. data/app/views/ship/panel/lines/_edit_form.html.erb +0 -4
  163. data/app/views/ship/panel/lines/_filter_form.html.erb +0 -9
  164. data/app/views/ship/panel/lines/_form.html.erb +0 -4
  165. data/app/views/ship/panel/lines/_index_tbody.html.erb +0 -4
  166. data/app/views/ship/panel/lines/_index_thead.html.erb +0 -5
  167. data/app/views/ship/panel/lines/_index_tr.html.erb +0 -19
  168. data/app/views/ship/panel/lines/_new_form.html.erb +0 -4
  169. data/app/views/ship/panel/lines/_show_table.html.erb +0 -12
  170. data/app/views/ship/panel/lines/index.html.erb +0 -5
  171. data/app/views/ship/panel/similars/_breadcrumb.html.erb +0 -7
  172. data/app/views/ship/panel/similars/_button.html.erb +0 -3
  173. data/app/views/ship/panel/similars/_edit_form.html.erb +0 -4
  174. data/app/views/ship/panel/similars/_filter_form.html.erb +0 -9
  175. data/app/views/ship/panel/similars/_form.html.erb +0 -4
  176. data/app/views/ship/panel/similars/_index_tbody.html.erb +0 -3
  177. data/app/views/ship/panel/similars/_index_thead.html.erb +0 -4
  178. data/app/views/ship/panel/similars/_new/_button.html.erb +0 -0
  179. data/app/views/ship/panel/similars/_new/_index_tr.html.erb +0 -10
  180. data/app/views/ship/panel/similars/_new/_index_tr_remove.html.erb +0 -10
  181. data/app/views/ship/panel/similars/_new_form.html.erb +0 -4
  182. data/app/views/ship/panel/similars/_show_table.html.erb +0 -12
  183. data/app/views/ship/panel/similars/create.turbo_stream.erb +0 -3
  184. data/app/views/ship/panel/similars/destroy.turbo_stream.erb +0 -3
  185. data/app/views/ship/panel/similars/index.html.erb +0 -5
  186. data/app/views/ship/panel/similars/new.html.erb +0 -16
  187. data/config/locales/zh.attributes.yml +0 -15
  188. data/config/locales/zh.yml +0 -51
  189. data/lib/rails_ship/config.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed2c568e3f960e452267781613935c718b0717ed1634bf30e327260f576b51a3
4
- data.tar.gz: d8e5e7e205539ad4f0c2b95dcd277f15b15a4ca71cfd1b8c556b6e61a39be1ce
3
+ metadata.gz: a7bd27b030b8b72fec042fb7a74bebf6ecc567bd0e3194b87ab923e056715b55
4
+ data.tar.gz: 80de6ea4b2d35a34304c1ba1b2cdff2279c1c17c5d4375cf5ff5c8cdef8491ef
5
5
  SHA512:
6
- metadata.gz: 53174a30f7f5ada7250eef14c528d8b53b80934f88f4782f6cb153989bc6e1d0259a0d994af1c51bf0dcc6af897bb26ac20166f591906d1417a64d84e593b25c
7
- data.tar.gz: 9cd1a62d72180c722a3f34a146a20f9e4046f688bffacf56351cf65b9361fe27301c018dde5dbbb3fb38f6a7148db4282e449626bac8831248175998533aef11
6
+ metadata.gz: d74eb976cc5f512139c8ba743e27c27729c7274ce0fc25cb6b21984023e97ccfb07d778af6c975ddde34167ce810ec86d673eb87a9ee9eed3acf04adc44d913e
7
+ data.tar.gz: 4a81d76f617bfbed5b766691c3c67436c25c3632bc005b812416b2a0acfc883967e35ad138f085cab4765e9a12608b06bc0f49ae7b3b5afcf9352dc9b4162a27
data/LICENSE CHANGED
@@ -1,20 +1,165 @@
1
- Copyright (c) 2018-Present Mingyuan Qin <mingyuan0715@foxmail.com>
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2018 Mingyuan Qin.
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/README.md CHANGED
@@ -1,8 +1,4 @@
1
1
  # RailsShip
2
-
3
- [![测试](https://github.com/work-design/rails_ship/actions/workflows/test.yml/badge.svg)](https://github.com/work-design/rails_ship/actions/workflows/test.yml)
4
- [![Docker构建](https://github.com/work-design/rails_ship/actions/workflows/cd.yml/badge.svg)](https://github.com/work-design/rails_ship/actions/workflows/cd.yml)
5
- [![Gem](https://github.com/work-design/rails_ship/actions/workflows/gempush.yml/badge.svg)](https://github.com/work-design/rails_ship/actions/workflows/gempush.yml)
6
2
  Short description and motivation.
7
3
 
8
4
  ## Usage
@@ -25,8 +21,8 @@ Or install it yourself as:
25
21
  $ gem install rails_ship
26
22
  ```
27
23
 
28
- ## 依赖
29
- * [rails_trade](https://github.com/work-design/rails_trade)
24
+ ## Contributing
25
+ Contribution directions go here.
30
26
 
31
- ## 许可证
32
- 遵循 [MIT](https://opensource.org/licenses/MIT) 协议
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,13 @@
1
+ class Address < ApplicationRecord
2
+ belongs_to :area, optional: true
3
+ belongs_to :buyer, polymorphic: true
4
+
5
+ enum kind: {
6
+ transport: 'transport',
7
+ forwarder: 'forwarder',
8
+ invoice: 'invoice'
9
+ }
10
+
11
+
12
+
13
+ end unless RailsTrade.config.disabled_models.include?('Address')
@@ -0,0 +1,65 @@
1
+ class Area < ApplicationRecord
2
+ has_many :provinces, -> { where(city: '').where.not(province: '') }, class_name: 'Area', primary_key: :nation, foreign_key: :nation, dependent: :destroy
3
+ has_many :cities, -> { where.not(city: '') }, class_name: 'Area', primary_key: :province, foreign_key: :province, dependent: :destroy
4
+
5
+ scope :all_provinces, -> { where(city: '').where.not(province: '')}
6
+
7
+ scope :popular, -> { where(popular: true) }
8
+
9
+ scope :nations, ->(region_name){ where(region: region_name).group(:nation).pluck(:nation, :nation) }
10
+ scope :provinces, ->(nation_name){ select(:province).distinct.where(nation: nation_name) }
11
+ scope :cities, ->(province_name){ select(:city).distinct.where(province: province_name) }
12
+
13
+ default_scope -> { where(published: true) }
14
+
15
+ after_commit :update_timestamp, :delete_cache, on: [:create, :update]
16
+
17
+ def self.list
18
+ Rails.cache.fetch('areas/list') do
19
+ nations.includes(provinces: :cities).map do |nation|
20
+ {
21
+ id: nation.id,
22
+ name: nation.nation,
23
+ provinces: nation.provinces.map do |province|
24
+ {
25
+ id: province.id,
26
+ name: province.province,
27
+ cities: province.cities.map do |city|
28
+ { id: city.id, name: city.city }
29
+ end
30
+ }
31
+ end
32
+ }
33
+ end
34
+ end
35
+ end
36
+
37
+ def self.timestamp
38
+ Rails.cache.fetch('areas/timestamp') do
39
+ order(updated_at: :desc).last.updated_at.to_i
40
+ end
41
+ end
42
+
43
+ def self.all_nations
44
+ Rails.cache.fetch('areas/all_nations') do
45
+ select(:nation).distinct.pluck(:nation)
46
+ end
47
+ end
48
+
49
+ private
50
+ def delete_cache
51
+ ['areas/list', 'areas/popular', 'areas/all_nations'].each do |c|
52
+ Rails.cache.delete(c)
53
+ end
54
+ end
55
+
56
+ def update_timestamp
57
+ t = self.updated_at.to_i
58
+ Rails.cache.write('areas/timestamp', t)
59
+ end
60
+
61
+ end unless RailsTrade.config.disabled_models.include?('Area')
62
+ # :region
63
+ # :nation
64
+ # :province
65
+ # :city
@@ -0,0 +1,8 @@
1
+ class Shipment < ApplicationRecord
2
+
3
+
4
+ def xx
5
+
6
+ end
7
+
8
+ end unless RailsTrade.config.disabled_models.include?('Shipment')
data/config/routes.rb CHANGED
@@ -1,66 +1,2 @@
1
1
  Rails.application.routes.draw do
2
-
3
- namespace :ship do
4
- namespace :panel do
5
- resources :similars
6
- end
7
- end
8
- namespace :ship do
9
- namespace :panel do
10
- resources :lines
11
- end
12
- end
13
- namespace :ship, defaults: { business: 'ship' } do
14
-
15
- namespace :panel, defaults: { namespace: 'panel' } do
16
- resources :lines do
17
- resources :similars
18
- end
19
- end
20
-
21
- namespace :admin, defaults: { namespace: 'admin' } do
22
- resources :addresses do
23
- resources :trade_items do
24
- collection do
25
- post :package
26
- end
27
- end
28
- end
29
- resources :packages, except: [:new, :create]
30
- resources :lines do
31
- resources :locations
32
- end
33
- root 'home#index'
34
- end
35
-
36
- namespace :driver, defaults: { namespace: 'driver' } do
37
- resources :favorites
38
- end
39
-
40
- namespace :my, defaults: { namespace: 'my' } do
41
- resource :driver
42
- resources :favorites
43
- resources :cars
44
- resources :lines do
45
- collection do
46
- get :requirement
47
- post :add
48
- post :select
49
- end
50
- resources :locations
51
- end
52
- resources :principal_addresses, only: [:index, :show] do
53
- member do
54
- get :plans
55
- end
56
- resources :packages do
57
- member do
58
- put :wait
59
- end
60
- end
61
- end
62
- end
63
-
64
- end
65
-
66
2
  end
@@ -1,21 +1,4 @@
1
- require 'rails_com'
2
-
3
1
  module RailsShip
4
2
  class Engine < ::Rails::Engine
5
-
6
- config.generators do |g|
7
- g.rails = {
8
- assets: false,
9
- stylesheets: false,
10
- helper: false,
11
- route: false
12
- }
13
- g.test_unit = {
14
- fixture: true,
15
- fixture_replacement: :factory_girl
16
- }
17
- g.templates.unshift File.expand_path('lib/templates', RailsCom::Engine.root)
18
- end
19
-
20
3
  end
21
4
  end
@@ -0,0 +1,3 @@
1
+ module RailsShip
2
+ VERSION = '0.1.0'
3
+ end
data/lib/rails_ship.rb CHANGED
@@ -1,2 +1,5 @@
1
- require 'rails_ship/engine'
2
- require 'rails_ship/config'
1
+ require "rails_ship/engine"
2
+
3
+ module RailsShip
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :rails_ship do
3
+ # # Task goes here
4
+ # end