refinerycms 0.9.7.8 → 0.9.7.9

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.
Files changed (101) hide show
  1. data/.gitignore +4 -1
  2. data/Gemfile +1 -1
  3. data/bin/refinery-upgrade-096-to-097 +30 -13
  4. data/bin/refinerycms +32 -20
  5. data/changelog.md +14 -0
  6. data/db/migrate/20100729221735_remove_page_translations_if_present.rb +12 -0
  7. data/db/schema.rb +13 -15
  8. data/features/refinery/create_inquiries.feature +40 -0
  9. data/features/refinery/dashboard.feature +35 -1
  10. data/features/refinery/manage_files.feature +42 -1
  11. data/features/refinery/manage_images.feature +58 -1
  12. data/features/refinery/manage_inquiries.feature +55 -3
  13. data/features/refinery/manage_pages.feature +1 -1
  14. data/features/refinery/manage_refinery_settings.feature +1 -0
  15. data/features/refinery/manage_users.feature +1 -1
  16. data/features/refinery/plugin_generator.feature +27 -0
  17. data/features/refinery/site_bar.feature +4 -3
  18. data/features/refinery/theme_generator.feature +16 -0
  19. data/features/step_definitions/refinery/core_steps.rb +4 -0
  20. data/features/step_definitions/refinery/file_steps.rb +22 -0
  21. data/features/step_definitions/refinery/generator_steps.rb +11 -0
  22. data/features/step_definitions/refinery/image_steps.rb +43 -0
  23. data/features/step_definitions/refinery/inquiry_steps.rb +13 -0
  24. data/features/step_definitions/refinery/page_steps.rb +4 -6
  25. data/features/step_definitions/refinery/plugin_generator_steps.rb +16 -0
  26. data/features/step_definitions/refinery/theme_generator_steps.rb +15 -0
  27. data/features/step_definitions/refinery/user_steps.rb +1 -1
  28. data/features/step_definitions/web_steps.rb +18 -18
  29. data/features/support/env.rb +6 -7
  30. data/features/support/paths.rb +25 -1
  31. data/features/uploads/beach.INVALID +0 -0
  32. data/features/uploads/beach.jpeg +0 -0
  33. data/features/uploads/id-rather-be-here.jpg +0 -0
  34. data/features/uploads/refinery_is_awesome.txt +1 -0
  35. data/public/javascripts/refinery/admin.js +4 -4
  36. data/public/stylesheets/refinery/refinery.css +4 -1
  37. data/readme.md +1 -1
  38. data/todo.md +20 -8
  39. data/vendor/plugins/authentication/app/models/user.rb +1 -1
  40. data/vendor/plugins/dashboard/app/views/admin/dashboard/index.rss.builder +26 -0
  41. data/vendor/plugins/inquiries/app/views/admin/inquiries/_inquiry.html.erb +2 -1
  42. data/vendor/plugins/inquiries/app/views/admin/inquiry_settings/_confirmation_email_form.html.erb +9 -5
  43. data/vendor/plugins/inquiries/config/locales/en.yml +2 -2
  44. data/vendor/plugins/inquiries/config/routes.rb +14 -4
  45. data/vendor/plugins/pages/app/controllers/pages_controller.rb +3 -1
  46. data/vendor/plugins/refinery/app/views/shared/_google_analytics.html.erb +2 -2
  47. data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +18 -13
  48. data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +3 -0
  49. data/vendor/plugins/refinery/app/views/shared/admin/_search.html.erb +1 -3
  50. data/vendor/plugins/refinery/config/locales/en.yml +1 -1
  51. data/vendor/plugins/refinery/lib/crud.rb +4 -1
  52. data/vendor/plugins/refinery/lib/generators/refinery/refinery_generator.rb +4 -61
  53. data/vendor/plugins/refinery/lib/generators/refinery_plugin/README +36 -0
  54. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/Rakefile +2 -3
  55. data/vendor/plugins/refinery/lib/generators/refinery_plugin/USAGE +2 -0
  56. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/install.rb +0 -0
  57. data/vendor/plugins/refinery/lib/generators/refinery_plugin/refinery_plugin_generator.rb +76 -0
  58. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/MIGRATE +0 -0
  59. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/locales/en.yml +4 -1
  60. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/locales/nb.yml +4 -1
  61. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/locales/nl.yml +4 -1
  62. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/routes.rb +0 -0
  63. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/controller.rb +0 -0
  64. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/migration.rb +0 -0
  65. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/model.rb +0 -0
  66. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/public_controller.rb +0 -0
  67. data/vendor/plugins/refinery/lib/generators/refinery_plugin/templates/rails/init.rb +9 -0
  68. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/seed.rb +0 -0
  69. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/_form.html.erb +0 -0
  70. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/_singular_name.html.erb +0 -0
  71. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/_sortable_list.html.erb +0 -0
  72. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/edit.html.erb +0 -0
  73. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/index.html.erb +0 -0
  74. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/new.html.erb +0 -0
  75. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/index.html.erb +0 -0
  76. data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/show.html.erb +0 -0
  77. data/vendor/plugins/refinery/lib/refinery.rb +1 -1
  78. data/vendor/plugins/refinery/lib/refinery/activity.rb +3 -3
  79. data/vendor/plugins/refinery/lib/refinery/application_controller.rb +1 -1
  80. data/vendor/plugins/refinery/lib/tasks/refinery.rake +109 -32
  81. data/vendor/plugins/refinery/plugins.md +3 -3
  82. data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +26 -10
  83. data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_form.html.erb +1 -2
  84. data/vendor/plugins/themes/generators/refinery_theme/README +17 -0
  85. data/vendor/plugins/themes/generators/refinery_theme/Rakefile +11 -0
  86. data/vendor/plugins/themes/generators/refinery_theme/USAGE +2 -0
  87. data/vendor/plugins/themes/generators/refinery_theme/install.rb +2 -0
  88. data/vendor/plugins/themes/generators/refinery_theme/refinery_theme_generator.rb +41 -0
  89. data/vendor/plugins/themes/generators/refinery_theme/templates/stylesheets/application.css +5 -0
  90. data/vendor/plugins/themes/generators/refinery_theme/templates/stylesheets/formatting.css +7 -0
  91. data/vendor/plugins/themes/generators/refinery_theme/templates/stylesheets/home.css +5 -0
  92. data/vendor/plugins/themes/generators/refinery_theme/templates/views/layouts/application.html.erb +21 -0
  93. data/vendor/plugins/themes/generators/refinery_theme/templates/views/pages/home.html.erb +4 -0
  94. data/vendor/plugins/themes/generators/refinery_theme/templates/views/pages/show.html.erb +4 -0
  95. data/vendor/plugins/themes/rails/init.rb +0 -1
  96. data/vendor/plugins/themes/readme.md +7 -2
  97. metadata +54 -28
  98. data/db/migrate/20100606173919_create_page_translations.rb +0 -12
  99. data/vendor/plugins/refinery/lib/generators/refinery/README +0 -30
  100. data/vendor/plugins/refinery/lib/generators/refinery/USAGE +0 -2
  101. data/vendor/plugins/refinery/lib/generators/refinery/templates/rails/init.rb +0 -13
@@ -57,13 +57,12 @@ def each_run
57
57
  Cucumber::Rails::World.use_transactional_fixtures = true
58
58
  # How to clean your database when transactions are turned off. See
59
59
  # http://github.com/bmabey/database_cleaner for more info.
60
- if defined?(ActiveRecord::Base)
61
- begin
62
- require 'database_cleaner'
63
- DatabaseCleaner.strategy = :truncation
64
- rescue LoadError => ignore_if_database_cleaner_not_present
65
- end
66
- end
60
+ require 'database_cleaner'
61
+ DatabaseCleaner.strategy = :truncation
62
+
63
+ require 'fileutils'
64
+ require 'rails_generator'
65
+ require 'rails_generator/scripts/generate'
67
66
 
68
67
  require 'authlogic/test_case'
69
68
  Before do
@@ -9,14 +9,38 @@ module NavigationHelpers
9
9
  case page_name
10
10
 
11
11
  when /the home\s?page/
12
- root_url
12
+ root_path
13
13
 
14
14
  when /the list of pages/
15
15
  admin_pages_path
16
16
 
17
+ when /the new page form/
18
+ new_admin_page_path
19
+
17
20
  when /the list of users/
18
21
  admin_users_path
19
22
 
23
+ when /the list of files/
24
+ admin_resources_path
25
+
26
+ when /the list of images/
27
+ admin_images_path
28
+
29
+ when /the contact page/
30
+ new_inquiry_path
31
+
32
+ when /the contact thank you page/
33
+ thank_you_inquiries_path
34
+
35
+ when /the contact create page/
36
+ inquiries_path
37
+
38
+ when /the list of inquiries/
39
+ admin_inquiries_path
40
+
41
+ when /the (d|D)ashboard/
42
+ admin_dashboard_index_path
43
+
20
44
  # Add more mappings here.
21
45
  # Here is an example that pulls values out of the Regexp:
22
46
  #
Binary file
Binary file
@@ -0,0 +1 @@
1
+ http://www.refineryhq.com/
@@ -547,7 +547,8 @@ var page_options = {
547
547
  modal: true,
548
548
  resizable: false,
549
549
  autoOpen: false,
550
- width: 600
550
+ width: 600,
551
+ height: 200
551
552
  });
552
553
 
553
554
  $('#add_page_part').click(function(e){
@@ -591,6 +592,8 @@ var page_options = {
591
592
  $('#new_page_part_title').val('');
592
593
 
593
594
  page_options.tabs.find('> ul li a').corner('top 5px');
595
+
596
+ $('#new_page_part_dialog').dialog('close');
594
597
  }
595
598
  );
596
599
  }else{
@@ -599,9 +602,6 @@ var page_options = {
599
602
  }else{
600
603
  alert("You have not entered a title for the content section, please enter one.");
601
604
  }
602
-
603
-
604
- $('#new_page_part_dialog').dialog('close');
605
605
  });
606
606
 
607
607
  $('#new_page_part_cancel').click(function(e){
@@ -765,6 +765,9 @@ label.stripped {
765
765
  #inquiry tr:last-child td {
766
766
  border-bottom: 0px;
767
767
  }
768
+ #inquiry td label.stripped {
769
+ font-weight: bold;
770
+ }
768
771
  body.dialog {
769
772
  background: #FFF;
770
773
  }
@@ -1221,7 +1224,7 @@ ul#plugins li {
1221
1224
  width:auto;
1222
1225
  }
1223
1226
  #new_page_part_dialog .field {
1224
- padding: 30px 10px;
1227
+ padding: 0px 10px;
1225
1228
  }
1226
1229
  .hide-overflow {
1227
1230
  overflow: hidden;
data/readme.md CHANGED
@@ -95,7 +95,7 @@ Mac OS 10.5+ users [this shell install script](http://github.com/maddox/magick-i
95
95
 
96
96
  Extend Refinery easily by running the Refinery generator
97
97
 
98
- ruby script/generate refinery
98
+ ruby script/generate refinery_plugin
99
99
 
100
100
  to get help on how to use that. Or read the full documentation on [writing plugins for Refinery](http://github.com/resolve/refinerycms/blob/master/vendor/plugins/refinery/plugins.md)
101
101
 
data/todo.md CHANGED
@@ -1,24 +1,36 @@
1
- # Todo
1
+ # Todos required for 1.0 release
2
2
 
3
- What are some of the known things that need to be done?
4
-
5
- ## Tests
3
+ ## Solid Test Coverage
6
4
 
5
+ * Add Cucumber for the whole of Refinery. (top priority)
7
6
  * Add unit test coverage for user, user plugin and user mailer
8
7
  * Add unit test coverage for inquiry mailer and inquiry setting
9
8
  * Add functional tests for the whole of Refinery.
10
- * Add Cucumber for the whole of Refinery. (MOST IMPORTANT)
11
9
  * Add RSpec for the whole of Refinery.
12
10
 
13
- # Rails 3.0 Support
11
+ ## Rails 3.0 Support
14
12
 
15
13
  We've started an effort to move to Rails 3.0 - that just needs to be completed.
16
14
 
17
15
  Join the IRC channel on freenode.net #refinerycms on August 7th to contribute!
18
16
 
19
- # I18n support
17
+ ## I18n support
20
18
 
21
19
  * Check all the views for missing translations
22
20
  * Translate models and model attributes used in forms (Rails 2.3.8 supports translation form labels!)
23
21
  * Javascript messages etc:
24
- - http://github.com/fnando/i18n-js
22
+ - http://github.com/fnando/i18n-js
23
+ * Add in i18n support for the front-end as well
24
+
25
+ ## Plugin API
26
+
27
+ * Install process, update process, copying assets to public
28
+ * All these things should be made standard so that it is easier for plugin authors
29
+ * Most plugins should be packaged as gems for ease
30
+ * Standardize the naming (refinerycms-[plugin_name]), most do this already but there are a few exceptions
31
+
32
+ # Internet Explorer 7+ Support
33
+
34
+ * WYMEditor and the dialogs are the weakest areas right now.
35
+
36
+ # Organise a party and media for 1.0 release
@@ -35,7 +35,7 @@ class User < ActiveRecord::Base
35
35
 
36
36
  has_and_belongs_to_many :roles
37
37
  has_many :plugins, :class_name => "UserPlugin", :order => "position ASC"
38
- has_friendly_id :login, :use_slug => false
38
+ has_friendly_id :login, :use_slug => true
39
39
 
40
40
  def plugins=(plugin_names)
41
41
  unless self.new_record? # don't add plugins when the user_id is NULL.
@@ -0,0 +1,26 @@
1
+ xml.instruct! :xml, :version => "1.0"
2
+ xml.rss :version => "2.0", "xmlns:atom" => "http://www.w3.org/2005/Atom" do
3
+ xml.channel do
4
+ # Required to pass W3C validation.
5
+ xml.atom :link, nil, {
6
+ :href => admin_dashboard_index_url(:format => 'rss'),
7
+ :rel => 'self', :type => 'application/rss+xml'
8
+ }
9
+
10
+ # Feed basics.
11
+ xml.title "Refinery Updates"
12
+ xml.description "See the recent activity on your Refinery site."
13
+ xml.link admin_dashboard_index_url(:format => 'rss')
14
+
15
+ # Recent activity.
16
+ @recent_activity.each do |change|
17
+ xml.item do
18
+ xml.title change.class
19
+ #xml.link link
20
+ xml.description activity_message_for change
21
+ #xml.pubDate date.to_s(:rfc822)
22
+ #xml.guid unique
23
+ end
24
+ end
25
+ end
26
+ end
@@ -6,7 +6,8 @@
6
6
  <span class='actions'>
7
7
  <%= link_to refinery_icon_tag('delete.png'), admin_inquiry_url(inquiry),
8
8
  :class => "cancel confirm-delete",
9
- :title => t('.remove_inquiry', :name => inquiry.name) -%>
9
+ :title => t('.title'),
10
+ :'data-confirm' => t('.remove_inquiry', :name => inquiry.name) -%>
10
11
 
11
12
  <%= link_to refinery_icon_tag('zoom.png'), admin_inquiry_url(inquiry),
12
13
  :title => t('.read_inquiry') -%>
@@ -9,7 +9,7 @@
9
9
  <table id='inquiry'>
10
10
  <tr>
11
11
  <td>
12
- <strong><%= t('.to') %></strong>
12
+ <label class='stripped'><%= t('.to') %></label>
13
13
  </td>
14
14
  <td>
15
15
  <%= t('.the_customer_making_inquiry') %>
@@ -17,7 +17,7 @@
17
17
  </tr>
18
18
  <tr>
19
19
  <td>
20
- <strong><%= t('.from') %></strong>
20
+ <label class='stripped'><%= t('.from') %></label>
21
21
  </td>
22
22
  <td>
23
23
  <%= "#{RefinerySetting[:site_name]} &lt;no-reply@#{request.domain(RefinerySetting.find_or_set(:tld_length, 1))}&gt;" %>
@@ -25,7 +25,7 @@
25
25
  </tr>
26
26
  <tr>
27
27
  <td>
28
- <strong><%= t('.subject') %></strong>
28
+ <label class='stripped'><%= t('.subject') %></label>
29
29
  </td>
30
30
  <td>
31
31
  <%= link_to InquirySetting.confirmation_subject.value, edit_admin_inquiry_setting_url(InquirySetting.confirmation_subject),
@@ -34,10 +34,14 @@
34
34
  </tr>
35
35
  <tr>
36
36
  <td valign='top'>
37
- <strong><%= t('.message') %></strong>
37
+ <%= f.label :value, t('.message'),
38
+ :class => 'stripped' %>
38
39
  </td>
39
40
  <td>
40
- <%= f.text_area :value, :cols => "100", :rows => "5", :class => 'widest' %><br/>
41
+ <%= f.text_area :value,
42
+ :rows => "5",
43
+ :class => 'widest' %>
44
+ <br/>
41
45
  <em><%= t('.note') %></em>
42
46
  </td>
43
47
  </tr>
@@ -27,7 +27,7 @@ en:
27
27
  move_inquiry_to_open: Move this inquiry to open
28
28
  read_inquiry: Read the inquiry
29
29
  remove_inquiry: "Are you sure you want to delete the inquiry from '{{name}}'?"
30
- title: Remove this inquiry forever.
30
+ title: Remove this inquiry forever
31
31
  said: said
32
32
  mark_as_spam: Mark as spam
33
33
  mark_as_ham: Move to inbox
@@ -54,7 +54,7 @@ en:
54
54
  spam: Spam
55
55
  spam_yes: 'yes'
56
56
  inquiry: Inquiry
57
- title: Remove this inquiry forever.
57
+ title: Remove this inquiry forever
58
58
  inquiry_settings:
59
59
  update:
60
60
  updated: "'{{setting}}' was successfully updated."
@@ -1,10 +1,20 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
- map.new_inquiry '/contact', :controller => 'inquiries', :action => 'new'
3
- map.thank_you_inquiries '/contact/thank_you', :controller => 'inquiries', :action => 'thank_you'
4
- map.resources :inquiries, :collection => {:thank_you => :get}
2
+ map.new_inquiry '/contact',
3
+ :controller => 'inquiries',
4
+ :action => 'new'
5
+
6
+ map.thank_you_inquiries '/contact/thank_you',
7
+ :controller => 'inquiries',
8
+ :action => 'thank_you'
9
+
10
+ map.resources :inquiries,
11
+ :collection => {:thank_you => :get}
5
12
 
6
13
  map.namespace(:admin, :path_prefix => 'refinery') do |admin|
7
- admin.resources :inquiries, :collection => {:spam => :get}, :member => {:toggle_spam => :get}
14
+ admin.resources :inquiries,
15
+ :collection => {:spam => :get},
16
+ :member => {:toggle_spam => :get}
17
+
8
18
  admin.resources :inquiry_settings
9
19
  end
10
20
  end
@@ -29,7 +29,9 @@ class PagesController < ApplicationController
29
29
  Page.find(params[:id], :include => [:parts, :slugs])
30
30
  end
31
31
 
32
- if @page.try(:live?) or (logged_in? and current_user.authorized_plugins.include?("Pages"))
32
+ if @page.try(:live?) or
33
+ (refinery_user? and
34
+ current_user.authorized_plugins.include?("refinery_pages"))
33
35
  # if the admin wants this to be a "placeholder" page which goes to its first child, go to that instead.
34
36
  if @page.skip_to_first_child
35
37
  first_live_child = @page.children.find_by_draft(false, :order => "position ASC")
@@ -1,5 +1,5 @@
1
- <% if ((page_code = RefinerySetting[:analytics_page_code].to_s.strip).present? &&
2
- page_code != 'UA-xxxxxx-x') -%>
1
+ <% unless refinery_user? or
2
+ (page_code = RefinerySetting[:analytics_page_code].to_s.strip) =~ /^(UA-xxxxxx-x)?$/ -%>
3
3
  <script type="text/javascript">
4
4
  var _gaq = _gaq || [];
5
5
  _gaq.push(['_setAccount', '<%= page_code %>']);
@@ -1,17 +1,22 @@
1
1
  <%
2
- cache("#{Refinery.base_cache_key}_#{RefinerySetting.find_or_set(:refinery_menu_cache_action_suffix, "site_menu")}_#{request.path}") do
3
- if (collection ||= @menu_pages).any?
2
+ dom_id ||= 'menu'
3
+ css ||= 'menu'
4
+ cache_key = [Refinery.base_cache_key]
5
+ cache_key << RefinerySetting.find_or_set(:refinery_menu_cache_action_suffix, "site_menu")
6
+ cache_key << request.path
7
+ cache(cache_key.join('_')) do
8
+ if (collection ||= @menu_pages).any?
4
9
  -%>
5
- <nav id='<%= dom_id ||= "menu" %>' class='<%= [css ||= "menu", 'clearfix'].join(' ') %>'>
6
- <%= render :partial => "/shared/menu_branch",
7
- :collection => collection,
8
- :locals => {
9
- :hide_children => RefinerySetting.find_or_set(:menu_hide_children, false),
10
- :sibling_count => collection.size - 1
11
- }
12
- -%>
13
- </nav>
14
- <%
10
+ <nav id='<%= dom_id %>' class='<%= %W(#{css} clearfix).join(' ') %>'>
11
+ <%= render :partial => "/shared/menu_branch",
12
+ :collection => collection,
13
+ :locals => {
14
+ :hide_children => RefinerySetting.find_or_set(:menu_hide_children, false),
15
+ :sibling_count => collection.size - 1
16
+ }
17
+ -%>
18
+ </nav>
19
+ <%
20
+ end
15
21
  end
16
- end
17
22
  -%>
@@ -33,6 +33,9 @@
33
33
  delete_url ||= eval("admin_#{f.object.class.name.underscore}_url(#{f.object.id})")
34
34
  end
35
35
  -%>
36
+ <input type='hidden' name='modal' value='<%= from_dialog? %>' />
37
+ <input type='hidden' name='dialog' value='<%= from_dialog? %>' />
38
+
36
39
  <div class='form-actions<%= ' form-actions-dialog' if from_dialog? %>'>
37
40
  <div class='form-actions-left'>
38
41
  <%= submit_tag submit_button_text,
@@ -1,7 +1,5 @@
1
1
  <form method="GET" action="<%= url %>" class="search_form">
2
2
  <input id="search" name="search" size="22" type="search" value="<%= params[:search] %>" />
3
- <% if from_dialog? %>
4
- <input id="dialog" name="dialog" type="hidden" value="true" />
5
- <% end %>
3
+ <input id="dialog" name="dialog" type="hidden" value="<%= from_dialog? %>" />
6
4
  <%= submit_tag t('admin.search'), :name => "" %>
7
5
  </form>
@@ -22,7 +22,7 @@ en:
22
22
  crudify:
23
23
  created: "{{what}} was successfully created."
24
24
  updated: "{{what}} was successfully updated."
25
- destroyed: "{{what}} was successfully destroyed"
25
+ destroyed: "{{what}} was successfully destroyed."
26
26
  shared:
27
27
  site_bar:
28
28
  log_out: Log out
@@ -109,7 +109,10 @@ module Crud
109
109
  end
110
110
 
111
111
  def destroy
112
- flash.now[:notice] = t('refinery.crudify.destroyed', :what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'") if @#{singular_name}.destroy
112
+ if @#{singular_name}.destroy
113
+ flash[:notice] = t('refinery.crudify.destroyed',
114
+ :what => "'\#{@#{singular_name}.#{options[:title_attribute]}}'")
115
+ end
113
116
  redirect_to #{options[:redirect_to_url]}
114
117
  end
115
118
 
@@ -1,70 +1,13 @@
1
1
  class RefineryGenerator < Rails::Generator::NamedBase
2
2
 
3
- def initialize(*runtime_args)
4
- super(*runtime_args)
5
- $title_name = singular_name.gsub("_", " ").gsub(/\b([a-z])/) { $1.capitalize }
6
- end
7
-
8
3
  def banner
9
- "Usage: ./script/generate refinery singular_model_name attribute:type [attribute2:type ...]"
4
+ puts "This generator has been renamed. Please this instead:"
5
+ puts "ruby script/generate refinery_plugin"
6
+ exit
10
7
  end
11
8
 
12
9
  def manifest
13
- record do |m|
14
- # Copy controller, model and migration
15
- directories = ["#{plural_name}", "#{plural_name}/app", "#{plural_name}/app/controllers",
16
- "#{plural_name}/app/controllers/admin", "#{plural_name}/app/models", "#{plural_name}/app/views",
17
- "#{plural_name}/app/helpers", "#{plural_name}/app/views", "#{plural_name}/app/views/admin",
18
- "#{plural_name}/config", "#{plural_name}/config/locales", "#{plural_name}/rails"].map { |d| "vendor/plugins/#{d}" }
19
-
20
- directories.each do |dir|
21
- m.directory dir
22
- end
23
-
24
- m.template "controller.rb", "vendor/plugins/#{plural_name}/app/controllers/admin/#{plural_name}_controller.rb"
25
- m.template "model.rb", "vendor/plugins/#{plural_name}/app/models/#{singular_name}.rb"
26
- m.template "config/routes.rb", "vendor/plugins/#{plural_name}/config/routes.rb"
27
- Dir[File.expand_path(File.dirname(__FILE__) + "/templates/config/locales/*.yml")].each do |yml|
28
- yml_filename = yml.split(File::SEPARATOR).last
29
- m.template "config/locales/#{yml_filename}", "vendor/plugins/#{plural_name}/config/locales/#{yml_filename}"
30
- end
31
-
32
- # Create view directory
33
- admin_view_dir = File.join("vendor/plugins/#{plural_name}/app/views/admin", plural_name)
34
- m.directory admin_view_dir
35
-
36
- # Copy in all views
37
- admin_view_files = ['_form.html.erb', '_sortable_list.html.erb', 'edit.html.erb', 'index.html.erb', 'new.html.erb']
38
-
39
- admin_view_files.each do |view_file|
40
- m.template "views/admin/#{view_file}", "#{admin_view_dir}/#{view_file}"
41
- end
42
-
43
- m.template "views/admin/_singular_name.html.erb", "#{admin_view_dir}/_#{singular_name}.html.erb"
44
-
45
- # Now for the public views and controller
46
- public_dir = File.join("vendor/plugins/#{plural_name}/app/views/", plural_name)
47
- m.directory public_dir
48
-
49
- view_files = ['index.html.erb', 'show.html.erb']
50
- view_files.each do |view_file|
51
- m.template "views/#{view_file}", "#{public_dir}/#{view_file}"
52
- end
53
-
54
- m.template "public_controller.rb", "vendor/plugins/#{plural_name}/app/controllers/#{plural_name}_controller.rb"
55
-
56
- # Add in the init file that ties the plugin to the app.
57
- m.template "rails/init.rb", "vendor/plugins/#{plural_name}/rails/init.rb"
58
-
59
- m.directory 'db/migrate/'
60
- m.directory 'db/seeds/'
61
- m.template 'seed.rb', "db/seeds/#{plural_name}.rb"
62
- m.migration_template 'migration.rb', 'db/migrate',
63
- :assigns => {:migration_name => "Create#{class_name.pluralize}"},
64
- :migration_file_name => "create_#{singular_name.pluralize}"
65
-
66
- m.readme "MIGRATE"
67
- end
10
+ banner
68
11
  end
69
12
 
70
13
  end