refinerycms-generators 0.9.9.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gemspec.rb +1 -3
- data/lib/generators/refinery_engine/templates/app/controllers/admin/plural_name_controller.rb +1 -8
- data/lib/generators/refinery_engine/templates/app/views/admin/plural_name/_actions.html.erb +28 -0
- data/lib/generators/refinery_engine/templates/app/views/admin/plural_name/_form.html.erb +5 -2
- data/lib/generators/refinery_engine/templates/app/views/admin/plural_name/_records.html.erb +18 -0
- data/lib/generators/refinery_engine/templates/app/views/admin/plural_name/index.html.erb +7 -51
- data/lib/generators/refinery_engine/templates/config/locales/en.yml +3 -2
- data/lib/generators/refinery_engine/templates/config/locales/lolcat.yml +3 -2
- data/lib/generators/refinery_engine/templates/config/locales/nb.yml +3 -2
- data/lib/generators/refinery_engine/templates/config/locales/nl.yml +3 -2
- data/readme.md +30 -10
- data/refinerycms-generators.gemspec +4 -4
- metadata +5 -3
data/lib/gemspec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
version = '0.
|
2
|
+
version = '1.0.0'
|
3
3
|
raise "Could not get version so gemspec can not be built" if version.nil?
|
4
4
|
files = Dir.glob("**/*").flatten.reject do |file|
|
5
5
|
file =~ /\.gem$/
|
@@ -17,8 +17,6 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.authors = ["Resolve Digital"]
|
18
18
|
s.require_paths = %w(lib)
|
19
19
|
|
20
|
-
#s.add_dependency 'refinerycms', '>= 0.9.9'
|
21
|
-
|
22
20
|
s.files = [
|
23
21
|
'#{files.join("',\n '")}'
|
24
22
|
]
|
data/lib/generators/refinery_engine/templates/app/controllers/admin/plural_name_controller.rb
CHANGED
@@ -4,14 +4,7 @@ module Admin
|
|
4
4
|
crudify :<%= singular_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? and title.name != 'title' %>,
|
5
5
|
:title_attribute => '<%= title.name %>'<% end %><% if plural_name == singular_name %>,
|
6
6
|
:redirect_to_url => :admin_<%= singular_name %>_index_url
|
7
|
-
<% end
|
8
|
-
|
9
|
-
def index
|
10
|
-
search_all_<%= plural_name %> if searching?
|
11
|
-
paginate_all_<%= plural_name %>
|
12
|
-
|
13
|
-
render :partial => '<%= plural_name %>' if request.xhr?
|
14
|
-
end
|
7
|
+
<% end %>, :xhr_paging => true
|
15
8
|
|
16
9
|
end
|
17
10
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<ul>
|
2
|
+
<%% if Admin::<%= class_name.pluralize %>Controller.searchable? %>
|
3
|
+
<li>
|
4
|
+
<%%= render :partial => "/shared/admin/search",
|
5
|
+
:locals => {
|
6
|
+
:url => admin_<%= plural_name %><%= "_index" if plural_name == singular_name%>_url
|
7
|
+
} %>
|
8
|
+
</li>
|
9
|
+
<%% end %>
|
10
|
+
<li>
|
11
|
+
<%%= link_to t('.create_new'), new_admin_<%= singular_name %>_url,
|
12
|
+
:class => "add_icon" %>
|
13
|
+
</li>
|
14
|
+
<%% if !searching? and Admin::<%= class_name.pluralize %>Controller.sortable? and <%= class_name %>.count > 1 %>
|
15
|
+
<li>
|
16
|
+
<%%= link_to t('.reorder', :what => "<%= singular_name.titleize.pluralize %>"),
|
17
|
+
admin_<%= plural_name %><%= "_index" if plural_name == singular_name%>_url,
|
18
|
+
:id => "reorder_action",
|
19
|
+
:class => "reorder_icon" %>
|
20
|
+
|
21
|
+
<%%= link_to t('.reorder_done', :what => "<%= singular_name.titleize.pluralize %>"),
|
22
|
+
admin_<%= plural_name %><%= "_index" if plural_name == singular_name%>_url,
|
23
|
+
:id => "reorder_action_done",
|
24
|
+
:style => "display: none;",
|
25
|
+
:class => "reorder_icon" %>
|
26
|
+
</li>
|
27
|
+
<%% end %>
|
28
|
+
</ul>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
:include_object_name => true
|
9
9
|
} %>
|
10
10
|
<% attributes.each_with_index do |attribute, index| %>
|
11
|
-
<div class='field'>
|
12
11
|
<% unless attribute.field_type.to_s == 'text_area' -%>
|
12
|
+
<div class='field'>
|
13
13
|
<%%= f.label :<%= attribute.name %> -%>
|
14
14
|
<% end -%>
|
15
15
|
<% if attribute.type.to_s == 'image' -%>
|
@@ -26,6 +26,7 @@
|
|
26
26
|
:resource => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %>,
|
27
27
|
} %>
|
28
28
|
<% elsif attribute.field_type.to_s == "text_area" and !generated_text_areas -%>
|
29
|
+
<div class='field'>
|
29
30
|
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
|
30
31
|
<ul id='page_parts'>
|
31
32
|
<%% <%= text_areas.map{|t| t.name.to_sym}.inspect -%>.each_with_index do |part, part_index| %>
|
@@ -44,10 +45,12 @@
|
|
44
45
|
</div>
|
45
46
|
</div>
|
46
47
|
<% generated_text_areas = true -%>
|
47
|
-
<%
|
48
|
+
<% elsif attribute.field_type.to_s != 'text_area' -%>
|
48
49
|
<%%= f.<%= attribute.field_type -%> :<%= attribute.name -%><%= ", :class => 'larger widest'" if (index == 0 && attribute.field_type == :text_field) -%> -%>
|
49
50
|
<% end -%>
|
51
|
+
<% if attribute.field_type.to_s != 'text_area' -%>
|
50
52
|
</div>
|
53
|
+
<% end -%>
|
51
54
|
<% end %>
|
52
55
|
<%%= render :partial => "/shared/admin/form_actions",
|
53
56
|
:locals => {
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%% if searching? %>
|
2
|
+
<h2><%%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
|
3
|
+
<%% end %>
|
4
|
+
<%% if @<%= plural_name %>.any? %>
|
5
|
+
<div class='pagination_container'>
|
6
|
+
<%%= render :partial => '<%= plural_name %>' %>
|
7
|
+
</div>
|
8
|
+
<%% else %>
|
9
|
+
<p>
|
10
|
+
<%% unless searching? %>
|
11
|
+
<strong>
|
12
|
+
<%%= t('.no_items_yet') %>
|
13
|
+
</strong>
|
14
|
+
<%% else %>
|
15
|
+
<%%= t('no_results', :scope => 'shared.admin.search') %>
|
16
|
+
<%% end %>
|
17
|
+
</p>
|
18
|
+
<%% end %>
|
@@ -1,54 +1,10 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
</div>
|
9
|
-
<%% else %>
|
10
|
-
<p>
|
11
|
-
<%% unless searching? %>
|
12
|
-
<strong>
|
13
|
-
<%%= t('.no_items_yet') %>
|
14
|
-
</strong>
|
15
|
-
<%% else %>
|
16
|
-
<%%= t('no_results', :scope => 'shared.admin.search') %>
|
17
|
-
<%% end %>
|
18
|
-
</p>
|
19
|
-
<%% end %>
|
20
|
-
</div>
|
21
|
-
<div id='actions'>
|
22
|
-
<ul>
|
23
|
-
<%% if Admin::<%= class_name.pluralize %>Controller.searchable? %>
|
24
|
-
<li>
|
25
|
-
<%%= render :partial => "/shared/admin/search",
|
26
|
-
:locals => {
|
27
|
-
:url => admin_<%= plural_name %><%= "_index" if plural_name == singular_name%>_url
|
28
|
-
} %>
|
29
|
-
</li>
|
30
|
-
<%% end %>
|
31
|
-
<li>
|
32
|
-
<%%= link_to t('.create_new'), new_admin_<%= singular_name %>_url,
|
33
|
-
:class => "add_icon" %>
|
34
|
-
</li>
|
35
|
-
<%% if !searching? and Admin::<%= class_name.pluralize %>Controller.sortable? and <%= class_name %>.count > 1 %>
|
36
|
-
<li>
|
37
|
-
<%%= link_to t('.reorder', :what => "<%= singular_name.titleize.pluralize %>"),
|
38
|
-
admin_<%= plural_name %><%= "_index" if plural_name == singular_name%>_url,
|
39
|
-
:id => "reorder_action",
|
40
|
-
:class => "reorder_icon" %>
|
41
|
-
|
42
|
-
<%%= link_to t('.reorder_done', :what => "<%= singular_name.titleize.pluralize %>"),
|
43
|
-
admin_<%= plural_name %><%= "_index" if plural_name == singular_name%>_url,
|
44
|
-
:id => "reorder_action_done",
|
45
|
-
:style => "display: none;",
|
46
|
-
:class => "reorder_icon" %>
|
47
|
-
</li>
|
48
|
-
<%% end %>
|
49
|
-
</ul>
|
50
|
-
</div>
|
51
|
-
<%%= render :partial => "/shared/admin/make_sortable",
|
1
|
+
<section id='records'>
|
2
|
+
<%%= render :partial => 'records' %>
|
3
|
+
</section>
|
4
|
+
<aside id='actions'>
|
5
|
+
<%%= render :partial => 'actions' %>
|
6
|
+
</aside>
|
7
|
+
<%%= render :partial => '/shared/admin/make_sortable',
|
52
8
|
:locals => {
|
53
9
|
:tree => false
|
54
10
|
} if !searching? and Admin::<%= class_name.pluralize %>Controller.sortable? and <%= class_name %>.count > 1 %>
|
@@ -8,11 +8,12 @@ en:
|
|
8
8
|
title: <%= plural_name.titleize %>
|
9
9
|
admin:
|
10
10
|
<%= plural_name %>:
|
11
|
-
|
12
|
-
title: <%= plural_name.titleize %>
|
11
|
+
actions:
|
13
12
|
create_new: Add New <%= singular_name.titleize %>
|
14
13
|
reorder: Reorder <%= singular_name.titleize.pluralize %>
|
15
14
|
reorder_done: Done Reordering <%= singular_name.titleize.pluralize %>
|
15
|
+
records:
|
16
|
+
title: <%= plural_name.titleize %>
|
16
17
|
sorry_no_results: Sorry! There are no results found.
|
17
18
|
no_items_yet: There are no <%= singular_name.titleize.pluralize %> yet. Click "Add New <%= singular_name.titleize %>" to add your first <%= singular_name.titleize.downcase %>.
|
18
19
|
<%= singular_name %>:
|
@@ -8,11 +8,12 @@ lolcat:
|
|
8
8
|
title: <%= plural_name.titleize %>
|
9
9
|
admin:
|
10
10
|
<%= plural_name %>:
|
11
|
-
|
12
|
-
title: <%= plural_name.titleize %>
|
11
|
+
actions:
|
13
12
|
create_new: CREATE NEW <%= singular_name.titleize %>
|
14
13
|
reorder: REORDR <%= singular_name.titleize.pluralize %>
|
15
14
|
reorder_done: DUN REORDERIN <%= singular_name.titleize.pluralize %>
|
15
|
+
records:
|
16
|
+
title: <%= plural_name.titleize %>
|
16
17
|
sorry_no_results: SRY! THAR R NO RESULTS FINDZ.
|
17
18
|
no_items_yet: THAR R NO <%= singular_name.titleize.pluralize %> YET. CLICK "CREATE NEW <%= singular_name.titleize %>" 2 ADD UR FURST <%= singular_name.titleize.downcase %>.
|
18
19
|
<%= singular_name %>:
|
@@ -4,11 +4,12 @@ nb:
|
|
4
4
|
title: <%= plural_name.titleize %>
|
5
5
|
admin:
|
6
6
|
<%= plural_name %>:
|
7
|
-
|
8
|
-
title: <%= plural_name.titleize %>
|
7
|
+
actions:
|
9
8
|
create_new: Lag en ny <%= singular_name.titleize %>
|
10
9
|
reorder: Endre rekkefølgen på <%= singular_name.titleize.pluralize %>
|
11
10
|
reorder_done: Ferdig å endre rekkefølgen <%= singular_name.titleize.pluralize %>
|
11
|
+
records:
|
12
|
+
title: <%= plural_name.titleize %>
|
12
13
|
sorry_no_results: Beklager! Vi fant ikke noen resultater.
|
13
14
|
no_items_yet: Det er ingen <%= singular_name.titleize.pluralize %> enda. Klikk på "Lag en ny <%= singular_name.titleize %>" for å legge til din første <%= singular_name.titleize.downcase %>.
|
14
15
|
<%= singular_name %>:
|
@@ -4,11 +4,12 @@ nl:
|
|
4
4
|
title: <%= plural_name.titleize %>
|
5
5
|
admin:
|
6
6
|
<%= plural_name %>:
|
7
|
-
|
8
|
-
title: <%= plural_name.titleize %>
|
7
|
+
actions:
|
9
8
|
create_new: Maak een nieuwe <%= singular_name.titleize %>
|
10
9
|
reorder: Wijzig de volgorde van de <%= singular_name.titleize.pluralize %>
|
11
10
|
reorder_done: Klaar met het wijzingen van de volgorde van de <%= singular_name.titleize.pluralize %>
|
11
|
+
records:
|
12
|
+
title: <%= plural_name.titleize %>
|
12
13
|
sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
|
13
14
|
no_items_yet: Er zijn nog geen <%= singular_name.titleize.pluralize %>. Druk op 'Maak een nieuwe <%= singular_name.titleize %>' om de eerste aan te maken.
|
14
15
|
<%= singular_name %>:
|
data/readme.md
CHANGED
@@ -2,11 +2,15 @@
|
|
2
2
|
|
3
3
|
## Dependencies
|
4
4
|
|
5
|
-
This version
|
5
|
+
This version is targeted at RefineryCMS versions 1.0.0 and higher. Before that,
|
6
|
+
these were built in but we've extracted them to provide greater flexibility for
|
7
|
+
all future versions.
|
6
8
|
|
7
9
|
## Engine Generator
|
8
10
|
|
9
|
-
The Refinery generator is a standard Rails generator that functions just like the
|
11
|
+
The Refinery generator is a standard Rails generator that functions just like the
|
12
|
+
scaffold generator. It allows you to quickly add new managed sections to the
|
13
|
+
Refinery backend and get the front end views for free.
|
10
14
|
|
11
15
|
To see how to use the generator run
|
12
16
|
|
@@ -16,32 +20,48 @@ Usage instructions should appear.
|
|
16
20
|
|
17
21
|
### Engine Generator Example
|
18
22
|
|
19
|
-
Let's say you have a client who has a range of products they want to show on their website.
|
23
|
+
Let's say you have a client who has a range of products they want to show on their website.
|
24
|
+
You've considered using a few pages to manage the products but you've decided it would be
|
25
|
+
much nicer if there was a separate place that had forms dedicated to managing products.
|
20
26
|
|
21
|
-
First decide what fields they need to manage. In our case, the client is going to want
|
27
|
+
First decide what fields they need to manage. In our case, the client is going to want
|
28
|
+
to edit the title and description of each product. They would also like a little "facts panel"
|
29
|
+
to show on the right of the page.
|
22
30
|
|
23
31
|
So go to the root of your project and run
|
24
32
|
|
25
33
|
rails generate refinery_engine
|
26
34
|
|
27
|
-
This will output the help on how to use the generator. To generate the new section
|
35
|
+
This will output the help on how to use the generator. To generate the new section
|
36
|
+
we want to manage products we run:
|
28
37
|
|
29
38
|
rails generate refinery_engine product title:string description:text image:image brochure:resource
|
30
39
|
|
31
|
-
The generator will output a list of files it generated. You'll notice there is a
|
40
|
+
The generator will output a list of files it generated. You'll notice there is a
|
41
|
+
new engine that has been added in `vendor/engines/products`.
|
42
|
+
This is where both the backend and front end files are held for this new products area.
|
32
43
|
|
33
|
-
Engines are treated like gems. When you generate a new engine it adds the gem
|
44
|
+
Engines are treated like gems. When you generate a new engine it adds the gem
|
45
|
+
dependency for this engine to the end of your `Gemfile`. Because your `Gemfile`
|
46
|
+
has changed you now need to run:
|
34
47
|
|
35
48
|
bundle install
|
36
49
|
|
37
|
-
When the products engine was generated a products generator was also created.
|
50
|
+
When the products engine was generated a products generator was also created.
|
51
|
+
This installs any migrations and seeds into your Rails app.
|
52
|
+
Here's how to finish off the install:
|
38
53
|
|
39
54
|
rails generate refinerycms_products
|
40
55
|
rake db:migrate
|
41
56
|
|
42
|
-
Start up your app by running ``ruby script/server`` go to [http://localhost:3000](http://localhost:3000)
|
57
|
+
Start up your app by running ``ruby script/server`` go to [http://localhost:3000](http://localhost:3000)
|
58
|
+
and you'll see instantly a new menu item called "products".
|
59
|
+
Click on that and you'll see there are no products yet.
|
43
60
|
|
44
|
-
Now go to the backend of your site by visiting [http://localhost:3000/refinery](http://localhost:3000/refinery)
|
61
|
+
Now go to the backend of your site by visiting [http://localhost:3000/refinery](http://localhost:3000/refinery)
|
62
|
+
and logging in. You'll see a new tab called "Products", click on that and then click
|
63
|
+
"Add a new product", fill the form and add an example product. Now go back to the front
|
64
|
+
end and you'll see your product is showing up in the products part of your site.
|
45
65
|
|
46
66
|
Now you have a fully managed products section in Refinery, nice.
|
47
67
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{refinerycms-generators}
|
3
|
-
s.version = %q{0.
|
4
|
-
s.date = %q{2011-03-
|
3
|
+
s.version = %q{1.0.0}
|
4
|
+
s.date = %q{2011-03-11}
|
5
5
|
s.summary = %q{Core generators for the Refinery CMS project.}
|
6
6
|
s.description = %q{Core generators for Refinery CMS including refinery_engine.}
|
7
7
|
s.homepage = %q{http://refinerycms.com}
|
@@ -9,8 +9,6 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Resolve Digital"]
|
10
10
|
s.require_paths = %w(lib)
|
11
11
|
|
12
|
-
#s.add_dependency 'refinerycms', '>= 0.9.9'
|
13
|
-
|
14
12
|
s.files = [
|
15
13
|
'features',
|
16
14
|
'features/engine_generator.feature',
|
@@ -35,8 +33,10 @@ Gem::Specification.new do |s|
|
|
35
33
|
'lib/generators/refinery_engine/templates/app/views',
|
36
34
|
'lib/generators/refinery_engine/templates/app/views/admin',
|
37
35
|
'lib/generators/refinery_engine/templates/app/views/admin/plural_name',
|
36
|
+
'lib/generators/refinery_engine/templates/app/views/admin/plural_name/_actions.html.erb',
|
38
37
|
'lib/generators/refinery_engine/templates/app/views/admin/plural_name/_form.html.erb',
|
39
38
|
'lib/generators/refinery_engine/templates/app/views/admin/plural_name/_plural_name.html.erb',
|
39
|
+
'lib/generators/refinery_engine/templates/app/views/admin/plural_name/_records.html.erb',
|
40
40
|
'lib/generators/refinery_engine/templates/app/views/admin/plural_name/_singular_name.html.erb',
|
41
41
|
'lib/generators/refinery_engine/templates/app/views/admin/plural_name/_sortable_list.html.erb',
|
42
42
|
'lib/generators/refinery_engine/templates/app/views/admin/plural_name/edit.html.erb',
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: refinerycms-generators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 1.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Resolve Digital
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-11 00:00:00 +13:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -32,8 +32,10 @@ files:
|
|
32
32
|
- lib/generators/refinery_engine/templates/app/controllers/admin/plural_name_controller.rb
|
33
33
|
- lib/generators/refinery_engine/templates/app/controllers/plural_name_controller.rb
|
34
34
|
- lib/generators/refinery_engine/templates/app/models/singular_name.rb
|
35
|
+
- lib/generators/refinery_engine/templates/app/views/admin/plural_name/_actions.html.erb
|
35
36
|
- lib/generators/refinery_engine/templates/app/views/admin/plural_name/_form.html.erb
|
36
37
|
- lib/generators/refinery_engine/templates/app/views/admin/plural_name/_plural_name.html.erb
|
38
|
+
- lib/generators/refinery_engine/templates/app/views/admin/plural_name/_records.html.erb
|
37
39
|
- lib/generators/refinery_engine/templates/app/views/admin/plural_name/_singular_name.html.erb
|
38
40
|
- lib/generators/refinery_engine/templates/app/views/admin/plural_name/_sortable_list.html.erb
|
39
41
|
- lib/generators/refinery_engine/templates/app/views/admin/plural_name/edit.html.erb
|
@@ -88,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
90
|
requirements: []
|
89
91
|
|
90
92
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.6.
|
93
|
+
rubygems_version: 1.6.1
|
92
94
|
signing_key:
|
93
95
|
specification_version: 3
|
94
96
|
summary: Core generators for the Refinery CMS project.
|