New UI changes(tags, categories, authorisations, module index…)
To run: - ruby lib/remove_old_tags.rb DB_NAME - rake new_ui:migrate_tags - rake new_ui:migrate_categories['APP_KEY,''MODEL_NAME'] (check new_ui.rake for more details)
This commit is contained in:
1 parent
07b3857465
commit
856898016b
1495 files changed
+52132
-9876
No files matched your search
@@ -0,0 +1,3 @@
|
||||
.cke_wordcount {display:block;float:right;margin-top:-2px;margin-right:3px;color:black;}
|
||||
|
||||
.cke_wordcountLimitReached span {color:red! important}
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.plugins.setLang('wordcount', 'de', {
|
||||
WordCount: 'Wörter:',
|
||||
CharCount: 'Zeichen:',
|
||||
limit: 'Limit:',
|
||||
title: 'Statistik'
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.plugins.setLang('wordcount', 'en', {
|
||||
WordCount: 'Words:',
|
||||
CharCount: 'Characters:',
|
||||
limit: 'Limit:',
|
||||
title: 'Statistics'
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
// French Translation by Nicolas M.
|
||||
|
||||
CKEDITOR.plugins.setLang('wordcount', 'fr', {
|
||||
WordCount: 'Mots:',
|
||||
CharCount: 'Caractères:',
|
||||
limit: 'Limite:',
|
||||
title: 'Statistiques'
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.plugins.setLang('wordcount', 'pl', {
|
||||
WordCount: 'Słów:',
|
||||
CharCount: 'Znaków:',
|
||||
limit: 'Limit:',
|
||||
title: 'Statystyka'
|
||||
});
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.add('wordcount', {
|
||||
lang: ['de', 'en', 'fr', 'pl'],
|
||||
init: function (editor) {
|
||||
|
||||
var defaultFormat = '<span class="cke_path_item">';
|
||||
|
||||
var intervalId;
|
||||
var lastWordCount = 0;
|
||||
var lastCharCount = 0;
|
||||
var limitReachedNotified = false;
|
||||
var limitRestoredNotified = false;
|
||||
|
||||
// Default Config
|
||||
var defaultConfig = {
|
||||
showWordCount: true,
|
||||
showCharCount: false,
|
||||
charLimit: 'unlimited',
|
||||
wordLimit: 'unlimited'
|
||||
};
|
||||
|
||||
// Get Config & Lang
|
||||
var config = CKEDITOR.tools.extend(defaultConfig, editor.config.wordcount || {}, true);
|
||||
|
||||
if (config.showCharCount) {
|
||||
defaultFormat += editor.lang.wordcount.CharCount + ' %charCount%';
|
||||
|
||||
|
||||
if (config.charLimit != 'unlimited') {
|
||||
defaultFormat += ' (' + editor.lang.wordcount.limit + ' ' + config.charLimit + ')';
|
||||
}
|
||||
}
|
||||
|
||||
if (config.showCharCount && config.showWordCount) {
|
||||
defaultFormat += ', ';
|
||||
}
|
||||
|
||||
if (config.showWordCount) {
|
||||
defaultFormat += editor.lang.wordcount.WordCount + ' %wordCount%';
|
||||
|
||||
if (config.wordLimit != 'unlimited') {
|
||||
defaultFormat += ' (' + editor.lang.wordcount.limit + ' ' + config.wordLimit + ')';
|
||||
}
|
||||
}
|
||||
|
||||
defaultFormat += '</span>';
|
||||
|
||||
var format = defaultFormat;
|
||||
|
||||
CKEDITOR.document.appendStyleSheet(this.path + 'css/wordcount.css');
|
||||
|
||||
function counterId(editor) {
|
||||
return 'cke_wordcount_' + editor.name;
|
||||
}
|
||||
|
||||
function counterElement(editor) {
|
||||
return document.getElementById(counterId(editor));
|
||||
}
|
||||
|
||||
function strip(html) {
|
||||
var tmp = document.createElement("div");
|
||||
tmp.innerHTML = html;
|
||||
|
||||
if (tmp.textContent == '' && typeof tmp.innerText == 'undefined') {
|
||||
return '0';
|
||||
}
|
||||
return tmp.textContent || tmp.innerText;
|
||||
}
|
||||
|
||||
function updateCounter(editor) {
|
||||
|
||||
var wordCount = 0;
|
||||
var charCount = 0;
|
||||
|
||||
if (editor.getData()) {
|
||||
var text = editor.getData().replace(/(\r\n|\n|\r)/gm, " ").replace(/( )/g, " ");
|
||||
|
||||
if (config.showWordCount) {
|
||||
wordCount = strip(text).trim().split(/\s+/).length;
|
||||
}
|
||||
|
||||
charCount = strip(text).trim().length;
|
||||
}
|
||||
var html = format.replace('%wordCount%', wordCount).replace('%charCount%', charCount);
|
||||
|
||||
counterElement(editor).innerHTML = html;
|
||||
|
||||
if (charCount == lastCharCount) {
|
||||
return true;
|
||||
} else {
|
||||
lastWordCount = wordCount;
|
||||
lastCharCount = charCount;
|
||||
}
|
||||
|
||||
// Check for word limit
|
||||
if (config.showWordCount && wordCount > config.wordLimit) {
|
||||
limitReached(editor, limitReachedNotified);
|
||||
} else if (!limitRestoredNotified && wordCount < config.wordLimit) {
|
||||
limitRestored(editor);
|
||||
}
|
||||
|
||||
// Check for char limit
|
||||
if (config.showCharCount && charCount > config.charLimit) {
|
||||
limitReached(editor, limitReachedNotified);
|
||||
} else if (!limitRestoredNotified && charCount < config.charLimit) {
|
||||
limitRestored(editor);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function limitReached(editor, notify) {
|
||||
limitReachedNotified = true;
|
||||
limitRestoredNotified = false;
|
||||
|
||||
editor.execCommand('undo');
|
||||
if (!notify) {
|
||||
counterElement(editor).className += " cke_wordcountLimitReached";
|
||||
|
||||
editor.fire('limitReached', {}, editor);
|
||||
}
|
||||
// lock editor
|
||||
editor.config.Locked = 1;
|
||||
editor.fire("change");
|
||||
}
|
||||
|
||||
function limitRestored(editor) {
|
||||
limitRestoredNotified = true;
|
||||
limitReachedNotified = false;
|
||||
editor.config.Locked = 0;
|
||||
|
||||
counterElement(editor).className = "cke_wordcount";
|
||||
}
|
||||
|
||||
editor.on('uiSpace', function(event) {
|
||||
if (event.data.space == 'bottom') {
|
||||
event.data.html += '<div id="' + counterId(event.editor) + '" class="cke_wordcount" style=""' + ' title="' + editor.lang.wordcount.title + '"' + '> </div>';
|
||||
}
|
||||
}, editor, null, 100);
|
||||
editor.on('dataReady', function(event) {
|
||||
var count = event.editor.getData().length;
|
||||
if (count > config.wordLimit) {
|
||||
limitReached(editor);
|
||||
}
|
||||
updateCounter(event.editor);
|
||||
}, editor, null, 100);
|
||||
editor.on('key', function (event) {
|
||||
updateCounter(event.editor);
|
||||
}, editor, null, 100);
|
||||
editor.on('afterPaste', function (event) {
|
||||
updateCounter(event.editor);
|
||||
}, editor, null, 100);
|
||||
/* editor.on('change', function (event) {
|
||||
updateCounter(event.editor);
|
||||
}, editor, null, 100);*/
|
||||
editor.on('focus', function(event) {
|
||||
editorHasFocus = true;
|
||||
intervalId = window.setInterval(function(editor) {
|
||||
updateCounter(editor);
|
||||
}, 100, event.editor);
|
||||
}, editor, null, 100);
|
||||
editor.on('blur', function() {
|
||||
editorHasFocus = false;
|
||||
if (intervalId) clearInterval(intervalId);
|
||||
}, editor, null, 100);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user