refinerycms 0.9.5.12 → 0.9.5.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. data/db/schema.rb +1 -0
  2. data/public/javascripts/refinery/admin.js +3 -2
  3. data/public/javascripts/refinery/boot_wym.js +2 -3
  4. data/public/javascripts/refinery/tooltips.js +37 -38
  5. data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +16 -16
  6. data/public/stylesheets/refinery/refinery.css +1 -1
  7. data/vendor/plugins/authentication/app/views/admin/users/_form.html.erb +1 -5
  8. data/vendor/plugins/images/app/controllers/admin/images_controller.rb +1 -1
  9. data/vendor/plugins/images/app/views/admin/images/_form.html.erb +2 -4
  10. data/vendor/plugins/images/app/views/admin/images/_list_view.html.erb +1 -1
  11. data/vendor/plugins/inquiries/app/views/admin/inquiry_settings/_confirmation_email_form.html.erb +1 -5
  12. data/vendor/plugins/inquiries/app/views/admin/inquiry_settings/_notification_recipients_form.html.erb +1 -5
  13. data/vendor/plugins/news/app/views/admin/news_items/_form.html.erb +1 -5
  14. data/vendor/plugins/pages/app/views/admin/pages/_form.html.erb +1 -12
  15. data/vendor/plugins/refinery/app/views/admin/_head.html.erb +13 -9
  16. data/vendor/plugins/refinery/app/views/layouts/admin.html.erb +1 -0
  17. data/vendor/plugins/refinery/app/views/shared/admin/_continue_editing.html.erb +51 -0
  18. data/vendor/plugins/refinery/app/views/shared/admin/_error_messages_for.html.erb +7 -0
  19. data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +15 -0
  20. data/vendor/plugins/refinery/lib/crud.rb +33 -13
  21. data/vendor/plugins/refinery/lib/generators/refinery/templates/views/admin/_form.html.erb +4 -8
  22. data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_form.html.erb +1 -5
  23. data/vendor/plugins/resources/app/controllers/admin/resources_controller.rb +1 -1
  24. data/vendor/plugins/resources/app/views/admin/resources/_form.html.erb +2 -5
  25. data/vendor/plugins/resources/app/views/admin/resources/index.html.erb +1 -1
  26. metadata +4 -1
@@ -51,6 +51,7 @@ ActiveRecord::Schema.define(:version => 20091109012126) do
51
51
  t.datetime "created_at"
52
52
  t.datetime "updated_at"
53
53
  t.datetime "publish_date"
54
+ t.text "blurb"
54
55
  end
55
56
 
56
57
  create_table "page_parts", :force => true do |t|
@@ -1,8 +1,9 @@
1
1
  init_tooltips = function(){
2
- $$('a[title]', '#image_grid img[title]').each(function(element)
2
+ arguments = arguments.length > 0 ? arguments : ['a[title]', '#image_grid img[title]'];
3
+ $$(arguments).each(function(element)
3
4
  {
4
5
  new Tooltip(element, {mouseFollow:false, delay: 0, opacity: 1, appearDuration:0, hideDuration: 0, rounded: false});
5
- })
6
+ });
6
7
  };
7
8
 
8
9
  FastInit.addOnLoad(function()
@@ -66,9 +66,8 @@ var wymeditor_boot_options = {
66
66
 
67
67
  , iframeHtml:
68
68
  "<div class='wym_iframe wym_section'>"
69
- + "<iframe src='" + WYMeditor.IFRAME_BASE_PATH + "wymiframe' frameborder='0'"
70
- + "onload='this.contentWindow.parent.WYMeditor.INSTANCES[" + WYMeditor.INDEX + "].initIframe(this); init_tooltips();'>"
71
- + "</iframe>"
69
+ + "<iframe id='WYMeditor_" + WYMeditor.INDEX + "' src='" + WYMeditor.IFRAME_BASE_PATH + "wymiframe' frameborder='0'"
70
+ + " onload='this.contentWindow.parent.WYMeditor.INSTANCES[" + WYMeditor.INDEX + "].initIframe(this);'></iframe>"
72
71
  +"</div>"
73
72
 
74
73
  , dialogImageHtml: ""
@@ -3,50 +3,49 @@ var Tooltip = Class.create();
3
3
  Tooltip.prototype = {
4
4
  initialize: function(el, options) {
5
5
  this.el = $(el);
6
- this.el.tooltip = this;
7
- this.initialized = false;
8
- this.setOptions(options);
9
- this.options.relativeTo = $(this.options.relativeTo);
10
-
11
- // Event handlers
12
- this.showEvent = this.show.bindAsEventListener(this);
13
- this.hideEvent = this.hide.bindAsEventListener(this);
14
- this.updateEvent = this.update.bindAsEventListener(this);
15
- Event.observe(this.el, "mouseover", this.showEvent );
16
- Event.observe(this.el, "mouseout", this.hideEvent );
17
-
18
6
  // Removing title from DOM element to avoid showing it
19
- this.content = this.el.title;
20
- this.el.title = "";
7
+ if ((this.content = this.el.title) != null && this.content.length > 0) {
8
+ this.el.tooltip = this;
9
+ this.initialized = false;
10
+ this.setOptions(options);
11
+ this.options.relativeTo = $(this.options.relativeTo);
12
+
13
+ // Event handlers
14
+ this.showEvent = this.show.bindAsEventListener(this);
15
+ this.hideEvent = this.hide.bindAsEventListener(this);
16
+ this.updateEvent = this.update.bindAsEventListener(this);
17
+ Event.observe(this.el, "mouseover", this.showEvent );
18
+ Event.observe(this.el, "mouseout", this.hideEvent );
21
19
 
22
- // If descendant elements has 'alt' attribute defined, clear it
23
- this.el.descendants().each(function(el){
24
- if(Element.readAttribute(el, 'alt'))
25
- el.alt = "";
26
- });
20
+ // If descendant elements has 'alt' attribute defined, clear it
21
+ this.el.descendants().each(function(el){
22
+ if(Element.readAttribute(el, 'alt'))
23
+ el.alt = "";
24
+ });
27
25
 
28
- rounding = this.options.rounded ? ["xb1", "xb2", "xb3", "xb4"] : [];
26
+ rounding = this.options.rounded ? ["xb1", "xb2", "xb3", "xb4"] : [];
29
27
 
30
- // Building tooltip container
31
- tooltipClassName = this.options.rounded ? "tooltip tooltip-rounded" : "tooltip tooltip-square";
32
- this.tooltip = new Element("div", {style: 'display:none'}).addClassName(tooltipClassName);
28
+ // Building tooltip container
29
+ tooltipClassName = this.options.rounded ? "tooltip tooltip-rounded" : "tooltip tooltip-square";
30
+ this.tooltip = new Element("div", {style: 'display:none'}).addClassName(tooltipClassName);
33
31
 
34
- xtop = new Element("div").addClassName("xtop");
35
- rounding.each(function(rounder)
36
- {
37
- xtop.insert(new Element("div").addClassName(rounder));
38
- });
39
- this.tooltip.insert(xtop);
40
- this.tooltip.insert(new Element("div").addClassName("xboxcontent").update(this.content));
32
+ xtop = new Element("div").addClassName("xtop");
33
+ rounding.each(function(rounder)
34
+ {
35
+ xtop.insert(new Element("div").addClassName(rounder));
36
+ });
37
+ this.tooltip.insert(xtop);
38
+ this.tooltip.insert(new Element("div").addClassName("xboxcontent").update(this.content));
41
39
 
42
- xbottom = new Element("div").addClassName("xbottom");
43
- rounding.reverse(false).each(function(rounder)
44
- {
45
- xbottom.insert(new Element("div").addClassName(rounder));
46
- });
47
- this.tooltip.insert(xbottom);
40
+ xbottom = new Element("div").addClassName("xbottom");
41
+ rounding.reverse(false).each(function(rounder)
42
+ {
43
+ xbottom.insert(new Element("div").addClassName(rounder));
44
+ });
45
+ this.tooltip.insert(xbottom);
48
46
 
49
- return this;
47
+ return this;
48
+ }
50
49
  },
51
50
  setOptions: function(options) {
52
51
  this.options = {
@@ -70,7 +69,7 @@ Tooltip.prototype = {
70
69
 
71
70
  if (!this.insertedIntoDocument)
72
71
  {
73
- document.body.insertBefore(this.tooltip, document.body.childNodes[0]);
72
+ $('tooltip_container').insert(this.tooltip);
74
73
 
75
74
  this.options.width = this.tooltip.getWidth() + 2 // adding 2 seems to display tooltips on one line in FF, yay;
76
75
  this.tooltip.style.minWidth = (this.options.width < this.options.maxWidth ? this.options.width : this.options.maxWidth) + 'px'; // IE7 needs width to be defined. Use min-width because we can sacrifice older browser compatibility.
@@ -1223,19 +1223,19 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1223
1223
 
1224
1224
  selected = this.selected();
1225
1225
  if (dialogType == WYMeditor.DIALOG_LINK && jQuery.browser.mozilla) {
1226
- selection = this._iframe.contentWindow.getSelection();
1227
- matches = selected.innerHTML.match(new RegExp(selection.anchorNode.textContent + "(.*)" + selection.focusNode.textContent));
1228
- if (matches != null && matches.length > 0 && (possible_anchor_tag = matches.last()) != null) {
1229
- if ((href = possible_anchor_tag.match(/href="([^"]*)"/).last()) != null) {
1230
- possible_anchors = this._iframe.document().getElementsByTagName('a');
1231
- for (i=0;i<possible_anchors.length;i++) {
1232
- if ((possible_match = possible_anchors[i]).innerHTML == selection) {
1233
- selected = possible_match;
1234
- }
1235
- }
1236
- }
1237
- }
1238
- }
1226
+ selection = this._iframe.contentWindow.getSelection();
1227
+ matches = selected.innerHTML.match(new RegExp(RegExp.escape(selection.anchorNode.textContent) + "(.*)" + RegExp.escape(selection.focusNode.textContent)));
1228
+ if (matches != null && matches.length > 0 && (possible_anchor_tag = matches.last()) != null) {
1229
+ if (((href_matches = possible_anchor_tag.match(/href="([^"]*)"/)) != null) && (href = href_matches.last()) != null) {
1230
+ possible_anchors = this._iframe.document().getElementsByTagName('a');
1231
+ for (i=0;i<possible_anchors.length;i++) {
1232
+ if ((possible_match = possible_anchors[i]).innerHTML == selection) {
1233
+ selected = possible_match;
1234
+ }
1235
+ }
1236
+ }
1237
+ }
1238
+ }
1239
1239
 
1240
1240
  // set up handlers.
1241
1241
  imageGroup = null;
@@ -4142,9 +4142,9 @@ WYMeditor.WymClassExplorer.prototype.initIframe = function(iframe) {
4142
4142
  //init designMode
4143
4143
  this._doc.designMode="on";
4144
4144
  try{
4145
- // (bermi's note) noticed when running unit tests on IE6
4146
- // Is this really needed, it trigger an unexisting property on IE6
4147
- this._doc = iframe.contentWindow.document;
4145
+ // (bermi's note) noticed when running unit tests on IE6
4146
+ // Is this really needed, it trigger an unexisting property on IE6
4147
+ this._doc = iframe.contentWindow.document;
4148
4148
  }catch(e){}
4149
4149
  };
4150
4150
 
@@ -498,7 +498,7 @@ label {
498
498
  display: block;
499
499
  }
500
500
 
501
- textarea, select {
501
+ textarea {
502
502
  padding: 5px;
503
503
  }
504
504
 
@@ -33,10 +33,6 @@
33
33
  <% end %>
34
34
  </ul>
35
35
  </div>
36
- <div class='form-actions'>
37
- <%= f.submit 'Save', :id => "submit_button" %>
38
- or
39
- <%= link_to "Cancel", admin_users_url, :title => "Cancelling will lose all changes you've made to this news item" %>
40
- </div>
36
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %>
41
37
 
42
38
  <% end %>
@@ -17,7 +17,7 @@ class Admin::ImagesController < Admin::BaseController
17
17
  :conditions => "parent_id IS NULL"
18
18
  end
19
19
 
20
- if RefinerySetting.find_or_set(:group_images_by_date_uploaded, false)
20
+ if RefinerySetting.find_or_set(:group_images_by_date_uploaded, true)
21
21
  @grouped_images = []
22
22
  @images.each do |image|
23
23
  key = image.created_at.strftime("%Y-%m-%d")
@@ -10,10 +10,8 @@
10
10
  <% end %>
11
11
  <%= f.file_field :uploaded_data %>
12
12
  </div>
13
- <div class='form-actions'>
14
- <%= f.submit 'Save', :id => "submit_button" %>
15
- <%= "or #{link_to "Cancel", admin_images_url, :title => "Cancelling will lose all changes you've made to this image", :class => "close_dialog"}" if !from_dialog? or @thickbox %>
16
- </div>
13
+
14
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false, :hide_cancel => (from_dialog? and !@thickbox)} %>
17
15
 
18
16
  <% if @thickbox %>
19
17
  <input type='hidden' name='thickbox' value='<%= @thickbox %>' />
@@ -1,4 +1,4 @@
1
- <% if RefinerySetting.find_or_set(:group_images_by_date_uploaded, false) %>
1
+ <% if RefinerySetting.find_or_set(:group_images_by_date_uploaded, true) %>
2
2
  <% @grouped_images.each do |container| %>
3
3
  <h3><%= (image_group = container.last).first.created_at.strftime("%A, %d %B %Y") %></h3>
4
4
  <ul>
@@ -42,9 +42,5 @@
42
42
  </td>
43
43
  </tr>
44
44
  </table>
45
- <div class='form-actions'>
46
- <%= f.submit 'Save', :id => "submit_button" %>
47
- or
48
- <%= link_to "Cancel", admin_inquiries_url, :title => "Cancelling will lose all changes you've made" %>
49
- </div>
45
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false, :cancel_url => admin_inquiries_url} %>
50
46
  <% end %>
@@ -14,9 +14,5 @@
14
14
  E.g. me@domain.com, friend@msn.com, workmate@work.com
15
15
  </p>
16
16
  </div>
17
- <div class='form-actions'>
18
- <%= f.submit 'Save', :id => "submit_button" %>
19
- or
20
- <%= link_to "Cancel", admin_inquiries_url, :title => "Cancelling will lose all changes you've made" %>
21
- </div>
17
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false, :cancel_url => admin_inquiries_url} %>
22
18
  <% end %>
@@ -15,9 +15,5 @@
15
15
  </div>
16
16
  </div>
17
17
 
18
- <div class='form-actions'>
19
- <%= f.submit 'Save', :id => "submit_button", :class => "wymupdate" %>
20
- or
21
- <%= link_to "Cancel", admin_news_items_url, :title => "Cancelling will lose all changes you've made to this news item" %>
22
- </div>
18
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => true} %>
23
19
  <% end %>
@@ -114,14 +114,7 @@
114
114
  <%= f.check_box :draft %>
115
115
  <%= f.label :draft, "Save as Draft", :class => "stripped" %>
116
116
  </div>
117
- <div class='form-actions'>
118
- <%= f.submit 'Save', :id => "submit_button", :class => "wymupdate" %>
119
- or
120
- <%= hidden_field_tag :continue_editing, false %>
121
- <%= f.submit 'Save &amp; Continue Editing', :id => "submit_continue_button", :class => "wymupdate" %>
122
- or
123
- <%= link_to "Cancel", admin_pages_url, :title => "Cancelling will lose all changes you've made to this page", :id => "cancel_button", :class => "close_dialog" %>
124
- </div>
117
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => true} %>
125
118
  <div id='new_page_part_dialog' style='display: none'>
126
119
  <div class='field'>
127
120
  <label for='new_page_part_title'>Title</label>
@@ -163,10 +156,6 @@
163
156
  }
164
157
  });
165
158
 
166
- $('submit_continue_button').observe("click", function(e) {
167
- $('continue_editing').value = true;
168
- });
169
-
170
159
  <% if RefinerySetting.find_or_set(:new_page_parts, false) %>
171
160
  $('add_page_part').observe('click', function(e) {
172
161
  tb_show('Create Content Section', '#?auto_size_content=true&draggable=true&titlebar=true&inlineId=new_page_part_dialog&TB_inline=true&modal=true');
@@ -4,15 +4,19 @@
4
4
  <%= RefinerySetting.find_or_set(:site_name, 'Company Name').titleize %> - Refinery
5
5
  </title>
6
6
  <%= stylesheet_link_tag 'refinery/thickbox', 'refinery/refinery', 'refinery/tooltips' %>
7
- <% unless local_request? %>
8
- <script type='text/javascript' src="http://www.google.com/jsapi"></script>
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");
13
- </script>
14
- <% else %>
15
- <%= javascript_include_tag 'prototype', 'scriptaculous', 'jquery/jquery' %>
7
+ <% if RefinerySetting.find_or_set(:use_google_ajax_libraries, true) %>
8
+ <% unless local_request? %>
9
+ <script type='text/javascript' src="http://www.google.com/jsapi"></script>
10
+ <script type='text/javascript'>
11
+ google.load("prototype", "1.6.1");
12
+ google.load("scriptaculous", "1.8.3");
13
+ google.load("jquery", "1.3");
14
+ </script>
15
+ <% else %>
16
+ <%= javascript_include_tag 'prototype', 'scriptaculous', 'jquery/jquery' %>
17
+ <% end %>
18
+ <% else%>
19
+ <%= javascript_include_tag 'prototype', 'scriptaculous', 'jquery/jquery' %>
16
20
  <% end %>
17
21
  <script type='text/javascript'>jQuery.noConflict();</script>
18
22
  <%= javascript_include_tag 'refinery/prototype.enhancements.js', 'fastinit', 'refinery/tooltips', 'livepipe', 'tabs', 'thickbox', "wymeditor/jquery.refinery.wymeditor.js", 'refinery/boot_wym', 'refinery/admin' %>
@@ -2,6 +2,7 @@
2
2
  <html xmlns="http://www.w3.org/1999/xhtml">
3
3
  <%= render :partial => "/admin/head" %>
4
4
  <body>
5
+ <div id='tooltip_container'></div>
5
6
  <div id="page_container"<%= " class='login'" unless logged_in? %><%= " class='splash'" if logged_in? and params[:action] == "index" %>>
6
7
  <div id="page">
7
8
  <div class="clearfix" id="header">
@@ -0,0 +1,51 @@
1
+ <% unless f.object.new_record? -%>
2
+ <%= hidden_field_tag :continue_editing, false %>
3
+ <%= f.submit 'Save &amp; Continue Editing', :id => "submit_continue_button", :class => "wymupdate" %>
4
+ <% content_for :head do -%>
5
+ <script type='text/javascript'>
6
+ FastInit.addOnLoad(function() {
7
+ if ($('submit_continue_button') != null) {
8
+ $('submit_continue_button').observe("click", function(e) {
9
+ $('continue_editing').value = true;
10
+
11
+ if ((flash=$('flash')) != null) {
12
+ flash.hide();
13
+ }
14
+
15
+ new Ajax.Request(this.form.action, {
16
+ method: this.form.method
17
+ , parameters: this.form.serialize()
18
+ , onComplete: function(e) {
19
+ if ((flash_container = $('flash_container')) != null) {
20
+
21
+ flash_container.update(e.transport.responseText);
22
+
23
+ if ((flash = $('flash')) != null) {
24
+ flash.style.width = 'auto';
25
+ flash.appear();
26
+ }
27
+
28
+ $$('#errorExplanation').each(function(errorExplanation) {
29
+ if (errorExplanation.parentNode.id != 'flash_container') {
30
+ errorExplanation.remove();
31
+ }
32
+ });
33
+
34
+ $$('.fieldWithErrors').each(function(field) {
35
+ field.removeClassName('fieldWithErrors').addClassName('field');
36
+ });
37
+
38
+ flash_container.scrollTo();
39
+ $('continue_editing').value = false;
40
+ }
41
+ }
42
+ , evalScripts: true
43
+ });
44
+
45
+ e.preventDefault();
46
+ });
47
+ }
48
+ });
49
+ </script>
50
+ <% end -%>
51
+ <% end -%>
@@ -0,0 +1,7 @@
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>
@@ -0,0 +1,15 @@
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?) %>
5
+ or
6
+ <%= render :partial => "/shared/admin/continue_editing", :locals => {:f => f} %>
7
+ <% end %>
8
+
9
+ <% unless (hide_cancel ||= false) %>
10
+ or
11
+ <%= link_to "Cancel", (cancel_url ||= send("admin_#{f.object.class.name.pluralize.underscore}_url")),
12
+ :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>
@@ -34,16 +34,27 @@ module Crud
34
34
  end
35
35
 
36
36
  def create
37
- @#{singular_name} = #{class_name}.create(params[:#{singular_name}])
38
- if @#{singular_name}.valid?
39
- flash[:notice] = "'\#{@#{singular_name}.#{options[:title_attribute]}}' was successfully created."
37
+ if (@#{singular_name} = #{class_name}.create(params[:#{singular_name}])).valid?
38
+ unless request.xhr?
39
+ flash[:notice] = "'\#{@#{singular_name}.#{options[:title_attribute]}}' was successfully created."
40
+ else
41
+ flash.now[:notice] = "'\#{@#{singular_name}.#{options[:title_attribute]}}' was successfully created."
42
+ end
40
43
  unless params[:continue_editing] =~ /true|on|1/
41
44
  redirect_to admin_#{plural_name}_url
42
45
  else
43
- redirect_to :back
46
+ unless request.xhr?
47
+ redirect_to :back
48
+ else
49
+ render :partial => "/shared/message"
50
+ end
44
51
  end
45
52
  else
46
- render :action => 'new'
53
+ unless request.xhr?
54
+ render :action => 'new'
55
+ else
56
+ render :partial => "/shared/admin/error_messages_for", :locals => {:symbol => :#{singular_name}, :object => @#{singular_name}}
57
+ end
47
58
  end
48
59
  end
49
60
 
@@ -52,23 +63,32 @@ module Crud
52
63
  end
53
64
 
54
65
  def update
55
- @#{singular_name}.update_attributes(params[:#{singular_name}])
56
- if @#{singular_name}.valid?
57
- flash[:notice] = "'\#{@#{singular_name}.#{options[:title_attribute]}}' was successfully updated."
66
+ if @#{singular_name}.update_attributes(params[:#{singular_name}])
67
+ unless request.xhr?
68
+ flash[:notice] = "'\#{@#{singular_name}.#{options[:title_attribute]}}' was successfully updated."
69
+ else
70
+ flash.now[:notice] = "'\#{@#{singular_name}.#{options[:title_attribute]}}' was successfully updated."
71
+ end
58
72
  unless params[:continue_editing] =~ /true|on|1/
59
73
  redirect_to admin_#{plural_name}_url
60
74
  else
61
- redirect_to :back
75
+ unless request.xhr?
76
+ redirect_to :back
77
+ else
78
+ render :partial => "/shared/message"
79
+ end
62
80
  end
63
81
  else
64
- render :action => 'edit'
82
+ unless request.xhr?
83
+ render :action => 'edit'
84
+ else
85
+ render :partial => "/shared/admin/error_messages_for", :locals => {:symbol => :#{singular_name}, :object => @#{singular_name}}
86
+ end
65
87
  end
66
88
  end
67
89
 
68
90
  def destroy
69
- if @#{singular_name}.destroy
70
- flash[:notice] = "'\#{@#{singular_name}.#{options[:title_attribute]}}' was successfully deleted."
71
- end
91
+ flash[:notice] = "'\#{@#{singular_name}.#{options[:title_attribute]}}' was successfully deleted." if @#{singular_name}.destroy
72
92
  redirect_to admin_#{plural_name}_url
73
93
  end
74
94
 
@@ -1,7 +1,7 @@
1
1
  <%%= error_messages_for :<%= singular_name %> -%>
2
2
  <%% form_for [:admin, @<%= singular_name %>] do |f| -%>
3
- <% attributes.each do |attribute| -%>
4
- <div class='field'>
3
+ <% attributes.each do |attribute| %>
4
+ <div class='field'>
5
5
  <%%= f.label :<%= attribute.name %> -%>
6
6
  <% if attribute.field_type.to_s == "text_area" -%>
7
7
  <%%= f.text_area :<%= attribute.name %>, :rows => 20, :cols => 140, :class => 'wymeditor' -%>
@@ -9,10 +9,6 @@
9
9
  <%%= f.<%= attribute.field_type -%> :<%= attribute.name -%> -%>
10
10
  <% end -%>
11
11
  </div>
12
- <% end -%>
13
- <div class='form-actions'>
14
- <%%= f.submit 'Save', :id => "submit_button", :class => "wymupdate" %>
15
- or
16
- <%%= link_to "Cancel", admin_<%= plural_name %>_url, :class => "close_dialog", :id => "cancel_button" %>
17
- </div>
12
+ <% end %>
13
+ <%%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %>
18
14
  <%% end -%>
@@ -13,9 +13,5 @@
13
13
  <%= f.label :value %>
14
14
  <%= f.text_area :value, :rows => 5, :cols => 100 %>
15
15
  </div>
16
- <div class='form-actions'>
17
- <%= f.submit 'Save', :id => "submit_button" %>
18
- or
19
- <%= link_to "Cancel", admin_refinery_settings_url %>
20
- </div>
16
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %>
21
17
  <% end -%>
@@ -39,7 +39,7 @@ class Admin::ResourcesController < Admin::BaseController
39
39
  :order => "created_at DESC"
40
40
  end
41
41
 
42
- if RefinerySetting.find_or_set(:group_resources_by_date_uploaded, false)
42
+ if RefinerySetting.find_or_set(:group_resources_by_date_uploaded, true)
43
43
  @grouped_resources = []
44
44
  @resources.each do |resource|
45
45
  key = resource.created_at.strftime("%Y-%m-%d")
@@ -10,11 +10,8 @@
10
10
  <% end -%>
11
11
  <%= f.file_field :uploaded_data -%>
12
12
  </div>
13
- <div class='form-actions'>
14
- <%= f.submit 'Save', :id => "submit_button" %>
15
- or
16
- <%= link_to "Cancel", admin_resources_url, :title => "Cancelling will lose all changes you've made to this file", :class => "close_dialog" -%>
17
- </div>
13
+
14
+ <%= render :partial => "/shared/admin/form_actions", :locals => {:f => f, :continue_editing => false} %>
18
15
 
19
16
  <% if @thickbox %>
20
17
  <input type='hidden' name='thickbox' value='<%= @thickbox %>' />
@@ -19,7 +19,7 @@
19
19
  <% else %>
20
20
  <% if @resources.size > 0 -%>
21
21
  <%= will_paginate @resources, :previous_label => '&laquo;', :next_label => '&raquo;' %>
22
- <% if RefinerySetting.find_or_set(:group_resources_by_date_uploaded, false) %>
22
+ <% if RefinerySetting.find_or_set(:group_resources_by_date_uploaded, true) %>
23
23
  <% @grouped_resources.each do |container| %>
24
24
  <h3><%= (resource_group = container.last).first.created_at.strftime("%A, %d %B %Y") %></h3>
25
25
  <ul>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5.12
4
+ version: 0.9.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Resolve Digital
@@ -424,6 +424,9 @@ files:
424
424
  - vendor/plugins/refinery/app/views/shared/_message.html.erb
425
425
  - vendor/plugins/refinery/app/views/shared/_submenu.html.erb
426
426
  - vendor/plugins/refinery/app/views/shared/_submenu_branch.html.erb
427
+ - vendor/plugins/refinery/app/views/shared/admin/_continue_editing.html.erb
428
+ - vendor/plugins/refinery/app/views/shared/admin/_error_messages_for.html.erb
429
+ - vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb
427
430
  - vendor/plugins/refinery/app/views/shared/admin/_image_picker.html.erb
428
431
  - vendor/plugins/refinery/app/views/shared/admin/_resource_picker.html.erb
429
432
  - vendor/plugins/refinery/app/views/shared/admin/_make_sortable.html.erb