viewable 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +10 -10
- data/.travis.yml +22 -22
- data/AUTHORS.md +6 -6
- data/CONTRIBUTING.md +22 -22
- data/Gemfile +7 -7
- data/LICENSE.md +23 -23
- data/README.md +41 -41
- data/Rakefile +6 -6
- data/lib/viewable/generators/viewable/controller_generator.rb +22 -22
- data/lib/viewable/generators/viewable/css_generator.rb +11 -11
- data/lib/viewable/generators/viewable/install_generator.rb +16 -16
- data/lib/viewable/generators/viewable/js_generator.rb +17 -17
- data/lib/viewable/generators/viewable/resource_model_generator.rb +21 -21
- data/lib/viewable/generators/viewable/templates/assets/javascript/calendar-editable.js +6991 -6991
- data/lib/viewable/generators/viewable/templates/assets/javascript/custom.js +130 -130
- data/lib/viewable/generators/viewable/templates/assets/javascript/fullcalendar.js +6110 -6110
- data/lib/viewable/generators/viewable/templates/assets/stylesheets/fullcalendar.css +587 -587
- data/lib/viewable/generators/viewable/templates/controllers/resource_controller.rb +50 -50
- data/lib/viewable/generators/viewable/templates/controllers/viewing_controller.rb +77 -77
- data/lib/viewable/generators/viewable/templates/models/datetime.rb +6 -6
- data/lib/viewable/generators/viewable/templates/models/resource.rb +4 -4
- data/lib/viewable/generators/viewable/templates/models/viewable.rb +85 -85
- data/lib/viewable/generators/viewable/templates/models/viewing.rb +4 -4
- data/lib/viewable/generators/viewable/templates/views/_errors.html.erb +13 -13
- data/lib/viewable/generators/viewable/templates/views/_form.html.erb +6 -6
- data/lib/viewable/generators/viewable/templates/views/edit.html.erb +1 -1
- data/lib/viewable/generators/viewable/templates/views/index.html.erb +12 -11
- data/lib/viewable/generators/viewable/templates/views/new.html.erb +1 -1
- data/lib/viewable/generators/viewable/templates/views/viewings/_errors.html.erb +12 -12
- data/lib/viewable/generators/viewable/templates/views/viewings/_form.html.erb +11 -11
- data/lib/viewable/generators/viewable/templates/views/viewings/edit.html.erb +9 -9
- data/lib/viewable/generators/viewable/templates/views/viewings/index.html.erb +22 -22
- data/lib/viewable/generators/viewable/templates/views/viewings/new.html.erb +9 -9
- data/lib/viewable/generators/viewable/templates/views/viewings/show.html.erb +6 -6
- data/lib/viewable/generators/viewable/viewing_model_generator.rb +25 -25
- data/lib/viewable/generators/viewable/views_generator.rb +21 -21
- data/lib/viewable/railtie.rb +8 -8
- data/lib/viewable/viewable.rb +2 -2
- data/viewable.gemspec +31 -30
- metadata +3 -4
- data/lib/viewable/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c295dc1e421d089a2d65cd71cdd80d07f5b65cf
|
4
|
+
data.tar.gz: 3dd8cffa8c9e16c5b1b6d2ebb8d5e51a8a8fd8a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a9170fce1d55ec0d60c6e57b9a235a86af216678e951946e7e6aca240bbd36ae2c3596707406ff4eeaa3144a19376c66ae9d41e138008ad0c3cc63830a47e0e
|
7
|
+
data.tar.gz: fc07e7b7b9c415b0c2a61f70bda3c0d25b737858373c1ba8db7cd83fad2c8b6200c3fbcfff6abdf3453039c37cb5707465be7e6f5a442ffe3ad2ca690dfc3d7b
|
data/.editorconfig
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
# http://editorconfig.org
|
2
|
-
root = true
|
3
|
-
|
4
|
-
[*]
|
5
|
-
charset = utf-8
|
6
|
-
indent_style = tab
|
7
|
-
indent_size = 1
|
8
|
-
end_of_line = crlf
|
9
|
-
insert_final_newline = false
|
10
|
-
trim_trailing_whitespace = true
|
1
|
+
# http://editorconfig.org
|
2
|
+
root = true
|
3
|
+
|
4
|
+
[*]
|
5
|
+
charset = utf-8
|
6
|
+
indent_style = tab
|
7
|
+
indent_size = 1
|
8
|
+
end_of_line = crlf
|
9
|
+
insert_final_newline = false
|
10
|
+
trim_trailing_whitespace = true
|
data/.travis.yml
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
os:
|
2
|
-
- linux
|
3
|
-
language: ruby
|
4
|
-
|
5
|
-
rvm:
|
6
|
-
- 2.2.0
|
7
|
-
- 2.0.0
|
8
|
-
before_install:
|
9
|
-
- sudo apt-get update
|
10
|
-
- gem update --system
|
11
|
-
- gem update
|
12
|
-
- gem --version
|
13
|
-
|
14
|
-
before_script:
|
15
|
-
- bundle exec rake
|
16
|
-
|
17
|
-
notifications:
|
18
|
-
on_success: change
|
19
|
-
on_failure: change
|
20
|
-
email:
|
21
|
-
recipients:
|
22
|
-
- tom.jcox@icloud.com
|
1
|
+
os:
|
2
|
+
- linux
|
3
|
+
language: ruby
|
4
|
+
|
5
|
+
rvm:
|
6
|
+
- 2.2.0
|
7
|
+
- 2.0.0
|
8
|
+
before_install:
|
9
|
+
- sudo apt-get update
|
10
|
+
- gem update --system
|
11
|
+
- gem update
|
12
|
+
- gem --version
|
13
|
+
|
14
|
+
before_script:
|
15
|
+
- bundle exec rake
|
16
|
+
|
17
|
+
notifications:
|
18
|
+
on_success: change
|
19
|
+
on_failure: change
|
20
|
+
email:
|
21
|
+
recipients:
|
22
|
+
- tom.jcox@icloud.com
|
data/AUTHORS.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# C|R|M
|
2
|
-
|
3
|
-
>Cox | Rees | Mitchell | [crmis](https://crm-is.herokuapp.com)
|
4
|
-
|
5
|
-
## Tom Cox
|
6
|
-
#### [Github](https://github.com/Koxzi95) | [Website](http://koxzi.me) | [Twitter](https://twitter.com/Koxzi95) | [![endorse](https://api.coderwall.com/koxzi95/endorsecount.png)](https://coderwall.com/koxzi95)
|
1
|
+
# C|R|M
|
2
|
+
|
3
|
+
>Cox | Rees | Mitchell | [crmis](https://crm-is.herokuapp.com)
|
4
|
+
|
5
|
+
## Tom Cox
|
6
|
+
#### [Github](https://github.com/Koxzi95) | [Website](http://koxzi.me) | [Twitter](https://twitter.com/Koxzi95) | [![endorse](https://api.coderwall.com/koxzi95/endorsecount.png)](https://coderwall.com/koxzi95)
|
data/CONTRIBUTING.md
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
# Contributing to [crmis/viewable](www.github.com/crmis/viewable)
|
2
|
-
|
3
|
-
#### Thanks for thinking of contributing to crmis! Whether you are here to report issues or develop on the project the sections below provide outlines on how to get started.
|
4
|
-
|
5
|
-
## Bugs/Issues :bug:
|
6
|
-
|
7
|
-
Write specifically which browser (and version if possible) this is reported to be found in.
|
8
|
-
|
9
|
-
Write out the steps to replicate the error. What did you expect to happen? What happened instead?
|
10
|
-
|
11
|
-
If possible provide a snippet of code, and the syntax if possible. Check the guide on how to do so:
|
12
|
-
[Mastering Markdown.](https://guides.github.com/features/mastering-markdown/)
|
13
|
-
|
14
|
-
## Steps
|
15
|
-
|
16
|
-
##### 1. Fork this repository to your own space.
|
17
|
-
##### 2. Make any changes on your version.
|
18
|
-
##### 3. Push your repository
|
19
|
-
##### 4. Make a pull request, this will get reviewed/discussed.
|
20
|
-
##### 5. If it's good and passes the tests, it should get pulled in!
|
21
|
-
|
22
|
-
###### Needs more work :octocat:
|
1
|
+
# Contributing to [crmis/viewable](www.github.com/crmis/viewable)
|
2
|
+
|
3
|
+
#### Thanks for thinking of contributing to crmis! Whether you are here to report issues or develop on the project the sections below provide outlines on how to get started.
|
4
|
+
|
5
|
+
## Bugs/Issues :bug:
|
6
|
+
|
7
|
+
Write specifically which browser (and version if possible) this is reported to be found in.
|
8
|
+
|
9
|
+
Write out the steps to replicate the error. What did you expect to happen? What happened instead?
|
10
|
+
|
11
|
+
If possible provide a snippet of code, and the syntax if possible. Check the guide on how to do so:
|
12
|
+
[Mastering Markdown.](https://guides.github.com/features/mastering-markdown/)
|
13
|
+
|
14
|
+
## Steps
|
15
|
+
|
16
|
+
##### 1. Fork this repository to your own space.
|
17
|
+
##### 2. Make any changes on your version.
|
18
|
+
##### 3. Push your repository
|
19
|
+
##### 4. Make a pull request, this will get reviewed/discussed.
|
20
|
+
##### 5. If it's good and passes the tests, it should get pulled in!
|
21
|
+
|
22
|
+
###### Needs more work :octocat:
|
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Dependencies are specified in viewable.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
|
7
|
-
gem 'rspec-rails', '~> 3.2.1'
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Dependencies are specified in viewable.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
|
7
|
+
gem 'rspec-rails', '~> 3.2.1'
|
data/LICENSE.md
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
###### We use the Github License generator. But if you're unsure check out: http://choosealicense.com/
|
2
|
-
|
3
|
-
# The MIT License (MIT)
|
4
|
-
|
5
|
-
### Copyright (c) 2015 Tom Cox
|
6
|
-
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
-
of this software and associated documentation files (the "Software"), to deal
|
9
|
-
in the Software without restriction, including without limitation the rights
|
10
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
-
copies of the Software, and to permit persons to whom the Software is
|
12
|
-
furnished to do so, subject to the following conditions:
|
13
|
-
|
14
|
-
The above copyright notice and this permission notice shall be included in all
|
15
|
-
copies or substantial portions of the Software.
|
16
|
-
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
-
SOFTWARE.
|
1
|
+
###### We use the Github License generator. But if you're unsure check out: http://choosealicense.com/
|
2
|
+
|
3
|
+
# The MIT License (MIT)
|
4
|
+
|
5
|
+
### Copyright (c) 2015 Tom Cox
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
9
|
+
in the Software without restriction, including without limitation the rights
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
15
|
+
copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
# viewable-gem
|
2
|
-
|
3
|
-
:octocat:
|
4
|
-
|
5
|
-
[![
|
6
|
-
[![
|
7
|
-
[![
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
The necessary routes will be applied to your routes file and you will need to run, you may want to edit the migration file.
|
40
|
-
|
41
|
-
$ rake db:migrate
|
1
|
+
# viewable-gem
|
2
|
+
|
3
|
+
:octocat:
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/viewable.svg)](http://badge.fury.io/rb/viewable)
|
6
|
+
[![Build Status](https://travis-ci.org/crmis/viewable.svg?branch=master)](https://travis-ci.org/crmis/viewable)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/crmis/viewable-gem/badges/gpa.svg)](https://codeclimate.com/github/crmis/viewable-gem)
|
8
|
+
[![Dependency Status](https://gemnasium.com/crmis/viewable-gem.svg)](https://gemnasium.com/crmis/viewable-gem)
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Viewable works with Rails 4.0. Add this line to your Gemfile:
|
13
|
+
|
14
|
+
gem 'viewable', '~> 0.5.7'
|
15
|
+
|
16
|
+
Then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install viewable
|
23
|
+
|
24
|
+
After you've installed the gem, you need to run the generator:
|
25
|
+
|
26
|
+
$ rails generate viewable:install
|
27
|
+
|
28
|
+
Alternatively you can specify a named resource such as 'room'
|
29
|
+
|
30
|
+
$ rails generate viewable:install room
|
31
|
+
|
32
|
+
The generator will create the file structure you need to implement viewing functionality into your app:
|
33
|
+
* controllers
|
34
|
+
* models - resource(room) and viewing
|
35
|
+
* views
|
36
|
+
* javascript - which uses the jQuery Full Calendar (old) plugin
|
37
|
+
* css - some basic CSS is provided which you may want to override
|
38
|
+
|
39
|
+
The necessary routes will be applied to your routes file and you will need to run, you may want to edit the migration file.
|
40
|
+
|
41
|
+
$ rake db:migrate
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
|
3
|
-
# temp
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
RSpec::Core::RakeTask.new(:spec)
|
6
|
-
task :default => :spec
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
|
3
|
+
# temp
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
task :default => :spec
|
@@ -1,22 +1,22 @@
|
|
1
|
-
module Viewable
|
2
|
-
module Generators
|
3
|
-
class ControllerGenerator < Rails::Generators::Base
|
4
|
-
source_root File.expand_path('../templates/controllers', __FILE__)
|
5
|
-
argument :resource_name, type: :string, default: 'resource'
|
6
|
-
def generate_viewable_controller
|
7
|
-
template "viewing_controller.rb", "app/controllers/viewings_controller.rb"
|
8
|
-
template "resource_controller.rb", "app/controllers/#{resource_name_underscore.pluralize}_controller.rb"
|
9
|
-
route "resources :#{resource_name_underscore.pluralize} do\n" \
|
10
|
-
"\t resources :viewings\n" \
|
11
|
-
"\tend"
|
12
|
-
end
|
13
|
-
private
|
14
|
-
def resource_name_underscore
|
15
|
-
resource_name.underscore
|
16
|
-
end
|
17
|
-
def resource_name_camelize
|
18
|
-
resource_name.camelize
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
1
|
+
module Viewable
|
2
|
+
module Generators
|
3
|
+
class ControllerGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates/controllers', __FILE__)
|
5
|
+
argument :resource_name, type: :string, default: 'resource'
|
6
|
+
def generate_viewable_controller
|
7
|
+
template "viewing_controller.rb", "app/controllers/viewings_controller.rb"
|
8
|
+
template "resource_controller.rb", "app/controllers/#{resource_name_underscore.pluralize}_controller.rb"
|
9
|
+
route "resources :#{resource_name_underscore.pluralize} do\n" \
|
10
|
+
"\t resources :viewings\n" \
|
11
|
+
"\tend"
|
12
|
+
end
|
13
|
+
private
|
14
|
+
def resource_name_underscore
|
15
|
+
resource_name.underscore
|
16
|
+
end
|
17
|
+
def resource_name_camelize
|
18
|
+
resource_name.camelize
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module Viewable
|
2
|
-
module Generators
|
3
|
-
class CssGenerator < Rails::Generators::Base
|
4
|
-
source_root File.expand_path('../templates/assets/stylesheets', __FILE__)
|
5
|
-
def generate_css
|
6
|
-
template "custom.css", "app/assets/stylesheets/viewable_custom.css"
|
7
|
-
template "fullcalendar.css", "app/assets/stylesheets/viewable_fullcalendar.css"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
module Viewable
|
2
|
+
module Generators
|
3
|
+
class CssGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates/assets/stylesheets', __FILE__)
|
5
|
+
def generate_css
|
6
|
+
template "custom.css", "app/assets/stylesheets/viewable_custom.css"
|
7
|
+
template "fullcalendar.css", "app/assets/stylesheets/viewable_fullcalendar.css"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
module Viewable
|
2
|
-
module Generators
|
3
|
-
class InstallGenerator < Rails::Generators::Base
|
4
|
-
argument :resource_name, :type => :string, :default => "resource"
|
5
|
-
source_root File.expand_path("../", __FILE__)
|
6
|
-
def install
|
7
|
-
generate "viewable:resource_model #{resource_name}"
|
8
|
-
generate "viewable:viewing_model #{resource_name}"
|
9
|
-
generate "viewable:controller #{resource_name}"
|
10
|
-
generate "viewable:views #{resource_name}"
|
11
|
-
generate "viewable:js #{resource_name}"
|
12
|
-
generate "viewable:css #{resource_name}"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
1
|
+
module Viewable
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
argument :resource_name, :type => :string, :default => "resource"
|
5
|
+
source_root File.expand_path("../", __FILE__)
|
6
|
+
def install
|
7
|
+
generate "viewable:resource_model #{resource_name}"
|
8
|
+
generate "viewable:viewing_model #{resource_name}"
|
9
|
+
generate "viewable:controller #{resource_name}"
|
10
|
+
generate "viewable:views #{resource_name}"
|
11
|
+
generate "viewable:js #{resource_name}"
|
12
|
+
generate "viewable:css #{resource_name}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
module Viewable
|
2
|
-
module Generators
|
3
|
-
class JsGenerator < Rails::Generators::Base
|
4
|
-
source_root File.expand_path('../templates/assets/javascript', __FILE__)
|
5
|
-
argument :viewable_js_name, :type => :string, :default => "resource"
|
6
|
-
def generate_viewable_js
|
7
|
-
template "custom.js", "app/assets/javascripts/viewable_custom.js"
|
8
|
-
template "fullcalendar.js", "app/assets/javascripts/viewable_fullcalendar.js"
|
9
|
-
template "calendar-editable.js", "app/assets/javascripts/viewable_calendar-editable.js"
|
10
|
-
end
|
11
|
-
private
|
12
|
-
def viewable_name
|
13
|
-
viewable_js_name.underscore.pluralize
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
1
|
+
module Viewable
|
2
|
+
module Generators
|
3
|
+
class JsGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates/assets/javascript', __FILE__)
|
5
|
+
argument :viewable_js_name, :type => :string, :default => "resource"
|
6
|
+
def generate_viewable_js
|
7
|
+
template "custom.js", "app/assets/javascripts/viewable_custom.js"
|
8
|
+
template "fullcalendar.js", "app/assets/javascripts/viewable_fullcalendar.js"
|
9
|
+
template "calendar-editable.js", "app/assets/javascripts/viewable_calendar-editable.js"
|
10
|
+
end
|
11
|
+
private
|
12
|
+
def viewable_name
|
13
|
+
viewable_js_name.underscore.pluralize
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
module Viewable
|
2
|
-
module Generators
|
3
|
-
class ResourceModelGenerator < Rails::Generators::Base
|
4
|
-
source_root File.expand_path('../templates/models', __FILE__)
|
5
|
-
argument :resource_name, :type => :string, :default => "resource"
|
6
|
-
def generate_resource_model
|
7
|
-
template "resource.rb", "app/models/#{resource_name_underscore.singularize}.rb"
|
8
|
-
end
|
9
|
-
def create_resource_migration
|
10
|
-
generate "migration Create#{resource_name_camelize.pluralize} name:string"
|
11
|
-
end
|
12
|
-
private
|
13
|
-
def resource_name_underscore
|
14
|
-
resource_name.underscore
|
15
|
-
end
|
16
|
-
def resource_name_camelize
|
17
|
-
resource_name.camelize
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
module Viewable
|
2
|
+
module Generators
|
3
|
+
class ResourceModelGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates/models', __FILE__)
|
5
|
+
argument :resource_name, :type => :string, :default => "resource"
|
6
|
+
def generate_resource_model
|
7
|
+
template "resource.rb", "app/models/#{resource_name_underscore.singularize}.rb"
|
8
|
+
end
|
9
|
+
def create_resource_migration
|
10
|
+
generate "migration Create#{resource_name_camelize.pluralize} name:string"
|
11
|
+
end
|
12
|
+
private
|
13
|
+
def resource_name_underscore
|
14
|
+
resource_name.underscore
|
15
|
+
end
|
16
|
+
def resource_name_camelize
|
17
|
+
resource_name.camelize
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|