refinerycms 0.9.5.31 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/.gitignore +1 -0
  2. data/VERSION +1 -1
  3. data/bin/refinery +2 -1
  4. data/config/environment.rb +1 -1
  5. data/config/environments/development.rb +3 -0
  6. data/contributors.md +2 -0
  7. data/db/migrate/20100202034802_remove_custom_title_image_id_and_image_id_from_pages.rb +13 -0
  8. data/db/migrate/20100204011654_change_part_titles_to_titleized_version_for_new_format.rb +13 -0
  9. data/db/schema.rb +6 -10
  10. data/public/javascripts/admin.js +1 -1
  11. data/public/javascripts/jquery-ui-1.8rc1.min.js +375 -0
  12. data/public/javascripts/jquery.js +4231 -2529
  13. data/public/javascripts/refinery/admin.js +609 -38
  14. data/public/javascripts/refinery/boot_wym.js +3 -3
  15. data/public/javascripts/thickbox.js +116 -129
  16. data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +3674 -3732
  17. data/public/javascripts/wymeditor/skins/refinery/skin.js +8 -8
  18. data/public/stylesheets/refinery/refinery.css +142 -32
  19. data/public/stylesheets/wymeditor/skins/refinery/skin.css +8 -1
  20. data/readme.md +35 -21
  21. data/test/fixtures/page_parts.yml +9 -0
  22. data/test/fixtures/pages.yml +88 -0
  23. data/test/performance/browsing_test.rb +9 -0
  24. data/test/test_helper.rb +38 -0
  25. data/test/unit/image_test.rb +14 -0
  26. data/test/unit/page_part_test.rb +19 -0
  27. data/test/unit/page_test.rb +130 -0
  28. data/vendor/plugins/authentication/app/controllers/sessions_controller.rb +1 -1
  29. data/vendor/plugins/authentication/app/views/admin/users/index.html.erb +1 -2
  30. data/vendor/plugins/authentication/authentication.md +9 -1
  31. data/vendor/plugins/dashboard/dashboard.md +3 -3
  32. data/vendor/plugins/images/app/controllers/admin/images_controller.rb +17 -13
  33. data/vendor/plugins/images/app/helpers/admin/images_helper.rb +6 -0
  34. data/vendor/plugins/images/app/models/image.rb +24 -39
  35. data/vendor/plugins/images/app/views/admin/images/_form.html.erb +11 -4
  36. data/vendor/plugins/images/app/views/admin/images/_grid_view.html.erb +1 -2
  37. data/vendor/plugins/images/app/views/admin/images/_list_view_image.html.erb +1 -2
  38. data/vendor/plugins/images/app/views/admin/images/index.html.erb +1 -1
  39. data/vendor/plugins/images/app/views/admin/images/insert.html.erb +8 -71
  40. data/vendor/plugins/images/images.md +12 -7
  41. data/vendor/plugins/inquiries/app/views/admin/inquiries/_inquiry.html.erb +6 -13
  42. data/vendor/plugins/inquiries/app/views/admin/inquiry_settings/index.html.erb +1 -2
  43. data/vendor/plugins/inquiries/inquiries.md +8 -8
  44. data/vendor/plugins/news/app/views/admin/news_items/_news_item.html.erb +1 -2
  45. data/vendor/plugins/news/news.md +4 -4
  46. data/vendor/plugins/pages/app/controllers/admin/page_dialogs_controller.rb +11 -10
  47. data/vendor/plugins/pages/app/controllers/admin/page_parts_controller.rb +5 -1
  48. data/vendor/plugins/pages/app/controllers/admin/pages_controller.rb +2 -2
  49. data/vendor/plugins/pages/app/models/page.rb +75 -29
  50. data/vendor/plugins/pages/app/models/page_part.rb +1 -1
  51. data/vendor/plugins/pages/app/views/admin/page_dialogs/_page_link.html.erb +2 -2
  52. data/vendor/plugins/pages/app/views/admin/page_dialogs/link_to.html.erb +8 -112
  53. data/vendor/plugins/pages/app/views/admin/pages/_form.html.erb +50 -154
  54. data/vendor/plugins/pages/app/views/admin/pages/_list.html.erb +10 -10
  55. data/vendor/plugins/pages/app/views/admin/pages/_page_part_field.html.erb +4 -4
  56. data/vendor/plugins/pages/app/views/admin/pages/_sortable_list.html.erb +1 -1
  57. data/vendor/plugins/pages/pages.md +30 -25
  58. data/vendor/plugins/refinery/app/views/admin/_head.html.erb +5 -14
  59. data/vendor/plugins/refinery/app/views/admin/_menu.html.erb +2 -64
  60. data/vendor/plugins/refinery/app/views/shared/_message.html.erb +0 -6
  61. data/vendor/plugins/refinery/app/views/shared/admin/_error_messages_for.html.erb +1 -6
  62. data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +8 -10
  63. data/vendor/plugins/refinery/app/views/shared/admin/_image_picker.html.erb +22 -38
  64. data/vendor/plugins/refinery/app/views/shared/admin/_make_sortable.html.erb +6 -65
  65. data/vendor/plugins/refinery/app/views/shared/admin/_resource_picker.html.erb +16 -16
  66. data/vendor/plugins/refinery/app/views/shared/admin/_sortable_list.html.erb +3 -4
  67. data/vendor/plugins/refinery/lib/crud.rb +1 -1
  68. data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_singular_name.html.erb +1 -1
  69. data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_sortable_list.html.erb +1 -1
  70. data/vendor/plugins/refinery/plugins.md +19 -12
  71. data/vendor/plugins/refinery_dialogs/app/controllers/admin/dialogs_controller.rb +6 -4
  72. data/vendor/plugins/refinery_dialogs/app/views/admin/dialogs/show.html.erb +3 -3
  73. data/vendor/plugins/refinery_dialogs/app/views/layouts/admin_dialog.html.erb +7 -14
  74. data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_refinery_setting.html.erb +1 -1
  75. data/vendor/plugins/refinery_settings/settings.md +51 -1
  76. data/vendor/plugins/resources/app/controllers/admin/resources_controller.rb +16 -11
  77. data/vendor/plugins/resources/app/views/admin/resources/_form.html.erb +9 -2
  78. data/vendor/plugins/resources/app/views/admin/resources/_resource.html.erb +1 -3
  79. data/vendor/plugins/resources/app/views/admin/resources/index.html.erb +2 -2
  80. data/vendor/plugins/resources/app/views/admin/resources/insert.html.erb +14 -60
  81. data/vendor/plugins/resources/resources.md +1 -1
  82. data/vendor/plugins/themes/app/controllers/admin/themes_controller.rb +6 -6
  83. data/vendor/plugins/themes/app/models/theme.rb +3 -3
  84. data/vendor/plugins/themes/app/views/admin/themes/_theme.html.erb +14 -20
  85. data/vendor/plugins/themes/themes.md +21 -19
  86. metadata +18 -19
  87. data/public/javascripts/builder.js +0 -136
  88. data/public/javascripts/controls.js +0 -963
  89. data/public/javascripts/dragdrop.js +0 -973
  90. data/public/javascripts/effects.js +0 -1128
  91. data/public/javascripts/fastinit.js +0 -84
  92. data/public/javascripts/livepipe.js +0 -180
  93. data/public/javascripts/prototype.js +0 -4874
  94. data/public/javascripts/refinery/dialog.js +0 -52
  95. data/public/javascripts/refinery/parse_url.js +0 -38
  96. data/public/javascripts/refinery/prototype.enhancements.js +0 -24
  97. data/public/javascripts/refinery/tooltips.js +0 -173
  98. data/public/javascripts/scriptaculous.js +0 -47
  99. data/public/javascripts/slider.js +0 -275
  100. data/public/javascripts/tabs.js +0 -149
  101. data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_make_sortable.html.erb +0 -7
@@ -5,7 +5,7 @@
5
5
  "branch_start"
6
6
  end
7
7
  -%>
8
- <li class='clearfix record<%= " #{branch}" %>' id="<%= dom_id(page) -%>">
8
+ <li class='record<%= " #{branch}" %>' id="<%= dom_id(page) -%>">
9
9
  <div class='clearfix'>
10
10
  <span class='actions'>
11
11
  <%= link_to refinery_icon_tag('application_go.png'), page.url, :target => "_blank",
@@ -13,17 +13,17 @@
13
13
  <%= link_to refinery_icon_tag('application_edit.png'), edit_admin_page_path(page),
14
14
  :title => "Edit this page" %>
15
15
  <%= link_to refinery_icon_tag('delete.png'), admin_page_path(page),
16
- :confirm => "Are you sure you want to delete '#{page.title}'?",
17
- :class => "cancel", :method => :delete,
18
- :title => "Remove this page forever" if page.deletable? %>
16
+ :class => "cancel confirm-delete",
17
+ :title => "Remove this page forever" if page.deletable? %>
19
18
  </span>
20
19
  <%= h page.title %> <%= "<em>(hidden)</em>" unless page.show_in_menu? %>
21
20
  <%= "<em>(draft)</em>" if page.draft? %>
22
21
  </div>
23
- <ul<%= " class='#{page.children.empty? ? 'empty' : 'nested'}'" %>>
24
- <% page.children.each do |child| %>
25
- <%= render :partial => 'list', :locals => {:page => child} %>
22
+ <% unless (children = page.children).empty? %>
23
+ <ul<%= " class='nested'" %>>
24
+ <% children.each do |child| %>
25
+ <%= render :partial => 'list', :locals => {:page => child} %>
26
+ <% end %>
27
+ </ul>
26
28
  <% end %>
27
- <span class='spacing'>&nbsp;</span>
28
- </ul>
29
- </li>
29
+ </li>
@@ -1,4 +1,4 @@
1
- <div class='page_part field' id='part_<%= title.downcase.gsub(" ", "_") %>'>
2
- <%= hidden_field_tag "page[parts_attributes][#{part_index}][title]", title if new_part %>
3
- <%= text_area_tag "page[parts_attributes][#{part_index}][body]", body, :rows => 20, :cols => 140, :class => 'wymeditor' %>
4
- </div>
1
+ <div class='page_part field' id='<%= new_part ? "page_part_new_#{part_index}" : dom_id(part) %>'>
2
+ <%= hidden_field_tag "page[parts_attributes][#{part_index}][title]", part.title if new_part %>
3
+ <%= text_area_tag "page[parts_attributes][#{part_index}][body]", part.body, :rows => 20, :cols => 140, :class => 'wymeditor' %>
4
+ </div>
@@ -1,4 +1,4 @@
1
1
  <% @pages.each do |page| %>
2
2
  <%= render :partial => 'list', :locals => {:page => page} %>
3
3
  <% end %>
4
- <%= render :partial => "/shared/admin/sortable_list" %>
4
+ <%= render :partial => "/shared/admin/sortable_list", :locals => {:continue_reordering => (defined?(continue_reordering) ? continue_reordering : true)} %>
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## About
6
6
 
7
- One core part of is Pages. Plugins such as news and inquiries hook to pages. The menu is rendered based off the structure of your pages.
7
+ One core part of is Pages. Plugins such as News and Inquiries hook to pages. The menu is rendered based off the structure of your pages.
8
8
 
9
9
  Pages have one key thing about them that is unique - page parts.
10
10
 
@@ -12,25 +12,31 @@ Pages have one key thing about them that is unique - page parts.
12
12
 
13
13
  ![Refinery Page Parts](http://refinerycms.com/system/images/0000/0586/editing-page.png)
14
14
 
15
- ### What are they
15
+ ### What are they?
16
16
 
17
17
  Think of a page part is a single piece of content on your page. At [Resolve Digital](http://www.resolvedigital.co.nz) we often simply use ``body`` and ``side_body``. One is for the main content and one is for the content which goes on a side bit of the page to display other information.
18
18
 
19
19
  ### Default Page Parts
20
20
 
21
- You can change what the default page parts are called or add more by editing the "Default Page Parts" setting. This is a serialize array of names. The default looks like this
21
+ You can change what the default page parts are called or add more by editing the "Default Page Parts" setting. This is a serialized array of names. The default looks like this
22
22
 
23
23
  ---
24
24
  - body
25
25
  - side_body
26
26
 
27
- Add more to this setting if you want more default page parts.
27
+ Edit this setting to suit your taste.
28
28
 
29
- ### Adding Page Parts for Specify Pages
29
+ ### Adding Page Parts for Specific Pages
30
30
 
31
- You can add extra page parts to your pages by setting the "New Page Parts" to ``true`` and editing the page you want to add a part to and clicked the little "+" icon.
31
+ You can add extra page parts to your pages by setting the "New Page Parts" to ``true``.
32
32
 
33
- Note in the user-facing front end we call them "content sections" not "page parts".
33
+ Now do this
34
+
35
+ * Edit the page you want to add a part to
36
+ * Click the little "+" icon up by the page part tabs
37
+ * Type the name of your new part and hit add.
38
+
39
+ _Note: in the user-facing front end we call them "content sections" not "page parts"._
34
40
 
35
41
  ## Page Options
36
42
 
@@ -44,36 +50,35 @@ There are three options for how the page title will be rendered on the front end
44
50
 
45
51
  * ``None``: will just default to the page title
46
52
  * ``Text``: allows you to have a different name for the page in the backend to the front end (sometimes good for SEO)
47
- * ``Image``: If you're designer is using a custom non-standard web font, this is ideal. Bang the image of your title right in there (_we don't recommend this though!_)
53
+ * ``Image``: If your designer is using a custom non-standard web font, this is ideal. Bang the image of your title right in there (_we don't recommend this though! Standard web fonts are always a good idea_)
48
54
 
49
- ### Show in menu
55
+ ### Show in Menu
50
56
 
51
- You can hide a page from the navigation if you like by unchecking "show in menu"
57
+ You can hide a page from the navigation if you like by unchecking "show in menu". This is good for extra reference pages or even pages you might want to link someone up to directly but not "advertise" the pages existence on the menu.
52
58
 
53
59
  ### Custom URL
54
60
 
55
- This allows you to make your page not link to a normal page but make it show something else. This could be a donation link to a completely different site for example. Or as Refinery uses it, you might want to link to another plugin.
61
+ This allows you to make your page not link to a normal page but make it show something else. This could be a donation link to a completely different site or as Refinery uses it, you might want to link to another plugin.
56
62
 
57
- The "contact us" page for example has a Custom URL of ``/inquiries/new`` because we want it to load the inquiries form from the inquiries plugin instead.
63
+ The "contact us" page for example has a Custom URL of ``/inquiries/new``, this is because we want it to load the inquiries form from the inquiries plugin instead.
58
64
 
59
65
  ### WYMEditor (the visual editor)
60
66
 
61
67
  Refinery is backed by [WYMEditor](http://www.wymeditor.org/)
62
68
 
63
- It's a standards compliant editor that we've trimmed to only have what we feel is absolutely necessary. When you're editing the content is a page part you're using [WYMEditor](http://www.wymeditor.org/).
69
+ It's a standards compliant editor that we've trimmed to only have what we feel is absolutely necessary. When you're editing the content in a page part you're using [WYMEditor](http://www.wymeditor.org/).
64
70
 
65
- You can also switch to "source" view and edit XHTML manually.
71
+ You can also switch to "source" view and edit XHTML manually if the visual editor is not playing nice.
66
72
 
67
- ### Custom selectable styles in WYMEditor
73
+ ### Custom Selectable Styles in WYMEditor
68
74
 
69
75
  ![Refinery Page Editor Styles](http://refinerycms.com/system/images/0000/0596/editing-page-style.png)
70
76
 
71
- Some sites require a little more than just your standard bold and heading controls. This is where the "css" style drop down comes in hand.
77
+ Some sites require a little more than just your standard bold and heading controls. This is where the "css" style drop down comes in handy.
72
78
 
73
- It allows your customers to select a style you define. You need to edut/create a CSS file called ``theme.css``. You could have this in one of two places
79
+ It allows your users to select a style you define. You need to edit/create a CSS file called ``theme.css``.
74
80
 
75
- 1. ``/public/stylesheets/themes.css``
76
- 2. ``/themes/your_theme_name/stylesheets/themes.css``
81
+ This file should be located in ``/public/stylesheets/themes.css``
77
82
 
78
83
  Inside that file you define your styles like this
79
84
 
@@ -81,7 +86,7 @@ Inside that file you define your styles like this
81
86
  // apply your CSS rules here
82
87
  }
83
88
 
84
- For example if I wanted to add a style that allowed my users to highlight their text a light yellow colour I would put this
89
+ For example, if I wanted to add a style that allowed my users to highlight their text a light yellow colour, I would put this
85
90
 
86
91
  .text-highlight-yellow {
87
92
  background: LightYellow;
@@ -97,7 +102,7 @@ Currently your ``admin.js`` file will have something like this
97
102
  ,  {name: 'font-size', rules:['small','normal','large'], join: '-'}
98
103
  ]
99
104
 
100
- Let's just breakdown a single WYMeditor class line and understand it:
105
+ Let's just breakdown a single WYMeditor line and understand it:
101
106
 
102
107
  {name: 'font-size', rules:['small','normal','large'], join: '-'}
103
108
 
@@ -107,7 +112,7 @@ Let's just breakdown a single WYMeditor class line and understand it:
107
112
  .font-size-normal { // CSS rules here }
108
113
  .font-size-large { // CSS rules here }
109
114
 
110
- So going back to our text highlighting above we make the new style show up in the editor by changing our ``admin.js`` file to:
115
+ So going back to our text highlighting style above, we make the new style show up in the editor by changing our ``admin.js`` file to:
111
116
 
112
117
  var wymeditorClassesItems = [
113
118
     {name: 'text-align', rules:['left', 'center', 'right', 'justify'], join: '-'}
@@ -122,7 +127,7 @@ So going back to our text highlighting above we make the new style show up in th
122
127
 
123
128
  ## Page Link dialog
124
129
 
125
- The link dialog lets you link in several different ways
130
+ The link dialog lets you link in several different ways:
126
131
 
127
132
  * To an internal page
128
133
  * To an external page
@@ -135,7 +140,7 @@ Simply lets you select from an existing image found in the Images tab or upload
135
140
 
136
141
  ## Refinery Default Pages
137
142
 
138
- Some pages you have to keep in order for Refinery to fully function.
143
+ Some pages you have to keep in order for Refinery to stay fully functional:
139
144
 
140
- * Page not found - the default 404 page, it's hidden from the navigation
145
+ * Page not found - the default 404 page
141
146
  * Down for maintenance - renders when you're site is being updated.
@@ -7,22 +7,13 @@
7
7
  <% if (using_google_libs = RefinerySetting.find_or_set(:use_google_ajax_libraries, true)) and !local_request? -%>
8
8
  <script type='text/javascript' src="http://www.google.com/jsapi"></script>
9
9
  <script type='text/javascript'>
10
- google.load("prototype", "1.6.1");
11
- google.load("scriptaculous", "1.8.3");
12
- google.load("jquery", "1.3");
10
+ google.load("jquery", "1.4");
11
+ google.load("jqueryui", "1.8");
13
12
  </script>
14
13
  <% end %>
15
- <% if !using_google_libs or local_request? %>
16
- <% if use_caching %>
17
- <%= javascript_include_tag 'prototype', 'scriptaculous', 'builder', 'effects', 'dragdrop', 'controls', 'slider', 'jquery', :cache => "cache/libraries" %>
18
- <% else %>
19
- <%= javascript_include_tag 'prototype', 'scriptaculous', 'jquery' %>
20
- <% end %>
21
- <% end %>
22
- <script type='text/javascript'>jQuery.noConflict();</script>
23
- <%= javascript_include_tag 'admin' %>
24
- <%= javascript_include_tag 'refinery/prototype.enhancements.js', 'fastinit', 'refinery/tooltips', 'livepipe', 'tabs', 'thickbox', "wymeditor/jquery.refinery.wymeditor.js", 'refinery/boot_wym', 'refinery/admin', :cache => (use_caching ? "cache/admin" : false) %>
25
- <%= "<script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>" if RefinerySetting.find_or_set(:show_firebug_lite, false) == true -%>
14
+ <%= javascript_include_tag 'jquery', 'jquery-ui-1.8rc1.min.js', :cache => (use_caching ? "cache/libraries" : nil) if !using_google_libs or local_request? %>
15
+ <%= javascript_include_tag 'admin', 'thickbox', 'wymeditor/jquery.refinery.wymeditor.js', 'refinery/boot_wym', 'refinery/admin', :cache => (use_caching ? "cache/admin" : false) %>
16
+ <%= javascript_include_tag "http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js" if RefinerySetting.find_or_set(:show_firebug_lite, false) -%>
26
17
  <%= "<script type='text/javascript'>jQuery(document).ready(function(){ jQuery('#flash').fadeIn(550); });</script>" unless flash.empty? -%>
27
18
  <%= yield :head %>
28
19
  </head>
@@ -8,7 +8,7 @@
8
8
  </li>
9
9
  <% end
10
10
  end -%>
11
- <% if Refinery::Plugins.active.in_menu.size > 1 %>
11
+ <% if Refinery::Plugins.active.in_menu.size > 1 -%>
12
12
  <li>
13
13
  <%= link_to "&nbsp;", "", :id => "menu_reorder", :title => "Reorder menu" %>
14
14
  <%= link_to "&nbsp;", "", :id => "menu_reorder_done", :title => "I'm done reordering the menu", :style => "display: none;" %>
@@ -18,68 +18,6 @@
18
18
  <%= link_to "Log out", logout_url %>
19
19
  </li>
20
20
  </ul>
21
- <input type='hidden' id='admin_menu_reorder_authenticity_token' value='<%= form_authenticity_token %>' />
22
- <script type='text/javascript'>
23
- disable_menu_reordering = function(e)
24
- {
25
- Sortable.destroy("menu");
26
21
 
27
- menu = $('menu');
28
- menu.removeClassName('reordering_menu');
22
+ <input type='hidden' id='admin_authenticity_token' value='<%= form_authenticity_token %>' />
29
23
 
30
- $('menu_reorder_done').hide();
31
- $('menu_reorder').show();
32
-
33
- [$('header').childElements().without(menu), $('content'), $('logout')].flatten().each(function(element) {
34
- new Effect.Appear(element, { duration: 0.5});
35
- });
36
-
37
- $$('#menu li a').each(function(anchor) {
38
- if (!anchor.id.startsWith("menu_reorder")) {
39
- anchor.stopObserving('click');
40
- }
41
- });
42
-
43
- e.stop();
44
- }
45
-
46
- enable_menu_reordering = function(e)
47
- {
48
- $('menu_reorder_done').show();
49
- $('menu_reorder').hide();
50
-
51
- menu = $('menu');
52
- menu.addClassName('reordering_menu');
53
-
54
- Sortable.create($('menu'), {
55
- constraint: 'horizontal'
56
- , only: 'tab'
57
- , onUpdate:function() {
58
- new Ajax.Request('<%= url_for :controller => "/admin", :action => "update_menu_positions" %>',
59
- {
60
- asynchronous:true
61
- , evalScripts:true
62
- , parameters: Sortable.serialize('menu') + '&authenticity_token=' + encodeURIComponent($('admin_menu_reorder_authenticity_token').value)
63
- });
64
- }
65
- });
66
-
67
- [$('header').childElements().without(menu), $('content'), $('logout')].flatten().each(function(element) {
68
- new Effect.Fade(element, { duration: 0.5, from: 1, to: 0.2 });
69
- });
70
-
71
- $$('#menu li a').each(function(anchor) {
72
- if (!anchor.id.startsWith("menu_reorder")) {
73
- anchor.observe('click', function(e){e.stop();});
74
- }
75
- });
76
-
77
- e.stop();
78
- }
79
-
80
- FastInit.addOnLoad(function()
81
- {
82
- $('menu_reorder').observe('click', enable_menu_reordering);
83
- $('menu_reorder_done').observe('click', disable_menu_reordering);
84
- });
85
- </script>
@@ -1,11 +1,5 @@
1
1
  <% flash.each do |key, value| %>
2
2
  <div id="flash" class="flash_<%= key %>" style='display: none;' >
3
3
  <%= value %> (<%= link_to "close", "", {:id => "flash_close"} %>)
4
- <script type="text/javascript">
5
- jQuery('#flash_close').click(function(e) {
6
- jQuery('#flash').fadeOut({duration: 330});
7
- e.preventDefault();
8
- });
9
- </script>
10
4
  </div>
11
5
  <% end %>
@@ -1,7 +1,2 @@
1
1
  <%= error_messages_for symbol %>
2
- <% fields = []; object.errors.each { |attrib, msg| fields << "#{object.class.name.underscore}_#{attrib}" } %>
3
- <script type='text/javascript'>
4
- $$('#<%= fields.join("','#") %>').each(function(error_field) {
5
- error_field.up('div.field').addClassName('fieldWithErrors').removeClassName('field');
6
- });
7
- </script>
2
+ <input type='hidden' id='fieldsWithErrors' value='<%= object.errors.collect { |attrib, msg| "#{object.class.name.underscore}_#{attrib}"}.join(",") %>' />
@@ -1,15 +1,13 @@
1
1
  <div class='form-actions'>
2
- <%= f.submit 'Save', :id => "submit_button", :class => "wymupdate" %>
3
-
4
- <% if (continue_editing ||= false and !f.object.new_record?) %>
2
+ <%= f.submit 'Save', :id => "#{submit_button_id ||= "submit_button"}", :class => "wymupdate" -%>
3
+ <% if (continue_editing ||= false and !f.object.new_record?) -%>
5
4
  or
6
- <%= render :partial => "/shared/admin/continue_editing", :locals => {:f => f} %>
7
- <% end %>
8
-
9
- <% unless (hide_cancel ||= false) %>
5
+ <%= render :partial => "/shared/admin/continue_editing", :locals => {:f => f} -%>
6
+ <% end -%>
7
+ <% unless (hide_cancel ||= from_dialog?) -%>
10
8
  or
11
9
  <%= link_to "Cancel", (cancel_url ||= send("admin_#{f.object.class.name.pluralize.underscore}_url")),
12
10
  :title => (title ||= "Cancelling will lose all changes you've made to this #{f.object.class.name.underscore.gsub("_", " ")}"),
13
- :id => "cancel_button", :class => "close_dialog" %>
14
- <% end %>
15
- </div>
11
+ :id => "#{cancel_button_id ||= "cancel_button"}", :class => "close_dialog" %>
12
+ <% end -%>
13
+ </div>
@@ -1,50 +1,34 @@
1
- <%= link_to "Show", "", :id => "current_image_toggler" if (toggle_image_display ||= false) %>
2
- <%= f.hidden_field field %>
3
- <div id='current_image_container'<%= " style='display: none'" if (toggle_image_display ||= false) %>>
4
- <a id='current_image_link' href="<%= insert_admin_images_url %>?thickbox=true&amp;modal=true&amp;titlebar=true&amp;field=<%= f.object.class.name.underscore.downcase %>_<%= field %>&amp;update_image=current_picked_image&amp;callback=picked_image_changed&amp;thumbnail=&amp;KeepThis=true&amp;TB_iframe=true&amp;width=<%= width ||= 950 %>&amp;height=<%= height ||= 510 %>" style='border: 0px' title='Change <%= (description ||= "image").titleize %>' name='Change <%= (description ||= "image").titleize %>' class='thickbox'>
5
- <% unless image.nil? %>
1
+ <%
2
+ description ||= "image"
3
+ thumbnail ||= "medium"
4
+ toggle_image_display ||= false
5
+ -%>
6
+ <%= link_to "Show", "", :id => "current_image_toggler" if toggle_image_display -%>
7
+ <%= f.hidden_field field, :id => 'custom_title_field' -%>
8
+
9
+ <div id='current_image_container'<%= " style='display: none'" if toggle_image_display %> style="margin-top: 10px;">
10
+ <a id='current_image_link' href="<%= insert_admin_images_url %>?thickbox=true&amp;modal=true&amp;titlebar=true&amp;field=custom_title_field&amp;thumbnail=&amp;KeepThis=true&amp;TB_iframe=true&amp;width=958&amp;height=510" style='border: 0px' title='Change <%= description.titleize %>' name='Change <%= description.titleize %>' class='thickbox'>
11
+ <% unless image.nil? -%>
6
12
  <%= image_fu image, nil, {:class => "brown_border", :id => "current_picked_image"} %>
7
- <% else %>
13
+ <% else -%>
8
14
  <img id="current_picked_image" class="" src="" alt="" style='display: none' />
9
- <% end %>
15
+ <% end -%>
10
16
  <p id='no_picked_image_selected' <%= "style='display: none;'" unless image.nil? %>>
11
- There is currently no <%= description ||= "image" %> selected, please click here to add one.
17
+ There is currently no <%= description %> selected, please click here to add one.
12
18
  </p>
13
19
  </a>
14
20
  <br/>
15
- <%= link_to "Remove current #{description ||= "image"}", "", :id => "remove_picked_image", :style => "margin-top:8px;display:inline-block;width:auto;#{"display:none;" if image.nil?}" %>
21
+ <%= link_to "Remove current #{description}", "#", :id => "remove_picked_image", :style => "#{"display:none;" if image.nil?}" %>
16
22
  </div>
17
- <% content_for :head do %>
18
- <script type='text/javascript'>
19
- picked_image_changed = function()
20
- {
21
- $('remove_picked_image').show();
22
- $('current_picked_image').show();
23
- $('current_picked_image').addClassName('brown_border');
24
- $('no_picked_image_selected').hide();
25
- }
26
23
 
27
- FastInit.addOnLoad(function() {
28
- $('remove_picked_image').observe('click', function(e)
29
- {
30
- $('current_picked_image').removeClassName('brown_border');
31
- $('current_picked_image').src = '';
32
- $('current_picked_image').alt = 'There is currently no <%= description ||= "image" %> selected, please click here to add one.';
33
- $('<%= f.object.class.name.underscore.downcase %>_<%= field %>').value = '';
34
- $('current_picked_image').style.width = "auto";
35
- $('current_picked_image').style.height = "auto";
36
- $('no_picked_image_selected').show();
37
- $('current_picked_image').hide();
38
- this.hide();
39
- e.stop();
40
- });
41
- <% if toggle_image_display ||= false -%>
42
- jQuery('#current_image_toggler').click(function(e){
43
- jQuery(this).html((jQuery(this).html() == 'Show' ? 'Hide' : 'Show'));
44
- jQuery("#current_image_container").toggle();
45
- e.preventDefault();
24
+ <% content_for :head do -%>
25
+ <script type='text/javascript'>
26
+ $(document).ready(function(){
27
+ image_picker.init({
28
+ thumbnail: '<%= thumbnail %>'
29
+ , toggle_image_display: <%= toggle_image_display.to_s %>
30
+ , description: '<%= description %>'
46
31
  });
47
- <% end -%>
48
32
  });
49
33
  </script>
50
34
  <% end %>
@@ -1,69 +1,10 @@
1
- <%
2
- list_id ||= "sortable_list"
3
- update_url ||= url_for(:action => "update_positions")
4
- tree ||= false
5
-
6
- content_for :head do
7
- %>
1
+ <% content_for :head do -%>
8
2
  <script type='text/javascript'>
9
- reordering_button_enabled = true;
10
- FastInit.addOnLoad(function()
11
- {
12
- $('reorder_action').observe('click', enable_reordering);
13
- $('reorder_action_done').observe('click', disable_reordering);
3
+ $(document).ready(function(){
4
+ list_reorder.update_url = '<%= update_url ||= url_for(:action => "update_positions") %>';
5
+ list_reorder.sortable_list = $('#<%= list_id ||= "sortable_list" %>');
6
+ list_reorder.tree = <%= tree ||= false %>;
7
+ list_reorder.init();
14
8
  });
15
-
16
- disable_reordering = function(e)
17
- {
18
- if (reordering_button_enabled) {
19
- $('<%= list_id %>').removeClassName('reordering');
20
-
21
- Sortable.destroy("<%= list_id %>");
22
-
23
- $('reorder_action_done').hide();
24
- $('reorder_action').show();
25
- }
26
- if (e) { e.stop(); }
27
- }
28
-
29
- enable_reordering = function(e)
30
- {
31
- sortable_list = $('<%= list_id %>');
32
- sortable_list.addClassName('reordering');
33
-
34
- nest_id = 0;
35
- sortable_list.select('ul.nested').each(function(nested)
36
- {
37
- nested.id = nested.id.length > 0 ? nested.id : "nested_" + nest_id++;
38
- Sortable.create(nested.id, {
39
- constraint: <%= tree ? "false" : "'vertical'" %>
40
- , hoverclass: 'hover'
41
- , scroll: window
42
- , tree: <%= tree %>
43
- });
44
- });
45
-
46
- Sortable.create("<%= list_id %>", {
47
- constraint: <%= tree ? "false" : "'vertical'" %>
48
- , hoverclass: 'hover'
49
- , scroll: window
50
- , tree: <%= tree %>
51
- , onUpdate:function() {
52
- reordering_button_enabled = false;
53
- new Ajax.Updater('<%= list_id %>', '<%= update_url %>',
54
- {
55
- asynchronous:true
56
- , evalScripts:true
57
- , parameters: Sortable.serialize('<%= list_id %>') + '&tree=<%= tree %>' + '&authenticity_token=' + encodeURIComponent($('reorder_authenticity_token').value)
58
- , onComplete: function(e) { reordering_button_enabled = true; }
59
- });
60
- }
61
- });
62
-
63
- $('reorder_action').hide();
64
- $('reorder_action_done').show();
65
-
66
- if (e) { e.stop(); }
67
- }
68
9
  </script>
69
10
  <% end %>