dust-generators 0.2.6 → 0.2.8
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.
- data/README.rdoc +18 -6
- data/TODO.txt +5 -0
- data/lib/dust/version.rb +2 -2
- data/lib/generators/dust/albums/USAGE +2 -4
- data/lib/generators/dust/albums/albums_generator.rb +138 -138
- data/lib/generators/dust/albums/templates/app/controllers/albums_controller.rb +18 -18
- data/lib/generators/dust/albums/templates/app/controllers/photos_controller.rb +37 -37
- data/lib/generators/dust/albums/templates/app/controllers/view_albums_controller.rb +9 -9
- data/lib/generators/dust/albums/templates/app/models/album.rb +50 -48
- data/lib/generators/dust/albums/templates/app/models/photo.rb +21 -21
- data/lib/generators/dust/albums/templates/app/views/albums/_form.html.haml +35 -0
- data/lib/generators/dust/albums/templates/app/views/albums/_search.html.haml +4 -0
- data/lib/generators/dust/albums/templates/app/views/albums/_upload_script.html.haml +39 -0
- data/lib/generators/dust/albums/templates/app/views/albums/edit.html.haml +4 -0
- data/lib/generators/dust/albums/templates/app/views/albums/index.html.haml +35 -0
- data/lib/generators/dust/albums/templates/app/views/albums/manage.html.haml +47 -0
- data/lib/generators/dust/albums/templates/app/views/albums/new.html.haml +6 -0
- data/lib/generators/dust/albums/templates/app/views/albums/show.html.haml +42 -0
- data/lib/generators/dust/albums/templates/app/views/albums/show.js.haml +1 -0
- data/lib/generators/dust/albums/templates/app/views/photos/_form.html.haml +17 -0
- data/lib/generators/dust/albums/templates/app/views/photos/_photo.html.haml +22 -0
- data/lib/generators/dust/albums/templates/app/views/photos/_search.html.haml +5 -0
- data/lib/generators/dust/albums/templates/app/views/photos/array.js.haml +3 -0
- data/lib/generators/dust/albums/templates/app/views/photos/edit.html.haml +27 -0
- data/lib/generators/dust/albums/templates/app/views/photos/index.html.haml +85 -0
- data/lib/generators/dust/albums/templates/app/views/photos/new.html.haml +7 -0
- data/lib/generators/dust/albums/templates/app/views/photos/show.html.haml +24 -0
- data/lib/generators/dust/albums/templates/app/views/photos/show.js.haml +10 -0
- data/lib/generators/dust/albums/templates/app/views/view_albums/index.html.haml +25 -0
- data/lib/generators/dust/albums/templates/app/views/view_albums/show.html.haml +32 -0
- data/lib/generators/dust/albums/templates/javascripts/dust_album.js +22 -22
- data/lib/generators/dust/albums/templates/migration/albums_migration.rb +23 -21
- data/lib/generators/dust/albums/templates/stylesheets/dust_album.css +15 -3
- data/lib/generators/dust/albums/templates/stylesheets/dust_album_app.css +54 -3
- data/lib/generators/dust/scaffold/scaffold_generator.rb +20 -20
- data/lib/generators/dust/scaffold/templates/controller.rb +6 -6
- data/lib/generators/dust/scaffold/templates/migration.rb +2 -0
- data/lib/generators/dust/scaffold/templates/model.rb +10 -10
- data/lib/generators/dust/scaffold/templates/view_controller.rb +8 -8
- data/lib/generators/dust/scaffold/templates/views/erb/_search.html.erb +5 -5
- data/lib/generators/dust/scaffold/templates/views/front_end/{index.html.erb → erb/index.html.erb} +6 -6
- data/lib/generators/dust/scaffold/templates/views/front_end/erb/show.html.erb +17 -0
- data/lib/generators/dust/scaffold/templates/views/front_end/haml/index.html.haml +10 -0
- data/lib/generators/dust/scaffold/templates/views/front_end/haml/show.html.haml +15 -0
- data/lib/generators/dust/scaffold/templates/views/haml/_form.html.haml +7 -4
- data/lib/generators/dust/scaffold/templates/views/haml/_search.html.haml +5 -0
- data/lib/generators/dust/scaffold/templates/views/haml/edit.html.haml +1 -11
- data/lib/generators/dust/scaffold/templates/views/haml/index.html.haml +18 -23
- data/lib/generators/dust/scaffold/templates/views/haml/new.html.haml +1 -3
- data/lib/generators/dust/scaffold/templates/views/haml/show.html.haml +15 -13
- data/rails_generators/dust_albums/USAGE +2 -4
- data/rails_generators/dust_config/USAGE +3 -3
- data/rails_generators/dust_scaffold/USAGE +5 -5
- metadata +30 -26
- data/lib/generators/dust/albums/templates/app/views/albums/_form.html.erb +0 -52
- data/lib/generators/dust/albums/templates/app/views/albums/_search.html.erb +0 -6
- data/lib/generators/dust/albums/templates/app/views/albums/_upload_script.html.erb +0 -39
- data/lib/generators/dust/albums/templates/app/views/albums/edit.html.erb +0 -5
- data/lib/generators/dust/albums/templates/app/views/albums/index.html.erb +0 -61
- data/lib/generators/dust/albums/templates/app/views/albums/manage.html.erb +0 -65
- data/lib/generators/dust/albums/templates/app/views/albums/new.html.erb +0 -6
- data/lib/generators/dust/albums/templates/app/views/albums/show.html.erb +0 -56
- data/lib/generators/dust/albums/templates/app/views/albums/show.js.erb +0 -1
- data/lib/generators/dust/albums/templates/app/views/photos/_form.html.erb +0 -23
- data/lib/generators/dust/albums/templates/app/views/photos/_photo.html.erb +0 -25
- data/lib/generators/dust/albums/templates/app/views/photos/_search.html.erb +0 -6
- data/lib/generators/dust/albums/templates/app/views/photos/array.js.erb +0 -3
- data/lib/generators/dust/albums/templates/app/views/photos/edit.html.erb +0 -28
- data/lib/generators/dust/albums/templates/app/views/photos/index.html.erb +0 -85
- data/lib/generators/dust/albums/templates/app/views/photos/new.html.erb +0 -7
- data/lib/generators/dust/albums/templates/app/views/photos/show.html.erb +0 -26
- data/lib/generators/dust/albums/templates/app/views/photos/show.js.erb +0 -9
- data/lib/generators/dust/albums/templates/app/views/view_albums/index.html.erb +0 -31
- data/lib/generators/dust/albums/templates/app/views/view_albums/show.html.erb +0 -31
- data/lib/generators/dust/scaffold/templates/views/front_end/show.html.erb +0 -17
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
$(document).ready(function(){
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
// <%=child_singular_name%> management ////////////////////////
|
|
4
|
+
$(".sortable").dragsort({
|
|
5
|
+
dragSelector: "div",
|
|
6
|
+
dragEnd: notice,
|
|
7
|
+
placeHolderTemplate: "<li class='placeHolder'><div></div></li>"
|
|
8
|
+
});
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
$("#reorder").hide();
|
|
11
|
+
function notice() {
|
|
12
|
+
$("#reorder").slideDown();
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
$(function () { // this line makes sure this code runs on page load
|
|
16
|
+
$('.checkall').click(function () {
|
|
17
|
+
$(this).parents('form:eq(0)').find(':checkbox').attr('checked', this.checked);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
$("#order_items").click(function(){
|
|
22
|
+
mylist = $('.sortable').serializelist();
|
|
23
|
+
$.post("/<%=child_plural_name%>/array", mylist);
|
|
24
|
+
$.fancybox.showActivity();
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
27
27
|
|
|
28
|
-
});
|
|
28
|
+
});
|
|
@@ -2,38 +2,40 @@ class Create<%=parent_plural_class_name%> < ActiveRecord::Migration
|
|
|
2
2
|
def self.up
|
|
3
3
|
create_table :<%=parent_plural_name%> do |t|
|
|
4
4
|
t.string :title
|
|
5
|
-
|
|
5
|
+
t.string :filename
|
|
6
6
|
t.text :desc
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
t.boolean :active
|
|
8
|
+
t.string :heading
|
|
9
|
+
t.string :nav
|
|
10
|
+
t.integer :parent_id
|
|
11
|
+
t.integer :lft
|
|
12
|
+
t.integer :rgt
|
|
11
13
|
t.timestamps
|
|
12
14
|
end
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
CmsMenuItem.create({:title =>"<%=parent_plural_class_name%>", :controller_name => "<%=parent_plural_name%>", :url => "/<%=parent_plural_name%>"})
|
|
17
|
+
MenuItem.create({:title => "All <%=parent_plural_class_name%>", :url => "/all/<%=parent_plural_name%>", :active => true})
|
|
18
|
+
|
|
19
|
+
create_table :<%=child_plural_name%> do |t|
|
|
18
20
|
t.string :title
|
|
19
21
|
t.text :desc
|
|
20
22
|
t.date :date_shot
|
|
21
23
|
t.string :location
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
t.integer :<%=parent_singular_name%>_id
|
|
25
|
+
t.string :file_file_name
|
|
26
|
+
t.string :file_content_type
|
|
27
|
+
t.integer :file_file_size
|
|
28
|
+
t.datetime :file_updated_at
|
|
29
|
+
t.integer :parent_id
|
|
30
|
+
t.integer :lft
|
|
31
|
+
t.integer :rgt
|
|
30
32
|
t.timestamps
|
|
31
33
|
end
|
|
32
|
-
|
|
34
|
+
|
|
33
35
|
end
|
|
34
|
-
|
|
36
|
+
|
|
35
37
|
def self.down
|
|
36
38
|
drop_table :<%=parent_plural_name%>
|
|
37
|
-
|
|
39
|
+
drop_table :<%=child_plural_name%>
|
|
38
40
|
end
|
|
39
41
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#uploadify h3 { display:block; text-align:center; color:#767D87; font-weight: normal; }
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
.<%=child_plural_name%>{overflow:hidden;}
|
|
4
4
|
.<%=child_singular_name%> { text-align:center; float:left; width:100px; height:150px; margin: 5px; }
|
|
5
5
|
|
|
6
6
|
tr.even td { background: #fff;}
|
|
@@ -10,7 +10,19 @@ table.<%=child_plural_name%> tr th { background: #D3DAE6; padding:5px; }
|
|
|
10
10
|
table.<%=child_plural_name%> tr.even td { background: #D3DAE6; padding:15px;}
|
|
11
11
|
table.<%=child_plural_name%> tr.odd td { padding:15px;}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
.<%=child_plural_name%> li{ float:left; padding:5px; width:100px; height:125px; }
|
|
14
14
|
.<%=child_singular_name%>{ width:90px; height:125px; padding:5px; text-align:center; }
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
.<%=parent_plural_name%> li{ overflow:hidden;}
|
|
17
|
+
.<%=parent_plural_name%> .image, .<%=parent_plural_name%> .title, .<%=parent_plural_name%> .date{ float: left; }
|
|
18
|
+
.<%=parent_plural_name%> .title, .<%=parent_plural_name%> .date{padding: 35px;}
|
|
19
|
+
|
|
20
|
+
.placeHolder div { background-color:transparent !important; width:100px; height: 125px; }
|
|
21
|
+
|
|
22
|
+
.manage_photos{float:left;display:block;width:15px;height:13px;margin:0 5px;}
|
|
23
|
+
|
|
24
|
+
.manage{ float:right; }
|
|
25
|
+
|
|
26
|
+
.even { background: #D3DAE6; padding:15px;}
|
|
27
|
+
.odd {padding:15px;}
|
|
28
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*================== ALBUMS ==================*/
|
|
2
2
|
|
|
3
3
|
#uploadify h3 { display:block; text-align:center; color:#767D87; font-weight: normal; }
|
|
4
4
|
|
|
@@ -7,9 +7,60 @@ tr.even td { background: #fff;}
|
|
|
7
7
|
#uploads{overflow:hidden; width: 845px; margin:0 auto}
|
|
8
8
|
.<%=child_singular_name%> { text-align:center; float:left; width:130px; height: 175px; margin: 5px; }
|
|
9
9
|
.<%=parent_singular_name%>_thumb{ width: 288px; height:125px; margin:10px; float:left }
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
.<%=parent_singular_name%>_thumb a{ text-align:left; }
|
|
11
|
+
|
|
12
12
|
table.<%=child_plural_name%>{ margin: 0 auto; width:100%; border:1px solid #C5CCD6; }
|
|
13
13
|
tr th { background: #D3DAE6; padding:5px; }
|
|
14
14
|
tr.even td { background: #D3DAE6; padding:15px;}
|
|
15
15
|
tr.odd td { padding:15px;}
|
|
16
|
+
|
|
17
|
+
/*================== PHOTOS ==================*/
|
|
18
|
+
|
|
19
|
+
ul.columns{
|
|
20
|
+
text-align:left;
|
|
21
|
+
list-style: none;
|
|
22
|
+
margin: 0 auto; padding: 0;
|
|
23
|
+
}
|
|
24
|
+
ul.columns li {
|
|
25
|
+
width: 100px;
|
|
26
|
+
float: left; display: inline;
|
|
27
|
+
margin: 3px; padding: 0;
|
|
28
|
+
position: relative;
|
|
29
|
+
}
|
|
30
|
+
ul.columns li:hover {z-index: 99;}
|
|
31
|
+
|
|
32
|
+
ul.columns li img {
|
|
33
|
+
position: relative;
|
|
34
|
+
filter: alpha(opacity=70);
|
|
35
|
+
opacity: 0.7;
|
|
36
|
+
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
|
|
37
|
+
}
|
|
38
|
+
ul.columns li:hover img{
|
|
39
|
+
z-index: 999;
|
|
40
|
+
filter: alpha(opacity=100);
|
|
41
|
+
opacity: 1;
|
|
42
|
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ul.columns li .info {
|
|
46
|
+
position: absolute;
|
|
47
|
+
left: -30px; top: -10px;
|
|
48
|
+
padding: 120px 10px 20px;
|
|
49
|
+
width: 150px;
|
|
50
|
+
display: none;
|
|
51
|
+
background: #fff;
|
|
52
|
+
font-size: 1.2em;
|
|
53
|
+
-webkit-border-radius: 3px;
|
|
54
|
+
-moz-border-radius: 3px;
|
|
55
|
+
border-radius: 3px;
|
|
56
|
+
border:1px solid #999999;
|
|
57
|
+
}
|
|
58
|
+
ul.columns li:hover .info {display: block;}
|
|
59
|
+
|
|
60
|
+
ul.columns li h2 {
|
|
61
|
+
font-size: 1.2em;
|
|
62
|
+
font-weight: normal;
|
|
63
|
+
text-transform: uppercase;
|
|
64
|
+
margin: 0; padding: 10px 0;
|
|
65
|
+
}
|
|
66
|
+
ul.columns li p {padding: 0; margin: 0; font-size: 0.9em;}
|
|
@@ -17,7 +17,7 @@ module Dust
|
|
|
17
17
|
class_option :skip_frontend, :desc => 'Don\'t generate a front end controller or views.', :type => :boolean
|
|
18
18
|
class_option :skip_controller, :desc => 'Don\'t generate controller, helper, or views.', :type => :boolean
|
|
19
19
|
class_option :invert, :desc => 'Generate all controller actions except these mentioned.', :type => :boolean
|
|
20
|
-
class_option :
|
|
20
|
+
class_option :erb, :desc => 'Generate ERB views instead of HAML.', :type => :boolean
|
|
21
21
|
|
|
22
22
|
class_option :testunit, :desc => 'Use test/unit for test files.', :group => 'Test framework', :type => :boolean
|
|
23
23
|
class_option :rspec, :desc => 'Use RSpec for test files.', :group => 'Test framework', :type => :boolean
|
|
@@ -30,7 +30,7 @@ module Dust
|
|
|
30
30
|
@model_attributes = []
|
|
31
31
|
@skip_model = options.skip_model?
|
|
32
32
|
@invert_actions = options.invert?
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
|
|
35
35
|
args_for_c_m.each do |arg|
|
|
36
36
|
if arg == '!'
|
|
@@ -66,7 +66,7 @@ module Dust
|
|
|
66
66
|
def add_gems
|
|
67
67
|
gem "mocha", :group => :test unless File.read(destination_path("Gemfile")).include? "mocha"
|
|
68
68
|
end
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
def create_model
|
|
71
71
|
unless @skip_model
|
|
72
72
|
template 'model.rb', "app/models/#{singular_name}.rb"
|
|
@@ -91,28 +91,28 @@ module Dust
|
|
|
91
91
|
template 'controller.rb', "app/controllers/#{plural_name}_controller.rb"
|
|
92
92
|
|
|
93
93
|
template 'helper.rb', "app/helpers/#{plural_name}_helper.rb"
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
controller_actions.each do |action|
|
|
96
96
|
if %w[index show new edit].include?(action) # Actions with templates
|
|
97
97
|
template "views/#{view_language}/#{action}.html.#{view_language}", "app/views/#{plural_name}/#{action}.html.#{view_language}"
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
|
|
101
|
+
template "views/#{view_language}/_search.html.#{view_language}", "app/views/#{plural_name}/_search.html.#{view_language}"
|
|
102
|
+
|
|
103
103
|
if form_partial?
|
|
104
104
|
template "views/#{view_language}/_form.html.#{view_language}", "app/views/#{plural_name}/_form.html.#{view_language}"
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
unless options[:skip_frontend]
|
|
108
|
+
template "view_controller.rb", "app/controllers/view_#{plural_name}_controller.rb"
|
|
109
|
+
|
|
110
|
+
route("match \"all-#{plural_name}\" => \"view_#{plural_name}#index\", :as => :view_#{plural_name}")
|
|
111
|
+
route("match \"#{singular_name}/:filename\" => \"view_#{plural_name}#show\", :as => :view_#{singular_name}")
|
|
112
|
+
|
|
113
|
+
template "views/front_end/#{view_language}/index.html.#{view_language}", "app/views/view_#{plural_name}/index.html.#{view_language}"
|
|
114
|
+
template "views/front_end/#{view_language}/show.html.#{view_language}", "app/views/view_#{plural_name}/show.html.#{view_language}"
|
|
115
|
+
end
|
|
116
116
|
|
|
117
117
|
route "resources #{plural_name.to_sym.inspect}"
|
|
118
118
|
|
|
@@ -166,10 +166,10 @@ module Dust
|
|
|
166
166
|
|
|
167
167
|
def render_form
|
|
168
168
|
if form_partial?
|
|
169
|
-
if options.
|
|
170
|
-
"= render 'form'"
|
|
171
|
-
else
|
|
169
|
+
if options.erb?
|
|
172
170
|
"<%= render 'form' %>"
|
|
171
|
+
else
|
|
172
|
+
"= render 'form'"
|
|
173
173
|
end
|
|
174
174
|
else
|
|
175
175
|
read_template("views/#{view_language}/_form.html.#{view_language}")
|
|
@@ -215,7 +215,7 @@ module Dust
|
|
|
215
215
|
end
|
|
216
216
|
|
|
217
217
|
def view_language
|
|
218
|
-
options.
|
|
218
|
+
options.erb? ? 'erb' : 'haml'
|
|
219
219
|
end
|
|
220
220
|
|
|
221
221
|
def test_framework
|
|
@@ -11,7 +11,9 @@ class Create<%= plural_class_name %> < ActiveRecord::Migration
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
CmsMenuItem.create({:title =>"<%= plural_class_name %>", :controller_name => "<%= plural_name %>", :url => "/<%= plural_name %>"})
|
|
14
|
+
<%- unless options[:skip_frontend] %>
|
|
14
15
|
MenuItem.create({:title => "All <%=plural_class_name%>", :url => "/all-<%=plural_name%>", :active => true})
|
|
16
|
+
<%- end -%>
|
|
15
17
|
|
|
16
18
|
def self.down
|
|
17
19
|
drop_table :<%= plural_name %>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
class <%= class_name %> < ActiveRecord::Base
|
|
2
2
|
attr_accessible <%= model_attributes.map { |a| ":#{a.name}" }.join(", ") %>
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
<%- first_attribute = model_attributes.first -%>
|
|
5
|
+
def self.page(search, page)
|
|
6
|
+
with_permissions_to(:manage).search(search).order("<%= first_attribute.name %>").paginate(:per_page => 12, :page => page)
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
def self.search(search)
|
|
10
|
+
if search
|
|
11
|
+
where("<%= first_attribute.name %> LIKE ?", "%#{search}%")
|
|
12
|
+
else
|
|
13
|
+
scoped
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
16
|
end
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<%- first_attribute = model_attributes.first -%>
|
|
2
2
|
class View<%= plural_class_name %>Controller < ApplicationController
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
def index
|
|
5
5
|
@<%= plural_name %> = <%= class_name %>.page(params[:search], params[:page])
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def show
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if <%= class_name %>.find_by_<%= first_attribute.name %>(params[:filename]) == nil
|
|
10
|
+
@<%= singular_name %> = <%= class_name %>.find(:first)
|
|
11
|
+
render :file => "#{RAILS_ROOT}/public/404.html", :layout => false, :status => 404
|
|
12
|
+
else
|
|
13
|
+
@<%= singular_name %> = <%= class_name %>.find_by_<%= first_attribute.name %>(params[:filename])
|
|
14
|
+
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
end
|
|
17
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div id="searchbox">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
</div>
|
|
2
|
+
<%%= form_tag <%= plural_name %>_path, :method => 'get' do %>
|
|
3
|
+
<%%= text_field_tag :search, params[:search], :class => "input-text", :placeholder => 'Search <%= plural_name.capitalize %>' %>
|
|
4
|
+
<%%= image_submit_tag "admin/blank.png", :class => "image-submit"%>
|
|
5
|
+
<%% end %>
|
|
6
|
+
</div>
|
data/lib/generators/dust/scaffold/templates/views/front_end/{index.html.erb → erb/index.html.erb}
RENAMED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
<%%= will_paginate @<%= plural_name %> %>
|
|
5
5
|
|
|
6
6
|
<%% @<%= plural_name %>.each do |<%= singular_name %>| %>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
<div class="item">
|
|
8
|
+
<h3>
|
|
9
|
+
<%%= link_to <%= singular_name %>.<%= first_attribute.name %>, view_<%= singular_name %>_path(<%= singular_name %>.<%= first_attribute.name %>) %>
|
|
10
|
+
</h3>
|
|
11
|
+
</div>
|
|
12
12
|
<%% end -%>
|
|
13
13
|
|
|
14
|
-
<%%= will_paginate @<%= plural_name %> %>
|
|
14
|
+
<%%= will_paginate @<%= plural_name %> %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%- first_attribute = model_attributes.first -%>
|
|
2
|
+
<%% title @<%= singular_name %>.title %>
|
|
3
|
+
|
|
4
|
+
<%% content_tag :div, :class => "page_#{@<%= singular_name %>.id}" do %>
|
|
5
|
+
|
|
6
|
+
<%% heading @<%= singular_name %>.<%= first_attribute.name %> %>
|
|
7
|
+
<%%= @<%= singular_name %>.<%= first_attribute.name %> %>
|
|
8
|
+
|
|
9
|
+
<%% end %>
|
|
10
|
+
|
|
11
|
+
<%% if permitted_to? :manage, :<%= plural_name %> %>
|
|
12
|
+
<p>
|
|
13
|
+
<%%= link_to "Edit", edit_<%= singular_name %>_path(@<%= singular_name %>) %> |
|
|
14
|
+
<%%= link_to "Destroy", @<%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %> |
|
|
15
|
+
<%%= link_to "View All", <%= plural_name %>_path %>
|
|
16
|
+
</p>
|
|
17
|
+
<%% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
- title "<%= plural_name.titleize %>"
|
|
2
|
+
<%- first_attribute = model_attributes.first -%>
|
|
3
|
+
|
|
4
|
+
= will_paginate @<%= plural_name %>
|
|
5
|
+
|
|
6
|
+
- @<%= plural_name %>.each do |<%= singular_name %>|
|
|
7
|
+
.item
|
|
8
|
+
%h3= link_to <%= singular_name %>.<%= first_attribute.name %>, view_<%= singular_name %>_path(<%= singular_name %>.<%= first_attribute.name %>)
|
|
9
|
+
|
|
10
|
+
= will_paginate @<%= plural_name %>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<%- first_attribute = model_attributes.first -%>
|
|
2
|
+
- title @<%= singular_name %>.title
|
|
3
|
+
|
|
4
|
+
- content_tag :div, :class => "page_#{@<%= singular_name %>.id}" do
|
|
5
|
+
|
|
6
|
+
- heading @<%= singular_name %>.<%= first_attribute.name %>
|
|
7
|
+
= @<%= singular_name %>.<%= first_attribute.name %>
|
|
8
|
+
|
|
9
|
+
- if permitted_to? :manage, :<%= plural_name %>
|
|
10
|
+
%p
|
|
11
|
+
= link_to "Edit", edit_<%= singular_name %>_path(@<%= singular_name %>)
|
|
12
|
+
|
|
|
13
|
+
= link_to "Destroy", @<%= singular_name %>, :confirm => 'Are you sure?', :method => :delete
|
|
14
|
+
|
|
|
15
|
+
= link_to "View All", <%= plural_name %>_path
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
= content_for :head do
|
|
2
|
+
= javascript_include_tag :ckeditor
|
|
3
|
+
|
|
4
|
+
- form_for @<%= singular_name %>, :validate => true do |f|
|
|
2
5
|
= f.error_messages
|
|
3
6
|
<%- for attribute in model_attributes -%>
|
|
4
|
-
|
|
7
|
+
.item
|
|
5
8
|
= f.label :<%= attribute.name %>
|
|
6
9
|
%br
|
|
7
|
-
= f.<%= attribute.field_type %> :<%= attribute.name
|
|
10
|
+
= f.<%= attribute.field_type %> :<%= attribute.name %>, :class => 'field'
|
|
8
11
|
<%- end -%>
|
|
9
|
-
|
|
12
|
+
.item
|
|
10
13
|
= f.submit
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
- title "Edit <%= singular_name.titleize %>"
|
|
2
|
+
- heading "Edit <%= singular_name.titleize %>"
|
|
2
3
|
|
|
3
4
|
<%= render_form %>
|
|
4
|
-
|
|
5
|
-
<%- if actions? :show, :index -%>
|
|
6
|
-
%p
|
|
7
|
-
<%- if action? :show -%>
|
|
8
|
-
= link_to "Show", <%= singular_name %>_path(@<%= singular_name %>)
|
|
9
|
-
|
|
|
10
|
-
<%- end -%>
|
|
11
|
-
<%- if action? :index -%>
|
|
12
|
-
= link_to "View All", <%= plural_name %>_path
|
|
13
|
-
<%- end -%>
|
|
14
|
-
<%- end -%>
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
- title "<%= plural_name.titleize %>"
|
|
1
|
+
- title "<%= plural_name.titleize %>"
|
|
2
|
+
<%- first_attribute = model_attributes.first -%>
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
%th <%= attribute.human_name %>
|
|
7
|
-
<%- end -%>
|
|
8
|
-
- for <%= singular_name %> in @<%= plural_name %>
|
|
9
|
-
%tr
|
|
10
|
-
<%- for attribute in model_attributes -%>
|
|
11
|
-
%td= <%= singular_name %>.<%= attribute.name %>
|
|
12
|
-
<%- end -%>
|
|
13
|
-
<%- if action? :show -%>
|
|
14
|
-
%td= link_to 'Show', <%= singular_name %>
|
|
15
|
-
<%- end -%>
|
|
16
|
-
<%- if action? :edit -%>
|
|
17
|
-
%td= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>)
|
|
18
|
-
<%- end -%>
|
|
19
|
-
<%- if action? :destroy -%>
|
|
20
|
-
%td= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete
|
|
21
|
-
<%- end -%>
|
|
4
|
+
.button_bar
|
|
5
|
+
= render :partial => 'search'
|
|
6
|
+
= link_to 'new page', new_<%= singular_name %>_path, :class => 'newfile tip', :title => "New <%= singular_name.titleize %>"
|
|
22
7
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
= will_paginate @<%= plural_name %>
|
|
9
|
+
|
|
10
|
+
- @<%= plural_name %>.each do |<%= singular_name %>|
|
|
11
|
+
.item
|
|
12
|
+
.ui-widget.ui-helper-clearfix{:style => 'float:right'}
|
|
13
|
+
= link_to '', edit_<%= singular_name %>_path(<%= singular_name %>), :class => 'ui-icon ui-icon-pencil edit tip', :title => "Edit This Item"
|
|
14
|
+
= link_to '', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete, :class => 'ui-icon ui-icon-close destroy tip', :title => "Destroy This Item"
|
|
15
|
+
|
|
16
|
+
%h3= link_to <%= singular_name %>.<%= first_attribute.name %>, <%= singular_name %>
|
|
17
|
+
%p
|
|
18
|
+
= link_to "Preview <%= singular_name.titleize %>", <%= singular_name %>, :class => 'remote_iframe'
|
|
19
|
+
|
|
20
|
+
= will_paginate @<%= plural_name %>
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
- title "<%= singular_name.titleize %>"
|
|
2
|
+
<%- first_attribute = model_attributes.first -%>
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
%p
|
|
5
|
-
%strong <%= attribute.human_name.titleize %>:
|
|
6
|
-
= @<%= singular_name %>.<%= attribute.name %>
|
|
7
|
-
<%- end -%>
|
|
4
|
+
.item
|
|
8
5
|
|
|
9
|
-
|
|
6
|
+
.ui-widget.ui-helper-clearfix{:style => "float:right"}
|
|
10
7
|
<%- if action? :edit -%>
|
|
11
|
-
|
|
12
|
-
|
|
|
8
|
+
=link_to '', edit_<%= singular_name %>_path(@<%= singular_name %>), :class => 'ui-icon ui-icon-pencil edit tip', :title => "Edit This Item"
|
|
13
9
|
<%- end -%>
|
|
14
10
|
<%- if action? :destroy -%>
|
|
15
|
-
|
|
16
|
-
|
|
|
17
|
-
<%- end -%>
|
|
18
|
-
<%- if action? :index -%>
|
|
19
|
-
= link_to "View All", <%= plural_name %>_path
|
|
11
|
+
=link_to "", @<%= singular_name %>, :confirm => 'Are you sure?', :method => :delete, :class => 'ui-icon ui-icon-close destroy tip', :title => "Destroy This Item"
|
|
20
12
|
<%- end -%>
|
|
13
|
+
|
|
14
|
+
%h3= link_to @<%= singular_name %>.<%= first_attribute.name %>, @<%= singular_name %>
|
|
15
|
+
%p
|
|
16
|
+
= link_to "Preview <%= singular_name.titleize %>", @<%= singular_name %>, :class => 'remote_iframe'
|
|
17
|
+
|
|
18
|
+
<%- for attribute in model_attributes -%>
|
|
19
|
+
%p
|
|
20
|
+
%strong <%=attribute.human_name.titleize%>:
|
|
21
|
+
= @<%= singular_name %>.<%= attribute.name %>
|
|
22
|
+
<%- end %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Description:
|
|
2
|
-
The
|
|
2
|
+
The dust_config generator creates YAML file in your config
|
|
3
3
|
directory and an initializer to load this config. The config has a
|
|
4
4
|
separate section for each environment. This is a great place to put
|
|
5
5
|
any config settings you don't want in your app.
|
|
@@ -12,12 +12,12 @@ Description:
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
Examples:
|
|
15
|
-
script/generate
|
|
15
|
+
script/generate dust_config
|
|
16
16
|
|
|
17
17
|
Config: config/app_config.yml
|
|
18
18
|
Initializer: config/initializers/load_app_config.rb
|
|
19
19
|
|
|
20
|
-
script/generate
|
|
20
|
+
script/generate dust_config passwords
|
|
21
21
|
|
|
22
22
|
Config: config/passwords_config.yml
|
|
23
23
|
Initializer: config/initializers/load_passwords_config.rb
|