spud_core 0.9.7 → 0.9.8
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/app/assets/javascripts/spud/admin/editor.js +76 -22
- data/app/assets/stylesheets/spud/admin/application.css +7 -0
- data/app/views/spud/admin/users/_edit.html.erb +4 -0
- data/app/views/spud/admin/users/_new.html.erb +4 -0
- data/lib/spud_core/engine.rb +1 -0
- data/lib/spud_core/version.rb +1 -1
- data/spec/dummy/log/development.log +15 -37
- data/spec/dummy/log/test.log +118646 -28169
- metadata +20 -4
@@ -1,3 +1,5 @@
|
|
1
|
+
//= require codemirror
|
2
|
+
//= require codemirror/modes/markdown
|
1
3
|
|
2
4
|
spud.admin.editor = {};
|
3
5
|
|
@@ -40,41 +42,93 @@ spud.admin.editor = {};
|
|
40
42
|
|
41
43
|
var validFormats = "p,h1,h2,h3,h4,h5,h6";
|
42
44
|
|
43
|
-
theme_advanced_blockformats :
|
44
|
-
editor.init = function(){
|
45
|
-
editor.initWithOptions({});
|
46
|
-
};
|
47
45
|
|
48
|
-
editor.
|
46
|
+
editor.init = function(options) {
|
47
|
+
editor.monitorFormatters();
|
48
|
+
options = options || {};
|
49
49
|
var selector = options.selector || 'textarea.tinymce';
|
50
|
+
$(selector).each(function() {
|
51
|
+
var $this = $(this);
|
52
|
+
var dataFormat = $this.attr('data-format');
|
53
|
+
switch(dataFormat) {
|
54
|
+
case 'Markdown':
|
55
|
+
editor.initCodeMirrorWithOptions(this,'markdown', options || {});
|
56
|
+
break;
|
57
|
+
case 'HTML':
|
58
|
+
default:
|
59
|
+
editor.initMCEWithOptions(this, options || {});
|
60
|
+
};
|
61
|
+
|
62
|
+
|
63
|
+
});
|
64
|
+
|
65
|
+
};
|
66
|
+
|
67
|
+
editor.monitorFormatters = function() {
|
68
|
+
$('select[data-formatter]').off('onchange');
|
69
|
+
$('select[data-formatter]').change(editor.formatterChanged);
|
70
|
+
};
|
71
|
+
|
72
|
+
editor.formatterChanged = function() {
|
73
|
+
var formatId = $(this).attr('data-formatter');
|
74
|
+
editor.unload('#' + formatId);
|
75
|
+
$('#' + formatId).attr('data-format',$(this).val());
|
76
|
+
editor.init({selector: '#' + formatId});
|
77
|
+
};
|
78
|
+
|
79
|
+
editor.initMCEWithOptions = function(element, options){
|
80
|
+
|
50
81
|
var theme = options.theme || 'advanced';
|
51
82
|
var height = options.height || 400;
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
});
|
83
|
+
|
84
|
+
$(element).tinymce({
|
85
|
+
theme: theme,
|
86
|
+
plugins: registeredPlugins.join(','),
|
87
|
+
theme_advanced_toolbar_location: "top",
|
88
|
+
theme_advanced_buttons1: registeredButtons[0].join(','),
|
89
|
+
theme_advanced_buttons2: registeredButtons[1].join(','),
|
90
|
+
theme_advanced_buttons3: registeredButtons[2].join(','),
|
91
|
+
theme_advanced_buttons4: registeredButtons[3].join(','),
|
92
|
+
theme_advanced_toolbar_align: 'left',
|
93
|
+
theme_advanced_blockformats: validFormats,
|
94
|
+
convert_urls: false,
|
95
|
+
valid_elements: validElements,
|
96
|
+
width: $(element).width(),
|
97
|
+
height: height
|
68
98
|
});
|
69
99
|
|
100
|
+
|
101
|
+
};
|
102
|
+
|
103
|
+
var codeMirrors = [];
|
104
|
+
editor.initCodeMirrorWithOptions = function(element, format, options) {
|
105
|
+
var editor = CodeMirror.fromTextArea(element, {
|
106
|
+
mode: 'markdown',
|
107
|
+
lineNumbers: true,
|
108
|
+
theme: "default",
|
109
|
+
extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}
|
110
|
+
});
|
111
|
+
codeMirrors.push(editor);
|
112
|
+
|
113
|
+
$(element).attr('code-mirror-id',codeMirrors.length-1);
|
70
114
|
};
|
71
115
|
|
72
116
|
editor.unload = function(selectorOptional) {
|
73
117
|
var selector = selectorOptional || 'textarea.tinymce';
|
74
|
-
$(selector).each(function() {
|
118
|
+
$(selector).each(function() {
|
119
|
+
var $this = $(this);
|
120
|
+
if($this.attr('code-mirror-id')) {
|
121
|
+
codeMirrors[parseInt($this.attr('code-mirror-id'),10)].toTextArea();
|
122
|
+
codeMirrors[parseInt($this.attr('code-mirror-id'),10)] = null;
|
123
|
+
$this.removeAttr('code-mirror-id');
|
124
|
+
}
|
125
|
+
tinyMCE.execCommand('mceRemoveControl',false,this.id);
|
126
|
+
});
|
75
127
|
|
76
128
|
};
|
77
129
|
|
130
|
+
|
131
|
+
|
78
132
|
editor.registerPlugin = function(pluginName){
|
79
133
|
if($.inArray(registeredPlugins, pluginName) < 0){
|
80
134
|
registeredPlugins.push(pluginName);
|
@@ -2,6 +2,7 @@
|
|
2
2
|
*= require bootstrap/css/bootstrap
|
3
3
|
*= require datepicker/css/datepicker
|
4
4
|
*= require jquery-ui/css/flick/jquery-ui-1.9.1.custom
|
5
|
+
*= require codemirror/themes/night
|
5
6
|
*= require_self
|
6
7
|
*/
|
7
8
|
|
@@ -471,3 +472,9 @@ form input.full-width {
|
|
471
472
|
height:10px;
|
472
473
|
bottom:10px;
|
473
474
|
}
|
475
|
+
|
476
|
+
/* Modal Dialogs
|
477
|
+
---------------*/
|
478
|
+
#modal_window .form-actions-no-modal{
|
479
|
+
display: none;
|
480
|
+
}
|
@@ -5,6 +5,10 @@
|
|
5
5
|
<%=form_for @user,:url => spud_admin_user_path(:id => @user.id),:html=>{:class=>"form-horizontal"} do |f|%>
|
6
6
|
<%=render :partial => "form",:locals => {:f => f}%>
|
7
7
|
|
8
|
+
<div class="form-actions form-actions-no-modal">
|
9
|
+
<%=f.submit "Save User", :class=>"btn btn-primary"%> or <%=link_to "cancel",request.referer,:class => "btn"%>
|
10
|
+
</div>
|
11
|
+
|
8
12
|
<%end%>
|
9
13
|
|
10
14
|
|
@@ -5,6 +5,10 @@
|
|
5
5
|
<%=form_for @user,:url => spud_admin_users_path(),:html=>{:class=>"form-horizontal"} do |f|%>
|
6
6
|
<%=render :partial => "form",:locals => {:f => f}%>
|
7
7
|
|
8
|
+
<div class="form-actions form-actions-no-modal">
|
9
|
+
<%=f.submit "Save User", :class=>"btn btn-primary"%> or <%=link_to "cancel",request.referer,:class => "btn"%>
|
10
|
+
</div>
|
11
|
+
|
8
12
|
<%end%>
|
9
13
|
|
10
14
|
|
data/lib/spud_core/engine.rb
CHANGED
data/lib/spud_core/version.rb
CHANGED
@@ -1,39 +1,17 @@
|
|
1
1
|
Connecting to database specified by database.yml
|
2
|
-
[1m[36m (
|
3
|
-
[1m[35m (
|
4
|
-
[1m[36m (0.3ms)[0m [1mSELECT `schema_migrations`.`version` FROM `schema_migrations` [0m
|
5
|
-
Migrating to CreateSpudAdminPermissions (20111214161011)
|
6
|
-
[1m[35m (103.8ms)[0m CREATE TABLE `spud_admin_permissions` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255), `access` tinyint(1), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
7
|
-
[1m[36m (0.8ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20111214161011')[0m
|
8
|
-
Migrating to CreateSpudUsers (20111214161146)
|
9
|
-
[1m[35m (113.1ms)[0m CREATE TABLE `spud_users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `first_name` varchar(255), `last_name` varchar(255), `super_admin` tinyint(1), `login` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `crypted_password` varchar(255) NOT NULL, `password_salt` varchar(255) NOT NULL, `persistence_token` varchar(255) NOT NULL, `single_access_token` varchar(255) NOT NULL, `perishable_token` varchar(255) NOT NULL, `login_count` int(11) DEFAULT 0 NOT NULL, `failed_login_count` int(11) DEFAULT 0 NOT NULL, `last_request_at` datetime, `current_login_at` datetime, `last_login_at` datetime, `current_login_ip` varchar(255), `last_login_ip` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
10
|
-
[1m[36m (117.7ms)[0m [1mCREATE INDEX `index_spud_users_on_login` ON `spud_users` (`login`)[0m
|
11
|
-
[1m[35m (111.0ms)[0m CREATE INDEX `index_spud_users_on_email` ON `spud_users` (`email`)
|
12
|
-
[1m[36m (0.8ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20111214161146')[0m
|
13
|
-
Migrating to AddTimeZoneToSpudUser (20120327124229)
|
14
|
-
[1m[35m (149.1ms)[0m ALTER TABLE `spud_users` ADD `time_zone` varchar(255)
|
15
|
-
[1m[36m (0.5ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20120327124229')[0m
|
16
|
-
Migrating to AddScopeToSpudAdminPermissions (20120328235431)
|
17
|
-
[1m[35m (130.5ms)[0m ALTER TABLE `spud_admin_permissions` ADD `scope` varchar(255)
|
18
|
-
[1m[36m (0.5ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20120328235431')[0m
|
19
|
-
Migrating to CreateSpudUserSettings (20120329174000)
|
20
|
-
[1m[35m (105.9ms)[0m CREATE TABLE `spud_user_settings` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `spud_user_id` int(11), `key` varchar(255), `value` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
|
21
|
-
[1m[36m (0.8ms)[0m [1mINSERT INTO `schema_migrations` (`version`) VALUES ('20120329174000')[0m
|
22
|
-
[1m[35m (0.3ms)[0m SELECT `schema_migrations`.`version` FROM `schema_migrations`
|
23
|
-
Connecting to database specified by database.yml
|
24
|
-
[1m[36m (0.3ms)[0m [1mSELECT `schema_migrations`.`version` FROM `schema_migrations` [0m
|
25
|
-
[1m[35m (0.5ms)[0m DROP DATABASE IF EXISTS `spud_core_test`
|
2
|
+
[1m[36m (0.2ms)[0m [1mSELECT `schema_migrations`.`version` FROM `schema_migrations` [0m
|
3
|
+
[1m[35m (22.6ms)[0m DROP DATABASE IF EXISTS `spud_core_test`
|
26
4
|
[1m[36m (0.3ms)[0m [1mCREATE DATABASE `spud_core_test` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`[0m
|
27
|
-
[1m[35m (
|
28
|
-
[1m[36m (
|
29
|
-
[1m[35m (
|
30
|
-
[1m[36m (
|
31
|
-
[1m[35m (
|
32
|
-
[1m[36m (
|
33
|
-
[1m[35m (
|
34
|
-
[1m[36m (0.
|
35
|
-
[1m[35m (
|
36
|
-
[1m[36m (0.
|
37
|
-
[1m[35m (0.
|
38
|
-
[1m[36m (0.
|
39
|
-
[1m[35m (0.
|
5
|
+
[1m[35m (23.9ms)[0m CREATE TABLE `spud_admin_permissions` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255), `access` tinyint(1), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `scope` varchar(255)) ENGINE=InnoDB
|
6
|
+
[1m[36m (20.2ms)[0m [1mCREATE TABLE `spud_user_settings` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `spud_user_id` int(11), `key` varchar(255), `value` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB[0m
|
7
|
+
[1m[35m (9.2ms)[0m CREATE TABLE `spud_users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `first_name` varchar(255), `last_name` varchar(255), `super_admin` tinyint(1), `login` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `crypted_password` varchar(255) NOT NULL, `password_salt` varchar(255) NOT NULL, `persistence_token` varchar(255) NOT NULL, `single_access_token` varchar(255) NOT NULL, `perishable_token` varchar(255) NOT NULL, `login_count` int(11) DEFAULT 0 NOT NULL, `failed_login_count` int(11) DEFAULT 0 NOT NULL, `last_request_at` datetime, `current_login_at` datetime, `last_login_at` datetime, `current_login_ip` varchar(255), `last_login_ip` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `time_zone` varchar(255)) ENGINE=InnoDB
|
8
|
+
[1m[36m (13.0ms)[0m [1mCREATE INDEX `index_spud_users_on_email` ON `spud_users` (`email`)[0m
|
9
|
+
[1m[35m (11.9ms)[0m CREATE INDEX `index_spud_users_on_login` ON `spud_users` (`login`)
|
10
|
+
[1m[36m (10.6ms)[0m [1mCREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB[0m
|
11
|
+
[1m[35m (15.6ms)[0m CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
|
12
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM `schema_migrations`[0m
|
13
|
+
[1m[35m (1.3ms)[0m INSERT INTO `schema_migrations` (version) VALUES ('20120329174000')
|
14
|
+
[1m[36m (0.2ms)[0m [1mINSERT INTO `schema_migrations` (version) VALUES ('20111214161011')[0m
|
15
|
+
[1m[35m (0.7ms)[0m INSERT INTO `schema_migrations` (version) VALUES ('20111214161146')
|
16
|
+
[1m[36m (0.6ms)[0m [1mINSERT INTO `schema_migrations` (version) VALUES ('20120327124229')[0m
|
17
|
+
[1m[35m (0.6ms)[0m INSERT INTO `schema_migrations` (version) VALUES ('20120328235431')
|