beef-admin_area 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/beef-admin_area.gemspec +4 -2
- data/generators/admin_area_files/admin_area_files_generator.rb +19 -8
- data/generators/admin_area_files/templates/app/views/admin/settings/show.html.erb +1 -1
- data/generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/js/source_editor.js +62 -0
- data/generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/source_editor.htm +31 -0
- data/generators/admin_area_files/templates/public/javascripts/tiny-mce-config.js +7 -13
- metadata +4 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/beef-admin_area.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{beef-admin_area}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Steve England"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-01-26}
|
13
13
|
s.email = %q{steve@wearebeef.co.uk}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -149,6 +149,7 @@ Gem::Specification.new do |s|
|
|
149
149
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/js/anchor.js",
|
150
150
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/js/color_picker.js",
|
151
151
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/js/link.js",
|
152
|
+
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/js/source_editor.js",
|
152
153
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/langs/en.js",
|
153
154
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/langs/en_dlg.js",
|
154
155
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/link.htm",
|
@@ -161,6 +162,7 @@ Gem::Specification.new do |s|
|
|
161
162
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/skins/default/img/progress.gif",
|
162
163
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/skins/default/img/tabs.gif",
|
163
164
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/skins/default/ui.css",
|
165
|
+
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/source_editor.htm",
|
164
166
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/tiny_mce.js",
|
165
167
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/tiny_mce_popup.js",
|
166
168
|
"generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/utils/form_utils.js",
|
@@ -1,18 +1,18 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
|
2
2
|
|
3
3
|
class AdminAreaFilesGenerator < Rails::Generator::Base
|
4
|
-
|
4
|
+
|
5
5
|
def manifest
|
6
6
|
record do |m|
|
7
|
-
|
7
|
+
|
8
8
|
m.insert_into 'app/models/user.rb', <<-RUBY
|
9
9
|
# List of allowed roles. Removing admin role will cause errors
|
10
10
|
ROLES = [:team_member, :admin]
|
11
11
|
include Beef::AdminArea::Roles
|
12
|
-
|
12
|
+
|
13
13
|
attr_accessible :name
|
14
14
|
validates_presence_of :name
|
15
|
-
|
15
|
+
|
16
16
|
private
|
17
17
|
before_save :set_permalink
|
18
18
|
|
@@ -20,8 +20,8 @@ private
|
|
20
20
|
self.permalink = name.parameterize
|
21
21
|
end
|
22
22
|
RUBY
|
23
|
-
|
24
|
-
|
23
|
+
|
24
|
+
|
25
25
|
m.directory File.join("public", "images", "admin")
|
26
26
|
m.directory File.join("public", "images", "textile-editor")
|
27
27
|
m.directory File.join("public", "images", "lightwindow")
|
@@ -52,6 +52,9 @@ RUBY
|
|
52
52
|
m.directory File.join("public", "javascripts", "admin", "tiny_mce", "plugins", "inlinepopups", "skins", "clearlooks2")
|
53
53
|
m.directory File.join("public", "javascripts", "admin", "tiny_mce", "plugins", "inlinepopups", "skins", "clearlooks2", "img")
|
54
54
|
m.directory File.join("public", "javascripts", "admin", "tiny_mce", "plugins", "safari")
|
55
|
+
m.directory File.join("public", "javascripts", "admin", "tiny_mce", "plugins", "paste")
|
56
|
+
m.directory File.join("public", "javascripts", "admin", "tiny_mce", "plugins", "paste", "js")
|
57
|
+
m.directory File.join("public", "javascripts", "admin", "tiny_mce", "plugins", "paste", "langs")
|
55
58
|
|
56
59
|
|
57
60
|
|
@@ -150,6 +153,7 @@ RUBY
|
|
150
153
|
"public/javascripts/admin/tiny_mce/langs/en.js",
|
151
154
|
"public/javascripts/admin/tiny_mce/themes/advanced/anchor.htm",
|
152
155
|
"public/javascripts/admin/tiny_mce/themes/advanced/link.htm",
|
156
|
+
"public/javascripts/admin/tiny_mce/themes/advanced/source_editor.htm",
|
153
157
|
"public/javascripts/admin/tiny_mce/themes/advanced/skins/default/content.css",
|
154
158
|
"public/javascripts/admin/tiny_mce/themes/advanced/skins/default/ui.css",
|
155
159
|
"public/javascripts/admin/tiny_mce/themes/advanced/skins/default/img/tabs.gif",
|
@@ -167,6 +171,7 @@ RUBY
|
|
167
171
|
"public/javascripts/admin/tiny_mce/themes/advanced/js/link.js",
|
168
172
|
"public/javascripts/admin/tiny_mce/themes/advanced/js/color_picker.js",
|
169
173
|
"public/javascripts/admin/tiny_mce/themes/advanced/js/anchor.js",
|
174
|
+
"public/javascripts/admin/tiny_mce/themes/advanced/js/source_editor.js",
|
170
175
|
"public/javascripts/admin/tiny_mce/themes/advanced/color_picker.htm",
|
171
176
|
"public/javascripts/admin/tiny_mce/plugins/template/blank.htm",
|
172
177
|
"public/javascripts/admin/tiny_mce/plugins/template/css/template.css",
|
@@ -181,6 +186,12 @@ RUBY
|
|
181
186
|
"public/javascripts/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif",
|
182
187
|
"public/javascripts/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif",
|
183
188
|
"public/javascripts/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif",
|
189
|
+
"public/javascripts/admin/tiny_mce/plugins/paste/editor_plugin.js",
|
190
|
+
"public/javascripts/admin/tiny_mce/plugins/paste/js/pastetext.js",
|
191
|
+
"public/javascripts/admin/tiny_mce/plugins/paste/js/pasteword.js",
|
192
|
+
"public/javascripts/admin/tiny_mce/plugins/paste/langs/en_dlg.js",
|
193
|
+
"public/javascripts/admin/tiny_mce/plugins/paste/pastetext.htm",
|
194
|
+
"public/javascripts/admin/tiny_mce/plugins/paste/pasteword.htm",
|
184
195
|
"public/javascripts/admin/tiny_mce/plugins/inlinepopups/template.htm",
|
185
196
|
"public/javascripts/admin/tiny_mce/plugins/safari/blank.htm",
|
186
197
|
"public/javascripts/admin/tiny_mce/plugins/safari/editor_plugin.js",
|
@@ -189,9 +200,9 @@ RUBY
|
|
189
200
|
].each do |file|
|
190
201
|
m.file file, file
|
191
202
|
end
|
192
|
-
|
203
|
+
|
193
204
|
m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => 'create_settings_and_users'
|
194
|
-
|
205
|
+
|
195
206
|
end
|
196
207
|
end
|
197
208
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
tinyMCEPopup.requireLangPack();
|
2
|
+
tinyMCEPopup.onInit.add(onLoadInit);
|
3
|
+
|
4
|
+
function saveContent() {
|
5
|
+
tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});
|
6
|
+
tinyMCEPopup.close();
|
7
|
+
}
|
8
|
+
|
9
|
+
function onLoadInit() {
|
10
|
+
tinyMCEPopup.resizeToInnerSize();
|
11
|
+
|
12
|
+
// Remove Gecko spellchecking
|
13
|
+
if (tinymce.isGecko)
|
14
|
+
document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
|
15
|
+
|
16
|
+
document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
|
17
|
+
|
18
|
+
if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
|
19
|
+
setWrap('soft');
|
20
|
+
document.getElementById('wraped').checked = true;
|
21
|
+
}
|
22
|
+
|
23
|
+
resizeInputs();
|
24
|
+
}
|
25
|
+
|
26
|
+
function setWrap(val) {
|
27
|
+
var v, n, s = document.getElementById('htmlSource');
|
28
|
+
|
29
|
+
s.wrap = val;
|
30
|
+
|
31
|
+
if (!tinymce.isIE) {
|
32
|
+
v = s.value;
|
33
|
+
n = s.cloneNode(false);
|
34
|
+
n.setAttribute("wrap", val);
|
35
|
+
s.parentNode.replaceChild(n, s);
|
36
|
+
n.value = v;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
function toggleWordWrap(elm) {
|
41
|
+
if (elm.checked)
|
42
|
+
setWrap('soft');
|
43
|
+
else
|
44
|
+
setWrap('off');
|
45
|
+
}
|
46
|
+
|
47
|
+
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
|
48
|
+
|
49
|
+
function resizeInputs() {
|
50
|
+
var el = document.getElementById('htmlSource');
|
51
|
+
|
52
|
+
if (!tinymce.isIE) {
|
53
|
+
wHeight = self.innerHeight - 65;
|
54
|
+
wWidth = self.innerWidth - 16;
|
55
|
+
} else {
|
56
|
+
wHeight = document.body.clientHeight - 70;
|
57
|
+
wWidth = document.body.clientWidth - 16;
|
58
|
+
}
|
59
|
+
|
60
|
+
el.style.height = Math.abs(wHeight) + 'px';
|
61
|
+
el.style.width = Math.abs(wWidth) + 'px';
|
62
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
2
|
+
<head>
|
3
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
4
|
+
<title>{#advanced_dlg.code_title}</title>
|
5
|
+
<script type="text/javascript" src="../../tiny_mce_popup.js?v={tinymce_version}"></script>
|
6
|
+
<script type="text/javascript" src="js/source_editor.js?v={tinymce_version}"></script>
|
7
|
+
</head>
|
8
|
+
<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
|
9
|
+
<form name="source" onsubmit="saveContent();return false;" action="#">
|
10
|
+
<div style="float: left" class="title">{#advanced_dlg.code_title}</div>
|
11
|
+
|
12
|
+
<div id="wrapline" style="float: right">
|
13
|
+
<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{#advanced_dlg.code_wordwrap}</label>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<br style="clear: both" />
|
17
|
+
|
18
|
+
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea>
|
19
|
+
|
20
|
+
<div class="mceActionPanel">
|
21
|
+
<div style="float: left">
|
22
|
+
<input type="submit" name="insert" value="{#update}" id="insert" />
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div style="float: right">
|
26
|
+
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</form>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -5,11 +5,11 @@ document.observe("dom:loaded", function(){
|
|
5
5
|
editor_selector : "editor",
|
6
6
|
strict_loading_mode : 1,
|
7
7
|
convert_urls : false,
|
8
|
-
plugins : "safari,inlinepopups",
|
8
|
+
plugins : "safari,inlinepopups,paste",
|
9
9
|
//"safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
|
10
10
|
// Theme options
|
11
11
|
theme_advanced_blockformats : "h2,h3,h4",
|
12
|
-
theme_advanced_buttons1 :
|
12
|
+
theme_advanced_buttons1 : "undo,redo,|,bold,italic,underline,strikethrough,|,formatselect,|,bullist,numlist,|,link,unlink,|,indent,outdent,|,justifyleft,justifycenter,justifyright,justifyfull,|,code",
|
13
13
|
theme_advanced_buttons2 : "",
|
14
14
|
theme_advanced_buttons3 : "",
|
15
15
|
theme_advanced_buttons4 : "",
|
@@ -19,6 +19,10 @@ document.observe("dom:loaded", function(){
|
|
19
19
|
theme_advanced_statusbar_location : "bottom",
|
20
20
|
theme_advanced_resizing : true,
|
21
21
|
|
22
|
+
// Paste
|
23
|
+
paste_auto_cleanup_on_paste : true,
|
24
|
+
paste_remove_styles: true,
|
25
|
+
|
22
26
|
// Drop lists for link/image/media/template dialogs
|
23
27
|
external_link_list_url : false,
|
24
28
|
remove_redundant_brs : false,
|
@@ -28,28 +32,18 @@ document.observe("dom:loaded", function(){
|
|
28
32
|
|
29
33
|
saveEditorToElement = function(inst){
|
30
34
|
inst.save();
|
31
|
-
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
+
};
|
35
36
|
|
36
37
|
// Add image. insertAtCursor function in apllcation.js
|
37
38
|
addImage = function(imageurl,alt) {
|
38
|
-
// alt = alt.replace("(","").replace(")","");
|
39
|
-
// insertAtCursor(tinyMCE.activeEditor.getContainer(), '\n\n!'+imageurl+'('+alt+')!\n\n');
|
40
39
|
tinyMCE.execInstanceCommand(tinyMCE.activeEditor.id,"mceInsertContent",false, '<img src="' + imageurl + '" alt="' + alt + '" />');
|
41
40
|
};
|
42
41
|
|
43
42
|
addLinkedImage = function(imageurl,alt) {
|
44
|
-
// alt = alt.replace("(","").replace(")","");
|
45
|
-
// insertAtCursor(tinyMCE.activeEditor.getContainer(), '\n\n!'+imageurl+'('+alt+')!:'+imageurl+'\n\n');
|
46
|
-
|
47
43
|
tinyMCE.execInstanceCommand(tinyMCE.activeEditor.id,"mceInsertContent",false, '<a href="' + imageurl + '"><img src="' + imageurl + '" alt="' + alt + '" /></a>');
|
48
44
|
};
|
49
45
|
|
50
46
|
addLink = function(text, url) {
|
51
|
-
//insertAtCursor(tinyMCE.activeEditor.getContainer(), '"'+ text +'":'+ url + ' ');
|
52
|
-
|
53
47
|
tinyMCE.execInstanceCommand(tinyMCE.activeEditor.id,"mceInsertContent",false,'<a href="' + url + '">' + text + '</a>');
|
54
48
|
};
|
55
49
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beef-admin_area
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve England
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-26 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/js/anchor.js
|
186
186
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/js/color_picker.js
|
187
187
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/js/link.js
|
188
|
+
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/js/source_editor.js
|
188
189
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/langs/en.js
|
189
190
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/langs/en_dlg.js
|
190
191
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/link.htm
|
@@ -197,6 +198,7 @@ files:
|
|
197
198
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/skins/default/img/progress.gif
|
198
199
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/skins/default/img/tabs.gif
|
199
200
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/skins/default/ui.css
|
201
|
+
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/themes/advanced/source_editor.htm
|
200
202
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/tiny_mce.js
|
201
203
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/tiny_mce_popup.js
|
202
204
|
- generators/admin_area_files/templates/public/javascripts/admin/tiny_mce/utils/form_utils.js
|