refinerycms 0.9.5.21 → 0.9.5.22

Sign up to get free protection for your applications and to get access to all the features.
data/.gems CHANGED
@@ -1,6 +1,8 @@
1
1
  rake --version '>= 0.8.3'
2
- friendly_id --version '>= 2.1.4'
3
- mislav-will_paginate --version '>= 2.3.11'
4
- rails --version '>= 2.3.2'
5
- rubyist-aasm --version '>= 2.1.1'
6
- unicode --version '>= 0.1'
2
+ friendly_id --version '>= 2.2.2'
3
+ will_paginate --version '>= 2.3.11'
4
+ rails --version '>= 2.3.5'
5
+ aasm --version '>= 2.1.3'
6
+ unicode --version '>= 0.1'
7
+ slim_scrooge --version '>= 1.0.1'
8
+ hpricot --version '= 0.8.1'
data/README CHANGED
@@ -50,15 +50,15 @@ You will be prompted to setup your first user.
50
50
 
51
51
  == Environment required
52
52
 
53
- Refinery runs using a number of gems which (as of Refinery version 0.9.5) are outlined below:
53
+ Refinery runs using a number of gems which (as of Refinery version 0.9.5.21) are outlined below:
54
54
 
55
55
  - "rake", :version => ">= 0.8.3"
56
56
  - "friendly_id", :version => ">= 2.2.2"
57
57
  - "will_paginate", :version => ">= 2.3.11"
58
- - "rails", :version => ">= 2.3.4"
58
+ - "rails", :version => ">= 2.3.5"
59
59
  - "aasm", :version => ">= 2.1.3"
60
60
  - "unicode", :version => ">= 0.1"
61
- - "slim_scrooge", :version => ">= 1.0.1" (Note: This gem is disabled under Windows as we've had reports it doesn't work on Windows.)
61
+ - "slim_scrooge", :version => ">= 1.0.3"
62
62
  - "hpricot", :version => "= 0.8.1"
63
63
 
64
64
  == Updates to core files
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.5.21
1
+ 0.9.5.22
@@ -66,10 +66,10 @@ eval("#{(defined? Refinery::Initializer) ? Refinery : Rails}::Initializer").run
66
66
  config.gem "rake", :version => ">= 0.8.3", :lib => "rake"
67
67
  config.gem "friendly_id", :version => ">= 2.2.2", :lib => "friendly_id"
68
68
  config.gem "will_paginate", :version => ">= 2.3.11", :lib => "will_paginate", :source => "http://gemcutter.org"
69
- config.gem "rails", :version => ">= 2.3.4", :lib => "rails"
69
+ config.gem "rails", :version => ">= 2.3.5", :lib => "rails"
70
70
  config.gem "aasm", :version => ">= 2.1.3", :lib => "aasm", :source => "http://gemcutter.org"
71
71
  config.gem "unicode", :version => ">= 0.1", :lib => "unicode"
72
- config.gem "slim_scrooge", :version => ">= 1.0.1", :lib => "slim_scrooge", :source => "http://gemcutter.org" unless RUBY_PLATFORM =~ /mswin|mingw/ # kill gem when windows is running.
72
+ config.gem "slim_scrooge", :version => ">= 1.0.3", :lib => "slim_scrooge", :source => "http://gemcutter.org" #unless RUBY_PLATFORM =~ /mswin|mingw/ # kill gem when windows is running.
73
73
  config.gem "hpricot", :version => "= 0.8.1", :lib => "hpricot", :source => "http://gemcutter.org"
74
74
  #===REFINERY END OF REQUIRED GEMS===
75
75
  end
@@ -0,0 +1,12 @@
1
+ class AddSuperuserToUsers < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :users, :superuser, :boolean, :default => false
4
+ unless (user = User.first).nil?
5
+ user.update_attribute(:superuser, true)
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ remove_column :users, :superuser
11
+ end
12
+ end
data/db/schema.rb CHANGED
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # It's strongly recommended to check this file into your version control system.
11
11
 
12
- ActiveRecord::Schema.define(:version => 20091130040711) do
12
+ ActiveRecord::Schema.define(:version => 20091207033335) do
13
13
 
14
14
  create_table "images", :force => true do |t|
15
15
  t.integer "parent_id"
@@ -145,6 +145,7 @@ ActiveRecord::Schema.define(:version => 20091130040711) do
145
145
  t.datetime "deleted_at"
146
146
  t.datetime "created_at"
147
147
  t.datetime "updated_at"
148
+ t.boolean "superuser", :default => false
148
149
  end
149
150
 
150
151
  add_index "users", ["id"], :name => "index_users_on_id"
@@ -1236,7 +1236,7 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1236
1236
  }
1237
1237
  }
1238
1238
  }
1239
- }
1239
+ }
1240
1240
 
1241
1241
  // set up handlers.
1242
1242
  imageGroup = null;
@@ -1250,7 +1250,7 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1250
1250
  parent_node = selected;
1251
1251
  }
1252
1252
 
1253
- if (parent_node != null && parent_node.tagName.toLowerCase() != WYMeditor.A)
1253
+ if ((parent_node != null) && (dialogType != WYMeditor.DIALOG_PASTE) && (parent_node.tagName.toLowerCase() != WYMeditor.A))
1254
1254
  {
1255
1255
  // wrap the current selection with a funky span (not required for safari)
1256
1256
  if (!this._selected_image && !jQuery.browser.safari)
@@ -1260,15 +1260,17 @@ WYMeditor.editor.prototype.dialog = function( dialogType ) {
1260
1260
  }
1261
1261
  else {
1262
1262
  if (!this._selected_image) {
1263
- parent_node._id_before_replaceable = parent.id;
1263
+ parent_node._id_before_replaceable = parent_node.id;
1264
1264
  parent_node.id = 'replace_me_with_' + this._current_unique_stamp;
1265
1265
  }
1266
1266
 
1267
- path += (this._wym._options.dialogFeatures.length == 0) ? "?" : "&"
1268
- port = (window.location.port.length > 0 ? (":" + window.location.port) : "")
1269
- path += "current_link=" + parent_node.href.gsub(window.location.protocol + "//" + window.location.hostname + port, "");
1270
- path += "&target_blank=" + (parent_node.target == "_blank" ? "true" : "false")
1271
- }
1267
+ if (dialogType != WYMeditor.DIALOG_PASTE) {
1268
+ path += (this._wym._options.dialogFeatures.length == 0) ? "?" : "&";
1269
+ port = (window.location.port.length > 0 ? (":" + window.location.port) : "")
1270
+ path += "current_link=" + parent_node.href.gsub(window.location.protocol + "//" + window.location.hostname + port, "");
1271
+ path += "&target_blank=" + (parent_node.target == "_blank" ? "true" : "false");
1272
+ }
1273
+ }
1272
1274
 
1273
1275
  // launch thickbox
1274
1276
 
@@ -1332,9 +1334,14 @@ WYMeditor.editor.prototype.uniqueStamp = function() {
1332
1334
  };
1333
1335
 
1334
1336
  WYMeditor.editor.prototype.paste = function(sData) {
1335
- //console.log('pasting..');
1337
+
1338
+ this.format_block();
1339
+
1336
1340
  var sTmp;
1337
- var container = this.selected();
1341
+ replaceable = jQuery(this._doc.body).find('#replace_me_with_' + this._current_unique_stamp);
1342
+
1343
+ // replaceable doesn't actually get replaced here, it's just used as a marker for where the cursor was.
1344
+ var container = replaceable[0] || this.selected();
1338
1345
 
1339
1346
  //split the data, using double newlines as the separator
1340
1347
  var aP = sData.split(this._newLine + this._newLine);
@@ -1343,19 +1350,31 @@ WYMeditor.editor.prototype.paste = function(sData) {
1343
1350
  //add a P for each item
1344
1351
  if(container && container.tagName.toLowerCase() != WYMeditor.BODY) {
1345
1352
  for(x = aP.length - 1; x >= 0; x--) {
1346
- sTmp = aP[x];
1347
- //simple newlines are replaced by a break
1348
- sTmp = sTmp.replace(rExp, "<br />");
1349
- jQuery(container).after("<p>" + sTmp + "</p>");
1353
+ sTmp = aP[x];
1354
+ //simple newlines are replaced by a break
1355
+ sTmp = sTmp.replace(rExp, "<br />");
1356
+ if (x == aP.length-1 && jQuery(container).html().gsub(/<br\ ?\/?>/, "").length == 0) {
1357
+ jQuery(container).html(sTmp);
1358
+ } else {
1359
+ jQuery(container).after("<p>" + sTmp + "</p>");
1360
+ }
1350
1361
  }
1351
1362
  } else {
1352
1363
  for(x = 0; x < aP.length; x++) {
1353
- sTmp = aP[x];
1354
- //simple newlines are replaced by a break
1355
- sTmp = sTmp.replace(rExp, "<br />");
1356
- jQuery(this._doc.body).append("<p>" + sTmp + "</p>");
1364
+ sTmp = aP[x];
1365
+ //simple newlines are replaced by a break
1366
+ sTmp = sTmp.replace(rExp, "<br />");
1367
+ if (x == 0 && jQuery(container).html().gsub(/<br\ ?\/?>/, "").length == 0) {
1368
+ jQuery(container).html(sTmp);
1369
+ } else {
1370
+ jQuery(this._doc.body).append("<p>" + sTmp + "</p>");
1371
+ }
1357
1372
  }
1373
+ }
1358
1374
 
1375
+ if (replaceable[0] != null) {
1376
+ // set the id of the container back.
1377
+ replaceable[0].id = replaceable[0]._id_before_replaceable;
1359
1378
  }
1360
1379
  };
1361
1380
 
@@ -1363,7 +1382,7 @@ WYMeditor.editor.prototype.insert = function(html) {
1363
1382
  // Do we have a selection?
1364
1383
  if (this._iframe.contentWindow.getSelection().focusNode != null) {
1365
1384
  // Overwrite selection with provided html
1366
- this._exec( WYMeditor.INSERT_HTML, html);
1385
+ this._exec(WYMeditor.INSERT_HTML, html);
1367
1386
  } else {
1368
1387
  // Fall back to the internal paste function if there's no selection
1369
1388
  this.paste(html);
@@ -1398,6 +1417,32 @@ WYMeditor.editor.prototype.addCssRules = function(doc, aCss) {
1398
1417
  }
1399
1418
  };
1400
1419
 
1420
+ WYMeditor.editor.prototype.format_block = function(selected) {
1421
+
1422
+ //'this' should be the wymeditor instance.
1423
+ var wym = this;
1424
+
1425
+ var container = selected || wym.selected();
1426
+
1427
+ wym._selected_image = null;
1428
+
1429
+ var name = container.tagName.toLowerCase();
1430
+
1431
+ //fix forbidden main containers
1432
+ if(
1433
+ name == "strong" ||
1434
+ name == "b" ||
1435
+ name == "em" ||
1436
+ name == "i" ||
1437
+ name == "sub" ||
1438
+ name == "sup" ||
1439
+ name == "a"
1440
+
1441
+ ) name = container.parentNode.tagName.toLowerCase();
1442
+
1443
+ if(name == WYMeditor.BODY) wym._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P);
1444
+ };
1445
+
1401
1446
  /********** CONFIGURATION **********/
1402
1447
 
1403
1448
  WYMeditor.editor.prototype.computeBasePath = function() {
@@ -4470,71 +4515,36 @@ WYMeditor.WymClassMozilla.prototype.keyup = function(evt) {
4470
4515
 
4471
4516
  //'this' is the doc
4472
4517
  var wym = WYMeditor.INSTANCES[this.title];
4473
-
4474
- wym._selected_image = null;
4475
- var container = null;
4476
-
4477
- if(evt.keyCode == 13 && !evt.shiftKey) {
4478
-
4479
- //RETURN key
4480
- //cleanup <br><br> between paragraphs
4481
- jQuery(wym._doc.body).children(WYMeditor.BR).remove();
4482
-
4483
- //fix PRE bug #73
4484
- container = wym.selected();
4485
- if(container && container.tagName.toLowerCase() == WYMeditor.PRE)
4486
- wym._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P); //create P after PRE
4487
- }
4488
-
4489
- else if(evt.keyCode != 8
4490
- && evt.keyCode != 17
4491
- && evt.keyCode != 46
4492
- && evt.keyCode != 224
4493
- && !evt.metaKey
4494
- && !evt.ctrlKey) {
4495
- //NOT BACKSPACE, NOT DELETE, NOT CTRL, NOT COMMAND
4496
- //text nodes replaced by P
4497
-
4498
- wym.format_block();
4499
- }
4518
+ if (wym != null) {
4519
+ wym._selected_image = null;
4520
+ var container = null;
4521
+
4522
+ if(evt.keyCode == 13 && !evt.shiftKey) {
4523
+
4524
+ //RETURN key
4525
+ //cleanup <br><br> between paragraphs
4526
+ jQuery(wym._doc.body).children(WYMeditor.BR).remove();
4527
+
4528
+ //fix PRE bug #73
4529
+ container = wym.selected();
4530
+ if(container && container.tagName.toLowerCase() == WYMeditor.PRE)
4531
+ wym._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P); //create P after PRE
4532
+ }
4533
+
4534
+ else if(evt.keyCode != 8
4535
+ && evt.keyCode != 17
4536
+ && evt.keyCode != 46
4537
+ && evt.keyCode != 224
4538
+ && !evt.metaKey
4539
+ && !evt.ctrlKey) {
4540
+ //NOT BACKSPACE, NOT DELETE, NOT CTRL, NOT COMMAND
4541
+ //text nodes replaced by P
4542
+
4543
+ wym.format_block();
4544
+ }
4545
+ }
4500
4546
  };
4501
4547
 
4502
- WYMeditor.WymClassMozilla.prototype.paste = function(evt) {
4503
-
4504
- var wym = WYMeditor.INSTANCES[this.title];
4505
-
4506
- wym.format_block();
4507
-
4508
- };
4509
-
4510
- WYMeditor.WymClassMozilla.prototype.format_block = function(selected) {
4511
-
4512
- //'this' should be the wymeditor instance.
4513
- var wym = this;
4514
-
4515
- selected = selected || wym.selected();
4516
-
4517
- wym._selected_image = null;
4518
- var container = null;
4519
-
4520
- container = wym.selected();
4521
- var name = container.tagName.toLowerCase();
4522
-
4523
- //fix forbidden main containers
4524
- if(
4525
- name == "strong" ||
4526
- name == "b" ||
4527
- name == "em" ||
4528
- name == "i" ||
4529
- name == "sub" ||
4530
- name == "sup" ||
4531
- name == "a"
4532
-
4533
- ) name = container.parentNode.tagName.toLowerCase();
4534
-
4535
- if(name == WYMeditor.BODY) wym._exec(WYMeditor.FORMAT_BLOCK, WYMeditor.P);
4536
- }
4537
-
4538
4548
  WYMeditor.WymClassMozilla.prototype.enableDesignMode = function() {
4539
4549
  if(this.designMode == "off") {
4540
4550
  try {
@@ -17,29 +17,30 @@ class UsersController < ApplicationController
17
17
  render :text => "User signup is disabled", :layout => true
18
18
  else
19
19
  begin
20
- cookies.delete :auth_token
21
- # protects against session fixation attacks, wreaks havoc with
22
- # request forgery protection.
23
- # uncomment at your own risk
24
- # reset_session
25
- @user = User.new(params[:user])
26
- @selected_plugin_titles = params[:user][:plugins] || []
27
-
28
- @user.register! if @user.valid?
29
- if @user.errors.empty?
30
- @user.plugins = @selected_plugin_titles
31
- self.current_user = @user
32
- current_user.activate!
33
- redirect_back_or_default(admin_root_url)
34
-
35
- flash[:notice] = "Welcome to Refinery, #{current_user.login}."
36
- if User.count == 1 or RefinerySetting[:site_name] == "Company Name"
37
- refinery_setting = RefinerySetting.find_by_name("site_name")
38
- flash[:notice] << " First let's give the site a name. <a href='#{edit_admin_refinery_setting_url(refinery_setting)}'>Go here</a> to edit your website's name"
39
- end
40
- else
41
- render :action => 'new'
20
+ cookies.delete :auth_token
21
+ # protects against session fixation attacks, wreaks havoc with
22
+ # request forgery protection.
23
+ # uncomment at your own risk
24
+ # reset_session
25
+ @user = User.new(params[:user])
26
+ @selected_plugin_titles = params[:user][:plugins] || []
27
+
28
+ @user.register! if @user.valid?
29
+ if @user.errors.empty?
30
+ @user.plugins = @selected_plugin_titles
31
+ self.current_user = @user
32
+ current_user.activate!
33
+ current_user.update_attribute(:superuser, true) if User.count == 1 # this is the superuser if this user is the only user.
34
+ redirect_back_or_default(admin_root_url)
35
+
36
+ flash[:notice] = "Welcome to Refinery, #{current_user.login}."
37
+ if User.count == 1 or RefinerySetting[:site_name] == "Company Name"
38
+ refinery_setting = RefinerySetting.find_by_name("site_name")
39
+ flash[:notice] << "<br/>First let's give the site a name. <a href='#{edit_admin_refinery_setting_url(refinery_setting)}'>Go here</a> to edit your website's name"
42
40
  end
41
+ else
42
+ render :action => 'new'
43
+ end
43
44
  end
44
45
  end
45
46
  end
@@ -50,7 +51,7 @@ class UsersController < ApplicationController
50
51
  current_user.activate!
51
52
  flash[:notice] = "Signup complete!"
52
53
  end
53
- redirect_back_or_default('/')
54
+ redirect_back_or_default(root_url)
54
55
  end
55
56
 
56
57
  def suspend
@@ -84,4 +85,4 @@ protected
84
85
  User.count == 0
85
86
  end
86
87
 
87
- end
88
+ end
@@ -121,6 +121,10 @@ class User < ActiveRecord::Base
121
121
  @activated
122
122
  end
123
123
 
124
+ def ui_deletable?(current_user = self)
125
+ !self.superuser and User.count > 1 and (current_user.nil? or self.id != current_user.id)
126
+ end
127
+
124
128
  protected
125
129
  # before filter
126
130
  def encrypt_password
@@ -16,7 +16,7 @@
16
16
  <%= link_to refinery_icon_tag('delete.png'), admin_user_path(user),
17
17
  :confirm => "Are you sure you want to delete '#{user.login}'?",
18
18
  :class => "cancel", :method => :delete,
19
- :title => "Remove this user forever" if @users.size > 1 and user.id != current_user.id %>
19
+ :title => "Remove this user forever" if user.ui_deletable?(current_user) %>
20
20
  <%= link_to refinery_icon_tag('application_edit.png'), edit_admin_user_path(user),
21
21
  :title => 'Edit this user' %>
22
22
  <%= mail_to user.email, refinery_icon_tag('email_go.png'), :title => 'Email this user' %>
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  </div>
11
11
  <% unless @page.live? %>
12
- <div style='border: 1px solid #A00027;color: #A00027;background: #FFB1B1;padding:3px 9px;font-weight:bold;width:auto'>
12
+ <div class='page_not_live'>
13
13
  This page is NOT live for public viewing.
14
14
  </div>
15
15
  <% end %>
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.21
4
+ version: 0.9.5.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Resolve Digital
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-12-07 00:00:00 +13:00
14
+ date: 2009-12-08 00:00:00 +13:00
15
15
  default_executable:
16
16
  dependencies: []
17
17
 
@@ -58,6 +58,7 @@ files:
58
58
  - db/migrate/20091029034951_remove_blurb_from_news_items.rb
59
59
  - db/migrate/20091109012126_add_missing_indexes.rb
60
60
  - db/migrate/20091130040711_add_down_for_maintenance_page.rb
61
+ - db/migrate/20091207033335_add_superuser_to_users.rb
61
62
  - db/schema.rb
62
63
  - db/seeds.rb
63
64
  - lib/refinery_initializer.rb