inherited_rails_views 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/Readme.textile +11 -0
- data/inherited_rails_views.gemspec +25 -0
- data/lib/inherited_rails_views.rb +12 -0
- data/lib/inherited_rails_views/helpers/application_helper.rb +6 -0
- data/lib/inherited_rails_views/version.rb +3 -0
- data/lib/inherited_rails_views/views/application/_form.html.haml +19 -0
- data/lib/inherited_rails_views/views/application/edit.html.haml +10 -0
- data/lib/inherited_rails_views/views/application/index.html.haml +23 -0
- data/lib/inherited_rails_views/views/application/new.html.haml +8 -0
- data/lib/inherited_rails_views/views/application/show.html.haml +15 -0
- metadata +69 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/Readme.textile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
h1. DRY views
|
2
|
+
|
3
|
+
The "old inherited views project":https://github.com/fredwu/inherited_resources_views by Fred was a great idea. With Rails 3.1, inherited views got even simpler. This Project provides you with basic views for your CRUD actions. No generators, no nothing ;)
|
4
|
+
|
5
|
+
h1. Install
|
6
|
+
|
7
|
+
Add the inherited_rails_views-rails gem to your Applications Gemfile:
|
8
|
+
|
9
|
+
bc. gem 'inherited_rails_views'
|
10
|
+
|
11
|
+
Now you can delete your scaffolded views folder.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "inherited_rails_views/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "inherited_rails_views"
|
7
|
+
s.version = InheritedRailsViews::VERSION
|
8
|
+
s.authors = ["Robin Wenglewski"]
|
9
|
+
s.email = ["robin@wenglewski.de"]
|
10
|
+
s.homepage = "https://github.com/rweng/inherited_rails_views"
|
11
|
+
s.summary = %q{inherited views for Rails > 3.1}
|
12
|
+
# s.description = %q{TODO: Write a gem description}
|
13
|
+
|
14
|
+
# s.rubyforge_project = "inherited-views"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
s.add_dependency "haml-rails"
|
25
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "inherited_rails_views/version"
|
2
|
+
require "inherited_rails_views/helpers/application_helper"
|
3
|
+
|
4
|
+
module InheritedRailsViews
|
5
|
+
if defined?(::Rails) and Rails.version >="3.1"
|
6
|
+
class Engine < ::Rails::Engine
|
7
|
+
end
|
8
|
+
|
9
|
+
ActionController::Base.append_view_path( File.expand_path "../inherited_rails_views/views", __FILE__ )
|
10
|
+
ActionController::Base.extend ApplicationHelper
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
= form_for resource do |f|
|
2
|
+
-if resource.errors.any?
|
3
|
+
#error_explanation
|
4
|
+
%h2= "#{pluralize(resource.errors.count, "error")} prohibited this news from being saved:"
|
5
|
+
%ul
|
6
|
+
- resource.errors.full_messages.each do |msg|
|
7
|
+
%li= msg
|
8
|
+
|
9
|
+
%table
|
10
|
+
- shown_attrs.each do |attr|
|
11
|
+
%tr
|
12
|
+
%td.field
|
13
|
+
= f.label attr.titleize
|
14
|
+
%td.field
|
15
|
+
= f.text_field attr.to_sym
|
16
|
+
%tr
|
17
|
+
%td
|
18
|
+
%td.actions
|
19
|
+
= f.submit 'Save'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
%h1
|
2
|
+
Listing
|
3
|
+
= collection.name
|
4
|
+
|
5
|
+
%table
|
6
|
+
%tr
|
7
|
+
- shown_attrs.each do |attr|
|
8
|
+
%th
|
9
|
+
= attr.titleize
|
10
|
+
%th
|
11
|
+
%th
|
12
|
+
%th
|
13
|
+
|
14
|
+
- collection.each do |res|
|
15
|
+
%tr
|
16
|
+
- shown_attrs.each do |attr|
|
17
|
+
%td= res.send(attr)
|
18
|
+
%td= link_to 'Show', res
|
19
|
+
%td= link_to 'Edit', edit_resource_path(res)
|
20
|
+
%td= link_to 'Destroy', res, :confirm => 'Are you sure?', :method => :delete
|
21
|
+
%br
|
22
|
+
= link_to "Create #{collection.name}", new_resource_path
|
23
|
+
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: inherited_rails_views
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Robin Wenglewski
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-08-30 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: haml-rails
|
16
|
+
requirement: &70339569922680 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70339569922680
|
25
|
+
description:
|
26
|
+
email:
|
27
|
+
- robin@wenglewski.de
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- Gemfile
|
34
|
+
- Rakefile
|
35
|
+
- Readme.textile
|
36
|
+
- inherited_rails_views.gemspec
|
37
|
+
- lib/inherited_rails_views.rb
|
38
|
+
- lib/inherited_rails_views/helpers/application_helper.rb
|
39
|
+
- lib/inherited_rails_views/version.rb
|
40
|
+
- lib/inherited_rails_views/views/application/_form.html.haml
|
41
|
+
- lib/inherited_rails_views/views/application/edit.html.haml
|
42
|
+
- lib/inherited_rails_views/views/application/index.html.haml
|
43
|
+
- lib/inherited_rails_views/views/application/new.html.haml
|
44
|
+
- lib/inherited_rails_views/views/application/show.html.haml
|
45
|
+
homepage: https://github.com/rweng/inherited_rails_views
|
46
|
+
licenses: []
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.8.10
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: inherited views for Rails > 3.1
|
69
|
+
test_files: []
|