auctify 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +229 -0
- data/Rakefile +34 -0
- data/app/assets/config/auctify_manifest.js +1 -0
- data/app/assets/javascripts/folio/console/main_app.coffee +1 -0
- data/app/assets/stylesheets/auctify/application.css +15 -0
- data/app/assets/stylesheets/auctify/bidder_registrations.css +4 -0
- data/app/assets/stylesheets/auctify/bids.css +4 -0
- data/app/assets/stylesheets/auctify/sales.css +4 -0
- data/app/assets/stylesheets/auctify/sales_packs.css +4 -0
- data/app/assets/stylesheets/folio/console/_main_app.sass +1 -0
- data/app/assets/stylesheets/scaffold.css +80 -0
- data/app/cells/folio/console/atoms/previews/main_app.coffee +1 -0
- data/app/concerns/auctify/behavior/base.rb +20 -0
- data/app/concerns/auctify/behavior/buyer.rb +16 -0
- data/app/concerns/auctify/behavior/item.rb +27 -0
- data/app/concerns/auctify/behavior/seller.rb +36 -0
- data/app/concerns/auctify/sale/auction_callbacks.rb +44 -0
- data/app/controllers/auctify/api/v1/auctions_controller.rb +61 -0
- data/app/controllers/auctify/api/v1/base_controller.rb +22 -0
- data/app/controllers/auctify/api/v1/console/bids_controller.rb +37 -0
- data/app/controllers/auctify/application_controller.rb +8 -0
- data/app/controllers/auctify/bidder_registrations_controller.rb +65 -0
- data/app/controllers/auctify/bids_controller.rb +64 -0
- data/app/controllers/auctify/sales_controller.rb +75 -0
- data/app/controllers/auctify/sales_packs_controller.rb +75 -0
- data/app/helpers/auctify/application_helper.rb +10 -0
- data/app/helpers/auctify/bidder_registrations_helper.rb +6 -0
- data/app/helpers/auctify/bids_helper.rb +6 -0
- data/app/helpers/auctify/sales_helper.rb +15 -0
- data/app/helpers/auctify/sales_packs_helper.rb +6 -0
- data/app/jobs/auctify/application_job.rb +6 -0
- data/app/jobs/auctify/bidding_closer_job.rb +23 -0
- data/app/jobs/auctify/bidding_is_close_to_end_notifier_job.rb +29 -0
- data/app/mailers/auctify/application_mailer.rb +8 -0
- data/app/models/auctify/application_record.rb +14 -0
- data/app/models/auctify/behaviors.rb +27 -0
- data/app/models/auctify/bid.rb +72 -0
- data/app/models/auctify/bidder_registration.rb +84 -0
- data/app/models/auctify/sale/auction.rb +404 -0
- data/app/models/auctify/sale/base.rb +210 -0
- data/app/models/auctify/sale/retail.rb +97 -0
- data/app/models/auctify/sales_pack.rb +101 -0
- data/app/serializers/auctify/sale/auction_serializer.rb +46 -0
- data/app/services/auctify/bids_appender.rb +241 -0
- data/app/services/auctify/service_base.rb +78 -0
- data/app/types/auctify/minimal_bids_ladder_type.rb +77 -0
- data/app/views/auctify/api/v1/console/bids/index.html.erb +1 -0
- data/app/views/auctify/api/v1/console/bids/show.html.erb +1 -0
- data/app/views/auctify/bidder_registrations/_form.html.erb +27 -0
- data/app/views/auctify/bidder_registrations/edit.html.erb +6 -0
- data/app/views/auctify/bidder_registrations/index.html.erb +33 -0
- data/app/views/auctify/bidder_registrations/new.html.erb +5 -0
- data/app/views/auctify/bidder_registrations/show.html.erb +24 -0
- data/app/views/auctify/bids/_form.html.erb +32 -0
- data/app/views/auctify/bids/edit.html.erb +6 -0
- data/app/views/auctify/bids/index.html.erb +31 -0
- data/app/views/auctify/bids/new.html.erb +5 -0
- data/app/views/auctify/bids/show.html.erb +19 -0
- data/app/views/auctify/sales/_form.html.erb +32 -0
- data/app/views/auctify/sales/edit.html.erb +6 -0
- data/app/views/auctify/sales/index.html.erb +36 -0
- data/app/views/auctify/sales/new.html.erb +5 -0
- data/app/views/auctify/sales/show.html.erb +19 -0
- data/app/views/auctify/sales_packs/_form.html.erb +57 -0
- data/app/views/auctify/sales_packs/edit.html.erb +6 -0
- data/app/views/auctify/sales_packs/index.html.erb +40 -0
- data/app/views/auctify/sales_packs/new.html.erb +5 -0
- data/app/views/auctify/sales_packs/show.html.erb +44 -0
- data/app/views/layouts/auctify/application.html.erb +15 -0
- data/config/locales/auctify.cs.yml +121 -0
- data/config/locales/default.cs.yml +220 -0
- data/config/locales/default.en.yml +215 -0
- data/config/routes.rb +23 -0
- data/db/migrate/20210212163000_create_auctify_sales.rb +16 -0
- data/db/migrate/20210216151350_add_type_to_auctify_sales.rb +7 -0
- data/db/migrate/20210217101246_add_state_to_auctify_sales.rb +7 -0
- data/db/migrate/20210217110819_add_prices_to_auctify_sales.rb +9 -0
- data/db/migrate/20210222103031_add_published_at_to_auctify_sale.rb +7 -0
- data/db/migrate/20210223090240_create_auctify_bidder_registrations.rb +15 -0
- data/db/migrate/20210223152139_create_auctify_bids.rb +13 -0
- data/db/migrate/20210225103227_add_bid_steps_ladder_to_auctify_sales.rb +7 -0
- data/db/migrate/20210412114319_add_reserve_price_to_auctify_sales.rb +7 -0
- data/db/migrate/20210416140603_create_auctify_sales_packs.rb +17 -0
- data/db/migrate/20210416141111_add_pack_reference_to_auctify_sales.rb +7 -0
- data/db/migrate/20210419075003_add_ends_at_to_auctify_sales.rb +7 -0
- data/db/migrate/20210419082800_add_position_to_auctify_sales.rb +8 -0
- data/db/migrate/20210419083321_add_indexes.rb +12 -0
- data/db/migrate/20210421093652_add_number_to_auctify_sales.rb +7 -0
- data/db/migrate/20210423071326_removing_polymorphic_assoc_sale_to_item.rb +7 -0
- data/db/migrate/20210423071534_add_currently_ends_at_to_auctify_sales.rb +7 -0
- data/db/migrate/20210427121353_change_column_published_on_auctify_sale.rb +15 -0
- data/db/migrate/20210427122315_add_featured_to_auctify_sales.rb +7 -0
- data/db/migrate/20210428045651_add_sales_bool_indices.rb +9 -0
- data/db/migrate/20210428064615_allow_seller_to_be_nil.rb +13 -0
- data/db/migrate/20210429051508_add_sales_pack_start_and_end.rb +15 -0
- data/db/migrate/20210430080419_add_sales_slug.rb +11 -0
- data/db/migrate/20210503095704_add_cancelled_to_auctify_bids.rb +7 -0
- data/db/migrate/20210504072041_add_commission_and_contract_to_auctify_sales.rb +8 -0
- data/db/migrate/20210506064100_add_winner_to_auctify_sales.rb +7 -0
- data/db/migrate/20210506072438_add_bids_count_to_auctify_sales.rb +7 -0
- data/db/migrate/20210507085845_rename_bids_count_to_applied_bids_count.rb +7 -0
- data/db/migrate/20210510063146_add_dont_confirm_bids_to_registrations.rb +7 -0
- data/db/migrate/20210511081556_add_index_on_cancelled_on.rb +7 -0
- data/db/migrate/20210512162942_add_sold_at_to_auctify_sales.rb +7 -0
- data/db/migrate/20210607113440_add_commission_in_percent_to_sales_packs.rb +7 -0
- data/db/migrate/20210617062509_add_index_to_auctify_sales_currently_ends_at.rb +7 -0
- data/db/migrate/20210625125732_add_current_winner_to_auctify_sales.rb +7 -0
- data/lib/auctify.rb +7 -0
- data/lib/auctify/configuration.rb +43 -0
- data/lib/auctify/engine.rb +25 -0
- data/lib/auctify/version.rb +5 -0
- data/lib/tasks/auctify_tasks.rake +23 -0
- metadata +442 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c19c38113580070b4a0e6d9914b22c042fb3024e2a96193a7004fd61859985c3
|
4
|
+
data.tar.gz: '080f74640d3c40935a0faf304c120cb294e896e000ffa1cc822a769d077f3fbf'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b5dc577b91bd6ba035187bbf272f52f744a6ee7832c90c998e27c7eb63324c98b7bfa1eecb259f21522d0dae8accde3ef112a8166d58bc2ece2a6cbfd6edafa2
|
7
|
+
data.tar.gz: 67f7b5f692569e542eaa5a59727e15c9e602a1d022c69156046acf7e343f4f5acecad42b1e7adfd44bc8b7bb317dcd293bb5aec7c4d9d6e28078b829e24dd8b7
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2021 foton
|
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,229 @@
|
|
1
|
+
# Auctify
|
2
|
+
Rails engine for auctions of items. Can be used on any ActiveRecord models.
|
3
|
+
|
4
|
+
## Objects
|
5
|
+
- `:item` - object/model, which should be auctioned (from `main_app`)
|
6
|
+
- `:user` - source for `seller`, `owner`, `buyer` and `bidder` (from `main_app`)
|
7
|
+
- `sale` - sale of `:item`; can be direct `retail`, by `auction` or some other type
|
8
|
+
- `auction` for one `:item` (it is [Forward auction](https://en.wikipedia.org/wiki/Forward_auction)) (v češtině "Položka aukce")
|
9
|
+
- `seller` - person/company which sells `:item` in specific `sale`
|
10
|
+
- `bidder` - registered person/user allowed to bid in specific `auction`
|
11
|
+
- `buyer` - person/company which buys `:item` in specific `sale` ( eg. winner of auction)
|
12
|
+
- `bid` - one bid of one `bidder` in `auction`
|
13
|
+
- `sales_pack` - pack of sales(auctions), mostly time framed, Can have physical location or be online. (v češtině "Aukce")
|
14
|
+
- `auctioneer` - (needed?) company organizing `auction`
|
15
|
+
|
16
|
+
## Relations
|
17
|
+
- `:item` 1 : 0-N `sale`, (sale time periods cannot overlap)
|
18
|
+
- `:item` N : 1 `owner` (can change in time)
|
19
|
+
- `sale` N : 1 `seller`
|
20
|
+
- `sale` N : 1 `buyer`
|
21
|
+
- `sale::auction` 1 : N `bidders` (trough `bidder_registrations`) 1 : N `bids`
|
22
|
+
- `sales_pack` 0-1 : N `sales` (`sales_pack` is optional for `sale`)
|
23
|
+
- `auction` N : 1 `auctioneer` (?)
|
24
|
+
|
25
|
+
|
26
|
+
## Classes
|
27
|
+
### Sales
|
28
|
+
- `Sale::Auction` - full body auction of one item for many registered buyer (as bidders)
|
29
|
+
- `Sale::Retail` - direct sale of item to one buyer
|
30
|
+
|
31
|
+
## TODO
|
32
|
+
- generator to copy auction's views to main app (so they can be modified) (engine checks main_app views first)
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
## Notices
|
37
|
+
`sale belongs_to item` polymorphic , STI typed
|
38
|
+
`sale belongs_to seller` polymorphic
|
39
|
+
`sale belongs_to buyer` polymorphic
|
40
|
+
`auction has_many bidder_registrations` (?bidders?)
|
41
|
+
`bidder_registration belongs buyer` polymorphic
|
42
|
+
|
43
|
+
If `item.owner` exists, it is used as `auction.seller` (or Select from all aucitfied sellers)
|
44
|
+
|
45
|
+
## Features required
|
46
|
+
|
47
|
+
- if bidder adds bid in `:prolonging_limit` minutes before auction ends, end time is extended for `bid.time + prolonging_limit` (so auction end when there are no bids in last `:prolonging_limit` minutes)
|
48
|
+
- for each auction, there can be set of rules for minimal `bid` according to current `auctioned_price` (default can be `(1..Infinity) => 1`)
|
49
|
+
real example
|
50
|
+
```
|
51
|
+
minimal_bids = {
|
52
|
+
(0...5_000) => 100,
|
53
|
+
(5_000...20_000) => 500,
|
54
|
+
(20_000...100_000) => 1_000,
|
55
|
+
(100_000...500_000) => 5_000,
|
56
|
+
(500_000...1_000_000) => 10_000,
|
57
|
+
(1_000_000...2_000_000) => 50_000,
|
58
|
+
(2_000_000..) => 100_000
|
59
|
+
}
|
60
|
+
```
|
61
|
+
- first bid do not increase `auctioned_price` it stays on `base_price`
|
62
|
+
- bidder cannot "overbid" themselves (no following bids from same bidder)
|
63
|
+
- auctioneer can define format of auction numbers (eg. "YY#####") and sales_pack numbers
|
64
|
+
- there should be ability to follow `auction` (notification before end) or `item.author` (new item in auction)
|
65
|
+
- item can have category and user can select auction by categories.
|
66
|
+
- SalePack can be `(un)published /public`
|
67
|
+
- SalePack can be `open (adding items , bidding)/ closed(bidding ended)`
|
68
|
+
- auctioneer_commission is in % and adds to sold_price in checkout
|
69
|
+
- auction have `start_time` and `end_time`
|
70
|
+
- auction can be `highlighted` for cover pages
|
71
|
+
- auction stores all bids history even those cancelled by admin
|
72
|
+
- there should be two types of bid
|
73
|
+
- one with maximal price (amount => maximal bid price; placed in small bids as needed), system will increase bid automagicaly unless it reaches maximum
|
74
|
+
- second direct bid (amount => bid price; immediattely placed)
|
75
|
+
- sales numbering: YY#### (210001, 210002, …, 259999)
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
## Usage
|
82
|
+
In `ActiveRecord` model use class method `auctify_as` with params `:buyer`,`:seller`, `:item`.
|
83
|
+
```ruby
|
84
|
+
class User < ApplicationRecord
|
85
|
+
auctify_as :buyer, :seller # this will add method like `sales`, `puchases` ....
|
86
|
+
end
|
87
|
+
|
88
|
+
class Painting < ApplicationRecord
|
89
|
+
auctify_as :item # this will add method like `sales` ....
|
90
|
+
end
|
91
|
+
```
|
92
|
+
`Auctify` expects that auctifyied model instances responds to `to_label` and `:item` to reponds to `owner` (which should lead to object auctified as `:seller`)!
|
93
|
+
|
94
|
+
## Installation
|
95
|
+
1. ### Add gem
|
96
|
+
Add this line to your application's Gemfile:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
gem 'auctify'
|
100
|
+
```
|
101
|
+
|
102
|
+
And then execute:
|
103
|
+
```bash
|
104
|
+
$ bundle
|
105
|
+
```
|
106
|
+
|
107
|
+
Or install it yourself as:
|
108
|
+
```bash
|
109
|
+
$ gem install auctify
|
110
|
+
```
|
111
|
+
|
112
|
+
2. ### Auctify classes
|
113
|
+
```ruby
|
114
|
+
class User < ApplicationRecord
|
115
|
+
auctify_as :buyer, :seller # this will add method like `sales`, `puchases` ....
|
116
|
+
end
|
117
|
+
|
118
|
+
class Painting < ApplicationRecord
|
119
|
+
auctify_as :item # this will add method like `sales` ....
|
120
|
+
end
|
121
|
+
```
|
122
|
+
|
123
|
+
3. ### Configure
|
124
|
+
- optional
|
125
|
+
```ruby
|
126
|
+
Auctify.configure do |config|
|
127
|
+
config.autoregister_as_bidders_all_instances_of_classes = ["User"] # default is []
|
128
|
+
config.auction_prolonging_limit = 10.minutes # default is 1.minute
|
129
|
+
config.auctioneer_commission_in_percent = 10 # so buyer will pay: auction.current_price * ((100 + 10)/100)
|
130
|
+
config.autofinish_auction_after_bidding = true # after `auction.close_bidding!` immediatelly proces result to `auction.sold_in_auction!` or `auction.not_sold_in_auction!`; default false
|
131
|
+
config.when_to_notify_bidders_before_end_of_bidding = 30.minutes # default `nil` => no notifying
|
132
|
+
config.restrict_overbidding_yourself_to_max_price_increasing = false # default is `true` so only bids with `max_price` can be applied if You are winner.
|
133
|
+
end
|
134
|
+
```
|
135
|
+
|
136
|
+
If model autified as `:buyer` responds to `:bidding_allowed?` , check is done before each `auction.bid!`. Also if `buyer.bidding_allowed? => true` , registration to auction is created on first bid.
|
137
|
+
4. ### Callbacks
|
138
|
+
For available auction callback methods to override see `app/concerns/auctify/sale/auction_callbacks.rb`
|
139
|
+
|
140
|
+
|
141
|
+
5. ### Use directly
|
142
|
+
```ruby
|
143
|
+
banksy = User.find_by(nickname: "Banksy")
|
144
|
+
bidder1 = User.find_by(nickname: "Bidder1")
|
145
|
+
bidder2 = User.find_by(nickname: "Bidder2")
|
146
|
+
piece = Painting.find_by(title: "Love is in the bin")
|
147
|
+
|
148
|
+
piece.owner == banksy # => (not actually) :true
|
149
|
+
|
150
|
+
auction = banksy.offer_to_sale!(piece, { in: :auction, price: 100 })
|
151
|
+
|
152
|
+
auction.offered? # => :true
|
153
|
+
auction.item == piece # => :true
|
154
|
+
auction.seller == banksy # => :true
|
155
|
+
auction.offered_price # => 100.0
|
156
|
+
|
157
|
+
banksy.sales # => [auction]
|
158
|
+
banksy.auction_sales # => [auction]
|
159
|
+
banksy.retail_sales # => []
|
160
|
+
|
161
|
+
pieces.sales # => [auction]
|
162
|
+
|
163
|
+
auction.bidder_registrations # => [] unless config.autoregister_as_bidders_all_instances_of_classes is set
|
164
|
+
auction.bidder_registrations.create(bidder: bidder1) # => error, not allowed ("Aukce aktuálně nepovoluje nové registrace")
|
165
|
+
|
166
|
+
auction.accept_offer!
|
167
|
+
|
168
|
+
b1_reg = auction.bidder_registrations.create(bidder: bidder1)
|
169
|
+
b2_reg = auction.bidder_registrations.create(bidder: bidder2)
|
170
|
+
|
171
|
+
auction.bidder_registrations.size # => 2
|
172
|
+
auction.current_price # => nil
|
173
|
+
|
174
|
+
auction.start_sale!
|
175
|
+
auction.current_price # => 100.0
|
176
|
+
|
177
|
+
aucion.bid!(Auctify::Bid.new(registration: b1_reg, price: nil, max_price: 150))
|
178
|
+
# auction.bid_appended! is called after succesfull bid, You can override it
|
179
|
+
# auction.bid_not_appended!(errors) is called after unsuccesfull bid, You can override it
|
180
|
+
|
181
|
+
auction.current_price # => 100.0
|
182
|
+
auction.bidding_result.winner # => bidder1
|
183
|
+
auction.bidding_result.current_price # => 100.0
|
184
|
+
auction.bidding_result.current_minimal_bid # => 101.0 `auction.bid_steps_ladder` is empty, we increasing by 1
|
185
|
+
|
186
|
+
aucion.bid!(Auctify::Bid.new(registration: b2_reg, price: 145, max_price: nil))
|
187
|
+
# some auto bidding is done
|
188
|
+
auction.current_price # => 146.0
|
189
|
+
auction.bidding_result.winner # => bidder1
|
190
|
+
auction.bidding_result.current_price # => 146.0
|
191
|
+
auction.bidding_result.current_minimal_bid # => 147.0
|
192
|
+
auction.winner # => nil
|
193
|
+
|
194
|
+
aucion.bid!(Auctify::Bid.new(registration: b2_reg, price: 149, max_price: 155))
|
195
|
+
# some auto bidding is done
|
196
|
+
auction.current_price # => 151.0
|
197
|
+
auction.bidding_result.winner # => bidder2
|
198
|
+
auction.bidding_result.current_price # => 151.0
|
199
|
+
auction.bidding_result.current_minimal_bid # => 152.0
|
200
|
+
|
201
|
+
auction.close_bidding!
|
202
|
+
auction.bidding_ended? # => true
|
203
|
+
auction.buyer # => nil
|
204
|
+
auction.winner # => bidder2
|
205
|
+
|
206
|
+
auction.sold_in_auction!(buyer: bidder2, price: 149, sold_at: currently_ends_at) # it is verified against bids!
|
207
|
+
|
208
|
+
auction.auctioned_successfully? # => true
|
209
|
+
auction.buyer # => bidder2
|
210
|
+
|
211
|
+
# when all negotiations went well
|
212
|
+
auction.sell!
|
213
|
+
|
214
|
+
auction.sold? # => true
|
215
|
+
```
|
216
|
+
|
217
|
+
Look into tests `test/models/auctify/sale/auction_bidding_test.rb` and `test/services/auctify/bid_appender_test.rb` for more info about bidding process.
|
218
|
+
|
219
|
+
To protect accidential deletions, many associations are binded with `dependent: restrict_with_error`. Correct order ofdeletion is `bids` => `sales` => `sales_packs`.
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
## Contributing
|
224
|
+
Contribution directions go here.
|
225
|
+
|
226
|
+
## License
|
227
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
228
|
+
|
229
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require "bundler/setup"
|
5
|
+
rescue LoadError
|
6
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
7
|
+
end
|
8
|
+
|
9
|
+
require "rdoc/task"
|
10
|
+
|
11
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
12
|
+
rdoc.rdoc_dir = "rdoc"
|
13
|
+
rdoc.title = "Auctify"
|
14
|
+
rdoc.options << "--line-numbers"
|
15
|
+
rdoc.rdoc_files.include("README.md")
|
16
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
17
|
+
end
|
18
|
+
|
19
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
20
|
+
load "rails/tasks/engine.rake"
|
21
|
+
|
22
|
+
load "rails/tasks/statistics.rake"
|
23
|
+
|
24
|
+
require "bundler/gem_tasks"
|
25
|
+
|
26
|
+
require "rake/testtask"
|
27
|
+
|
28
|
+
Rake::TestTask.new(:test) do |t|
|
29
|
+
t.libs << "test"
|
30
|
+
t.pattern = "test/**/*_test.rb"
|
31
|
+
t.verbose = false
|
32
|
+
end
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/auctify .css
|
@@ -0,0 +1 @@
|
|
1
|
+
# Override in main app
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
// Override in main app
|
@@ -0,0 +1,80 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
margin: 33px;
|
5
|
+
}
|
6
|
+
|
7
|
+
body, p, ol, ul, td {
|
8
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
9
|
+
font-size: 13px;
|
10
|
+
line-height: 18px;
|
11
|
+
}
|
12
|
+
|
13
|
+
pre {
|
14
|
+
background-color: #eee;
|
15
|
+
padding: 10px;
|
16
|
+
font-size: 11px;
|
17
|
+
}
|
18
|
+
|
19
|
+
a {
|
20
|
+
color: #000;
|
21
|
+
}
|
22
|
+
|
23
|
+
a:visited {
|
24
|
+
color: #666;
|
25
|
+
}
|
26
|
+
|
27
|
+
a:hover {
|
28
|
+
color: #fff;
|
29
|
+
background-color: #000;
|
30
|
+
}
|
31
|
+
|
32
|
+
th {
|
33
|
+
padding-bottom: 5px;
|
34
|
+
}
|
35
|
+
|
36
|
+
td {
|
37
|
+
padding: 0 5px 7px;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.field,
|
41
|
+
div.actions {
|
42
|
+
margin-bottom: 10px;
|
43
|
+
}
|
44
|
+
|
45
|
+
#notice {
|
46
|
+
color: green;
|
47
|
+
}
|
48
|
+
|
49
|
+
.field_with_errors {
|
50
|
+
padding: 2px;
|
51
|
+
background-color: red;
|
52
|
+
display: table;
|
53
|
+
}
|
54
|
+
|
55
|
+
#error_explanation {
|
56
|
+
width: 450px;
|
57
|
+
border: 2px solid red;
|
58
|
+
padding: 7px 7px 0;
|
59
|
+
margin-bottom: 20px;
|
60
|
+
background-color: #f0f0f0;
|
61
|
+
}
|
62
|
+
|
63
|
+
#error_explanation h2 {
|
64
|
+
text-align: left;
|
65
|
+
font-weight: bold;
|
66
|
+
padding: 5px 5px 5px 15px;
|
67
|
+
font-size: 12px;
|
68
|
+
margin: -7px -7px 0;
|
69
|
+
background-color: #c00;
|
70
|
+
color: #fff;
|
71
|
+
}
|
72
|
+
|
73
|
+
#error_explanation ul li {
|
74
|
+
font-size: 12px;
|
75
|
+
list-style: square;
|
76
|
+
}
|
77
|
+
|
78
|
+
label {
|
79
|
+
display: block;
|
80
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
# Override in main app
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Auctify
|
4
|
+
module Behavior
|
5
|
+
module Base
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
def auctify_id
|
9
|
+
"#{self.class.name}@#{id}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def object_from_auctify_id(auctify_id)
|
13
|
+
return nil if auctify_id.blank?
|
14
|
+
|
15
|
+
klass, id = auctify_id.to_s.split("@")
|
16
|
+
klass.constantize.find(id)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|