radiant-find_replace-extension 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -6,13 +6,13 @@ Supports regular expressions and case (in)sensitivity.
|
|
6
6
|
When showing results, you can check which matches you want to update with the replace string.
|
7
7
|
If you are using regular expressions, you can render matches in the replace string. For example, find:
|
8
8
|
|
9
|
-
<p class="title">([
|
9
|
+
<p class="title">([^</p>]*)</p>
|
10
10
|
|
11
11
|
Replace:
|
12
12
|
|
13
13
|
<h2>\1</h2>
|
14
14
|
|
15
15
|
The results page does not show the actual results, but the pages, snippets and layouts that had at least one match.
|
16
|
-
All the more reason to be
|
16
|
+
All the more reason to be very careful when you use the replace functionality, especially when you are using regular expressions.
|
17
17
|
|
18
18
|
Created by Benny Degezelle.
|
@@ -9,17 +9,16 @@ class Admin::SearchController < ApplicationController
|
|
9
9
|
params.select{|k, v| k =~ /(page|snippet|layout)_(\d)/ }.map do |k,v|
|
10
10
|
class_name, id = k.to_s.split('_')
|
11
11
|
to_replace = class_name.titlecase.constantize.find(id)
|
12
|
-
|
12
|
+
qry = params[:regex_mode] ? params[:query] : Regexp.quote(params[:query])
|
13
|
+
srch = Regexp.new(qry, params[:case_insensitive])
|
13
14
|
|
14
15
|
if class_name == 'page'
|
15
|
-
page = Page.find(id)
|
16
16
|
[:slug, :title, :breadcrumb].each do |attr|
|
17
|
-
|
17
|
+
to_replace.update_attribute(attr, to_replace.send(attr).gsub(srch, params[:replace]))
|
18
18
|
end
|
19
|
-
|
19
|
+
to_replace.parts.each do |page_part|
|
20
20
|
page_part.update_attribute :content, page_part.content.gsub(srch, params[:replace])
|
21
21
|
end
|
22
|
-
|
23
22
|
else
|
24
23
|
to_replace.update_attribute :content, to_replace.content.gsub(srch, params[:replace])
|
25
24
|
end
|
@@ -80,9 +80,9 @@
|
|
80
80
|
:javascript
|
81
81
|
function toggle_cbs() {
|
82
82
|
if($("toggler").checked){
|
83
|
-
$$('input[type="checkbox"]').slice(1,-
|
83
|
+
$$('input[type="checkbox"]').slice(1,-2).each(function(e){ e.checked = 1 });
|
84
84
|
}
|
85
85
|
else{
|
86
|
-
$$('input[type="checkbox"]').slice(1,-
|
86
|
+
$$('input[type="checkbox"]').slice(1,-2).each(function(e){ e.checked = 0 });
|
87
87
|
}
|
88
88
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-find_replace-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-07-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Adds backend search and replace functionality to Radiant CMS!
|
15
15
|
email:
|
@@ -29,8 +29,6 @@ files:
|
|
29
29
|
- find_replace_extension.rb
|
30
30
|
- lib/radiant-find_replace-extension.rb
|
31
31
|
- lib/tasks/find_replace_extension_tasks.rake
|
32
|
-
- radiant-find_replace-extension-1.0.0.gem
|
33
|
-
- radiant-find_replace-extension-1.0.1.gem
|
34
32
|
- radiant-find_replace-extension.gemspec
|
35
33
|
- Rakefile
|
36
34
|
- README.md
|
@@ -65,3 +63,4 @@ test_files:
|
|
65
63
|
- spec/spec_helper.rb
|
66
64
|
- features/support/env.rb
|
67
65
|
- features/support/paths.rb
|
66
|
+
has_rdoc:
|
Binary file
|
Binary file
|