rails_booking 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +165 -0
- data/README.md +28 -0
- data/Rakefile +32 -0
- data/app/assets/config/rails_booking_manifest.js +2 -0
- data/app/assets/javascripts/rails_booking/application.js +1 -0
- data/app/assets/javascripts/rails_booking/repeat_type.js +13 -0
- data/app/assets/stylesheets/rails_booking/application.css +15 -0
- data/app/controllers/rails_booking/base_controller.rb +5 -0
- data/app/controllers/rails_booking/time_controller.rb +12 -0
- data/app/helpers/rails_booking/application_helper.rb +4 -0
- data/app/jobs/rails_booking/application_job.rb +4 -0
- data/app/mailers/rails_booking/application_mailer.rb +6 -0
- data/app/models/rails_booking/concerns/the_booking_locate.rb +16 -0
- data/app/models/rails_booking/concerns/the_booking_time.rb +116 -0
- data/app/models/rails_booking/locate.rb +9 -0
- data/app/views/layouts/the_booking/application.html.erb +14 -0
- data/app/views/rails_booking/time/_finish_at.html.erb +1 -0
- data/app/views/rails_booking/time/_finish_at_once.html.erb +1 -0
- data/app/views/rails_booking/time/_form.html.erb +16 -0
- data/app/views/rails_booking/time/_month_checkboxes.html.erb +1 -0
- data/app/views/rails_booking/time/_start_at.html.erb +1 -0
- data/app/views/rails_booking/time/_start_at_once.html.erb +1 -0
- data/app/views/rails_booking/time/_week_checkboxes.html.erb +1 -0
- data/app/views/rails_booking/time/repeat_form.js.erb +14 -0
- data/config/routes.rb +9 -0
- data/lib/rails_booking.rb +5 -0
- data/lib/rails_booking/engine.rb +7 -0
- data/lib/rails_booking/version.rb +3 -0
- data/lib/tasks/the_booking_tasks.rake +4 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3b2dadb933e5d872b930a5e790b33e25f9a1edf5f075902913a38d56a2bc32bb
|
4
|
+
data.tar.gz: 412b00cd59a8e9bc505fafb85caf9a9cfcaede94135a0876a6afeb32bad5657a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fdd3d0341c195de89a884fde7298a1443664170fec9b57902cb130e68af1d410524a672424d09db001463e7f4faabdabe6996dbfb049bd5dfb92ffc821ec6b20
|
7
|
+
data.tar.gz: 8b8f83000eaca985311939eb14772b607e31fdbfdffd994e42e781175fc8c50fc71ee99e2c944d3cccd9c6a514b524862d928e3e1038a6b4cad78ee97be9d2df
|
data/LICENSE
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2018 MingyuanQin.
|
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
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# RailsBooking
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'rails_booking'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install rails_booking
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
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 = 'RailsBooking'
|
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 @@
|
|
1
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
//= require rails_com/fetch_xhr_script
|
2
|
+
|
3
|
+
$('[data-title="repeat_type"]').dropdown({
|
4
|
+
|
5
|
+
onChange: function(value, text, $selectedItem){
|
6
|
+
var repeat_url = new URL(window.location.origin);
|
7
|
+
repeat_url.pathname = 'repeat_form';
|
8
|
+
repeat_url.search = $.param({booking_type: this.dataset['bookingType'], repeat_type: value});
|
9
|
+
|
10
|
+
fetch_xhr_script(repeat_url)
|
11
|
+
}
|
12
|
+
|
13
|
+
});
|
@@ -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,12 @@
|
|
1
|
+
class RailsBooking::TimeController < RailsBooking::BaseController
|
2
|
+
skip_before_action :verify_authenticity_token, only: [:repeat_form]
|
3
|
+
|
4
|
+
def repeat_form
|
5
|
+
@booking = params[:booking_type].classify.constantize.new
|
6
|
+
@booking.repeat_type = params[:repeat_type]
|
7
|
+
if @booking.repeat_type_changed?
|
8
|
+
@booking.repeat_days = []
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module RailsBookingTime
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
#attribute :repeat_type, :string, default: ''
|
6
|
+
#attribute :repeat_days, :integer, array: true
|
7
|
+
#attribute :start_at, :datetime
|
8
|
+
#attribute :finish_at, :datetime
|
9
|
+
|
10
|
+
unless defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) && connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
11
|
+
serialize :repeat_days, Array
|
12
|
+
end
|
13
|
+
|
14
|
+
enum repeat_type: {
|
15
|
+
once: 'once',
|
16
|
+
week: 'week',
|
17
|
+
month: 'month'
|
18
|
+
}
|
19
|
+
|
20
|
+
validate :validate_finish_at
|
21
|
+
|
22
|
+
before_save :deal_repeat_days, if: -> { repeat_days_changed? }
|
23
|
+
end
|
24
|
+
|
25
|
+
def validate_finish_at
|
26
|
+
return unless self.respond_to?('finish_at')
|
27
|
+
return if finish_at.nil? && start_at.nil?
|
28
|
+
unless finish_at > start_at
|
29
|
+
self.errors.add :finish_at, 'Finish At Should large then Start at time!'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def deal_repeat_days
|
34
|
+
self.repeat_days = self.repeat_days.map(&:to_i)
|
35
|
+
end
|
36
|
+
|
37
|
+
def extra
|
38
|
+
{}
|
39
|
+
end
|
40
|
+
|
41
|
+
def next_start_time
|
42
|
+
if start_at.nil?
|
43
|
+
return start_at
|
44
|
+
end
|
45
|
+
if self.once?
|
46
|
+
self.start_at
|
47
|
+
else
|
48
|
+
self.next_start_at
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def next_finish_time
|
53
|
+
if finish_at.nil?
|
54
|
+
return finish_at
|
55
|
+
end
|
56
|
+
if self.once?
|
57
|
+
self.finish_at
|
58
|
+
else
|
59
|
+
self.next_finish_at
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def next_start_at
|
64
|
+
return if start_at.nil?
|
65
|
+
_next_day = self.next_day(Time.now)
|
66
|
+
_next_day.change(hour: start_at.hour, min: start_at.min, sec: start_at.sec)
|
67
|
+
end
|
68
|
+
|
69
|
+
def next_finish_at
|
70
|
+
return if finish_at.nil?
|
71
|
+
_next_day = self.next_day(Time.now)
|
72
|
+
_next_day.change(hour: finish_at.hour, min: finish_at.min, sec: finish_at.sec)
|
73
|
+
end
|
74
|
+
|
75
|
+
def next_day(datetime)
|
76
|
+
start_at_date = self.start_at.change(year: datetime.year, month: datetime.month, day: datetime.day)
|
77
|
+
|
78
|
+
if start_at_date > datetime
|
79
|
+
if self.repeat_type == 'week'
|
80
|
+
next_days = self.repeat_days.select { |day| day >= datetime.days_to_week_start }
|
81
|
+
else #if self.repeat_type == 'month'
|
82
|
+
next_days = self.repeat_days.select { |day| day >= datetime.day }
|
83
|
+
end
|
84
|
+
else
|
85
|
+
next_days = self.repeat_days.select { |day| day > datetime.day }
|
86
|
+
end
|
87
|
+
|
88
|
+
if next_days.size > 0
|
89
|
+
if self.repeat_type == 'week'
|
90
|
+
days_span = next_days[0] - datetime.days_to_week_start
|
91
|
+
day = datetime.beginning_of_week.days_since(days_span)
|
92
|
+
month = day.month
|
93
|
+
min = day.day
|
94
|
+
else
|
95
|
+
month = datetime.month
|
96
|
+
min = next_days[0]
|
97
|
+
end
|
98
|
+
|
99
|
+
next_day = datetime.change(month: month, day: min)
|
100
|
+
else
|
101
|
+
if self.repeat_type == 'week'
|
102
|
+
str = Date::DAYS_INTO_WEEK.key(self.repeat_days.min)
|
103
|
+
day = datetime.next_week(str)
|
104
|
+
month = day.month
|
105
|
+
min = day.day
|
106
|
+
else
|
107
|
+
month = datetime.next_month.month
|
108
|
+
min = self.repeat_days.min
|
109
|
+
end
|
110
|
+
|
111
|
+
next_day = datetime.change(month: month, day: min)
|
112
|
+
end
|
113
|
+
next_day
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The booking</title>
|
5
|
+
<%= stylesheet_link_tag "rails_booking/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "rails_booking/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= f.time_field :finish_at if f.object.respond_to?(:finish_at) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= f.datetime_local_field :finish_at if f.object.respond_to?(:finish_at) %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= f.select :repeat_type, options_for_select(f.object.class.options_i18n(:repeat_type), f.object.repeat_type || 'once'), {}, { data: { booking_type: f.object.class.base_class.name, title: 'repeat_type' } } %>
|
2
|
+
<% if f.object.repeat_type == 'month' %>
|
3
|
+
<%= render partial: 'rails_booking/time/month_checkboxes', locals: { f: f } %>
|
4
|
+
<% elsif f.object.repeat_type == 'week' %>
|
5
|
+
<%= render partial: 'rails_booking/time/week_checkboxes', locals: { f: f } %>
|
6
|
+
<% else %>
|
7
|
+
<div id="<%= f.object.class.base_class.name.underscore %>_repeat_days_wrapper"></div>
|
8
|
+
<% end %>
|
9
|
+
<% if ['once', nil].include? f.object.repeat_type %>
|
10
|
+
<%= f.datetime_local_field :start_at %>
|
11
|
+
<%= f.datetime_local_field :finish_at if f.object.respond_to?(:finish_at) %>
|
12
|
+
<% else %>
|
13
|
+
<%= f.time_field :start_at %>
|
14
|
+
<%= f.time_field :finish_at if f.object.respond_to?(:finish_at) %>
|
15
|
+
<% end %>
|
16
|
+
<%= f.submit %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= f.collection_check_boxes :repeat_days, 1..31, :to_i, :ordinalize, { include_hidden: false } %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= f.time_field :start_at %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= f.datetime_local_field :start_at %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= f.collection_check_boxes :repeat_days, Date::DAYS_INTO_WEEK, :second, :first, { include_hidden: false } %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<% form_object = default_form_object(@booking, on: { wrapper_id: true }) %>
|
2
|
+
<% if params[:repeat_type] == 'week' %>
|
3
|
+
$('#<%= @booking.class.base_class.name.underscore %>_repeat_days_wrapper').replaceWith('<%= j(render partial: 'rails_booking/time/week_checkboxes', locals: { f: form_object }) %>');
|
4
|
+
$('#<%= @booking.class.base_class.name.underscore %>_start_at_wrapper').replaceWith('<%= j(render partial: 'rails_booking/time/start_at', locals: { f: form_object }) %>');
|
5
|
+
$('#<%= @booking.class.base_class.name.underscore %>_finish_at_wrapper').replaceWith('<%= j(render partial: 'rails_booking/time/finish_at', locals: { f: form_object }) %>');
|
6
|
+
<% elsif params[:repeat_type] == 'month' %>
|
7
|
+
$('#<%= @booking.class.base_class.name.underscore %>_repeat_days_wrapper').replaceWith('<%= j(render partial: 'rails_booking/time/month_checkboxes', locals: { f: form_object }) %>');
|
8
|
+
$('#<%= @booking.class.base_class.name.underscore %>_start_at_wrapper').replaceWith('<%= j(render partial: 'rails_booking/time/start_at', locals: { f: form_object }) %>');
|
9
|
+
$('#<%= @booking.class.base_class.name.underscore %>_finish_at_wrapper').replaceWith('<%= j(render partial: 'rails_booking/time/finish_at', locals: { f: form_object }) %>');
|
10
|
+
<% elsif params[:repeat_type] == 'once' %>
|
11
|
+
$('#<%= @booking.class.base_class.name.underscore %>_repeat_days_wrapper').html('');
|
12
|
+
$('#<%= @booking.class.base_class.name.underscore %>_start_at_wrapper').replaceWith('<%= j(render partial: 'rails_booking/time/start_at_once', locals: { f: form_object }) %>');
|
13
|
+
$('#<%= @booking.class.base_class.name.underscore %>_finish_at_wrapper').replaceWith('<%= j(render partial: 'rails_booking/time/finish_at_once', locals: { f: form_object }) %>');
|
14
|
+
<% end %>
|
data/config/routes.rb
ADDED
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_booking
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- qinmingyuan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-09-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
- - "<="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5.0'
|
30
|
+
- - "<="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: sqlite3
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.3'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.3'
|
47
|
+
description: Description of RailsBooking.
|
48
|
+
email:
|
49
|
+
- mingyuan0715@foxmail.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- LICENSE
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- app/assets/config/rails_booking_manifest.js
|
58
|
+
- app/assets/javascripts/rails_booking/application.js
|
59
|
+
- app/assets/javascripts/rails_booking/repeat_type.js
|
60
|
+
- app/assets/stylesheets/rails_booking/application.css
|
61
|
+
- app/controllers/rails_booking/base_controller.rb
|
62
|
+
- app/controllers/rails_booking/time_controller.rb
|
63
|
+
- app/helpers/rails_booking/application_helper.rb
|
64
|
+
- app/jobs/rails_booking/application_job.rb
|
65
|
+
- app/mailers/rails_booking/application_mailer.rb
|
66
|
+
- app/models/rails_booking/concerns/the_booking_locate.rb
|
67
|
+
- app/models/rails_booking/concerns/the_booking_time.rb
|
68
|
+
- app/models/rails_booking/locate.rb
|
69
|
+
- app/views/layouts/the_booking/application.html.erb
|
70
|
+
- app/views/rails_booking/time/_finish_at.html.erb
|
71
|
+
- app/views/rails_booking/time/_finish_at_once.html.erb
|
72
|
+
- app/views/rails_booking/time/_form.html.erb
|
73
|
+
- app/views/rails_booking/time/_month_checkboxes.html.erb
|
74
|
+
- app/views/rails_booking/time/_start_at.html.erb
|
75
|
+
- app/views/rails_booking/time/_start_at_once.html.erb
|
76
|
+
- app/views/rails_booking/time/_week_checkboxes.html.erb
|
77
|
+
- app/views/rails_booking/time/repeat_form.js.erb
|
78
|
+
- config/routes.rb
|
79
|
+
- lib/rails_booking.rb
|
80
|
+
- lib/rails_booking/engine.rb
|
81
|
+
- lib/rails_booking/version.rb
|
82
|
+
- lib/tasks/the_booking_tasks.rake
|
83
|
+
homepage: https://github.com/yougexiangfa/rails_booking
|
84
|
+
licenses:
|
85
|
+
- LGPL-3.0
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.7.6
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Summary of RailsBooking.
|
107
|
+
test_files: []
|