spud_core 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +41 -0
- data/app/assets/images/back_disabled.jpg +0 -0
- data/app/assets/images/back_enabled.jpg +0 -0
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/images/forward_disabled.jpg +0 -0
- data/app/assets/images/forward_enabled.jpg +0 -0
- data/app/assets/images/sort_asc.png +0 -0
- data/app/assets/images/sort_asc_disabled.png +0 -0
- data/app/assets/images/sort_both.png +0 -0
- data/app/assets/images/sort_desc.png +0 -0
- data/app/assets/images/sort_desc_disabled.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-bg_flat_0_eeeeee_40x100.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-bg_flat_55_ffffff_40x100.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-icons_0073ea_256x240.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-icons_666666_256x240.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-icons_ff0084_256x240.png +0 -0
- data/app/assets/images/spud/admin/flick/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/images/spud/admin/users_thumb.png +0 -0
- data/app/assets/javascripts/spud/admin/application.js +90 -0
- data/app/assets/javascripts/spud/admin/jquery.dataTables.min.js +151 -0
- data/app/assets/javascripts/spud/admin/settings.js +2 -0
- data/app/assets/javascripts/spud/admin/users.js +2 -0
- data/app/assets/javascripts/spud/setup.js +2 -0
- data/app/assets/javascripts/spud/sitemaps.js +2 -0
- data/app/assets/javascripts/spud/user_sessions.js +2 -0
- data/app/assets/javascripts/spud/users.js +2 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-article.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-aside.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-blockquote.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-command.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-details.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-figcaption.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-figure.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-footer.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-h1.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-h2.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-h3.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-h4.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-h5.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-h6.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-header.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-hgroup.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-mark.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-meter.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-nav.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-p.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-pre.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-progress.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-rp.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-rt.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-ruby.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-section.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-summary.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/lbl-time.png +0 -0
- data/app/assets/javascripts/wymeditor/iframe/default/readme.md +1 -0
- data/app/assets/javascripts/wymeditor/iframe/default/wymiframe.css +91 -0
- data/app/assets/javascripts/wymeditor/iframe/default/wymiframe.html +26 -0
- data/app/assets/javascripts/wymeditor/jquery.wymeditor.js +9983 -0
- data/app/assets/javascripts/wymeditor/jquery.wymeditor.min.js +34 -0
- data/app/assets/javascripts/wymeditor/lang/bg.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/ca.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/cs.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/cy.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/de.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/en.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/es.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/fa.js +46 -0
- data/app/assets/javascripts/wymeditor/lang/fi.js +44 -0
- data/app/assets/javascripts/wymeditor/lang/fr.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/gl.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/he.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/hr.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/hu.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/it.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/ja.js +44 -0
- data/app/assets/javascripts/wymeditor/lang/lt.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/nb.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/nl.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/nn.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/pl.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/pt-br.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/pt.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/ru.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/sv.js +46 -0
- data/app/assets/javascripts/wymeditor/lang/tr.js +45 -0
- data/app/assets/javascripts/wymeditor/lang/zh_cn.js +47 -0
- data/app/assets/javascripts/wymeditor/plugins/embed/jquery.wymeditor.embed.js +82 -0
- data/app/assets/javascripts/wymeditor/plugins/fullscreen/icon_fullscreen.gif +0 -0
- data/app/assets/javascripts/wymeditor/plugins/fullscreen/jquery.wymeditor.fullscreen.js +124 -0
- data/app/assets/javascripts/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js +49 -0
- data/app/assets/javascripts/wymeditor/plugins/list/jquery.wymeditor.list.js +60 -0
- data/app/assets/javascripts/wymeditor/plugins/rdfa/jquery.wymeditor.rdfa.js +186 -0
- data/app/assets/javascripts/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js +77 -0
- data/app/assets/javascripts/wymeditor/plugins/resizable/readme.txt +124 -0
- data/app/assets/javascripts/wymeditor/plugins/table/jquery.wymeditor.table.js +721 -0
- data/app/assets/javascripts/wymeditor/plugins/table/table_delete_column.png +0 -0
- data/app/assets/javascripts/wymeditor/plugins/table/table_delete_row.png +0 -0
- data/app/assets/javascripts/wymeditor/plugins/table/table_insert_column.png +0 -0
- data/app/assets/javascripts/wymeditor/plugins/table/table_insert_row.png +0 -0
- data/app/assets/javascripts/wymeditor/plugins/table/table_join_row.png +0 -0
- data/app/assets/javascripts/wymeditor/plugins/tidy/README +19 -0
- data/app/assets/javascripts/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js +78 -0
- data/app/assets/javascripts/wymeditor/plugins/tidy/tidy.php +58 -0
- data/app/assets/javascripts/wymeditor/plugins/tidy/wand.png +0 -0
- data/app/assets/javascripts/wymeditor/skins/compact/icons.png +0 -0
- data/app/assets/javascripts/wymeditor/skins/compact/skin.css +134 -0
- data/app/assets/javascripts/wymeditor/skins/compact/skin.js +37 -0
- data/app/assets/javascripts/wymeditor/skins/default/icons.png +0 -0
- data/app/assets/javascripts/wymeditor/skins/default/skin.css +133 -0
- data/app/assets/javascripts/wymeditor/skins/default/skin.js +40 -0
- data/app/assets/javascripts/wymeditor/skins/minimal/images/bg.header.gif +0 -0
- data/app/assets/javascripts/wymeditor/skins/minimal/images/bg.selector.silver.gif +0 -0
- data/app/assets/javascripts/wymeditor/skins/minimal/images/bg.wymeditor.png +0 -0
- data/app/assets/javascripts/wymeditor/skins/minimal/images/icons.silver.gif +0 -0
- data/app/assets/javascripts/wymeditor/skins/minimal/skin.css +131 -0
- data/app/assets/javascripts/wymeditor/skins/minimal/skin.js +30 -0
- data/app/assets/javascripts/wymeditor/skins/silver/COPYING +674 -0
- data/app/assets/javascripts/wymeditor/skins/silver/README +27 -0
- data/app/assets/javascripts/wymeditor/skins/silver/images/bg.header.gif +0 -0
- data/app/assets/javascripts/wymeditor/skins/silver/images/bg.selector.silver.gif +0 -0
- data/app/assets/javascripts/wymeditor/skins/silver/images/bg.wymeditor.png +0 -0
- data/app/assets/javascripts/wymeditor/skins/silver/images/icons.silver.gif +0 -0
- data/app/assets/javascripts/wymeditor/skins/silver/skin.css +297 -0
- data/app/assets/javascripts/wymeditor/skins/silver/skin.js +61 -0
- data/app/assets/javascripts/wymeditor/skins/twopanels/icons.png +0 -0
- data/app/assets/javascripts/wymeditor/skins/twopanels/skin.css +134 -0
- data/app/assets/javascripts/wymeditor/skins/twopanels/skin.js +39 -0
- data/app/assets/javascripts/wymeditor/skins/wymeditor_icon.png +0 -0
- data/app/assets/stylesheets/spud/admin/application.css +464 -0
- data/app/assets/stylesheets/spud/admin/jquery-ui.css +568 -0
- data/app/assets/stylesheets/spud/admin/settings.css +4 -0
- data/app/assets/stylesheets/spud/admin/users.css +4 -0
- data/app/assets/stylesheets/spud/forms.css +108 -0
- data/app/assets/stylesheets/spud/login/application.css +302 -0
- data/app/assets/stylesheets/spud/login.css +58 -0
- data/app/assets/stylesheets/spud/setup.css +4 -0
- data/app/assets/stylesheets/spud/sitemaps.css +4 -0
- data/app/assets/stylesheets/spud/user_sessions.css +4 -0
- data/app/assets/stylesheets/spud/users.css +4 -0
- data/app/controllers/spud/admin/application_controller.rb +19 -0
- data/app/controllers/spud/admin/dashboard_controller.rb +7 -0
- data/app/controllers/spud/admin/settings_controller.rb +15 -0
- data/app/controllers/spud/admin/users_controller.rb +111 -0
- data/app/controllers/spud/application_controller.rb +48 -0
- data/app/controllers/spud/setup_controller.rb +22 -0
- data/app/controllers/spud/sitemaps_controller.rb +6 -0
- data/app/controllers/spud/user_sessions_controller.rb +28 -0
- data/app/controllers/spud/users_controller.rb +21 -0
- data/app/helpers/spud/admin/application_helper.rb +17 -0
- data/app/helpers/spud/admin/settings_helper.rb +2 -0
- data/app/helpers/spud/admin/users_helper.rb +2 -0
- data/app/helpers/spud/setup_helper.rb +2 -0
- data/app/helpers/spud/sitemaps_helper.rb +2 -0
- data/app/helpers/spud/user_sessions_helper.rb +2 -0
- data/app/helpers/spud/users_helper.rb +2 -0
- data/app/models/spud_admin_permission.rb +2 -0
- data/app/models/spud_setting.rb +2 -0
- data/app/models/spud_user.rb +16 -0
- data/app/models/spud_user_session.rb +3 -0
- data/app/views/layouts/spud/admin/application.html.erb +44 -0
- data/app/views/layouts/spud/admin/detail.html.erb +31 -0
- data/app/views/layouts/spud/login/application.html.erb +17 -0
- data/app/views/layouts/spud/setup.html.erb +47 -0
- data/app/views/spud/admin/dashboard/index.html.erb +11 -0
- data/app/views/spud/admin/users/_edit.html.erb +14 -0
- data/app/views/spud/admin/users/_form.html.erb +51 -0
- data/app/views/spud/admin/users/_new.html.erb +14 -0
- data/app/views/spud/admin/users/index.html.erb +41 -0
- data/app/views/spud/admin/users/show.html.erb +17 -0
- data/app/views/spud/setup/index.html.erb +25 -0
- data/app/views/spud/sitemaps/show.xml.builder +12 -0
- data/app/views/spud/user_sessions/new.html.erb +22 -0
- data/app/views/spud/users/_form.html.erb +35 -0
- data/app/views/spud/users/settings.html.erb +14 -0
- data/config/application.rb +48 -0
- data/config/boot.rb +6 -0
- data/config/routes.rb +15 -0
- data/lib/spud_core/belongs_to_app.rb +54 -0
- data/lib/spud_core/configuration.rb +9 -0
- data/lib/spud_core/engine.rb +34 -0
- data/lib/spud_core/test_files.rb +25 -0
- data/lib/spud_core.rb +8 -0
- metadata +311 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2011 PolicyStat LLC.
|
|
3
|
+
* MIT licensed (MIT-license.txt)
|
|
4
|
+
*
|
|
5
|
+
* This plugin adds the ability to use tab and shift+tab to indent/outdent
|
|
6
|
+
* lists, mimicking a user's expected behavior when inside an editor.
|
|
7
|
+
*
|
|
8
|
+
* @author Wes Winham (winhamwr@gmail.com)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
function ListPlugin(options, wym) {
|
|
12
|
+
this._options = jQuery.extend({}, options);
|
|
13
|
+
this._wym = wym;
|
|
14
|
+
|
|
15
|
+
this.init();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
ListPlugin.prototype.init = function() {
|
|
19
|
+
this._wym.listPlugin = this;
|
|
20
|
+
|
|
21
|
+
this.bindEvents();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
ListPlugin.prototype.bindEvents = function() {
|
|
25
|
+
var listPlugin = this;
|
|
26
|
+
var wym = this._wym;
|
|
27
|
+
|
|
28
|
+
// Bind a key listener so we can handle tabs
|
|
29
|
+
// With jQuery 1.3, live() can be used to simplify handler logic
|
|
30
|
+
$(wym._doc).bind('keydown', listPlugin.handleKeyDown);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Handle any tab presses when inside list items and indent/outdent.
|
|
35
|
+
*/
|
|
36
|
+
ListPlugin.prototype.handleKeyDown = function(evt) {
|
|
37
|
+
//'this' is the editor._doc
|
|
38
|
+
var wym = WYMeditor.INSTANCES[this.title];
|
|
39
|
+
var listPlugin = wym.listPlugin;
|
|
40
|
+
|
|
41
|
+
var container = wym.selected();
|
|
42
|
+
var name = container.tagName.toLowerCase();
|
|
43
|
+
// We only care about tabs when we're inside a list
|
|
44
|
+
if (name != "li") {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Handle tab presses
|
|
49
|
+
if (evt.keyCode == WYMeditor.KEY.TAB) {
|
|
50
|
+
if (evt.shiftKey) {
|
|
51
|
+
wym.exec(WYMeditor.OUTDENT);
|
|
52
|
+
return false; // Short-circuit normal tab behavior
|
|
53
|
+
} else {
|
|
54
|
+
wym.exec(WYMeditor.INDENT);
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WYMeditor : what you see is What You Mean web-based editor
|
|
3
|
+
* Copyright (c) 2005 - 2011 Jean-Francois Hovinne, http://www.wymeditor.org/
|
|
4
|
+
* Dual licensed under the MIT (MIT-license.txt)
|
|
5
|
+
* and GPL (GPL-license.txt) licenses.
|
|
6
|
+
*
|
|
7
|
+
* For further information visit:
|
|
8
|
+
* http://www.wymeditor.org/
|
|
9
|
+
*
|
|
10
|
+
* File Name:
|
|
11
|
+
* jquery.wymeditor.rdfa.js
|
|
12
|
+
* RDFa plugin for WYMeditor
|
|
13
|
+
*
|
|
14
|
+
* File Authors:
|
|
15
|
+
* Jean-Francois Hovinne (@jfhovinne)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
//Extend WYMeditor
|
|
19
|
+
WYMeditor.editor.prototype.rdfa = function (options) {
|
|
20
|
+
var rdfa = new WYMeditor.RDFa(options, this);
|
|
21
|
+
return rdfa;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//RDFa constructor
|
|
25
|
+
WYMeditor.RDFa = function (options, wym) {
|
|
26
|
+
options = jQuery.extend({
|
|
27
|
+
setStdNameSpaces: true,
|
|
28
|
+
extendXHTMLParser: true,
|
|
29
|
+
buttons: {}
|
|
30
|
+
}, options);
|
|
31
|
+
|
|
32
|
+
this._options = options;
|
|
33
|
+
this._wym = wym;
|
|
34
|
+
this.init();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//RDFa plugin init
|
|
38
|
+
WYMeditor.RDFa.prototype.init = function () {
|
|
39
|
+
if (this._options.setStdNameSpaces) {
|
|
40
|
+
this.setStdNameSpaces();
|
|
41
|
+
}
|
|
42
|
+
if (this._options.extendXHTMLParser) {
|
|
43
|
+
this.extendXHTMLParser();
|
|
44
|
+
}
|
|
45
|
+
this.setButtons();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//Adding the namespaces to the document
|
|
49
|
+
WYMeditor.RDFa.prototype.setStdNameSpaces = function () {
|
|
50
|
+
this.addNameSpace('xmlns', 'http://www.w3.org/1999/xhtml');
|
|
51
|
+
this.addNameSpace('version', 'XHTML+RDFa 1.0');
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
WYMeditor.RDFa.prototype.addNameSpace = function (attr, value) {
|
|
55
|
+
jQuery('html', this._wym._doc)
|
|
56
|
+
.attr(attr, value);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
WYMeditor.RDFa.prototype.extendXHTMLParser = function () {
|
|
60
|
+
this.extendAttributes();
|
|
61
|
+
this.setStdVocabularies();
|
|
62
|
+
this.extendLinkAttributes();
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
WYMeditor.RDFa.prototype.extendAttributes = function () {
|
|
66
|
+
//Add the RDFa attributes
|
|
67
|
+
WYMeditor.XhtmlValidator._attributes.core.attributes.push(
|
|
68
|
+
'rel',
|
|
69
|
+
'rev',
|
|
70
|
+
'content',
|
|
71
|
+
'href',
|
|
72
|
+
'src',
|
|
73
|
+
'about',
|
|
74
|
+
'property',
|
|
75
|
+
'resource',
|
|
76
|
+
'datatype',
|
|
77
|
+
'typeof'
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
WYMeditor.RDFa.prototype.setStdVocabularies = function () {
|
|
82
|
+
var _this = this;
|
|
83
|
+
//Add the 'standard' vocabularies
|
|
84
|
+
vocabularies = [
|
|
85
|
+
'xmlns:biblio',
|
|
86
|
+
'xmlns:cc',
|
|
87
|
+
'xmlns:dbp',
|
|
88
|
+
'xmlns:dbr',
|
|
89
|
+
'xmlns:dc',
|
|
90
|
+
'xmlns:ex',
|
|
91
|
+
'xmlns:foaf',
|
|
92
|
+
'xmlns:rdf',
|
|
93
|
+
'xmlns:rdfs',
|
|
94
|
+
'xmlns:taxo',
|
|
95
|
+
'xmlns:xhv',
|
|
96
|
+
'xmlns:xsd'
|
|
97
|
+
];
|
|
98
|
+
jQuery.each(vocabularies, function (index, vocabulary) {
|
|
99
|
+
_this.addVocabulary(vocabulary);
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
WYMeditor.RDFa.prototype.addVocabulary = function (vocabulary) {
|
|
104
|
+
WYMeditor.XhtmlValidator._attributes.core.attributes.push(vocabulary);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
WYMeditor.RDFa.prototype.extendLinkAttributes = function () {
|
|
108
|
+
//Overwrite the <a> attributes 'rel' and 'rev'
|
|
109
|
+
WYMeditor.XhtmlValidator._tags.a = {
|
|
110
|
+
"attributes": {
|
|
111
|
+
"0": "charset",
|
|
112
|
+
"1": "coords",
|
|
113
|
+
"2": "href",
|
|
114
|
+
"3": "hreflang",
|
|
115
|
+
"4": "name",
|
|
116
|
+
"5": "rel",
|
|
117
|
+
"6": "rev",
|
|
118
|
+
"shape": /^(rect|rectangle|circ|circle|poly|polygon)$/,
|
|
119
|
+
"7": "type"
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
WYMeditor.RDFa.prototype.setButtons = function () {
|
|
125
|
+
var _this = this,
|
|
126
|
+
list = jQuery(this._wym._box).find('div.wym_classes ul');
|
|
127
|
+
jQuery.each(this._options.buttons, function (index, button) {
|
|
128
|
+
list
|
|
129
|
+
.append('<li></li>')
|
|
130
|
+
.children(':last')
|
|
131
|
+
.append('<a></a>')
|
|
132
|
+
.children(':last')
|
|
133
|
+
.attr('href', '#')
|
|
134
|
+
.text(button.title)
|
|
135
|
+
.bind('click',
|
|
136
|
+
{
|
|
137
|
+
instance: _this._wym,
|
|
138
|
+
button: button,
|
|
139
|
+
ns: button.ns,
|
|
140
|
+
attr: button.attr,
|
|
141
|
+
value: button.value
|
|
142
|
+
},
|
|
143
|
+
_this.clickButtonHandler);
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
WYMeditor.RDFa.prototype.clickButtonHandler = function (evt) {
|
|
148
|
+
var wym = evt.data.instance,
|
|
149
|
+
selected = wym.selected();
|
|
150
|
+
|
|
151
|
+
//the attribute already exists, remove it
|
|
152
|
+
if (typeof jQuery(selected).attr(evt.data.attr) !== 'undefined' &&
|
|
153
|
+
jQuery(selected).attr(evt.data.attr) !== '') {
|
|
154
|
+
WYMeditor.console.log(
|
|
155
|
+
'attribute already exists, remove it:',
|
|
156
|
+
evt.data.attr,
|
|
157
|
+
jQuery(selected).attr(evt.data.attr)
|
|
158
|
+
);
|
|
159
|
+
jQuery(selected)
|
|
160
|
+
.removeAttr(evt.data.attr)
|
|
161
|
+
.removeClass(evt.data.ns)
|
|
162
|
+
.removeClass(evt.data.attr)
|
|
163
|
+
.removeClass(evt.data.value);
|
|
164
|
+
|
|
165
|
+
//else, add it
|
|
166
|
+
} else {
|
|
167
|
+
WYMeditor.console.log('attribute does not exist, add it:', evt.data.attr, evt.data.value);
|
|
168
|
+
if (evt.data.value) { //value available
|
|
169
|
+
jQuery(selected)
|
|
170
|
+
.attr(evt.data.attr, evt.data.ns + ':' + evt.data.value)
|
|
171
|
+
.addClass(evt.data.ns)
|
|
172
|
+
.addClass(evt.data.attr)
|
|
173
|
+
.addClass(evt.data.value);
|
|
174
|
+
} else { //value not available
|
|
175
|
+
evt.data.value = prompt('Value', '');
|
|
176
|
+
if (evt.data.value !== null) {
|
|
177
|
+
jQuery(selected)
|
|
178
|
+
.attr(evt.data.attr, evt.data.value)
|
|
179
|
+
.addClass(evt.data.ns)
|
|
180
|
+
.addClass(evt.data.attr)
|
|
181
|
+
.addClass(evt.data.value);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return false;
|
|
186
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WYMeditor : what you see is What You Mean web-based editor
|
|
3
|
+
* Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
|
|
4
|
+
* Dual licensed under the MIT (MIT-license.txt)
|
|
5
|
+
* and GPL (GPL-license.txt) licenses.
|
|
6
|
+
*
|
|
7
|
+
* For further information visit:
|
|
8
|
+
* http://www.wymeditor.org/
|
|
9
|
+
*
|
|
10
|
+
* File Name:
|
|
11
|
+
* jquery.wymeditor.resizable.js
|
|
12
|
+
* resize plugin for WYMeditor
|
|
13
|
+
*
|
|
14
|
+
* File Authors:
|
|
15
|
+
* Peter Eschler (peschler _at_ gmail.com)
|
|
16
|
+
* Jean-Francois Hovinne - http://www.hovinne.com/
|
|
17
|
+
*
|
|
18
|
+
* Version:
|
|
19
|
+
* 0.4
|
|
20
|
+
*
|
|
21
|
+
* Changelog:
|
|
22
|
+
*
|
|
23
|
+
* 0.4
|
|
24
|
+
* - Removed UI and UI.resizable scripts loading - see #167 (jfh).
|
|
25
|
+
*
|
|
26
|
+
* 0.3
|
|
27
|
+
* - Added 'iframeOriginalSize' and removed 'ui.instance' calls (jfh).
|
|
28
|
+
*
|
|
29
|
+
* 0.2
|
|
30
|
+
* - Added full support for all jQueryUI resizable plugin options.
|
|
31
|
+
* - Refactored and documented code.
|
|
32
|
+
* 0.1
|
|
33
|
+
* - Initial release.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The resizable plugin makes the wymeditor box vertically resizable.
|
|
38
|
+
* It it based on the ui.resizable.js plugin of the jQuery UI library.
|
|
39
|
+
*
|
|
40
|
+
* The WYMeditor resizable plugin supports all parameters of the jQueryUI
|
|
41
|
+
* resizable plugin. The parameters are passed like this:
|
|
42
|
+
*
|
|
43
|
+
* wym.resizable({ handles: "s,e",
|
|
44
|
+
* maxHeight: 600 });
|
|
45
|
+
*
|
|
46
|
+
* DEPENDENCIES: jQuery UI, jQuery UI resizable
|
|
47
|
+
*
|
|
48
|
+
* @param options options for the plugin
|
|
49
|
+
*/
|
|
50
|
+
WYMeditor.editor.prototype.resizable = function(options) {
|
|
51
|
+
|
|
52
|
+
var wym = this;
|
|
53
|
+
var $iframe = jQuery(wym._box).find('iframe');
|
|
54
|
+
var $iframe_div = jQuery(wym._box).find('.wym_iframe');
|
|
55
|
+
var iframeOriginalSize = {};
|
|
56
|
+
|
|
57
|
+
// Define some default options
|
|
58
|
+
var default_options = {
|
|
59
|
+
resize: function() {
|
|
60
|
+
$iframe_div.height($iframe.height());
|
|
61
|
+
},
|
|
62
|
+
alsoResize: $iframe,
|
|
63
|
+
handles: "s,e,se",
|
|
64
|
+
minHeight: 250
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Merge given options with default options. Given options override
|
|
68
|
+
// default ones.
|
|
69
|
+
var final_options = jQuery.extend(default_options, options);
|
|
70
|
+
|
|
71
|
+
if (jQuery.isFunction(jQuery.fn.resizable)) {
|
|
72
|
+
jQuery(wym._box).resizable(final_options);
|
|
73
|
+
} else {
|
|
74
|
+
WYMeditor.console.error('Oops, jQuery UI.resizable unavailable.');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
resizable plugin for WYMeditor
|
|
4
|
+
##############################
|
|
5
|
+
|
|
6
|
+
The ``resizable`` plugin for WYMeditor_ enables vertical resizing of the
|
|
7
|
+
editor area. The plugin is based on the jQuery UI library.
|
|
8
|
+
|
|
9
|
+
Requirements
|
|
10
|
+
============
|
|
11
|
+
The following packages are required for using the WYMeditor ``resizable``
|
|
12
|
+
plugin:
|
|
13
|
+
|
|
14
|
+
* jQuery (tested with jQuery ``jquery-1.2.4a.js`` from ``jquery.ui`` package)
|
|
15
|
+
* WYMeditor SVN trunk (Revision: 482)
|
|
16
|
+
* jQuery-UI (tested with ``jquery.ui-1.5b2``)
|
|
17
|
+
|
|
18
|
+
It should be possible to use this plugin with ``WYMeditor-0.4`` but I have not
|
|
19
|
+
tried.
|
|
20
|
+
|
|
21
|
+
Download
|
|
22
|
+
========
|
|
23
|
+
You can download the WYMeditor ``resizable`` plugin here:
|
|
24
|
+
|
|
25
|
+
* wymeditor-resizable-plugin-0.2.tgz_
|
|
26
|
+
* wymeditor-resizable-plugin-0.1.tgz_
|
|
27
|
+
|
|
28
|
+
See the Changelog_ for more infos about the releases.
|
|
29
|
+
|
|
30
|
+
.. _wymeditor-resizable-plugin-0.2.tgz: http://pyjax.net/download/wymeditor-resizable-plugin-0.2.tgz
|
|
31
|
+
.. _wymeditor-resizable-plugin-0.1.tgz: http://pyjax.net/download/wymeditor-resizable-plugin-0.1.tgz
|
|
32
|
+
|
|
33
|
+
Installation
|
|
34
|
+
============
|
|
35
|
+
Just extract the downloaded archive into your WYMeditor's ``plugin``
|
|
36
|
+
directory.
|
|
37
|
+
|
|
38
|
+
Usage
|
|
39
|
+
=====
|
|
40
|
+
For general instructions on WYMeditor plugins please refer to the `WYMeditor
|
|
41
|
+
plugin page`_.
|
|
42
|
+
|
|
43
|
+
To use the ``resizable`` plugin simply include the plugin's JavaScript file in
|
|
44
|
+
your code. You **do not** need to include the jQuery UI files - this is done
|
|
45
|
+
automatically by the plugin (see `Internals`_)::
|
|
46
|
+
|
|
47
|
+
<script type="text/javascript"
|
|
48
|
+
src="/js/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js">
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
Make sure to adjust the ``src`` attribute to your needs, then initialize the
|
|
52
|
+
plugin in WYMeditor's ``postInit`` function::
|
|
53
|
+
|
|
54
|
+
wymeditor({postInit: function(wym) {
|
|
55
|
+
wym.hovertools(); // other plugins...
|
|
56
|
+
wym.resizable({handles: "s,e",
|
|
57
|
+
maxHeight: 600});
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
The ``resizable`` plugin takes exactly one parameter, which is an object literal
|
|
62
|
+
containing the options of the plugin. The WYMeditor ``resizable`` plugin
|
|
63
|
+
supports all options of the jQuery UI ``resizable`` plugin. These are the
|
|
64
|
+
default values used by the plugin::
|
|
65
|
+
|
|
66
|
+
handles: "s,e,se",
|
|
67
|
+
minHeight: 250,
|
|
68
|
+
maxHeight: 600
|
|
69
|
+
|
|
70
|
+
See the `jQuery UI resizable plugin docs`_ for a list of all options.
|
|
71
|
+
|
|
72
|
+
That's it! You are now able to resize the WYMeditor vertically, horizontally or
|
|
73
|
+
both, depending on your options.
|
|
74
|
+
|
|
75
|
+
.. _jQuery UI resizable plugin docs: http://docs.jquery.com/UI/Resizables
|
|
76
|
+
|
|
77
|
+
Internals
|
|
78
|
+
=========
|
|
79
|
+
The plugin takes care of loading the necessary jQuery UI files (``base`` and
|
|
80
|
+
``resizable``) from the same path the jQuery library was loaded. Here's how
|
|
81
|
+
it's done::
|
|
82
|
+
|
|
83
|
+
// Get the jQuery path from the editor, stripping away the jQuery file.
|
|
84
|
+
// see http://www.oreilly.com/catalog/regex/chapter/ch04.html
|
|
85
|
+
// The match result array contains the path and the filename.
|
|
86
|
+
var jQueryPath = wym.computeJqueryPath().match(/^(.*)\/(.*)$/)[1];
|
|
87
|
+
|
|
88
|
+
// Make an array of the external JavaScript files required by the plugin.
|
|
89
|
+
var jQueryPlugins = [jQueryPath + '/ui.base.js',
|
|
90
|
+
jQueryPath + '/ui.resizable.js'];
|
|
91
|
+
|
|
92
|
+
// First get the jQuery UI base file
|
|
93
|
+
$.getScript(jQueryPlugins[0]);
|
|
94
|
+
|
|
95
|
+
// Get the jQuery UI resizeable plugin and then init the wymeditor resizable
|
|
96
|
+
// plugin. It is import to do the initialisation after loading the
|
|
97
|
+
// necessary jQuery UI files has finished, otherwise the "resizable" method
|
|
98
|
+
// would not be available.
|
|
99
|
+
$.getScript(jQueryPlugins[1], function() {
|
|
100
|
+
jQuery(wym._box).resizable(final_options);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
An alternative approach would be to use an AJAX queue when getting the script
|
|
104
|
+
files to ensure that all jQuery files are loaded before the initialisation code
|
|
105
|
+
of the plugin is executed. There is an `jQuery AJAX queue plugin`_ which does
|
|
106
|
+
that.
|
|
107
|
+
|
|
108
|
+
.. _jQuery AJAX queue plugin: http://plugins.jquery.com/project/ajaxqueue
|
|
109
|
+
|
|
110
|
+
Changelog
|
|
111
|
+
=========
|
|
112
|
+
|
|
113
|
+
0.2
|
|
114
|
+
---
|
|
115
|
+
- Added full support for all jQuery UI resizable plugin options.
|
|
116
|
+
- Refactored and documented code.
|
|
117
|
+
- Now contains a packed version (775 bytes).
|
|
118
|
+
|
|
119
|
+
0.1
|
|
120
|
+
---
|
|
121
|
+
- Initial release.
|
|
122
|
+
|
|
123
|
+
.. _WYMeditor: http://www.wymeditor.org/
|
|
124
|
+
.. _WYMeditor plugin page: http://trac.wymeditor.org/trac/wiki/0.4/Plugins
|