express_templates_rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +26 -0
- data/lib/express_templates_rails.rb +40 -0
- data/lib/express_templates_rails/version.rb +3 -0
- data/lib/generators/et/controller/controller_generator.rb +16 -0
- data/lib/generators/et/controller/templates/view.html.et +2 -0
- data/lib/generators/et/mailer/mailer_generator.rb +16 -0
- data/lib/generators/et/mailer/templates/view.text.et +2 -0
- data/lib/generators/et/scaffold/scaffold_generator.rb +30 -0
- data/lib/generators/et/scaffold/templates/edit.html.et.erb +12 -0
- data/lib/generators/et/scaffold/templates/index.html.et.erb +11 -0
- data/lib/generators/et/scaffold/templates/new.html.et.erb +10 -0
- data/lib/generators/et/scaffold/templates/show.html.et.erb +12 -0
- data/lib/tasks/express_templates_rails_tasks.rake +4 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 63e1c2d9376193096d7b622aa4212d101ef3a83e
|
4
|
+
data.tar.gz: e329ebf1eb5956fa47d36be836107d531a43f821
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b14268907e2204a86f3d4200a0c45f8ae21194d8efb405cce352ae0eb225d891c0b5227701ce4960d4a25046495c3986fe1ba4765048be7f1c1d521b8b6740a2
|
7
|
+
data.tar.gz: 7a2e901686be7fa858ea3482b25f51d77c8c1900a62cae512839bc7bca209139908d7cab307654b6e0bb59a771b70b902aaceac89e026c69d79932c2776b8a64
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 Aelogica Pair Dev (Coron)
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
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.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
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
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
9
|
+
rdoc.rdoc_dir = 'rdoc'
|
10
|
+
rdoc.title = 'ExpressTemplatesRails'
|
11
|
+
rdoc.options << '--line-numbers'
|
12
|
+
rdoc.rdoc_files.include('README.rdoc')
|
13
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
14
|
+
end
|
15
|
+
|
16
|
+
load 'rails/tasks/statistics.rake'
|
17
|
+
Bundler::GemHelper.install_tasks
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
21
|
+
test.libs << 'lib' << 'test'
|
22
|
+
test.pattern = 'test/**/*_test.rb'
|
23
|
+
test.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
task :default => :test
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'express_templates'
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module Et
|
5
|
+
module Rails
|
6
|
+
class Engine < ::Rails::Engine
|
7
|
+
end
|
8
|
+
class Railtie < ::Rails::Railtie
|
9
|
+
config.app_generators.template_engine :et
|
10
|
+
|
11
|
+
initializer 'et_rails.configure_template_digestor' do
|
12
|
+
# Configure cache digests to parse et view templates
|
13
|
+
# when calculating cache keys for view fragments
|
14
|
+
|
15
|
+
ActiveSupport.on_load(:action_view) do
|
16
|
+
ActiveSupport.on_load(:after_initialize) do
|
17
|
+
begin
|
18
|
+
if defined?(CacheDigests::DependencyTracker)
|
19
|
+
# 'cache_digests' gem being used (overrides Rails 4 implementation)
|
20
|
+
CacheDigests::DependencyTracker.register_tracker :et, CacheDigests::DependencyTracker::ERBTracker
|
21
|
+
|
22
|
+
if ::Rails.env.development?
|
23
|
+
# recalculate cache digest keys for each request
|
24
|
+
CacheDigests::TemplateDigestor.cache = ActiveSupport::Cache::NullStore.new
|
25
|
+
end
|
26
|
+
else
|
27
|
+
# will only apply if Rails 4, which includes 'action_view/dependency_tracker'
|
28
|
+
require 'action_view/dependency_tracker'
|
29
|
+
ActionView::DependencyTracker.register_tracker :et, ActionView::DependencyTracker::ERBTracker
|
30
|
+
ActionView::Base.cache_template_loading = false if ::Rails.env.development?
|
31
|
+
end
|
32
|
+
rescue
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rails/generators/erb/controller/controller_generator'
|
2
|
+
|
3
|
+
module Et
|
4
|
+
module Generators
|
5
|
+
class ControllerGenerator < Erb::Generators::ControllerGenerator
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def handler
|
11
|
+
:et
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'generators/et/controller/controller_generator'
|
2
|
+
|
3
|
+
module Et
|
4
|
+
module Generators
|
5
|
+
class MailerGenerator < ControllerGenerator
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def format
|
11
|
+
:text
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rails/generators/erb/scaffold/scaffold_generator'
|
2
|
+
|
3
|
+
module Et
|
4
|
+
module Generators
|
5
|
+
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
def copy_view_files
|
9
|
+
available_views.each do |view|
|
10
|
+
filename = filename_with_extensions(view)
|
11
|
+
template "#{view}.html.et.erb", File.join("app/views", controller_file_path, filename)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
hook_for :form_builder, :as => :scaffold
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def available_views
|
20
|
+
%w(index edit show new)
|
21
|
+
end
|
22
|
+
|
23
|
+
def handler
|
24
|
+
:et
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
h1 "Editing <%= singular_table_name.titleize %>"
|
2
|
+
|
3
|
+
form_for(:<%= singular_table_name %>, method: :put) do |f|
|
4
|
+
<% for attribute in attributes -%>
|
5
|
+
f.<%= attribute.field_type %> :<%= attribute.name %>, wrapper_class: 'field'
|
6
|
+
<% end -%>
|
7
|
+
f.submit 'Save Changes'
|
8
|
+
end
|
9
|
+
|
10
|
+
a('Show', href: '{{<%= singular_table_name %>_path(@<%= singular_table_name %>)}}')
|
11
|
+
null_wrap "|"
|
12
|
+
a('Back', href: '{{<%= plural_table_name %>_path}}')
|
@@ -0,0 +1,11 @@
|
|
1
|
+
p(:notice) { notice }
|
2
|
+
h1 { "Listing <%= plural_table_name.titleize %>" }
|
3
|
+
|
4
|
+
table_for(:<%= plural_table_name %>) do |t|
|
5
|
+
<% for attribute in attributes -%>
|
6
|
+
t.column :<%= attribute.name %>
|
7
|
+
<% end -%>
|
8
|
+
t.column :default_action, header: 'Actions', actions: [:show, :edit, :delete]
|
9
|
+
end
|
10
|
+
|
11
|
+
link_to 'New <%= singular_table_name.titleize %>', '{{new_<%= singular_table_name %>_path}}'
|
@@ -0,0 +1,10 @@
|
|
1
|
+
h1 "<%= singular_table_name.titleize %>"
|
2
|
+
|
3
|
+
form_for(:<%= singular_table_name %>, method: :post) do |f|
|
4
|
+
<% for attribute in attributes -%>
|
5
|
+
f.<%= attribute.field_type %> :<%= attribute.name %>, wrapper_class: 'field'
|
6
|
+
<% end -%>
|
7
|
+
f.submit 'Save'
|
8
|
+
end
|
9
|
+
|
10
|
+
a('Back', href: '{{<%= plural_table_name %>_path}}')
|
@@ -0,0 +1,12 @@
|
|
1
|
+
p(:notice) { notice }
|
2
|
+
|
3
|
+
<% for attribute in attributes -%>
|
4
|
+
p {
|
5
|
+
b { "<%= attribute.human_name %>:" }
|
6
|
+
null_wrap { "{{@<%= singular_table_name %>.<%= attribute.name %>}}" }
|
7
|
+
}
|
8
|
+
<% end -%>
|
9
|
+
|
10
|
+
link_to 'Edit', '{{edit_<%= singular_table_name %>_path(@<%= singular_table_name %>)}}'
|
11
|
+
null_wrap '|'
|
12
|
+
link_to 'Back', '{{<%= plural_table_name %>_path}}'
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: express_templates_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steven Talcott Smith
|
8
|
+
- Eumir Gaspar
|
9
|
+
- Neil Gardose
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 4.2.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 4.2.0
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: express_templates
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
description: Provides Express Template generators for Rails
|
44
|
+
email:
|
45
|
+
- steve@aelogica.com
|
46
|
+
- eumir@aelogica.com
|
47
|
+
- neil@aelogica.com
|
48
|
+
executables: []
|
49
|
+
extensions: []
|
50
|
+
extra_rdoc_files: []
|
51
|
+
files:
|
52
|
+
- MIT-LICENSE
|
53
|
+
- README.rdoc
|
54
|
+
- Rakefile
|
55
|
+
- lib/express_templates_rails.rb
|
56
|
+
- lib/express_templates_rails/version.rb
|
57
|
+
- lib/generators/et/controller/controller_generator.rb
|
58
|
+
- lib/generators/et/controller/templates/view.html.et
|
59
|
+
- lib/generators/et/mailer/mailer_generator.rb
|
60
|
+
- lib/generators/et/mailer/templates/view.text.et
|
61
|
+
- lib/generators/et/scaffold/scaffold_generator.rb
|
62
|
+
- lib/generators/et/scaffold/templates/edit.html.et.erb
|
63
|
+
- lib/generators/et/scaffold/templates/index.html.et.erb
|
64
|
+
- lib/generators/et/scaffold/templates/new.html.et.erb
|
65
|
+
- lib/generators/et/scaffold/templates/show.html.et.erb
|
66
|
+
- lib/tasks/express_templates_rails_tasks.rake
|
67
|
+
homepage: http://github.com/aelogica/express_templates_rails
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.4.5
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: Provides Express Template generators for Rails
|
91
|
+
test_files: []
|