viewable 0.5.16 → 0.5.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +38 -38
- 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 +17 -17
- 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 +126 -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 -12
- 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 +1 -1
- data/viewable.gemspec +33 -33
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71bdc222154ae9dbf6617547f5bbd0e4ae92d4ea
|
4
|
+
data.tar.gz: b25eea649ec69a81a1df7d15770e48c4014f5fc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5e64e6b82dff2fc4c4fc1ab5ddbb490867c178867b5a9250f3b54f2b9d2816a60668e9975ede5243d08005b08244f007a7e75cb5f517227b49b1a8cdd6335b5
|
7
|
+
data.tar.gz: 620c26f91efd05a828f057421701f3db3e234c38029ca87ce70d4511fae5a267f95bceaefe27b16faf9bba3574fd22f4371d00d423fbe751f245338b59af0ed8
|
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) | [](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) | [](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,38 +1,38 @@
|
|
1
|
-
# viewable-gem
|
2
|
-
|
3
|
-
:octocat:
|
4
|
-
|
5
|
-
[](http://badge.fury.io/rb/viewable)
|
6
|
-
[](https://travis-ci.org/crmis/viewable)
|
7
|
-
[](https://codeclimate.com/github/crmis/viewable-gem)
|
8
|
-
[](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.
|
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, it will also run migrations after generating these:
|
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
|
-
* routes
|
1
|
+
# viewable-gem
|
2
|
+
|
3
|
+
:octocat:
|
4
|
+
|
5
|
+
[](http://badge.fury.io/rb/viewable)
|
6
|
+
[](https://travis-ci.org/crmis/viewable)
|
7
|
+
[](https://codeclimate.com/github/crmis/viewable-gem)
|
8
|
+
[](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.17'
|
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, it will also run migrations after generating these:
|
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
|
+
* routes
|
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,17 +1,17 @@
|
|
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
|
-
rake 'db:migrate'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
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
|
+
rake 'db:migrate'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
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
|