foundation_scaffold 0.0.2
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 +7 -0
- data/.ruby-version +1 -0
- data/LICENSE +20 -0
- data/README.md +1 -0
- data/foundation_scaffold.gemspec +19 -0
- data/lib/foundation/generators/scaffold_generator.rb +13 -0
- data/lib/foundation/generators/templates/_form.html.erb +36 -0
- data/lib/foundation/generators/templates/edit.html.erb +3 -0
- data/lib/foundation/generators/templates/index.html.erb +30 -0
- data/lib/foundation/generators/templates/new.html.erb +3 -0
- data/lib/foundation/generators/templates/show.html.erb +17 -0
- data/lib/foundation_helper.rb +28 -0
- data/lib/foundation_scaffold/version.rb +6 -0
- data/lib/foundation_scaffold.rb +13 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 09e3263f593d7479d03599b9298a9b8be25a1708
|
4
|
+
data.tar.gz: 6079a0420e75829488b8ed80caf182ea09fc5483
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4f4cd654ce2c137176f0bbe60803243056c737bfb41669bc43d471435b952639eed21bf24cf6fcd457a287205bb58ca84d8d83257539667bacabda93c2ba1a2d
|
7
|
+
data.tar.gz: 17c5b3cdb8339645a8503aa5998100e9e5e72e98375bcd2e6ac415fc4f2ccf51ac1f8947e2ff50c79d49dce2ae6f035db0978c8e15819b66a0d1f889fecbd8fd
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p247
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Jacob Evan Shreve
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Generate Scaffold made for foundation
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path('../lib/foundation_scaffold/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'foundation_scaffold'
|
5
|
+
s.version = Foundation::Scaffold::VERSION
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.authors = ["Jacob Evan Shreve"]
|
8
|
+
s.email = %w(jacob@shreve.ly)
|
9
|
+
s.summary = "Helpers and Generators just for Zurb's Foundation"
|
10
|
+
s.description = "Helpers and Generators just for the most advanced responsive front-end framework in the world."
|
11
|
+
|
12
|
+
s.homepage = 'https://github.com/shreve/foundation_scaffold'
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.add_dependency 'zurb-foundation'
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.require_path = 'lib'
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#require 'rails/generators/rails/scaffold/scaffold_generator'
|
2
|
+
require 'rails/generators/erb/scaffold/scaffold_generator'
|
3
|
+
|
4
|
+
module Foundation
|
5
|
+
module Generators
|
6
|
+
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
7
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
8
|
+
|
9
|
+
# Never generate scaffold.css
|
10
|
+
remove_hook_for :stylesheet_engine
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%%= form_for @<%= singular_table_name %>, html: { class: 'custom' } do |f| %>
|
2
|
+
<%% if @<%= singular_table_name %>.errors.any? %>
|
3
|
+
<div id="error list">
|
4
|
+
<h2><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
|
5
|
+
|
6
|
+
<ul class="errors">
|
7
|
+
<%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
|
8
|
+
<li class="alert alert-box"><%%= msg %></li>
|
9
|
+
<%% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<%% end %>
|
13
|
+
<% attributes.each do |attribute| -%>
|
14
|
+
<% symbol = attribute.reference? ? attribute.column_name : attribute.name %>
|
15
|
+
<%%= row class: 'collapse field' do %>
|
16
|
+
<% if attribute.password_digest? -%>
|
17
|
+
<%%= three_block f.label :password, class: 'prefix' %>
|
18
|
+
<%%= nine_block f.password_field :password %>
|
19
|
+
|
20
|
+
<%%= three_block f.label :password_confirmation, class: 'prefix' %>
|
21
|
+
<%%= nine_block f.password_field :password_confirmation %>
|
22
|
+
<% else -%>
|
23
|
+
<%%= three_block f.label :<%= symbol %>, class: 'prefix' %>
|
24
|
+
<%%= nine_block f.<%= attribute.field_type %> :<%= symbol %> %>
|
25
|
+
<% end -%>
|
26
|
+
<%% end %>
|
27
|
+
<% end -%>
|
28
|
+
<br/>
|
29
|
+
<ul class="button-group">
|
30
|
+
<li><%%= f.submit class: 'button' %></li>
|
31
|
+
<%% unless @<%= singular_table_name %>.new_record? %>
|
32
|
+
<li><%%= link_to 'Show', @<%= singular_table_name %>, class: 'secondary button' %></li>
|
33
|
+
<%% end %>
|
34
|
+
<li><%%= link_to 'Back', <%= index_helper %>_path, class: 'secondary button' %></li>
|
35
|
+
</ul>
|
36
|
+
<%% end %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<h1><%= plural_table_name.capitalize %></h1>
|
2
|
+
|
3
|
+
<%%= link_to 'New <%= human_name %>', new_<%= singular_table_name %>_path, class: 'button' %>
|
4
|
+
|
5
|
+
<table width="100%">
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
9
|
+
<th><%= attribute.human_name %></th>
|
10
|
+
<% end -%>
|
11
|
+
<th>Manage</th>
|
12
|
+
</tr>
|
13
|
+
</thead>
|
14
|
+
|
15
|
+
<tbody>
|
16
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
17
|
+
<tr>
|
18
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
19
|
+
<td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
|
20
|
+
<% end -%>
|
21
|
+
<td><ul class="button-group">
|
22
|
+
<li><%%= link_to 'Show', <%= singular_table_name %>, class: 'small secondary button' %></li>
|
23
|
+
<li><%%= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'small secondary button' %></li>
|
24
|
+
<li><%%= link_to 'Destroy', <%= singular_table_name %>, method: :delete, data: { confirm: 'Are you sure?' }, class: 'small alert button' %></li>
|
25
|
+
</ul></td>
|
26
|
+
</tr>
|
27
|
+
<%% end %>
|
28
|
+
</tbody>
|
29
|
+
</table>
|
30
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h1><%= singular_table_name.capitalize %> #<%%= @<%= singular_table_name %>.id %></h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tbody>
|
5
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
6
|
+
<tr>
|
7
|
+
<th><%= attribute.human_name %></th>
|
8
|
+
<td><%%= @<%= singular_table_name %>.<%= attribute.name %> %></td>
|
9
|
+
</tr>
|
10
|
+
<% end -%>
|
11
|
+
</tbody>
|
12
|
+
</table>
|
13
|
+
|
14
|
+
<ul class="button-group">
|
15
|
+
<li><%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: 'secondary button' %></li>
|
16
|
+
<li><%%= link_to 'Back', <%= index_helper %>_path, class: 'secondary button' %></li>
|
17
|
+
</ul>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module FoundationHelper
|
2
|
+
{
|
3
|
+
one: 1,
|
4
|
+
two: 2,
|
5
|
+
three: 3,
|
6
|
+
four: 4,
|
7
|
+
five: 5,
|
8
|
+
six: 6,
|
9
|
+
seven: 7,
|
10
|
+
eight: 8,
|
11
|
+
nine: 9,
|
12
|
+
ten: 10,
|
13
|
+
eleven: 11,
|
14
|
+
twelve: 12
|
15
|
+
}.each do |w,n|
|
16
|
+
define_method("#{w}_block".to_sym) do |content=nil, options={}, &block|
|
17
|
+
klass = "large-#{options[:large] || n} small-#{options[:small] || n} columns"
|
18
|
+
klass << " #{options[:class]}" if options[:class].present?
|
19
|
+
content_tag(options[:tag] || :div, content || options[:content] || capture(&block), class: klass)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def row(options={}, &block)
|
24
|
+
klass = "row"
|
25
|
+
klass << " #{options[:class]}" if options[:class].present?
|
26
|
+
content_tag(:div, capture(&block), class: klass)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
root = File.join(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require "#{root}/foundation_scaffold/version"
|
4
|
+
|
5
|
+
if defined?(Rails::Generators::Base) and defined?(Foundation)
|
6
|
+
require "#{root}/foundation/generators/scaffold_generator"
|
7
|
+
#require "#{root}/foundation/generators/scaffold_views_generator"
|
8
|
+
end
|
9
|
+
|
10
|
+
if defined?(ActionView::Base)
|
11
|
+
require 'foundation_helper'
|
12
|
+
ActionView::Base.send :include, FoundationHelper
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foundation_scaffold
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jacob Evan Shreve
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: zurb-foundation
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Helpers and Generators just for the most advanced responsive front-end
|
28
|
+
framework in the world.
|
29
|
+
email:
|
30
|
+
- jacob@shreve.ly
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- .ruby-version
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- foundation_scaffold.gemspec
|
39
|
+
- lib/foundation/generators/scaffold_generator.rb
|
40
|
+
- lib/foundation/generators/templates/_form.html.erb
|
41
|
+
- lib/foundation/generators/templates/edit.html.erb
|
42
|
+
- lib/foundation/generators/templates/index.html.erb
|
43
|
+
- lib/foundation/generators/templates/new.html.erb
|
44
|
+
- lib/foundation/generators/templates/show.html.erb
|
45
|
+
- lib/foundation_helper.rb
|
46
|
+
- lib/foundation_scaffold.rb
|
47
|
+
- lib/foundation_scaffold/version.rb
|
48
|
+
homepage: https://github.com/shreve/foundation_scaffold
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.0.3
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: Helpers and Generators just for Zurb's Foundation
|
72
|
+
test_files: []
|