refinerycms-generators 0.9.9.1 → 0.9.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/gemspec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- version = '0.9.9.1'
2
+ version = '0.9.9.2'
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$/
@@ -3,8 +3,15 @@ module Admin
3
3
 
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
- :redirect_to_url => :admin_<%= singular_name %>_index_url
6
+ :redirect_to_url => :admin_<%= singular_name %>_index_url
7
7
  <% end %>
8
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
15
+
9
16
  end
10
17
  end
@@ -1,26 +1,49 @@
1
+ <%
2
+ text_areas = attributes.reject{|a| a.field_type.to_s != 'text_area'}
3
+ generated_text_areas = false
4
+ -%>
1
5
  <%%= form_for [:admin, @<%= singular_name %>] do |f| -%>
2
6
  <%%= render :partial => "/shared/admin/error_messages", :locals => {
3
- :object => @<%= singular_name %>,
4
- :include_object_name => true
5
- } %>
7
+ :object => @<%= singular_name %>,
8
+ :include_object_name => true
9
+ } %>
6
10
  <% attributes.each_with_index do |attribute, index| %>
7
11
  <div class='field'>
12
+ <% unless attribute.field_type.to_s == 'text_area' -%>
8
13
  <%%= f.label :<%= attribute.name %> -%>
14
+ <% end -%>
9
15
  <% if attribute.type.to_s == 'image' -%>
10
16
  <%%= render :partial => "/shared/admin/image_picker", :locals => {
11
- :f => f,
12
- :field => :<%= "#{attribute.name}_id".gsub("_id_id", "_id") %>,
13
- :image => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %>,
14
- :toggle_image_display => false
15
- } %>
16
- <% elsif attribute.type.to_s == 'resource' %>
17
+ :f => f,
18
+ :field => :<%= "#{attribute.name}_id".gsub("_id_id", "_id") %>,
19
+ :image => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %>,
20
+ :toggle_image_display => false
21
+ } %>
22
+ <% elsif attribute.type.to_s == 'resource' -%>
17
23
  <%%= render :partial => "/shared/admin/resource_picker", :locals => {
18
- :f => f,
19
- :field => :<%= "#{attribute.name}_id".gsub("_id_id", "_id") %>,
20
- :resource => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %>,
21
- } %>
22
- <% elsif attribute.field_type.to_s == "text_area" -%>
23
- <%%= f.text_area :<%= attribute.name %>, :rows => 20, :class => 'wymeditor widest' -%>
24
+ :f => f,
25
+ :field => :<%= "#{attribute.name}_id".gsub("_id_id", "_id") %>,
26
+ :resource => @<%= singular_name %>.<%= attribute.name.gsub("_id", "") %>,
27
+ } %>
28
+ <% elsif attribute.field_type.to_s == "text_area" and !generated_text_areas -%>
29
+ <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
30
+ <ul id='page_parts'>
31
+ <%% <%= text_areas.map{|t| t.name.to_sym}.inspect -%>.each_with_index do |part, part_index| %>
32
+ <li class='ui-state-default<%%= ' ui-state-active' if part_index == 0 %>'>
33
+ <%%= link_to part.to_s.titleize, "##{part}" %>
34
+ </li>
35
+ <%% end %>
36
+ </ul>
37
+
38
+ <div id='page_part_editors'>
39
+ <%% <%= text_areas.map{|t| t.name.to_sym}.inspect -%>.each do |part| %>
40
+ <div class='page_part' id='<%%= part %>'>
41
+ <%%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
42
+ </div>
43
+ <%% end %>
44
+ </div>
45
+ </div>
46
+ <% generated_text_areas = true -%>
24
47
  <% else -%>
25
48
  <%%= f.<%= attribute.field_type -%> :<%= attribute.name -%><%= ", :class => 'larger widest'" if (index == 0 && attribute.field_type == :text_field) -%> -%>
26
49
  <% end -%>
@@ -34,3 +57,12 @@
34
57
  :delete_confirmation => t('message', :scope => 'shared.admin.delete'<% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>, :title => @<%= singular_name %>.<%= title.name %><% end %>)
35
58
  } %>
36
59
  <%% end -%>
60
+ <% if text_areas.any? -%>
61
+ <%% content_for :javascripts do %>
62
+ <script>
63
+ $(document).ready(function(){
64
+ page_options.init(false, '', '');
65
+ });
66
+ </script>
67
+ <%% end %>
68
+ <% end -%>
@@ -0,0 +1,2 @@
1
+ <%%= will_paginate @<%= plural_name %> %>
2
+ <%%= render :partial => "sortable_list" %>
@@ -1,4 +1,7 @@
1
1
  <ul id='sortable_list'>
2
2
  <%%= render :partial => '<%= singular_name %>', :collection => @<%= plural_name %> %>
3
3
  </ul>
4
- <%%= render :partial => "/shared/admin/sortable_list", :locals => {:continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)} %>
4
+ <%%= render :partial => "/shared/admin/sortable_list",
5
+ :locals => {
6
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true
7
+ } %>
@@ -3,11 +3,9 @@
3
3
  <h2><%%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
4
4
  <%% end %>
5
5
  <%% if @<%= plural_name %>.any? %>
6
- <%%= will_paginate @<%= plural_name %> %>
7
-
8
- <%%= render :partial => "sortable_list" %>
9
-
10
- <%%= will_paginate @<%= plural_name %> %>
6
+ <div class='pagination_container'>
7
+ <%%= render :partial => '<%= plural_name %>' %>
8
+ </div>
11
9
  <%% else %>
12
10
  <p>
13
11
  <%% unless searching? %>
@@ -34,7 +32,7 @@
34
32
  <%%= link_to t('.create_new'), new_admin_<%= singular_name %>_url,
35
33
  :class => "add_icon" %>
36
34
  </li>
37
- <%% if !searching? and <%= class_name %>.count > 1 and Admin::<%= class_name.pluralize %>Controller.sortable? %>
35
+ <%% if !searching? and Admin::<%= class_name.pluralize %>Controller.sortable? and <%= class_name %>.count > 1 %>
38
36
  <li>
39
37
  <%%= link_to t('.reorder', :what => "<%= singular_name.titleize.pluralize %>"),
40
38
  admin_<%= plural_name %><%= "_index" if plural_name == singular_name%>_url,
@@ -53,4 +51,4 @@
53
51
  <%%= render :partial => "/shared/admin/make_sortable",
54
52
  :locals => {
55
53
  :tree => false
56
- } if !searching? and <%= class_name %>.count > 1 %>
54
+ } if !searching? and Admin::<%= class_name.pluralize %>Controller.sortable? and <%= class_name %>.count > 1 %>
@@ -3,31 +3,33 @@
3
3
  <%% end %>
4
4
 
5
5
  <%% content_for :body_content_left do %>
6
- <% attributes.each do |attribute| %>
6
+ <% attributes.each do |attribute| -%>
7
7
  <section>
8
8
  <h1><%= attribute.name.titleize %></h1>
9
- <p><% if attribute.type.to_s == 'image' -%>
10
- <%%= image_fu @<%= singular_name %>.<%= attribute.name %>, nil %>
9
+ <p>
10
+ <% if attribute.type.to_s == 'image' -%>
11
+ <%%= image_fu @<%= singular_name %>.<%= attribute.name %>, nil %>
11
12
  <% elsif attribute.type.to_s == 'resource' -%>
12
- <%%= link_to <%= "'#{attribute.name}'" %>, @<%= singular_name %>.<%= attribute.name %>.url %>
13
+ <%%= link_to <%= "'#{attribute.name}'" %>, @<%= singular_name %>.<%= attribute.name %>.url %>
13
14
  <% else -%>
14
- <%%=raw @<%= singular_name %>.<%= attribute.name %> %>
15
- <% end -%></p>
15
+ <%%=raw @<%= singular_name %>.<%= attribute.name %> %>
16
+ <% end -%>
17
+ </p>
16
18
  </section>
17
- <% end %>
19
+ <% end -%>
18
20
  <%% end %>
19
21
 
20
22
  <%% content_for :body_content_right do %>
21
- <aside>
22
- <h2><%%= t('.other') %></h2>
23
- <ul id="<%= plural_name %>">
24
- <%% @<%= "all_" if plural_name == singular_name%><%= plural_name %>.each do |<%= singular_name %>| %>
25
- <li>
26
- <%%= link_to <%= singular_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>.<%= title.name %><% else %>.title<% end %>, <%= singular_name %>_url(<%= singular_name %>) %>
27
- </li>
28
- <%% end %>
29
- </ul>
30
- </aside>
23
+ <aside>
24
+ <h2><%%= t('.other') %></h2>
25
+ <ul id="<%= plural_name %>">
26
+ <%% @<%= "all_" if plural_name == singular_name%><%= plural_name %>.each do |<%= singular_name %>| %>
27
+ <li>
28
+ <%%= link_to <%= singular_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>.<%= title.name %><% else %>.title<% end %>, <%= singular_name %>_url(<%= singular_name %>) %>
29
+ </li>
30
+ <%% end %>
31
+ </ul>
32
+ </aside>
31
33
  <%% end %>
32
34
 
33
35
  <%%= render :partial => "/shared/content_page" %>
@@ -11,6 +11,6 @@ Given /^I (only )?have <%= plural_name %> titled "?([^\"]*)"?$/ do |only, titles
11
11
  end
12
12
  <% end -%>
13
13
 
14
- Then /^I should have ([0-9]+) <%= plural_name.to_s.gsub(/ies$/, '(ies|y)') %>?$/ do |count|
14
+ Then /^I should have ([0-9]+) <%= plural_name.to_s.gsub(/ies$/, '[y|ies]+') %>?$/ do |count|
15
15
  <%= class_name %>.count.should == count.to_i
16
16
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{refinerycms-generators}
3
- s.version = %q{0.9.9.1}
4
- s.date = %q{2011-01-27}
3
+ s.version = %q{0.9.9.2}
4
+ s.date = %q{2011-02-02}
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}
@@ -17,8 +17,8 @@ Gem::Specification.new do |s|
17
17
  'features/step_definitions',
18
18
  'features/step_definitions/engine_generator_steps.rb',
19
19
  'features/step_definitions/generator_steps.rb',
20
- 'features/step_definitions/support',
21
- 'features/step_definitions/support/paths.rb',
20
+ 'features/support',
21
+ 'features/support/paths.rb',
22
22
  'lib',
23
23
  'lib/gemspec.rb',
24
24
  'lib/generators',
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
36
36
  'lib/generators/refinery_engine/templates/app/views/admin',
37
37
  'lib/generators/refinery_engine/templates/app/views/admin/plural_name',
38
38
  'lib/generators/refinery_engine/templates/app/views/admin/plural_name/_form.html.erb',
39
+ 'lib/generators/refinery_engine/templates/app/views/admin/plural_name/_plural_name.html.erb',
39
40
  'lib/generators/refinery_engine/templates/app/views/admin/plural_name/_singular_name.html.erb',
40
41
  'lib/generators/refinery_engine/templates/app/views/admin/plural_name/_sortable_list.html.erb',
41
42
  'lib/generators/refinery_engine/templates/app/views/admin/plural_name/edit.html.erb',
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 9
8
8
  - 9
9
- - 1
10
- version: 0.9.9.1
9
+ - 2
10
+ version: 0.9.9.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Resolve Digital
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-27 00:00:00 +13:00
18
+ date: 2011-02-02 00:00:00 +13:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -45,13 +45,14 @@ files:
45
45
  - features/engine_generator.feature
46
46
  - features/step_definitions/engine_generator_steps.rb
47
47
  - features/step_definitions/generator_steps.rb
48
- - features/step_definitions/support/paths.rb
48
+ - features/support/paths.rb
49
49
  - lib/gemspec.rb
50
50
  - lib/generators/refinery_engine/refinery_engine_generator.rb
51
51
  - lib/generators/refinery_engine/templates/app/controllers/admin/plural_name_controller.rb
52
52
  - lib/generators/refinery_engine/templates/app/controllers/plural_name_controller.rb
53
53
  - lib/generators/refinery_engine/templates/app/models/singular_name.rb
54
54
  - lib/generators/refinery_engine/templates/app/views/admin/plural_name/_form.html.erb
55
+ - lib/generators/refinery_engine/templates/app/views/admin/plural_name/_plural_name.html.erb
55
56
  - lib/generators/refinery_engine/templates/app/views/admin/plural_name/_singular_name.html.erb
56
57
  - lib/generators/refinery_engine/templates/app/views/admin/plural_name/_sortable_list.html.erb
57
58
  - lib/generators/refinery_engine/templates/app/views/admin/plural_name/edit.html.erb