custom-template 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +3 -13
- data/{LICENSE.txt → LICENSE} +4 -2
- data/README.md +29 -0
- data/Rakefile +2 -49
- data/custom-template.gemspec +13 -63
- data/lib/custom-template/version.rb +5 -0
- data/lib/custom-template.rb +22 -0
- metadata +15 -82
- data/.document +0 -5
- data/.rspec +0 -1
- data/README.rdoc +0 -19
- data/VERSION +0 -1
- data/lib/generators/custom/template/template_generator.rb +0 -16
- data/lib/generators/custom/template/templates/erb/controller/view.html.erb +0 -2
- data/lib/generators/custom/template/templates/erb/mailer/view.text.erb +0 -3
- data/lib/generators/custom/template/templates/erb/scaffold/_form.html.erb +0 -25
- data/lib/generators/custom/template/templates/erb/scaffold/edit.html.erb +0 -7
- data/lib/generators/custom/template/templates/erb/scaffold/index.html.erb +0 -33
- data/lib/generators/custom/template/templates/erb/scaffold/new.html.erb +0 -6
- data/lib/generators/custom/template/templates/erb/scaffold/show.html.erb +0 -11
- data/lib/generators/custom/template/templates/rails/controller/controller.rb +0 -12
- data/lib/generators/custom/template/templates/rails/helper/helper.rb +0 -2
- data/lib/generators/custom/template/templates/rails/scaffold_controller/controller.rb +0 -73
- data/lib/generators/custom/template/templates/rails/stylesheets/scaffold.css +0 -56
- data/spec/custom-template_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -12
data/.gitignore
ADDED
data/Gemfile
CHANGED
@@ -1,14 +1,4 @@
|
|
1
|
-
source
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
1
|
+
source 'https://rubygems.org'
|
5
2
|
|
6
|
-
#
|
7
|
-
|
8
|
-
group :development do
|
9
|
-
gem "rspec", "~> 2.8.0"
|
10
|
-
gem "rdoc", "~> 3.12"
|
11
|
-
# gem "bundler", "~> 1.0.0"
|
12
|
-
gem "jeweler", "~> 1.8.3"
|
13
|
-
# gem "rcov", ">= 0"
|
14
|
-
end
|
3
|
+
# Specify your gem's dependencies in custom-template.gemspec
|
4
|
+
gemspec
|
data/{LICENSE.txt → LICENSE}
RENAMED
@@ -1,4 +1,6 @@
|
|
1
|
-
Copyright (c) 2012
|
1
|
+
Copyright (c) 2012 shu0115
|
2
|
+
|
3
|
+
MIT License
|
2
4
|
|
3
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
6
|
a copy of this software and associated documentation files (the
|
@@ -17,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
21
|
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.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Custom::Template
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'custom-template'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install custom-template
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -1,49 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "custom-template"
|
18
|
-
gem.homepage = "http://github.com/shu0115/custom-template"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = "Custom Scaffold Template"
|
21
|
-
gem.description = "Custom Template for Scaffold."
|
22
|
-
gem.email = "s.matsumoto0115@gmail.com"
|
23
|
-
gem.authors = ["Shun Matsumoto"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
|
-
|
28
|
-
require 'rspec/core'
|
29
|
-
require 'rspec/core/rake_task'
|
30
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
-
end
|
33
|
-
|
34
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
-
spec.rcov = true
|
37
|
-
end
|
38
|
-
|
39
|
-
task :default => :spec
|
40
|
-
|
41
|
-
require 'rdoc/task'
|
42
|
-
Rake::RDocTask.new do |rdoc|
|
43
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
-
|
45
|
-
rdoc.rdoc_dir = 'rdoc'
|
46
|
-
rdoc.title = "custom-template #{version}"
|
47
|
-
rdoc.rdoc_files.include('README*')
|
48
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
-
end
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
data/custom-template.gemspec
CHANGED
@@ -1,67 +1,17 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/custom-template/version', __FILE__)
|
5
3
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["shu0115"]
|
6
|
+
gem.email = ["raisondetre0115@gmail.com"]
|
7
|
+
gem.description = %q{Custom Template for Scaffold.}
|
8
|
+
gem.summary = %q{Custom Template}
|
9
|
+
gem.homepage = "https://github.com/shu0115/custom-template"
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".rspec",
|
22
|
-
"Gemfile",
|
23
|
-
"LICENSE.txt",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"custom-template.gemspec",
|
28
|
-
"lib/generators/custom/template/template_generator.rb",
|
29
|
-
"lib/generators/custom/template/templates/erb/controller/view.html.erb",
|
30
|
-
"lib/generators/custom/template/templates/erb/mailer/view.text.erb",
|
31
|
-
"lib/generators/custom/template/templates/erb/scaffold/_form.html.erb",
|
32
|
-
"lib/generators/custom/template/templates/erb/scaffold/edit.html.erb",
|
33
|
-
"lib/generators/custom/template/templates/erb/scaffold/index.html.erb",
|
34
|
-
"lib/generators/custom/template/templates/erb/scaffold/new.html.erb",
|
35
|
-
"lib/generators/custom/template/templates/erb/scaffold/show.html.erb",
|
36
|
-
"lib/generators/custom/template/templates/rails/controller/controller.rb",
|
37
|
-
"lib/generators/custom/template/templates/rails/helper/helper.rb",
|
38
|
-
"lib/generators/custom/template/templates/rails/scaffold_controller/controller.rb",
|
39
|
-
"lib/generators/custom/template/templates/rails/stylesheets/scaffold.css",
|
40
|
-
"spec/custom-template_spec.rb",
|
41
|
-
"spec/spec_helper.rb"
|
42
|
-
]
|
43
|
-
s.homepage = "http://github.com/shu0115/custom-template"
|
44
|
-
s.licenses = ["MIT"]
|
45
|
-
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = "1.8.23"
|
47
|
-
s.summary = "Custom Scaffold Template"
|
48
|
-
|
49
|
-
if s.respond_to? :specification_version then
|
50
|
-
s.specification_version = 3
|
51
|
-
|
52
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
54
|
-
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
55
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
56
|
-
else
|
57
|
-
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
58
|
-
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
59
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
60
|
-
end
|
61
|
-
else
|
62
|
-
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
63
|
-
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
64
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
65
|
-
end
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "custom-template"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Custom::Template::VERSION
|
66
17
|
end
|
67
|
-
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require "custom-template/version"
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module Custom
|
6
|
+
module Generators
|
7
|
+
class TemplateGenerator < ::Rails::Generators::Base
|
8
|
+
source_root File.expand_path("../custom-template", __FILE__)
|
9
|
+
desc "This generator custom template for scaffold"
|
10
|
+
|
11
|
+
#-------------------#
|
12
|
+
# generate_template #
|
13
|
+
#-------------------#
|
14
|
+
def generate_template
|
15
|
+
directory "templates/erb", "lib/templates/erb", recursive: true
|
16
|
+
directory "templates/haml", "lib/templates/haml", recursive: true
|
17
|
+
directory "templates/rails", "lib/templates/rails", recursive: true
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,97 +1,33 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: custom-template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- shu0115
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rspec
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 2.8.0
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 2.8.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: rdoc
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '3.12'
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '3.12'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: jeweler
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 1.8.3
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.8.3
|
12
|
+
date: 2012-07-06 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
62
14
|
description: Custom Template for Scaffold.
|
63
|
-
email:
|
15
|
+
email:
|
16
|
+
- raisondetre0115@gmail.com
|
64
17
|
executables: []
|
65
18
|
extensions: []
|
66
|
-
extra_rdoc_files:
|
67
|
-
- LICENSE.txt
|
68
|
-
- README.rdoc
|
19
|
+
extra_rdoc_files: []
|
69
20
|
files:
|
70
|
-
- .
|
71
|
-
- .rspec
|
21
|
+
- .gitignore
|
72
22
|
- Gemfile
|
73
|
-
- LICENSE
|
74
|
-
- README.
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
75
25
|
- Rakefile
|
76
|
-
- VERSION
|
77
26
|
- custom-template.gemspec
|
78
|
-
- lib/
|
79
|
-
- lib/
|
80
|
-
|
81
|
-
|
82
|
-
- lib/generators/custom/template/templates/erb/scaffold/edit.html.erb
|
83
|
-
- lib/generators/custom/template/templates/erb/scaffold/index.html.erb
|
84
|
-
- lib/generators/custom/template/templates/erb/scaffold/new.html.erb
|
85
|
-
- lib/generators/custom/template/templates/erb/scaffold/show.html.erb
|
86
|
-
- lib/generators/custom/template/templates/rails/controller/controller.rb
|
87
|
-
- lib/generators/custom/template/templates/rails/helper/helper.rb
|
88
|
-
- lib/generators/custom/template/templates/rails/scaffold_controller/controller.rb
|
89
|
-
- lib/generators/custom/template/templates/rails/stylesheets/scaffold.css
|
90
|
-
- spec/custom-template_spec.rb
|
91
|
-
- spec/spec_helper.rb
|
92
|
-
homepage: http://github.com/shu0115/custom-template
|
93
|
-
licenses:
|
94
|
-
- MIT
|
27
|
+
- lib/custom-template.rb
|
28
|
+
- lib/custom-template/version.rb
|
29
|
+
homepage: https://github.com/shu0115/custom-template
|
30
|
+
licenses: []
|
95
31
|
post_install_message:
|
96
32
|
rdoc_options: []
|
97
33
|
require_paths:
|
@@ -102,9 +38,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
38
|
- - ! '>='
|
103
39
|
- !ruby/object:Gem::Version
|
104
40
|
version: '0'
|
105
|
-
segments:
|
106
|
-
- 0
|
107
|
-
hash: 2782842031818533536
|
108
41
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
42
|
none: false
|
110
43
|
requirements:
|
@@ -116,5 +49,5 @@ rubyforge_project:
|
|
116
49
|
rubygems_version: 1.8.23
|
117
50
|
signing_key:
|
118
51
|
specification_version: 3
|
119
|
-
summary: Custom
|
52
|
+
summary: Custom Template
|
120
53
|
test_files: []
|
data/.document
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= custom-template
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Contributing to custom-template
|
6
|
-
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
-
* Fork the project.
|
10
|
-
* Start a feature/bugfix branch.
|
11
|
-
* Commit and push until you are happy with your contribution.
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2012 Shun Matsumoto. See LICENSE.txt for
|
18
|
-
further details.
|
19
|
-
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.1
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
|
3
|
-
module Custom
|
4
|
-
module Generators
|
5
|
-
class TemplateGenerator < ::Rails::Generators::Base
|
6
|
-
|
7
|
-
source_root File.expand_path("../templates", __FILE__)
|
8
|
-
desc "This generator custom template for scaffold"
|
9
|
-
|
10
|
-
def generate_template
|
11
|
-
directory "erb", "lib/templates/erb", recursive: true
|
12
|
-
directory "rails", "lib/templates/rails", recursive: true
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
|
2
|
-
<%%= form_for :<%= singular_table_name %>, url: { action: @submit, id: @<%= singular_table_name %>.try(:id) } do |f| %>
|
3
|
-
<%% if @<%= singular_table_name %>.errors.any? %>
|
4
|
-
<div id="error_explanation">
|
5
|
-
<h2><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
|
6
|
-
|
7
|
-
<ul>
|
8
|
-
<%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
|
9
|
-
<li><%%= msg %></li>
|
10
|
-
<%% end %>
|
11
|
-
</ul>
|
12
|
-
</div>
|
13
|
-
<%% end %>
|
14
|
-
|
15
|
-
<% attributes.each do |attribute| -%>
|
16
|
-
<div class="field">
|
17
|
-
<%%= f.label :<%= attribute.name %> %><br />
|
18
|
-
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
|
19
|
-
</div>
|
20
|
-
|
21
|
-
<% end -%>
|
22
|
-
<div class="actions">
|
23
|
-
<%%= f.submit t( "menu.#{@submit}", default: @submit ), disable_with: t( "menu.#{@submit}", default: @submit ) %>
|
24
|
-
</div>
|
25
|
-
<%% end %>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
|
2
|
-
<h1>Listing <%= plural_table_name %></h1>
|
3
|
-
|
4
|
-
<table>
|
5
|
-
<tr>
|
6
|
-
<% attributes.each do |attribute| -%>
|
7
|
-
<th><%= attribute.human_name %></th>
|
8
|
-
<% end -%>
|
9
|
-
<th></th>
|
10
|
-
<th></th>
|
11
|
-
<th></th>
|
12
|
-
</tr>
|
13
|
-
|
14
|
-
<%% @<%= plural_table_name %>.each{ |<%= singular_table_name %>| %>
|
15
|
-
<tr>
|
16
|
-
<% attributes.each do |attribute| -%>
|
17
|
-
<td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
|
18
|
-
<% end -%>
|
19
|
-
<td><%%= link_to t( "menu.show", default: "Show" ), action: "show", id: <%= singular_table_name %>.id %></td>
|
20
|
-
<td><%%= link_to t( "menu.edit", default: "Edit" ), action: "edit", id: <%= singular_table_name %>.id %></td>
|
21
|
-
<td><%%= link_to t( "menu.destroy", default: "Delete" ), { action: "destroy", id: <%= singular_table_name %>.id }, onclick: "return confirm('本当に削除してよろしいですか?');" %></td>
|
22
|
-
</tr>
|
23
|
-
<%% } %>
|
24
|
-
</table>
|
25
|
-
|
26
|
-
<br />
|
27
|
-
|
28
|
-
<%%= link_to t( "menu.new", default: "New" ), action: "new" %>
|
29
|
-
|
30
|
-
<br />
|
31
|
-
<br />
|
32
|
-
|
33
|
-
<%%= link_to t( "menu.top", default: "Top" ), :root %>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
|
2
|
-
<% attributes.each{ |attribute| -%>
|
3
|
-
<p>
|
4
|
-
<b><%= attribute.human_name %>:</b>
|
5
|
-
<%%= @<%= singular_table_name %>.<%= attribute.name %> %>
|
6
|
-
</p>
|
7
|
-
|
8
|
-
<% } %>
|
9
|
-
|
10
|
-
<%%= link_to t( "menu.edit", default: "Edit" ), action: "edit", id: @<%= singular_table_name %>.id %>
|
11
|
-
| <%%= link_to t( "menu.list", default: "List" ), action: "index" %>
|
@@ -1,73 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
class <%= controller_class_name %>Controller < ApplicationController
|
3
|
-
|
4
|
-
#-------#
|
5
|
-
# index #
|
6
|
-
#-------#
|
7
|
-
def index
|
8
|
-
@<%= plural_table_name %> = <%= "#{class_name}.where( user_id: session[:user_id] ).all" %>
|
9
|
-
end
|
10
|
-
|
11
|
-
#------#
|
12
|
-
# show #
|
13
|
-
#------#
|
14
|
-
def show
|
15
|
-
@<%= singular_table_name %> = <%= "#{class_name}.where( id: params[:id], user_id: session[:user_id] ).first" %>
|
16
|
-
end
|
17
|
-
|
18
|
-
#-----#
|
19
|
-
# new #
|
20
|
-
#-----#
|
21
|
-
def new
|
22
|
-
@<%= singular_table_name %> = <%= orm_class.build( class_name ) %>
|
23
|
-
|
24
|
-
@submit = "create"
|
25
|
-
end
|
26
|
-
|
27
|
-
#------#
|
28
|
-
# edit #
|
29
|
-
#------#
|
30
|
-
def edit
|
31
|
-
@<%= singular_table_name %> = <%= "#{class_name}.where( id: params[:id], user_id: session[:user_id] ).first" %>
|
32
|
-
|
33
|
-
@submit = "update"
|
34
|
-
end
|
35
|
-
|
36
|
-
#--------#
|
37
|
-
# create #
|
38
|
-
#--------#
|
39
|
-
def create
|
40
|
-
@<%= singular_table_name %> = <%= orm_class.build( class_name, " params[:#{singular_table_name}] " ) %>
|
41
|
-
@<%= "#{singular_table_name}.user_id" %> = <%= "session[:user_id]" %>
|
42
|
-
|
43
|
-
if @<%= orm_instance.save %>
|
44
|
-
redirect_to( { action: "index" }, notice: <%= "\"#{human_name} was successfully created.\"" %> )
|
45
|
-
else
|
46
|
-
render action: "new"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
#--------#
|
51
|
-
# update #
|
52
|
-
#--------#
|
53
|
-
def update
|
54
|
-
@<%= singular_table_name %> = <%= "#{class_name}.where( id: params[:id], user_id: session[:user_id] ).first" %>
|
55
|
-
|
56
|
-
if @<%= orm_instance.update_attributes(" params[:#{singular_table_name}] ") %>
|
57
|
-
redirect_to( { action: "show", id: <%= "params[:id]" %> }, notice: <%= "\"#{human_name} was successfully updated.\"" %> )
|
58
|
-
else
|
59
|
-
render action: "edit", id: <%= "params[:id]" %>
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
#---------#
|
64
|
-
# destroy #
|
65
|
-
#---------#
|
66
|
-
def destroy
|
67
|
-
@<%= singular_table_name %> = <%= "#{class_name}.where( id: params[:id], user_id: session[:user_id] ).first" %>
|
68
|
-
@<%= orm_instance.destroy %>
|
69
|
-
|
70
|
-
redirect_to action: "index"
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
body { background-color: #fff; color: #333; }
|
2
|
-
|
3
|
-
body, p, ol, ul, td {
|
4
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
-
font-size: 13px;
|
6
|
-
line-height: 18px;
|
7
|
-
}
|
8
|
-
|
9
|
-
pre {
|
10
|
-
background-color: #eee;
|
11
|
-
padding: 10px;
|
12
|
-
font-size: 11px;
|
13
|
-
}
|
14
|
-
|
15
|
-
a { color: #000; }
|
16
|
-
a:visited { color: #666; }
|
17
|
-
a:hover { color: #fff; background-color:#000; }
|
18
|
-
|
19
|
-
div.field, div.actions {
|
20
|
-
margin-bottom: 10px;
|
21
|
-
}
|
22
|
-
|
23
|
-
#notice {
|
24
|
-
color: green;
|
25
|
-
}
|
26
|
-
|
27
|
-
.field_with_errors {
|
28
|
-
padding: 2px;
|
29
|
-
background-color: red;
|
30
|
-
display: table;
|
31
|
-
}
|
32
|
-
|
33
|
-
#error_explanation {
|
34
|
-
width: 450px;
|
35
|
-
border: 2px solid red;
|
36
|
-
padding: 7px;
|
37
|
-
padding-bottom: 0;
|
38
|
-
margin-bottom: 20px;
|
39
|
-
background-color: #f0f0f0;
|
40
|
-
}
|
41
|
-
|
42
|
-
#error_explanation h2 {
|
43
|
-
text-align: left;
|
44
|
-
font-weight: bold;
|
45
|
-
padding: 5px 5px 5px 15px;
|
46
|
-
font-size: 12px;
|
47
|
-
margin: -7px;
|
48
|
-
margin-bottom: 0px;
|
49
|
-
background-color: #c00;
|
50
|
-
color: #fff;
|
51
|
-
}
|
52
|
-
|
53
|
-
#error_explanation ul li {
|
54
|
-
font-size: 12px;
|
55
|
-
list-style: square;
|
56
|
-
}
|
data/spec/spec_helper.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'custom-template'
|
5
|
-
|
6
|
-
# Requires supporting files with custom matchers and macros, etc,
|
7
|
-
# in ./support/ and its subdirectories.
|
8
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
|
12
|
-
end
|