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.
- checksums.yaml +4 -4
- data/LICENSE +165 -20
- data/README.md +4 -8
- data/app/{views/ship/admin/home/index.html.erb → assets/config/rails_ship_manifest.js} +0 -0
- data/app/models/rails_ship/address.rb +13 -0
- data/app/models/rails_ship/area.rb +65 -0
- data/app/models/rails_ship/shipment.rb +8 -0
- data/config/routes.rb +0 -64
- data/lib/rails_ship/engine.rb +0 -17
- data/lib/rails_ship/version.rb +3 -0
- data/lib/rails_ship.rb +5 -2
- data/lib/tasks/rails_ship_tasks.rake +4 -0
- metadata +29 -185
- data/app/controllers/ship/admin/addresses_controller.rb +0 -48
- data/app/controllers/ship/admin/base_controller.rb +0 -5
- data/app/controllers/ship/admin/home_controller.rb +0 -8
- data/app/controllers/ship/admin/packages_controller.rb +0 -43
- data/app/controllers/ship/admin/trade_items_controller.rb +0 -72
- data/app/controllers/ship/driver/base_controller.rb +0 -9
- data/app/controllers/ship/driver/favorites_controller.rb +0 -39
- data/app/controllers/ship/my/addresses_controller.rb +0 -58
- data/app/controllers/ship/my/base_controller.rb +0 -5
- data/app/controllers/ship/my/cars_controller.rb +0 -54
- data/app/controllers/ship/my/drivers_controller.rb +0 -38
- data/app/controllers/ship/my/favorites_controller.rb +0 -40
- data/app/controllers/ship/my/lines_controller.rb +0 -71
- data/app/controllers/ship/my/locations_controller.rb +0 -60
- data/app/controllers/ship/my/packages_controller.rb +0 -53
- data/app/controllers/ship/my/principal_addresses_controller.rb +0 -26
- data/app/controllers/ship/panel/base_controller.rb +0 -5
- data/app/controllers/ship/panel/lines_controller.rb +0 -53
- data/app/controllers/ship/panel/similars_controller.rb +0 -61
- data/app/jobs/ship/car_ocr_job.rb +0 -11
- data/app/jobs/ship/driver_ocr_job.rb +0 -11
- data/app/jobs/ship/location_geo_job.rb +0 -10
- data/app/models/ship/address.rb +0 -7
- data/app/models/ship/car.rb +0 -5
- data/app/models/ship/driver.rb +0 -5
- data/app/models/ship/ext/order.rb +0 -7
- data/app/models/ship/ext/trade_item.rb +0 -11
- data/app/models/ship/ext/user.rb +0 -15
- data/app/models/ship/favorite.rb +0 -5
- data/app/models/ship/line.rb +0 -5
- data/app/models/ship/line_similar.rb +0 -5
- data/app/models/ship/location.rb +0 -5
- data/app/models/ship/model/address.rb +0 -10
- data/app/models/ship/model/car.rb +0 -34
- data/app/models/ship/model/driver.rb +0 -45
- data/app/models/ship/model/favorite.rb +0 -14
- data/app/models/ship/model/line.rb +0 -28
- data/app/models/ship/model/line_similar.rb +0 -16
- data/app/models/ship/model/location.rb +0 -53
- data/app/models/ship/model/package.rb +0 -28
- data/app/models/ship/model/packaged.rb +0 -29
- data/app/models/ship/model/shipment.rb +0 -22
- data/app/models/ship/model/shipping.rb +0 -9
- data/app/models/ship/package.rb +0 -6
- data/app/models/ship/packaged.rb +0 -5
- data/app/models/ship/shipment.rb +0 -5
- data/app/models/ship.rb +0 -11
- data/app/views/admin/_ship_nav.html.erb +0 -11
- data/app/views/panel/_ship_nav.html.erb +0 -10
- data/app/views/ship/admin/addresses/_address.html.erb +0 -24
- data/app/views/ship/admin/addresses/_edit_form.html.erb +0 -3
- data/app/views/ship/admin/addresses/_form.html.erb +0 -9
- data/app/views/ship/admin/addresses/index.html.erb +0 -36
- data/app/views/ship/admin/base/_nav.html.erb +0 -3
- data/app/views/ship/admin/packages/_button.html.erb +0 -0
- data/app/views/ship/admin/packages/_edit_form.html.erb +0 -4
- data/app/views/ship/admin/packages/_filter_form.html.erb +0 -9
- data/app/views/ship/admin/packages/_form.html.erb +0 -5
- data/app/views/ship/admin/packages/_index_tbody.html.erb +0 -8
- data/app/views/ship/admin/packages/_index_thead.html.erb +0 -5
- data/app/views/ship/admin/packages/_new_form.html.erb +0 -4
- data/app/views/ship/admin/packages/_show_table.html.erb +0 -16
- data/app/views/ship/admin/packages/index.html.erb +0 -5
- data/app/views/ship/admin/rallies/_filter.html.erb +0 -7
- data/app/views/ship/admin/rallies/_form.html+phone.erb +0 -17
- data/app/views/ship/admin/rallies/_show_table.html+phone.erb +0 -24
- data/app/views/ship/admin/rallies/_show_table.html.erb +0 -12
- data/app/views/ship/admin/rallies/index.html+phone.erb +0 -26
- data/app/views/ship/admin/rallies/show.html.erb +0 -26
- data/app/views/ship/admin/trade_items/_filter.html.erb +0 -9
- data/app/views/ship/admin/trade_items/_form.html.erb +0 -7
- data/app/views/ship/admin/trade_items/_show_table.html.erb +0 -24
- data/app/views/ship/admin/trade_items/index.html.erb +0 -51
- data/app/views/ship/driver/favorites/_button.html+phone.erb +0 -4
- data/app/views/ship/driver/favorites/_edit_form.html.erb +0 -4
- data/app/views/ship/driver/favorites/_filter_form.html+phone.erb +0 -14
- data/app/views/ship/driver/favorites/_filter_form.html.erb +0 -9
- data/app/views/ship/driver/favorites/_form.html.erb +0 -3
- data/app/views/ship/driver/favorites/_index_tbody.html.erb +0 -6
- data/app/views/ship/driver/favorites/_index_thead.html.erb +0 -3
- data/app/views/ship/driver/favorites/_index_tr.html.erb +0 -4
- data/app/views/ship/driver/favorites/_new_form.html.erb +0 -4
- data/app/views/ship/driver/favorites/_show_table.html.erb +0 -8
- data/app/views/ship/driver/favorites/index.html.erb +0 -5
- data/app/views/ship/my/addresses/_edit_form.html.erb +0 -21
- data/app/views/ship/my/addresses/_form.html.erb +0 -23
- data/app/views/ship/my/addresses/index.html.erb +0 -44
- data/app/views/ship/my/cars/_edit_form.html.erb +0 -6
- data/app/views/ship/my/cars/_filter_form.html.erb +0 -9
- data/app/views/ship/my/cars/_index_tbody.html.erb +0 -3
- data/app/views/ship/my/cars/_index_thead.html.erb +0 -4
- data/app/views/ship/my/cars/_new_form.html.erb +0 -4
- data/app/views/ship/my/cars/_show_table.html.erb +0 -16
- data/app/views/ship/my/cars/create.turbo_stream.erb +0 -1
- data/app/views/ship/my/cars/index.html+phone.erb +0 -19
- data/app/views/ship/my/cars/index.html.erb +0 -5
- data/app/views/ship/my/cars/new.html.erb +0 -25
- data/app/views/ship/my/drivers/_edit_form.html.erb +0 -6
- data/app/views/ship/my/drivers/_form.html.erb +0 -4
- data/app/views/ship/my/drivers/_index_tbody.html.erb +0 -3
- data/app/views/ship/my/drivers/_index_thead.html.erb +0 -4
- data/app/views/ship/my/drivers/_new_form.html.erb +0 -4
- data/app/views/ship/my/drivers/_show_table.html.erb +0 -12
- data/app/views/ship/my/drivers/_uploader.html.erb +0 -22
- data/app/views/ship/my/drivers/edit.html.erb +0 -20
- data/app/views/ship/my/drivers/show.html.erb +0 -33
- data/app/views/ship/my/favorites/_button.html+phone.erb +0 -4
- data/app/views/ship/my/favorites/_edit_form.html.erb +0 -4
- data/app/views/ship/my/favorites/_filter_form.html+phone.erb +0 -14
- data/app/views/ship/my/favorites/_filter_form.html.erb +0 -9
- data/app/views/ship/my/favorites/_form.html.erb +0 -3
- data/app/views/ship/my/favorites/_index_tbody.html.erb +0 -6
- data/app/views/ship/my/favorites/_index_thead.html.erb +0 -3
- data/app/views/ship/my/favorites/_new_form.html.erb +0 -4
- data/app/views/ship/my/favorites/_show_table.html.erb +0 -8
- data/app/views/ship/my/favorites/index.html.erb +0 -5
- data/app/views/ship/my/lines/_edit_form.html.erb +0 -4
- data/app/views/ship/my/lines/_filter_form.html.erb +0 -1
- data/app/views/ship/my/lines/_form.html.erb +0 -3
- data/app/views/ship/my/lines/_index_tbody.html.erb +0 -6
- data/app/views/ship/my/lines/_index_tr.html.erb +0 -4
- data/app/views/ship/my/lines/_item_field.html.erb +0 -8
- data/app/views/ship/my/lines/_item_location.html.erb +0 -13
- data/app/views/ship/my/lines/_new_form.html.erb +0 -15
- data/app/views/ship/my/lines/_select/_tab_bar.html.erb +0 -10
- data/app/views/ship/my/lines/_select.html.erb +0 -10
- data/app/views/ship/my/lines/_show/_index_tbody.html.erb +0 -6
- data/app/views/ship/my/lines/_show/_index_tr.html+phone.erb +0 -6
- data/app/views/ship/my/lines/_show_table.html.erb +0 -9
- data/app/views/ship/my/lines/add.turbo_stream.erb +0 -1
- data/app/views/ship/my/lines/index.html.erb +0 -5
- data/app/views/ship/my/lines/new.html.erb +0 -1
- data/app/views/ship/my/lines/requirement.html.erb +0 -5
- data/app/views/ship/my/lines/select.turbo_stream.erb +0 -1
- data/app/views/ship/my/lines/show.html+phone.erb +0 -30
- data/app/views/ship/my/locations/_edit_form.html.erb +0 -4
- data/app/views/ship/my/locations/_filter_form.html.erb +0 -9
- data/app/views/ship/my/locations/_form.html.erb +0 -6
- data/app/views/ship/my/locations/_index_tbody.html.erb +0 -5
- data/app/views/ship/my/locations/_index_thead.html.erb +0 -6
- data/app/views/ship/my/locations/_new_form.html.erb +0 -4
- data/app/views/ship/my/locations/_show_table.html.erb +0 -20
- data/app/views/ship/my/locations/index.html.erb +0 -5
- data/app/views/ship/my/packages/index.html.erb +0 -31
- data/app/views/ship/my/principal_addresses/index.html+phone.erb +0 -32
- data/app/views/ship/my/principal_addresses/plans.html+phone.erb +0 -23
- data/app/views/ship/my/principal_addresses/show.html+phone.erb +0 -27
- data/app/views/ship/panel/base/_nav.html.erb +0 -3
- data/app/views/ship/panel/lines/_edit_form.html.erb +0 -4
- data/app/views/ship/panel/lines/_filter_form.html.erb +0 -9
- data/app/views/ship/panel/lines/_form.html.erb +0 -4
- data/app/views/ship/panel/lines/_index_tbody.html.erb +0 -4
- data/app/views/ship/panel/lines/_index_thead.html.erb +0 -5
- data/app/views/ship/panel/lines/_index_tr.html.erb +0 -19
- data/app/views/ship/panel/lines/_new_form.html.erb +0 -4
- data/app/views/ship/panel/lines/_show_table.html.erb +0 -12
- data/app/views/ship/panel/lines/index.html.erb +0 -5
- data/app/views/ship/panel/similars/_breadcrumb.html.erb +0 -7
- data/app/views/ship/panel/similars/_button.html.erb +0 -3
- data/app/views/ship/panel/similars/_edit_form.html.erb +0 -4
- data/app/views/ship/panel/similars/_filter_form.html.erb +0 -9
- data/app/views/ship/panel/similars/_form.html.erb +0 -4
- data/app/views/ship/panel/similars/_index_tbody.html.erb +0 -3
- data/app/views/ship/panel/similars/_index_thead.html.erb +0 -4
- data/app/views/ship/panel/similars/_new/_button.html.erb +0 -0
- data/app/views/ship/panel/similars/_new/_index_tr.html.erb +0 -10
- data/app/views/ship/panel/similars/_new/_index_tr_remove.html.erb +0 -10
- data/app/views/ship/panel/similars/_new_form.html.erb +0 -4
- data/app/views/ship/panel/similars/_show_table.html.erb +0 -12
- data/app/views/ship/panel/similars/create.turbo_stream.erb +0 -3
- data/app/views/ship/panel/similars/destroy.turbo_stream.erb +0 -3
- data/app/views/ship/panel/similars/index.html.erb +0 -5
- data/app/views/ship/panel/similars/new.html.erb +0 -16
- data/config/locales/zh.attributes.yml +0 -15
- data/config/locales/zh.yml +0 -51
- data/lib/rails_ship/config.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7bd27b030b8b72fec042fb7a74bebf6ecc567bd0e3194b87ab923e056715b55
|
4
|
+
data.tar.gz: 80de6ea4b2d35a34304c1ba1b2cdff2279c1c17c5d4375cf5ff5c8cdef8491ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d74eb976cc5f512139c8ba743e27c27729c7274ce0fc25cb6b21984023e97ccfb07d778af6c975ddde34167ce810ec86d673eb87a9ee9eed3acf04adc44d913e
|
7
|
+
data.tar.gz: 4a81d76f617bfbed5b766691c3c67436c25c3632bc005b812416b2a0acfc883967e35ad138f085cab4765e9a12608b06bc0f49ae7b3b5afcf9352dc9b4162a27
|
data/LICENSE
CHANGED
@@ -1,20 +1,165 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
the
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
30
26
|
|
31
|
-
##
|
32
|
-
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
File without changes
|
@@ -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
|
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
|
data/lib/rails_ship/engine.rb
CHANGED
@@ -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
|
data/lib/rails_ship.rb
CHANGED