fullcalendar 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +20 -0
- data/LICENSE.txt +21 -0
- data/README.md +110 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fullcalendar.gemspec +26 -0
- data/lib/fullcalendar.rb +73 -0
- data/lib/fullcalendar/engine.rb +9 -0
- data/lib/fullcalendar/version.rb +3 -0
- data/lib/generators/fullcalendar/install_generator.rb +61 -0
- data/lib/generators/fullcalendar/templates/default.js.tt +11 -0
- data/lib/generators/fullcalendar/templates/default.scss.tt +3 -0
- data/vendor/assets/javascripts/fullcalendar.js +14933 -0
- data/vendor/assets/javascripts/fullcalendar.min.js +12 -0
- data/vendor/assets/javascripts/fullcalendar/gcal.js +324 -0
- data/vendor/assets/javascripts/fullcalendar/gcal.min.js +6 -0
- data/vendor/assets/javascripts/fullcalendar/locale-all.js +6 -0
- data/vendor/assets/javascripts/fullcalendar/locale/af.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ar-dz.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ar-kw.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ar-ly.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ar-ma.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ar-sa.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ar-tn.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ar.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/bg.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ca.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/cs.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/da.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/de-at.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/de-ch.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/de.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/el.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/en-au.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/en-ca.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/en-gb.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/en-ie.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/en-nz.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/es-do.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/es-us.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/es.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/et.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/eu.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/fa.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/fi.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/fr-ca.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/fr-ch.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/fr.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/gl.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/he.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/hi.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/hr.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/hu.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/id.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/is.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/it.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ja.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/kk.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ko.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/lb.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/lt.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/lv.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/mk.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ms-my.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ms.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/nb.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/nl-be.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/nl.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/nn.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/pl.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/pt-br.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/pt.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ro.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/ru.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/sk.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/sl.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/sq.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/sr-cyrl.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/sr.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/sv.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/th.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/tr.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/uk.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/vi.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/zh-cn.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/locale/zh-tw.js +1 -0
- data/vendor/assets/javascripts/fullcalendar/scheduler.js +6331 -0
- data/vendor/assets/javascripts/fullcalendar/scheduler.min.js +9 -0
- data/vendor/assets/stylesheets/fullcalendar.css +1265 -0
- data/vendor/assets/stylesheets/fullcalendar.min.css +5 -0
- data/vendor/assets/stylesheets/fullcalendar.print.css +176 -0
- data/vendor/assets/stylesheets/fullcalendar.print.min.css +9 -0
- data/vendor/assets/stylesheets/fullcalendar/scheduler.css +463 -0
- data/vendor/assets/stylesheets/fullcalendar/scheduler.min.css +5 -0
- metadata +170 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0b2f5a4677893283caf958d7351356f1b68d46411d7ba33723342981a5154d2d
|
4
|
+
data.tar.gz: fef0ad90ef8c22b134f35560edafb08f24ce1ef3a5c6def94c6cfb34cae247b5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 69dee466cb2061c9ce144c05fb96f61393428baf8b5f599d2ff06e2e18cb9bd74da4d2699768d97b189788deb8b1019ddba3dc70958546bed895b994eeb044dd
|
7
|
+
data.tar.gz: 335d4f93533baa5c911f0b80626fac89e5d2be56cf750ded9cf997aa8c53f125b8c910bf77072e59c8bd782471414dec62d4249175be76a2e969639c0280a587
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at khairi@labs.my. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fullcalendar (3.8.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
rake (10.5.0)
|
10
|
+
|
11
|
+
PLATFORMS
|
12
|
+
ruby
|
13
|
+
|
14
|
+
DEPENDENCIES
|
15
|
+
bundler (~> 1.16)
|
16
|
+
fullcalendar!
|
17
|
+
rake (~> 10.0)
|
18
|
+
|
19
|
+
BUNDLED WITH
|
20
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 @company
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# Fullcalendar Ruby Gem
|
2
|
+
|
3
|
+
This gem just includes [fullcalendar](https://fullcalendar.io/) and [scheduler](https://fullcalendar.io/scheduler/) as an asset in rails applications or other ruby frameworks
|
4
|
+
[Fullcaledar-scheduler](https://fullcalendar.io/scheduler/) is not free for commercial use, so make sure you have a valid [license](https://fullcalendar.io/scheduler/license/) to use scheduler.
|
5
|
+
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Fullcalendar JavaScript depends on jQuery and moment js. If you're using Rails 5.1+, add the jquery-rails gem to your Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'jquery-rails'
|
13
|
+
gem 'momentjs-rails'
|
14
|
+
```
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'fullcalendar'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install fullcalendar
|
29
|
+
|
30
|
+
|
31
|
+
## Install generator
|
32
|
+
|
33
|
+
### command
|
34
|
+
```ruby
|
35
|
+
rails g fullcalendar:install
|
36
|
+
```
|
37
|
+
|
38
|
+
this generator will:
|
39
|
+
- 1. append ```//= require calendar ``` add `app/assets/javascripts/application.js`
|
40
|
+
- 2. append ```*= require calendar ``` add `app/assets/stylesheets/application.css`
|
41
|
+
- 3. create calendar.js in ```app/assets/javascripts/```
|
42
|
+
- 4. create calendar.scss in ```app/assets/stylesheets/```
|
43
|
+
|
44
|
+
## Manual install
|
45
|
+
|
46
|
+
### JavaScripts
|
47
|
+
|
48
|
+
Include the JavaScript in your `app/assets/javascripts/application.js`:
|
49
|
+
```
|
50
|
+
//= require jquery
|
51
|
+
//= require calendar
|
52
|
+
|
53
|
+
```
|
54
|
+
create new file `app/assets/javascripts/calendar.js`
|
55
|
+
```
|
56
|
+
//Core component
|
57
|
+
//= require fullcalendar
|
58
|
+
// optional locale
|
59
|
+
//= require fullcalendar/locale/ms
|
60
|
+
|
61
|
+
//Optional addon scheduler
|
62
|
+
//= require fullcalendar/scheduler
|
63
|
+
|
64
|
+
```
|
65
|
+
|
66
|
+
### Stylesheets
|
67
|
+
Include the stylesheet in your `app/assets/stylesheets/application.css`:
|
68
|
+
```
|
69
|
+
*= require calendar
|
70
|
+
```
|
71
|
+
|
72
|
+
or if you using scss
|
73
|
+
|
74
|
+
Include the stylesheet in your `app/assets/stylesheets/application.scss`:
|
75
|
+
```scss
|
76
|
+
@import 'calendar';
|
77
|
+
```
|
78
|
+
|
79
|
+
Create new file `app/assets/stylesheets/calendar.scss`
|
80
|
+
```scss
|
81
|
+
@import 'fullcalendar';
|
82
|
+
@import 'fullcalendar/scheduler';
|
83
|
+
```
|
84
|
+
|
85
|
+
### Initialization
|
86
|
+
Where needed in your JavaScripts, initialize your fullcalendar:
|
87
|
+
|
88
|
+
```js
|
89
|
+
$(document).ready(function() {
|
90
|
+
$("#calendar").fullcalendar();
|
91
|
+
});
|
92
|
+
```
|
93
|
+
|
94
|
+
## Usage
|
95
|
+
see fullcalendar documentations [here](https://fullcalendar.io/docs)
|
96
|
+
|
97
|
+
## Contributing
|
98
|
+
|
99
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fullcalendar. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
100
|
+
|
101
|
+
## License
|
102
|
+
|
103
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
104
|
+
Fullcalendar and Scheduler, which makes up the majority of this gem, has its own, separate licensing agreement.
|
105
|
+
- Fullcalendar [Read license](https://github.com/fullcalendar/fullcalendar/blob/master/LICENSE.txt)
|
106
|
+
- Scheduler [Read license](https://github.com/fullcalendar/fullcalendar-scheduler/blob/master/LICENSE.md)
|
107
|
+
|
108
|
+
## Code of Conduct
|
109
|
+
|
110
|
+
Everyone interacting in the Fullcalendar project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/fullcalendar/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "fullcalendar"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "fullcalendar/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fullcalendar"
|
8
|
+
spec.version = Fullcalendar::VERSION
|
9
|
+
spec.authors = ["mkhairi"]
|
10
|
+
spec.email = ["khairi@labs.my"]
|
11
|
+
|
12
|
+
spec.summary = %q{Gemified Fullcalendar, scheduler assets for rails and etc.}
|
13
|
+
spec.description = %q{Use Fullcalendar, scheduler in asset pipeline with ease}
|
14
|
+
spec.homepage = "https://github.com/mkhairi/fullcalendar"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
data/lib/fullcalendar.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
require "fullcalendar/version"
|
2
|
+
|
3
|
+
module Fullcalendar
|
4
|
+
#thanks to bootstrap-rubygem
|
5
|
+
class << self
|
6
|
+
# Inspired by Kaminari
|
7
|
+
def load!
|
8
|
+
if rails?
|
9
|
+
register_rails_engine
|
10
|
+
elsif hanami?
|
11
|
+
register_hanami
|
12
|
+
elsif sprockets?
|
13
|
+
register_sprockets
|
14
|
+
end
|
15
|
+
|
16
|
+
configure_sass
|
17
|
+
end
|
18
|
+
|
19
|
+
# Paths
|
20
|
+
def gem_path
|
21
|
+
@gem_path ||= File.expand_path '..', File.dirname(__FILE__)
|
22
|
+
end
|
23
|
+
|
24
|
+
def stylesheets_path
|
25
|
+
File.join assets_path, 'stylesheets'
|
26
|
+
end
|
27
|
+
|
28
|
+
def javascripts_path
|
29
|
+
File.join assets_path, 'javascripts'
|
30
|
+
end
|
31
|
+
|
32
|
+
def assets_path
|
33
|
+
@assets_path ||= File.join gem_path, 'vendor/assets'
|
34
|
+
end
|
35
|
+
|
36
|
+
# Environment detection helpers
|
37
|
+
def sprockets?
|
38
|
+
defined?(::Sprockets)
|
39
|
+
end
|
40
|
+
|
41
|
+
def rails?
|
42
|
+
defined?(::Rails)
|
43
|
+
end
|
44
|
+
|
45
|
+
def hanami?
|
46
|
+
defined?(::Hanami)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def configure_sass
|
52
|
+
require 'sass'
|
53
|
+
|
54
|
+
::Sass.load_paths << stylesheets_path
|
55
|
+
end
|
56
|
+
|
57
|
+
def register_rails_engine
|
58
|
+
require 'fullcalendar/engine'
|
59
|
+
end
|
60
|
+
|
61
|
+
def register_sprockets
|
62
|
+
Sprockets.append_path(stylesheets_path)
|
63
|
+
Sprockets.append_path(javascripts_path)
|
64
|
+
end
|
65
|
+
|
66
|
+
def register_hanami
|
67
|
+
Hanami::Assets.sources << assets_path
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
Fullcalendar.load!
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Fullcalendar
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
desc "This generator installs fullcalendar to the rails asset pipeline"
|
7
|
+
|
8
|
+
argument :style, :type => :string, :default => 'default'
|
9
|
+
# needed for thor templates
|
10
|
+
source_root File.expand_path("../templates", __FILE__)
|
11
|
+
|
12
|
+
def add_assets
|
13
|
+
js_manifest = 'app/assets/javascripts/application.js'
|
14
|
+
css_manifest = 'app/assets/stylesheets/application.css'
|
15
|
+
scss_manifest = 'app/assets/stylesheets/application.scss'
|
16
|
+
js_strings = "//= require calendar\n"
|
17
|
+
|
18
|
+
insert_into_file js_manifest, js_strings, :after => "turbolinks\n" if File.exists?(js_manifest)
|
19
|
+
insert_css_strings(css_manifest) if File.exists?(css_manifest)
|
20
|
+
insert_scss_strings(scss_manifest) if File.exists?(scss_manifest)
|
21
|
+
copy_core_file
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def insert_css_strings(css_manifest)
|
27
|
+
content = File.read(css_manifest)
|
28
|
+
css_strings = "*/= require calendar\n"
|
29
|
+
|
30
|
+
if requires_tree(content)
|
31
|
+
insert_into_file css_manifest, css_strings, :after => "require_tree .\n"
|
32
|
+
elsif requires_self(content)
|
33
|
+
insert_into_file css_manifest, css_strings, :before => " *= require_self\n"
|
34
|
+
else
|
35
|
+
insert_into_file css_manifest, css_strings, :before => " */"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
def insert_scss_strings(scss_manifest)
|
41
|
+
content = File.read(scss_manifest)
|
42
|
+
scss_strings = "\n@import \"calendar\";\n"
|
43
|
+
append_to_file scss_manifest, scss_strings
|
44
|
+
end
|
45
|
+
|
46
|
+
def requires_tree(content)
|
47
|
+
content.match(/require_tree\s+\.\s*$/)
|
48
|
+
end
|
49
|
+
|
50
|
+
def requires_self(content)
|
51
|
+
content.match(/require_self\s*$/)
|
52
|
+
end
|
53
|
+
|
54
|
+
def copy_core_file
|
55
|
+
template "#{style}.js.tt", "app/assets/javascripts/calendar.js"
|
56
|
+
template "#{style}.scss.tt", "app/assets/stylesheets/calendar.scss"
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|