thesilverspoon 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/.gitignore~ +4 -0
- data/Gemfile~ +6 -0
- data/lib/integratedscaffold.rb +299 -0
- data/lib/integratedscaffold.rb~ +299 -0
- data/lib/templates/actions/create.rb +8 -0
- data/lib/templates/actions/destroy.rb +5 -0
- data/lib/templates/actions/edit.rb +4 -0
- data/lib/templates/actions/index.rb +5 -0
- data/lib/templates/actions/integrated_view.rb +3 -0
- data/lib/templates/actions/new.rb +4 -0
- data/lib/templates/actions/parse_save_from_excel.rb +45 -0
- data/lib/templates/actions/show.rb +5 -0
- data/lib/templates/actions/update.rb +8 -0
- data/lib/templates/assets/images/background.jpg +0 -0
- data/lib/templates/assets/images/download.png +0 -0
- data/lib/templates/assets/images/inner_texture.jpeg +0 -0
- data/lib/templates/assets/images/logo.png +0 -0
- data/lib/templates/assets/images/new.png +0 -0
- data/lib/templates/assets/images/upload.png +0 -0
- data/lib/templates/assets/images/welcome_icon_1.png +0 -0
- data/lib/templates/assets/images/welcome_icon_2.png +0 -0
- data/lib/templates/assets/images/welcome_icon_3.png +0 -0
- data/lib/templates/assets/images/welcome_icon_4.png +0 -0
- data/lib/templates/assets/images/welcome_image.png +0 -0
- data/lib/templates/assets/javascripts/exclusions/fiddletabs.js +233 -0
- data/lib/templates/assets/javascripts/exclusions/jquery.mousewheel.min.js +12 -0
- data/lib/templates/assets/javascripts/exclusions/jquery.pageslide.js +202 -0
- data/lib/templates/assets/javascripts/jquery.dataTables.min.js +2475 -0
- data/lib/templates/assets/stylesheets/base_classes.css.scss +107 -0
- data/lib/templates/assets/stylesheets/exclusions/fiddletabs.css +77 -0
- data/lib/templates/assets/stylesheets/exclusions/images/Sorting icons.psd +0 -0
- data/lib/templates/assets/stylesheets/exclusions/images/back_disabled.jpg +0 -0
- data/lib/templates/assets/stylesheets/exclusions/images/back_enabled.jpg +0 -0
- data/lib/templates/assets/stylesheets/exclusions/images/favicon.ico +0 -0
- data/lib/templates/assets/stylesheets/exclusions/images/forward_disabled.jpg +0 -0
- data/lib/templates/assets/stylesheets/exclusions/images/forward_enabled.jpg +0 -0
- data/lib/templates/assets/stylesheets/exclusions/images/sort_asc.png +0 -0
- data/lib/templates/assets/stylesheets/exclusions/images/sort_asc_disabled.png +0 -0
- data/lib/templates/assets/stylesheets/exclusions/images/sort_both.png +0 -0
- data/lib/templates/assets/stylesheets/exclusions/images/sort_desc.png +0 -0
- data/lib/templates/assets/stylesheets/exclusions/images/sort_desc_disabled.png +0 -0
- data/lib/templates/assets/stylesheets/exclusions/jquery_data_table.css +513 -0
- data/lib/templates/assets/stylesheets/images/Sorting icons.psd +0 -0
- data/lib/templates/assets/stylesheets/images/back_disabled.jpg +0 -0
- data/lib/templates/assets/stylesheets/images/back_enabled.jpg +0 -0
- data/lib/templates/assets/stylesheets/images/favicon.ico +0 -0
- data/lib/templates/assets/stylesheets/images/forward_disabled.jpg +0 -0
- data/lib/templates/assets/stylesheets/images/forward_enabled.jpg +0 -0
- data/lib/templates/assets/stylesheets/images/sort_asc.png +0 -0
- data/lib/templates/assets/stylesheets/images/sort_asc_disabled.png +0 -0
- data/lib/templates/assets/stylesheets/images/sort_both.png +0 -0
- data/lib/templates/assets/stylesheets/images/sort_desc.png +0 -0
- data/lib/templates/assets/stylesheets/images/sort_desc_disabled.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-icons_222222_256x240.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-icons_454545_256x240.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-icons_888888_256x240.png +0 -0
- data/lib/templates/assets/stylesheets/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/templates/assets/stylesheets/information_page.css.scss +3 -0
- data/lib/templates/assets/stylesheets/jquery_data_table.css +513 -0
- data/lib/templates/controller.rb +4 -0
- data/lib/templates/file_uploader.rb +48 -0
- data/lib/templates/helper.rb +2 -0
- data/lib/templates/layouts/application.html.erb +69 -0
- data/lib/templates/layouts/dummy_data.html.erb +80 -0
- data/lib/templates/layouts/information_page.html.erb +81 -0
- data/lib/templates/layouts/pageslide_form_at.html.erb +2 -0
- data/lib/templates/layouts/welcome.html.erb +71 -0
- data/lib/templates/migration.rb +18 -0
- data/lib/templates/model.rb +20 -0
- data/lib/templates/views/erb/_form.html.erb +37 -0
- data/lib/templates/views/erb/edit.html.erb +11 -0
- data/lib/templates/views/erb/index.html.erb +29 -0
- data/lib/templates/views/erb/integrated_view.html.erb +229 -0
- data/lib/templates/views/erb/new.html.erb +11 -0
- data/lib/templates/views/erb/show.html.erb +20 -0
- data/lib/thesilverspoon.rb~ +302 -0
- data/lib/thesilverspoon/version.rb +1 -1
- data/lib/thesilverspoon/version.rb~ +3 -0
- data/thesilverspoon.gemspec~ +33 -0
- metadata +102 -15
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class FileUploader < CarrierWave::Uploader::Base
|
4
|
+
|
5
|
+
# Include RMagick or MiniMagick support:
|
6
|
+
# include CarrierWave::RMagick
|
7
|
+
include CarrierWave::MiniMagick
|
8
|
+
|
9
|
+
# Choose what kind of storage to use for this uploader:
|
10
|
+
storage :file
|
11
|
+
# storage :fog
|
12
|
+
|
13
|
+
# Override the directory where uploaded files will be stored.
|
14
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
15
|
+
def store_dir
|
16
|
+
"#{::Rails.root.to_s}/public/excel_uploaded_files/"
|
17
|
+
end
|
18
|
+
|
19
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
20
|
+
# def default_url
|
21
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
22
|
+
# end
|
23
|
+
|
24
|
+
# Process files as they are uploaded:
|
25
|
+
# process :scale => [200, 300]
|
26
|
+
#
|
27
|
+
# def scale(width, height)
|
28
|
+
# # do something
|
29
|
+
# end
|
30
|
+
|
31
|
+
# Create different versions of your uploaded files:
|
32
|
+
# version :thumb do
|
33
|
+
# process :scale => [50, 50]
|
34
|
+
# end
|
35
|
+
|
36
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
37
|
+
# For images you might use something like this:
|
38
|
+
def extension_white_list
|
39
|
+
[:xls]
|
40
|
+
end
|
41
|
+
|
42
|
+
# Override the filename of the uploaded files:
|
43
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
44
|
+
# def filename
|
45
|
+
# "something.jpg" if original_filename
|
46
|
+
# end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>BrandName</title>
|
5
|
+
<%%= stylesheet_link_tag "application" %>
|
6
|
+
<%%= javascript_include_tag "application" %>
|
7
|
+
<%%= csrf_meta_tags %>
|
8
|
+
<script type="text/javascript">
|
9
|
+
$(function() {
|
10
|
+
$('a.activate_pageslide').pageslide({direction:"left"});
|
11
|
+
});
|
12
|
+
</script>
|
13
|
+
<%%= yield(:head) %>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<div id="wrapper">
|
17
|
+
<div class="topbar" style="z-index: 999999999">
|
18
|
+
<div class="fill">
|
19
|
+
<div class="container">
|
20
|
+
<a class="brand" href="/">BrandName</a>
|
21
|
+
<ul class="nav">
|
22
|
+
<!--<li><a href="#about" style="color:white;">About</a></li>-->
|
23
|
+
<!--<li><a href="#contact" style="color:white;">Contact</a></li>-->
|
24
|
+
</ul>
|
25
|
+
|
26
|
+
<%% if !user_signed_in? %>
|
27
|
+
<%%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => "pull-right"}) do |f| %>
|
28
|
+
<%%= f.text_field :username, :class=>"input-small", :placeholder=>"Username" %>
|
29
|
+
<%%= f.password_field :password, :class=>"input-small", :placeholder=>"Password" %>
|
30
|
+
<%%= f.submit "Sign In", :class=>"primary btn" %>
|
31
|
+
<%% end %>
|
32
|
+
<%% else %>
|
33
|
+
<div class="pull-right" style="margin-top: 10px;color:white;">
|
34
|
+
<%%= current_user.username %>
|
35
|
+
<span class="nav_link">
|
36
|
+
| <%%= link_to "Sign out", destroy_user_session_path, :method => :delete, :style=>"color:white;" %>
|
37
|
+
</span>
|
38
|
+
</div>
|
39
|
+
<%% end %>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
<div class="container">
|
44
|
+
|
45
|
+
<div class="content">
|
46
|
+
<%%= js extend_gritter :position => :bottom_right %>
|
47
|
+
<%%= js add_gritter(flash[:notice], :image => :success, :title => "Notice", :sticky => false, :time => 2000) %>
|
48
|
+
<%%= js add_gritter(flash[:alert], :image => :warning, :title => "Alert!", :sticky => false, :time => 2000) %>
|
49
|
+
<%%= yield %>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
<%% if request.fullpath=="/" %>
|
53
|
+
|
54
|
+
<footer>
|
55
|
+
<p>A <a href="http://www.ptotem.com">Ptotem Learning Projects</a> Initiative 2011</p>
|
56
|
+
</footer>
|
57
|
+
|
58
|
+
<%% end %>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<%%= javascript_include_tag "/assets/exclusions/jquery.pageslide" %>
|
63
|
+
|
64
|
+
|
65
|
+
</body>
|
66
|
+
</html>
|
67
|
+
|
68
|
+
|
69
|
+
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>BrandName</title>
|
5
|
+
<%%= stylesheet_link_tag "application" %>
|
6
|
+
<%%= javascript_include_tag "application" %>
|
7
|
+
<%%= csrf_meta_tags %>
|
8
|
+
<script type="text/javascript">
|
9
|
+
$(function() {
|
10
|
+
$('a.activate_pageslide').pageslide({direction:"left"});
|
11
|
+
});
|
12
|
+
</script>
|
13
|
+
<%%= yield(:head) %>
|
14
|
+
<style>
|
15
|
+
table td {
|
16
|
+
border: none;
|
17
|
+
}
|
18
|
+
|
19
|
+
table tr {
|
20
|
+
border: none;
|
21
|
+
}
|
22
|
+
</style>
|
23
|
+
</head>
|
24
|
+
<body>
|
25
|
+
<div id="wrapper">
|
26
|
+
<div class="topbar" style="z-index: 999999999">
|
27
|
+
<div class="fill">
|
28
|
+
<div class="container">
|
29
|
+
<a class="brand" href="/">BrandName</a>
|
30
|
+
<ul class="nav">
|
31
|
+
<!--<li><a href="#about" style="color:white;">About</a></li>-->
|
32
|
+
<!--<li><a href="#contact" style="color:white;">Contact</a></li>-->
|
33
|
+
</ul>
|
34
|
+
|
35
|
+
<%% if !user_signed_in? %>
|
36
|
+
<%%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => "pull-right"}) do |f| %>
|
37
|
+
<%%= f.text_field :username, :class=>"input-small", :placeholder=>"Username" %>
|
38
|
+
<%%= f.password_field :password, :class=>"input-small", :placeholder=>"Password" %>
|
39
|
+
<%%= f.submit "Sign In", :class=>"primary btn" %>
|
40
|
+
<%% end %>
|
41
|
+
<%% else %>
|
42
|
+
<div class="pull-right" style="margin-top: 10px;color:white;">
|
43
|
+
<%%= current_user.username %>
|
44
|
+
<span class="nav_link">
|
45
|
+
| <%%= link_to "Sign out", destroy_user_session_path, :method => :delete, :style=>"color:white;" %>
|
46
|
+
</span>
|
47
|
+
</div>
|
48
|
+
<%% end %>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
<div class="container">
|
53
|
+
|
54
|
+
<div class="page-header" style="height:100px"></div>
|
55
|
+
<div style="position:absolute;margin-top: -110px;" class="span16">
|
56
|
+
<%%= yield(:page_header) %>
|
57
|
+
</div>
|
58
|
+
|
59
|
+
<div class="content">
|
60
|
+
<%%= js extend_gritter :position => :bottom_right %>
|
61
|
+
<%%= js add_gritter(flash[:notice], :image => :success, :title => "Notice", :sticky => false, :time => 2000) %>
|
62
|
+
<%%= js add_gritter(flash[:alert], :image => :warning, :title => "Alert!", :sticky => false, :time => 2000) %>
|
63
|
+
<%%= yield %>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<%% if request.fullpath=="/" %>
|
67
|
+
|
68
|
+
<footer>
|
69
|
+
<p>A <a href="http://www.ptotem.com">Ptotem Learning Projects</a> Initiative 2011</p>
|
70
|
+
</footer>
|
71
|
+
|
72
|
+
<%% end %>
|
73
|
+
</div>
|
74
|
+
</div>
|
75
|
+
|
76
|
+
<%%= javascript_include_tag "/assets/exclusions/jquery.pageslide" %>
|
77
|
+
|
78
|
+
|
79
|
+
</body>
|
80
|
+
</html>
|
@@ -0,0 +1,81 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>BrandName</title>
|
5
|
+
<%%= stylesheet_link_tag "application" %>
|
6
|
+
<%%= javascript_include_tag "application" %>
|
7
|
+
<script src='http://www.google.com/jsapi'></script>
|
8
|
+
<%%= csrf_meta_tags %>
|
9
|
+
<script type="text/javascript">
|
10
|
+
$(function() {
|
11
|
+
$('a.activate_pageslide').pageslide({direction:"left"});
|
12
|
+
});
|
13
|
+
</script>
|
14
|
+
<%%= yield(:head) %>
|
15
|
+
<style>
|
16
|
+
table td {
|
17
|
+
border: none;
|
18
|
+
}
|
19
|
+
|
20
|
+
table tr {
|
21
|
+
border: none;
|
22
|
+
}
|
23
|
+
</style>
|
24
|
+
</head>
|
25
|
+
<body>
|
26
|
+
<div id="wrapper">
|
27
|
+
<div class="topbar" style="z-index: 999999999">
|
28
|
+
<div class="fill">
|
29
|
+
<div class="container">
|
30
|
+
<a class="brand" href="/">BrandName</a>
|
31
|
+
<ul class="nav">
|
32
|
+
<!--<li><a href="#about" style="color:white;">About</a></li>-->
|
33
|
+
<!--<li><a href="#contact" style="color:white;">Contact</a></li>-->
|
34
|
+
</ul>
|
35
|
+
|
36
|
+
<%% if !user_signed_in? %>
|
37
|
+
<%%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => "pull-right"}) do |f| %>
|
38
|
+
<%%= f.text_field :username, :class=>"input-small", :placeholder=>"Username" %>
|
39
|
+
<%%= f.password_field :password, :class=>"input-small", :placeholder=>"Password" %>
|
40
|
+
<%%= f.submit "Sign In", :class=>"primary btn" %>
|
41
|
+
<%% end %>
|
42
|
+
<%% else %>
|
43
|
+
<div class="pull-right" style="margin-top: 10px;color:white;">
|
44
|
+
<%%= current_user.username %>
|
45
|
+
<span class="nav_link">
|
46
|
+
| <%%= link_to "Sign out", destroy_user_session_path, :method => :delete, :style=>"color:white;" %>
|
47
|
+
</span>
|
48
|
+
</div>
|
49
|
+
<%% end %>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
<div class="container">
|
54
|
+
|
55
|
+
<div class="page-header" style="height:100px"></div>
|
56
|
+
<div style="position:absolute;margin-top: -110px;" class="span16">
|
57
|
+
<%%= yield(:page_header) %>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div class="content">
|
61
|
+
<%%= js extend_gritter :position => :bottom_right %>
|
62
|
+
<%%= js add_gritter(flash[:notice], :image => :success, :title => "Notice", :sticky => false, :time => 2000) %>
|
63
|
+
<%%= js add_gritter(flash[:alert], :image => :warning, :title => "Alert!", :sticky => false, :time => 2000) %>
|
64
|
+
<%%= yield %>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
<%% if request.fullpath=="/" %>
|
68
|
+
|
69
|
+
<footer>
|
70
|
+
<p>A <a href="http://www.ptotem.com">Ptotem Learning Projects</a> Initiative 2011</p>
|
71
|
+
</footer>
|
72
|
+
|
73
|
+
<%% end %>
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<%%= javascript_include_tag "/assets/exclusions/jquery.pageslide" %>
|
78
|
+
|
79
|
+
|
80
|
+
</body>
|
81
|
+
</html>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>BrandName</title>
|
5
|
+
<%%= stylesheet_link_tag "application" %>
|
6
|
+
<%%= javascript_include_tag "application" %>
|
7
|
+
<%%= csrf_meta_tags %>
|
8
|
+
<script type="text/javascript">
|
9
|
+
$(function() {
|
10
|
+
$('a.activate_pageslide').pageslide({direction:"left"});
|
11
|
+
});
|
12
|
+
</script>
|
13
|
+
<%%= yield(:head) %>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<div id="wrapper">
|
17
|
+
<div class="topbar" style="z-index: 999999999">
|
18
|
+
<div class="fill">
|
19
|
+
<div class="container">
|
20
|
+
<a class="brand" href="/">BrandName</a>
|
21
|
+
<ul class="nav">
|
22
|
+
<!--<li><a href="#about" style="color:white;">About</a></li>-->
|
23
|
+
<!--<li><a href="#contact" style="color:white;">Contact</a></li>-->
|
24
|
+
</ul>
|
25
|
+
|
26
|
+
<%% if !user_signed_in? %>
|
27
|
+
<%%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => "pull-right"}) do |f| %>
|
28
|
+
<%%= f.text_field :username, :class=>"input-small", :placeholder=>"Username" %>
|
29
|
+
<%%= f.password_field :password, :class=>"input-small", :placeholder=>"Password" %>
|
30
|
+
<%%= f.submit "Sign In", :class=>"primary btn" %>
|
31
|
+
<%% end %>
|
32
|
+
<%% else %>
|
33
|
+
<div class="pull-right" style="margin-top: 10px;color:white;">
|
34
|
+
<%%= current_user.username %>
|
35
|
+
<span class="nav_link">
|
36
|
+
| <%%= link_to "Sign out", destroy_user_session_path, :method => :delete, :style=>"color:white;" %>
|
37
|
+
</span>
|
38
|
+
</div>
|
39
|
+
<%% end %>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
<div class="container">
|
44
|
+
|
45
|
+
<div class="page-header" style="height:100px"></div>
|
46
|
+
<div style="position:absolute;margin-top: -120px">
|
47
|
+
<h1><%%= yield(:page_header) %></h1>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<div class="content">
|
51
|
+
<%%= js extend_gritter :position => :bottom_right %>
|
52
|
+
<%%= js add_gritter(flash[:notice], :image => :success, :title => "Notice", :sticky => false, :time => 2000) %>
|
53
|
+
<%%= js add_gritter(flash[:alert], :image => :warning, :title => "Alert!", :sticky => false, :time => 2000) %>
|
54
|
+
<%%= yield %>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<%% if request.fullpath=="/" %>
|
58
|
+
|
59
|
+
<footer>
|
60
|
+
<p>A <a href="http://www.ptotem.com">Ptotem Learning Projects</a> Initiative 2011</p>
|
61
|
+
</footer>
|
62
|
+
|
63
|
+
<%% end %>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
<%%= javascript_include_tag "/assets/exclusions/jquery.pageslide" %>
|
68
|
+
|
69
|
+
|
70
|
+
</body>
|
71
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Create<%= class_name.pluralize.delete('::') %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :<%= table_name || plural_name.split('/').last %> do |t|
|
4
|
+
<%- for attribute in model_attributes -%>
|
5
|
+
t.<%= attribute.type %> :<%= attribute.name %>
|
6
|
+
<%- end -%>
|
7
|
+
<%- unless options[:skip_timestamps] -%>
|
8
|
+
t.timestamps
|
9
|
+
<%- end -%>
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table :<%= table_name || plural_name.split('/').last %>
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class <%= class_name %> < ActiveRecord::Base
|
2
|
+
<%= " set_table_name :#{table_name}\n" if table_name -%>
|
3
|
+
attr_accessible <%= model_attributes.map { |a| ":#{a.name}" }.join(", ") %>
|
4
|
+
<% model_attributes.each do |attribute| %>
|
5
|
+
<%= "#validates_presence_of :#{attribute.name}" %>
|
6
|
+
<% if attribute.type==:integer -%>
|
7
|
+
<%="#validates_numericality_of :#{attribute.name}"%>
|
8
|
+
<% end -%>
|
9
|
+
<% if attribute.type==:string -%>
|
10
|
+
<%= "#validates_length_of :#{attribute.name} ,:maximum=>255" %>
|
11
|
+
<% end -%>
|
12
|
+
<% end -%>
|
13
|
+
|
14
|
+
#Schema Information
|
15
|
+
<% model_attributes.each do |attribute| %>
|
16
|
+
#<%= attribute.name %>:<%=attribute.type %>
|
17
|
+
<% end %>
|
18
|
+
#scopes
|
19
|
+
#default_scope order('created_at DESC')
|
20
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%%= form_for <%= item_path :instance_variable => true %> do |f| %>
|
2
|
+
|
3
|
+
|
4
|
+
<%% if @<%= instance_name %>.errors.any? %>
|
5
|
+
<div id="error_explanation">
|
6
|
+
<h2><%%= pluralize(@<%= instance_name %>.errors.count, "error") %> prohibited this <%= instance_name %>from being saved:</h2>
|
7
|
+
|
8
|
+
<ul>
|
9
|
+
<%% @<%= instance_name %>.errors.full_messages.each do |msg| %>
|
10
|
+
<li><%%= msg %></li>
|
11
|
+
<%% end %>
|
12
|
+
</ul>
|
13
|
+
</div>
|
14
|
+
<%% end %>
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
<table class="condensed-table">
|
19
|
+
<%- for attribute in model_attributes -%>
|
20
|
+
<tr>
|
21
|
+
<td><%%= f.label :<%= attribute.name %> %></td>
|
22
|
+
<%- if attribute.name.match('_id') %>
|
23
|
+
<td><%%= f.select :<%= attribute.name %>,<%= attribute.name.split('_')[0].capitalize %>.all.collect{|var|[var.name,var.id]} %></td>
|
24
|
+
|
25
|
+
<%else %>
|
26
|
+
<td><%%= f.<%= attribute.field_type %> :<%= attribute.name %> %></td>
|
27
|
+
<% end %>
|
28
|
+
</tr>
|
29
|
+
|
30
|
+
<%- end -%>
|
31
|
+
</table>
|
32
|
+
<br>
|
33
|
+
<br>
|
34
|
+
|
35
|
+
<%%= f.submit "Submit" ,:style=>"margin:auto",:class=>"btn primary large"%>
|
36
|
+
|
37
|
+
<%% end %>
|