rails_wait 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +32 -0
- data/app/controllers/wait/admin/base_controller.rb +4 -0
- data/app/controllers/wait/admin/wait_taxons_controller.rb +51 -0
- data/app/models/wait/ext/wait_for.rb +10 -0
- data/app/models/wait/ext/waiting.rb +10 -0
- data/app/models/wait/item.rb +5 -0
- data/app/models/wait/list.rb +5 -0
- data/app/models/wait/model/address.rb +10 -0
- data/app/models/wait/model/item.rb +37 -0
- data/app/models/wait/model/list.rb +19 -0
- data/app/models/wait/model/taxon.rb +14 -0
- data/app/models/wait/taxon.rb +5 -0
- data/app/models/wait.rb +11 -0
- data/app/views/wait/admin/wait_taxons/_edit_form.html.erb +4 -0
- data/app/views/wait/admin/wait_taxons/_filter_form.html.erb +9 -0
- data/app/views/wait/admin/wait_taxons/_form.html.erb +2 -0
- data/app/views/wait/admin/wait_taxons/_index_tbody.html.erb +1 -0
- data/app/views/wait/admin/wait_taxons/_index_thead.html.erb +2 -0
- data/app/views/wait/admin/wait_taxons/_new_form.html.erb +4 -0
- data/app/views/wait/admin/wait_taxons/_show_table.html.erb +4 -0
- data/app/views/wait/admin/wait_taxons/index.html.erb +5 -0
- data/config/routes.rb +9 -0
- data/lib/rails_wait/config.rb +9 -0
- data/lib/rails_wait/engine.rb +19 -0
- data/lib/rails_wait/version.rb +3 -0
- data/lib/rails_wait.rb +2 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1120234fb7b5428c4a32c0b9203506ea993356478d00da693dc0016a1cdaa017
|
4
|
+
data.tar.gz: 7eed416ee9a459b86069f42ba0173f76b2d1e5b4d3252a81aa91148ca2177268
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e2f891049cb317e52580926a974075b90057585bb8393c861e36909e141985057d21d1f40e4b4633c4940cd9f0baaa98523bf49d79eebd58830ddc98a73acb13
|
7
|
+
data.tar.gz: cff29b6ce32638156b77315277dd3c4fd8112fcea36f8a19acdb83a0702b4a91ecfd01793a8a99b48b65768d60e6029309d73b3e4b0ecf55d247f7bddb6cd487
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2020-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.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# RailsWait
|
2
|
+
|
3
|
+
适用于预约及排队场景。
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
How to use my plugin.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rails_wait'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
```bash
|
17
|
+
$ bundle
|
18
|
+
```
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
```bash
|
22
|
+
$ gem install rails_wait
|
23
|
+
```
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
Contribution directions go here.
|
27
|
+
|
28
|
+
## License
|
29
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'RailsWait'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
task default: :test
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Wait
|
2
|
+
class Admin::WaitTaxonsController < Admin::BaseController
|
3
|
+
before_action :set_wait_taxon, only: [:show, :edit, :update, :destroy]
|
4
|
+
|
5
|
+
def index
|
6
|
+
@wait_taxons = WaitTaxon.page(params[:page])
|
7
|
+
end
|
8
|
+
|
9
|
+
def new
|
10
|
+
@wait_taxon = WaitTaxon.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def create
|
14
|
+
@wait_taxon = WaitTaxon.new(wait_taxon_params)
|
15
|
+
|
16
|
+
unless @wait_taxon.save
|
17
|
+
render :new, locals: { model: @wait_taxon }, status: :unprocessable_entity
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def show
|
22
|
+
end
|
23
|
+
|
24
|
+
def edit
|
25
|
+
end
|
26
|
+
|
27
|
+
def update
|
28
|
+
@wait_taxon.assign_attributes(wait_taxon_params)
|
29
|
+
|
30
|
+
unless @wait_taxon.save
|
31
|
+
render :edit, locals: { model: @wait_taxon }, status: :unprocessable_entity
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def destroy
|
36
|
+
@wait_taxon.destroy
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
def set_wait_taxon
|
41
|
+
@wait_taxon = WaitTaxon.find(params[:id])
|
42
|
+
end
|
43
|
+
|
44
|
+
def wait_taxon_params
|
45
|
+
params.fetch(:wait_taxon, {}).permit(
|
46
|
+
:name
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Wait
|
2
|
+
module Model::Item
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
acts_as_list scope: :list_id
|
7
|
+
|
8
|
+
attribute :state, :string
|
9
|
+
attribute :position, :integer
|
10
|
+
|
11
|
+
belongs_to :user
|
12
|
+
belongs_to :list, counter_cache: true
|
13
|
+
|
14
|
+
after_save_commit :to_notice, if: -> { saved_change_to_volunteer_id? && volunteer }
|
15
|
+
acts_as_notify(
|
16
|
+
:default,
|
17
|
+
only: [:position],
|
18
|
+
methods: [:state_i18n, :address]
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
def address
|
23
|
+
"#{list.address.content}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_notice
|
27
|
+
to_notification(
|
28
|
+
receiver: user,
|
29
|
+
title: '您的快递已备好',
|
30
|
+
body: '请即刻出发前往领取',
|
31
|
+
link: url_helpers.my_wait_item_url(id),
|
32
|
+
verbose: true
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Wait
|
2
|
+
module Model::List
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attribute :state, :string
|
7
|
+
attribute :start_at, :datetime
|
8
|
+
attribute :finish_at, :datetime
|
9
|
+
attribute :items_count, :integer, default: 0
|
10
|
+
|
11
|
+
belongs_to :address
|
12
|
+
belongs_to :wait_for, polymorphic: true, optional: true
|
13
|
+
belongs_to :taxon, optional: true
|
14
|
+
belongs_to :organ, optional: true
|
15
|
+
has_many :items, dependent: :destroy
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/app/models/wait.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= form_with theme: 'search', model: Wait::WaitTaxon.new do |f| %>
|
2
|
+
<div class="field-body">
|
3
|
+
<%= f.text_field :name %>
|
4
|
+
<div class="field is-narrow">
|
5
|
+
<%= f.submit %>
|
6
|
+
<%= link_to t('.clear'), filter_params(except: [:name]), class: 'button is-light' %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<td><%= model.name %></td>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails_com'
|
2
|
+
module RailsWait
|
3
|
+
class Engine < ::Rails::Engine
|
4
|
+
|
5
|
+
config.generators do |g|
|
6
|
+
g.rails = {
|
7
|
+
assets: false,
|
8
|
+
stylesheets: false,
|
9
|
+
helper: false
|
10
|
+
}
|
11
|
+
g.test_unit = {
|
12
|
+
fixture: true,
|
13
|
+
fixture_replacement: :factory_bot
|
14
|
+
}
|
15
|
+
g.templates.unshift File.expand_path('lib/templates', RailsCom::Engine.root)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/lib/rails_wait.rb
ADDED
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_wait
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- qinmingyuan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails_extend
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Description of RailsWait.
|
28
|
+
email:
|
29
|
+
- mingyuan0715@foxmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- app/controllers/wait/admin/base_controller.rb
|
38
|
+
- app/controllers/wait/admin/wait_taxons_controller.rb
|
39
|
+
- app/models/wait.rb
|
40
|
+
- app/models/wait/ext/wait_for.rb
|
41
|
+
- app/models/wait/ext/waiting.rb
|
42
|
+
- app/models/wait/item.rb
|
43
|
+
- app/models/wait/list.rb
|
44
|
+
- app/models/wait/model/address.rb
|
45
|
+
- app/models/wait/model/item.rb
|
46
|
+
- app/models/wait/model/list.rb
|
47
|
+
- app/models/wait/model/taxon.rb
|
48
|
+
- app/models/wait/taxon.rb
|
49
|
+
- app/views/wait/admin/wait_taxons/_edit_form.html.erb
|
50
|
+
- app/views/wait/admin/wait_taxons/_filter_form.html.erb
|
51
|
+
- app/views/wait/admin/wait_taxons/_form.html.erb
|
52
|
+
- app/views/wait/admin/wait_taxons/_index_tbody.html.erb
|
53
|
+
- app/views/wait/admin/wait_taxons/_index_thead.html.erb
|
54
|
+
- app/views/wait/admin/wait_taxons/_new_form.html.erb
|
55
|
+
- app/views/wait/admin/wait_taxons/_show_table.html.erb
|
56
|
+
- app/views/wait/admin/wait_taxons/index.html.erb
|
57
|
+
- config/routes.rb
|
58
|
+
- lib/rails_wait.rb
|
59
|
+
- lib/rails_wait/config.rb
|
60
|
+
- lib/rails_wait/engine.rb
|
61
|
+
- lib/rails_wait/version.rb
|
62
|
+
homepage: https://github.com/work-design/rails_wait
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata: {}
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubygems_version: 3.2.22
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Summary of RailsWait.
|
85
|
+
test_files: []
|