almost done with the tinyMCE customization

This commit is contained in:
did 2011-11-20 00:54:33 +01:00
parent cd411de4ce
commit a6211d594e
36 changed files with 134 additions and 1130 deletions

View File

@ -10,36 +10,9 @@ window.TinyMceDefaultSettings = {
theme_advanced_toolbar_align : "left",
height: '300',
width: '709',
inlinepopups_skin: 'locomotive',
convert_urls: false,
fullscreen_new_window : false,
fullscreen_settings : {
theme_advanced_path_location : "top"
}
/*
*
* These are call backs aide in the guider creation
*
*/
// onchange_callback: function(){
// if($('#pageeditcontent:visible').length > 0){
// guiders.next();
// }
// }
// ,
// oninit: function(){
// if(typeof window.guiders !== 'undefined' &&
// window.location.pathname.match('admin/pages/.+\/edit') != null){
// guiders.createGuider({
// attachTo: '#page_editable_elements_attributes_1_content_ifr',
// title: "Edit the content of the page",
// description: "You can edit the content of your page in this text box. Go Ahead, add somethign like 'locomotiveCMS rocks!'. We'll wait for you.",
// buttons: [],
// id: "pageeditcontent",
// next: "savepageedit",
// position: 9,
// width: 300
// });
// }
// }
};

View File

@ -35,7 +35,8 @@ class Locomotive.Views.Shared.AssetPickerView extends Backbone.View
create: =>
$('.ui-widget-overlay').bind 'click', => @close()
@$('h2').appendTo($(@el).prev())
$(@el).prev().find('.ui-dialog-title').html(@$('h2').html())
@$('h2').remove()
actions = @$('.dialog-actions').appendTo($(@el).parent()).addClass('ui-dialog-buttonpane ui-widget-content ui-helper-clearfix')
actions.find('#close-link').click (event) => @close(event)

View File

@ -1,132 +0,0 @@
@import "compass/css3";
@import "compass/css3/border-radius";
@import "compass/css3/images";
@import "compass/css3/text-shadow";
// @import "helpers";
/* Locomotive's version of Clearlooks 2 */
/* Reset */
// .locomotive, .locomotive div, .locomotive span, .locomotive a { vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; text-decoration:none; font-weight:normal; width:auto; height:auto; display:block; }
/* General */
.locomotive {
position: absolute;
direction: ltr;
text-align: left;
width: auto !important;
height: auto !important;
font-family: Helvetica, Arial;
background: transparent;
// @include box-shadow(rgba(0, 0, 0, 0.2) 0px 0px 10px 3px);
.mceWrapper {
position: static;
// padding: 30px;
height: 100%;
}
.mceTop {
// position: static;
width: 645px;
height: 47px;
background: red;
@include border-top-radius(6px);
@include box-shadow(rgba(0, 0, 0, 0.2) 0px -3px 10px 3px);
text-align: left;
span {
display: block;
position: relative;
border-bottom: 1px dotted #BBBBBD;
color: #1E1F26;
font-size: 18px;
font-weight: bold;
padding: 0;
margin: 0 10px;
line-height: 45px;
}
} // .mceTop
.mceMiddle {
position: static;
width: 100%;
height: 100%;
& > span {
top: 0px;
position: relative;
background: transparent;
}
iframe {
height: auto !important;
@include box-shadow(rgba(0, 0, 0, 0.2) 0px 3px 10px 3px);
}
} // .mceMiddle
.mceBottom {
display: none;
}
} // .locomotive
.mceEventBlocker {
position:fixed;
left:0;
top:0;
width:100%;
height:100%;
}
.locomotive .mcePlaceHolder { top: 0; left: 0; background: #666; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30); }
.locomotive_modalBlocker { position:fixed; left:0; top:0; width:100%; height:100%; background:#666; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30); display:none; }
/* Middle */
// .locomotive .mceMiddle { top: 0px; width: 100%; height: 100%; }
// .locomotive .mceMiddle span { top: 47px; position: relative; background: transparent; }
/* Bottom */
// .locomotive .mceBottom { bottom: 0px; width: 100%; height: 1px; background: #8b8d9a; }
/* Move & Close */
.locomotive a.mceClose { display: none; }
.locomotive a.mceMove { top: 1px; display: block; width: 100%; height: 35px; cursor: move; }
/* Resize */
.locomotive .mceResize { top:auto; left:auto; display:none; width:5px; height:5px; }
.locomotive .mceResizable .mceResize {display:block}
.locomotive .mceResizable .mceMin, .locomotive .mceMax {display:none}
.locomotive .mceMinimizable .mceMin {display:block}
.locomotive .mceMaximizable .mceMax {display:block}
.locomotive .mceMaximized .mceMed {display:block}
.locomotive .mceMaximized .mceMax {display:none}
.locomotive a.mceResizeN {top:0; left:0; width:100%; cursor:n-resize}
.locomotive a.mceResizeNW {top:0; left:0; cursor:nw-resize}
.locomotive a.mceResizeNE {top:0; right:0; cursor:ne-resize}
.locomotive a.mceResizeW {top:0; left:0; height:100%; cursor:w-resize;}
.locomotive a.mceResizeE {top:0; right:0; height:100%; cursor:e-resize}
.locomotive a.mceResizeS {bottom:0; left:0; width:100%; cursor:s-resize}
.locomotive a.mceResizeSW {bottom:0; left:0; cursor:sw-resize}
.locomotive a.mceResizeSE {bottom:0; right:0; cursor:se-resize}
/* Alert/Confirm */
.locomotive .mceButton {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0}
.locomotive .mceMiddle .mceIcon {left:15px; top:35px; width:32px; height:32px}
.locomotive .mceAlert .mceMiddle span, .locomotive .mceConfirm .mceMiddle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal}
.locomotive a:hover {font-weight:bold;}
.locomotive .mceAlert .mceMiddle, .locomotive .mceConfirm .mceMiddle {background:#D6D7D5}
.locomotive .mceAlert .mceOk {left:50%; top:auto; margin-left: -40px}
.locomotive .mceAlert .mceIcon {background:url(img/alert.gif)}
.locomotive .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px}
.locomotive .mceConfirm .mceCancel {left:50%; top:auto}
.locomotive .mceConfirm .mceIcon {background:url(img/confirm.gif)}

View File

@ -43,6 +43,7 @@
},
open : function(f, p) {
console.log(f);
f = f || {};
p = p || {};
@ -149,6 +150,33 @@
// Load in iframe src
if (!f.content) {
iframe.attr( 'src', f.url || f.file );
iframe.load(function() {
var iframeDom = $(iframe).contents();
// build the buttonpane of the dialog ui, that way we don't have to rewrite tinyMCE base plugins
buttonPane = $('<div></div>').addClass('ui-dialog-buttonpane ui-widget-content ui-helper-clearfix');
dialog.after(buttonPane);
buttons = $('<div></div>').addClass('button-wrapper').appendTo(buttonPane);
iframeDom.find('.mceActionPanel').hide().find('input[type=button], input[type=submit]').each(function() {
var button = $(this);
var link;
if (button.attr('id') == 'cancel') {
link = $('<a></a>').attr('href', '#').attr('id', 'close-link').html(button.val());
buttonPane.append(link);
} else {
link = $('<a></a>').attr('href', '#').addClass('button').html(button.val());
buttons.append(link);
}
link.bind('click', function(e) {
e.stopPropagation();
e.preventDefault();
button.trigger('click');
});
});
});
}
// Add window

View File

@ -1,95 +0,0 @@
body {
font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
font-size: 1em;
overflow: hidden;
}
p.no-items {
padding: 18px 0px;
background: transparent url(/assets/locomotive//list/none-small.png) no-repeat center 0;
text-align: center;
color: #9d8963 !important;
font-size: 1.1em !important;
}
.actions {
position: absolute;
top: 10px;
right: 10px;
}
ul.assets {
overflow: auto;
height: 275px;
}
ul.assets li.asset h4 a {
top: 9px;
font-size: 0.7em;
}
ul.assets li.asset .inside {
cursor: pointer;
}
ul.assets li.asset div.actions {
top: 7px;
}
ul.assets li.new-asset {
display: none;
}
#upload-link {
float: left;
display: block;
background: transparent url(/assets/locomotive//buttons/dark-gray-bg.png) repeat-x 0 0;
outline: none;
-moz-border-radius : 4px;
-webkit-border-radius: 4px;
height: 20px;
font-size: 0.8em;
font-family: 'Lucida Grande';
padding: 5px 12px 5px 12px;
margin: 5px 0 0 14px;
color: #fff !important;
text-decoration: none;
text-shadow: 1px 1px 1px #000;
}
#spinner {
position: fixed;
top: 40%;
left: 30%;
height: 60px;
width: 250px;
background: transparent;
z-index: 999;
}
#spinner .overlay, #spinner .text {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
-moz-border-radius : 10px;
-webkit-border-radius: 10px;
}
#spinner .overlay {
background: #000;
opacity: 0.8;
}
#spinner .text {
padding: 20px 0;
text-align: center;
font-size: 1.1em;
color: #fff;
text-shadow: 1px 1px 1px #000;
}
.mceActionPanel input {
font-size: 0.8em;
}

View File

@ -1,55 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#locomedia_dlg.dialog_title}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="/javascripts/admin/jquery.js"></script>
<script type="text/javascript" src="/javascripts/admin/rails.js"></script>
<script type="text/javascript" src="/javascripts/admin/plugins/plupload/plupload.full.js"></script>
<script type="text/javascript" src="/javascripts/admin/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
<script type="text/javascript" src="js/dialog.js?2"></script>
<link href="/stylesheets/admin/assets.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body id="locomedia" style="display: none">
<div id="spinner">
<div class="overlay"></div>
<div class="text loading">{#locomedia_dlg.loading}</div>
<div class="text uploading" style="display: none">{#locomedia_dlg.uploading}</div>
<div class="text destroying" style="display: none">{#locomedia_dlg.destroying}</div>
</div>
<p class="no-items" style="display: none">{#locomedia_dlg.no_items}</p>
<form onsubmit="insertAction();return false;" action="#">
<div id="images">
<ul class="assets">
<li class="new-asset">
<h4><a href="#">NoName</a></h4>
<div class="icon">
<div class="inside">
</div>
</div>
<div class="actions">
<a href="#" class="remove" data-remote="true" data-confirm="{#locomedia_dlg.confirm}" data-method="delete" rel="nofollow">
<img src="/assets/locomotive//list/icons/cross.png">
</a>
</div>
</li>
<li class="clear"></li>
</ul>
</div>
<div class="mceActionPanel">
<a href="/admin/assets.json" id="upload-link">{#locomedia_dlg.upload}</a>
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
</html>

View File

@ -1 +0,0 @@
(function(){tinymce.create('tinymce.plugins.LocoMediaPlugin',{init:function(ed,url){ed.addCommand('locoMedia',function(){ed.windowManager.open({file:url+'/dialog.htm?8',width:645,height:350,inline:1},{plugin_url:url})});ed.addButton('locomedia',{title:'locomedia.image_desc',cmd:'locoMedia'})},getInfo:function(){return{longname:'Locomotive Media File',author:'Didier Lafforgue',authorurl:'http://www.locomotivecms.com',infourl:'http://www.locomotivecms.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add('locomedia',tinymce.plugins.LocoMediaPlugin)})();

View File

@ -1,46 +0,0 @@
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
tinymce.create('tinymce.plugins.LocoMediaPlugin', {
init : function(ed, url) {
// Register commands
ed.addCommand('locoMedia', function() {
ed.windowManager.open({
file : url + '/dialog.htm',
width : 645,
height : 650,
inline : 1
}, {
plugin_url : url
});
});
// Register buttons
ed.addButton('locomedia', {
title : 'locomedia.image_desc',
cmd : 'locoMedia'
});
},
getInfo : function() {
return {
longname : 'Locomotive Media File',
author : 'Didier Lafforgue',
authorurl : 'http://www.locomotivecms.com',
infourl : 'http://www.locomotivecms.com',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});
// Register plugin
tinymce.PluginManager.add('locomedia', tinymce.plugins.LocoMediaPlugin);
})();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,205 +0,0 @@
var MediafileDialog = {
formElement: null,
listElement: null,
preInit : function() {
var url;
tinyMCEPopup.requireLangPack();
if (url = tinyMCEPopup.getParam("external_image_list_url"))
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
},
init : function(ed) {
var self = this;
with(window.parent) {
var csrf_token = $('meta[name=csrf-token]').attr('content'),
csrf_param = $('meta[name=csrf-param]').attr('content');
}
$.fn.setCsrfSettings(csrf_token, csrf_param);
formElement = $(document.forms[0]);
listElement = formElement.find('ul');
$.getJSON('/admin/assets.json', function(data) {
$(data.assets).each(function() {
self._addAsset(this);
});
self.setupUploader();
self.hideSpinner();
if ($('ul li.asset').length == 0) $('p.no-items').show();
});
},
hideSpinner: function() {
$('#spinner').hide();
},
showSpinner: function(msg) {
$('#spinner .text').hide();
$('#spinner .' + msg).show();
$('#spinner').show();
},
insertFile: function(asset) {
var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el;
tinyMCEPopup.restoreSelection();
// Fixes crash in Safari
if (tinymce.isWebKit) ed.getWin().focus();
if (asset.content_type == 'image')
tinymce.extend(args, { src : asset.url });
else
tinymce.extend(args, { href : asset.url });
el = ed.selection.getNode();
if (el && (el.nodeName == 'IMG' || el.nodeName == 'A')) {
ed.dom.setAttribs(el, args);
} else {
if (asset.content_type == 'image') {
ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', { skip_undo: 1 });
} else {
var html = ed.selection.getContent();
if (html == '') html = asset.filename;
ed.execCommand('mceInsertContent', false, '<a id="__mce_tmp" >' + html + '</a>', { skip_undo: 1 });
}
ed.dom.setAttribs('__mce_tmp', args);
ed.dom.setAttrib('__mce_tmp', 'id', '');
ed.undoManager.add();
}
tinyMCEPopup.close();
},
setupUploader: function() {
var self = this;
var multipartParams = {};
with(window.parent) {
multipartParams[$('meta[name=csrf-param]').attr('content')] = $('meta[name=csrf-token]').attr('content');
}
var uploader = new plupload.Uploader({
// runtimes : (jQuery.browser.webkit == true ? 'flash' : 'html5,flash'),
runtimes: 'gears,html5,flash',
browse_button : 'upload-link',
max_file_size : '10mb',
url : $('a#upload-link').attr('href'),
flash_swf_url : '/javascripts/admin/plugins/plupload/plupload.flash.swf',
multipart: true,
multipart_params: multipartParams,
filters : [
{ title : 'Media files', extensions : 'png,gif,jpg,jpeg,pdf,doc,docx,xls,xlsx,txt' },
]
});
uploader.bind('BeforeUpload', function(up, file) {
file.name = unescape(encodeURIComponent(file.name));
console.log(file.name);
});
uploader.bind('QueueChanged', function() {
self.showSpinner('uploading');
uploader.start();
});
uploader.bind('FileUploaded', function(up, file, response) {
console.log(up);
console.log(file);
console.log(response);
var json = JSON.parse(response.response);
if (json.status == 'success')
self._addAsset(json);
self.hideSpinner();
});
uploader.init();
},
_addAsset: function(data) {
var self = this;
var asset = $('ul li.new-asset')
.clone()
.insertBefore($('ul li.clear'))
.addClass('asset');
asset.find('h4 a').attr('href', data.url)
.html(data.short_name)
.bind('click', function(e) {
self.insertFile(data);
e.stopPropagation(); e.preventDefault();
});
html = '';
if (data.content_type == 'image') {
asset.find('.icon').removeClass('icon').addClass('image');
html = $('<img />')
.attr('src', data.vignette_url)
.bind('click', function(e) {
self.insertFile(data);
});
} else {
asset.find('.icon').addClass(data.content_type);
html = data.content_type == 'other' ? data.extname : data.content_type;
if (html == '') html = '?'
html = $('<span />').html(html)
.bind('click', function(e) {
self.insertFile(data);
});
}
asset.find('.inside').append(html);
asset.find('.actions a')
.attr('href', data.destroy_url)
.bind('ajax:success', function(event, data) {
self._destroyAsset(asset);
});
if ($('ul li.asset').length % 4 == 0)
asset.addClass('last');
asset.removeClass('new-asset');
$('p.no-items').hide();
},
_destroyAsset: function(asset) {
asset.remove();
if ($('ul li.asset').length == 0) {
$('p.no-items').show();
} else {
$('ul li.asset').each(function(index) {
if ((index + 1) % 4 == 0)
$(this).addClass('last');
else
$(this).removeClass('last');
});
}
this.hideSpinner();
}
};
MediafileDialog.preInit();
tinyMCEPopup.onInit.add(MediafileDialog.init, MediafileDialog);

View File

@ -1,9 +0,0 @@
tinyMCE.addI18n('de.locomedia_dlg',{
dialog_title: 'Mediendatei einfügen',
upload: 'Mediendatei hochladen',
loading: 'Laden...',
uploading: 'Hochladen...',
destroying: 'Löschen...',
confirm: 'Bist du sicher ?',
no_items: 'Momentan gibt es hier keine Mediendateien.'
});

View File

@ -1,9 +0,0 @@
tinyMCE.addI18n('en.locomedia_dlg',{
dialog_title: 'Insert media',
upload: 'Upload media',
loading: 'Loading...',
uploading: 'Uploading...',
destroying: 'Destroying...',
confirm: 'Are you sure ?',
no_items: 'There are no media for now.'
});

View File

@ -1,9 +0,0 @@
tinyMCE.addI18n('fr.locomedia_dlg',{
dialog_title: 'Insérer un média',
upload: 'Uploader média',
loading: 'Chargement...',
uploading: 'Uploading...',
destroying: 'Suppression...',
confirm: 'Êtes-vous sûr(e) ?',
no_items: 'Il n\'y a aucun média pour l\'instant'
});

View File

@ -1,9 +0,0 @@
tinyMCE.addI18n('it.locomedia_dlg',{
dialog_title: 'Inserisci immagine',
upload: 'Carica immagine',
loading: 'Caricamento...',
uploading: 'Caricamento file...',
destroying: 'Eliminazione...',
confirm: 'Sicuro?',
no_items: 'Per ora non ci sono immagini.'
});

View File

@ -1,9 +0,0 @@
tinyMCE.addI18n('no.locomedia_dlg',{
dialog_title: 'Sett inn media',
upload: 'Last opp media',
loading: 'Laster inn...',
uploading: 'Laster opp...',
destroying: 'Sletter...',
confirm: 'Er du sikker?',
no_items: 'Ingen media foreløpig.'
});

View File

@ -1,95 +0,0 @@
body {
font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
font-size: 1em;
overflow: hidden;
}
p.no-items {
padding: 18px 0px;
background: transparent url(/assets/locomotive//list/none-small.png) no-repeat center 0;
text-align: center;
color: #9d8963 !important;
font-size: 1.1em !important;
}
.actions {
position: absolute;
top: 10px;
right: 10px;
}
ul.assets {
overflow: auto;
height: 275px;
}
ul.assets li.asset h4 a {
top: 9px;
font-size: 0.7em;
}
ul.assets li.asset .inside {
cursor: pointer;
}
ul.assets li.asset div.actions {
top: 7px;
}
ul.assets li.new-asset {
display: none;
}
#upload-link {
float: left;
display: block;
background: transparent url(/assets/locomotive//buttons/dark-gray-bg.png) repeat-x 0 0;
outline: none;
-moz-border-radius : 4px;
-webkit-border-radius: 4px;
height: 20px;
font-size: 0.8em;
font-family: 'Lucida Grande';
padding: 5px 12px 5px 12px;
margin: 5px 0 0 14px;
color: #fff !important;
text-decoration: none;
text-shadow: 1px 1px 1px #000;
}
#spinner {
position: fixed;
top: 40%;
left: 30%;
height: 60px;
width: 250px;
background: transparent;
z-index: 999;
}
#spinner .overlay, #spinner .text {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
-moz-border-radius : 10px;
-webkit-border-radius: 10px;
}
#spinner .overlay {
background: #000;
opacity: 0.8;
}
#spinner .text {
padding: 20px 0;
text-align: center;
font-size: 1.1em;
color: #fff;
text-shadow: 1px 1px 1px #000;
}
.mceActionPanel input {
font-size: 0.8em;
}

View File

@ -1,55 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#locomedia_dlg.dialog_title}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="/javascripts/admin/jquery.js"></script>
<script type="text/javascript" src="/javascripts/admin/rails.js"></script>
<script type="text/javascript" src="/javascripts/admin/plugins/plupload/plupload.full.js"></script>
<script type="text/javascript" src="/javascripts/admin/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
<script type="text/javascript" src="js/dialog.js?2"></script>
<link href="/stylesheets/admin/assets.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body id="locomedia" style="display: none">
<div id="spinner">
<div class="overlay"></div>
<div class="text loading">{#locomedia_dlg.loading}</div>
<div class="text uploading" style="display: none">{#locomedia_dlg.uploading}</div>
<div class="text destroying" style="display: none">{#locomedia_dlg.destroying}</div>
</div>
<p class="no-items" style="display: none">{#locomedia_dlg.no_items}</p>
<form onsubmit="insertAction();return false;" action="#">
<div id="images">
<ul class="assets">
<li class="new-asset">
<h4><a href="#">NoName</a></h4>
<div class="icon">
<div class="inside">
</div>
</div>
<div class="actions">
<a href="#" class="remove" data-remote="true" data-confirm="{#locomedia_dlg.confirm}" data-method="delete" rel="nofollow">
<img src="/assets/locomotive//list/icons/cross.png">
</a>
</div>
</li>
<li class="clear"></li>
</ul>
</div>
<div class="mceActionPanel">
<a href="/admin/assets.json" id="upload-link">{#locomedia_dlg.upload}</a>
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>
</html>

View File

@ -1,11 +1,9 @@
/**
* editor_plugin_src.js
* LocomotiveMedia plugin
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
* Copyright 2011, Didier Lafforgue
* Released under MIT License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {

View File

@ -1,46 +0,0 @@
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
tinymce.create('tinymce.plugins.LocoMediaPlugin', {
init : function(ed, url) {
// Register commands
ed.addCommand('locoMedia', function() {
ed.windowManager.open({
file : url + '/dialog.htm',
width : 645,
height : 650,
inline : 1
}, {
plugin_url : url
});
});
// Register buttons
ed.addButton('locomedia', {
title : 'locomedia.image_desc',
cmd : 'locoMedia'
});
},
getInfo : function() {
return {
longname : 'Locomotive Media File',
author : 'Didier Lafforgue',
authorurl : 'http://www.locomotivecms.com',
infourl : 'http://www.locomotivecms.com',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});
// Register plugin
tinymce.PluginManager.add('locomedia', tinymce.plugins.LocoMediaPlugin);
})();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,205 +0,0 @@
var MediafileDialog = {
formElement: null,
listElement: null,
preInit : function() {
var url;
tinyMCEPopup.requireLangPack();
if (url = tinyMCEPopup.getParam("external_image_list_url"))
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
},
init : function(ed) {
var self = this;
with(window.parent) {
var csrf_token = $('meta[name=csrf-token]').attr('content'),
csrf_param = $('meta[name=csrf-param]').attr('content');
}
$.fn.setCsrfSettings(csrf_token, csrf_param);
formElement = $(document.forms[0]);
listElement = formElement.find('ul');
$.getJSON('/admin/assets.json', function(data) {
$(data.assets).each(function() {
self._addAsset(this);
});
self.setupUploader();
self.hideSpinner();
if ($('ul li.asset').length == 0) $('p.no-items').show();
});
},
hideSpinner: function() {
$('#spinner').hide();
},
showSpinner: function(msg) {
$('#spinner .text').hide();
$('#spinner .' + msg).show();
$('#spinner').show();
},
insertFile: function(asset) {
var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el;
tinyMCEPopup.restoreSelection();
// Fixes crash in Safari
if (tinymce.isWebKit) ed.getWin().focus();
if (asset.content_type == 'image')
tinymce.extend(args, { src : asset.url });
else
tinymce.extend(args, { href : asset.url });
el = ed.selection.getNode();
if (el && (el.nodeName == 'IMG' || el.nodeName == 'A')) {
ed.dom.setAttribs(el, args);
} else {
if (asset.content_type == 'image') {
ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', { skip_undo: 1 });
} else {
var html = ed.selection.getContent();
if (html == '') html = asset.filename;
ed.execCommand('mceInsertContent', false, '<a id="__mce_tmp" >' + html + '</a>', { skip_undo: 1 });
}
ed.dom.setAttribs('__mce_tmp', args);
ed.dom.setAttrib('__mce_tmp', 'id', '');
ed.undoManager.add();
}
tinyMCEPopup.close();
},
setupUploader: function() {
var self = this;
var multipartParams = {};
with(window.parent) {
multipartParams[$('meta[name=csrf-param]').attr('content')] = $('meta[name=csrf-token]').attr('content');
}
var uploader = new plupload.Uploader({
// runtimes : (jQuery.browser.webkit == true ? 'flash' : 'html5,flash'),
runtimes: 'gears,html5,flash',
browse_button : 'upload-link',
max_file_size : '10mb',
url : $('a#upload-link').attr('href'),
flash_swf_url : '/javascripts/admin/plugins/plupload/plupload.flash.swf',
multipart: true,
multipart_params: multipartParams,
filters : [
{ title : 'Media files', extensions : 'png,gif,jpg,jpeg,pdf,doc,docx,xls,xlsx,txt' },
]
});
uploader.bind('BeforeUpload', function(up, file) {
file.name = unescape(encodeURIComponent(file.name));
console.log(file.name);
});
uploader.bind('QueueChanged', function() {
self.showSpinner('uploading');
uploader.start();
});
uploader.bind('FileUploaded', function(up, file, response) {
console.log(up);
console.log(file);
console.log(response);
var json = JSON.parse(response.response);
if (json.status == 'success')
self._addAsset(json);
self.hideSpinner();
});
uploader.init();
},
_addAsset: function(data) {
var self = this;
var asset = $('ul li.new-asset')
.clone()
.insertBefore($('ul li.clear'))
.addClass('asset');
asset.find('h4 a').attr('href', data.url)
.html(data.short_name)
.bind('click', function(e) {
self.insertFile(data);
e.stopPropagation(); e.preventDefault();
});
html = '';
if (data.content_type == 'image') {
asset.find('.icon').removeClass('icon').addClass('image');
html = $('<img />')
.attr('src', data.vignette_url)
.bind('click', function(e) {
self.insertFile(data);
});
} else {
asset.find('.icon').addClass(data.content_type);
html = data.content_type == 'other' ? data.extname : data.content_type;
if (html == '') html = '?'
html = $('<span />').html(html)
.bind('click', function(e) {
self.insertFile(data);
});
}
asset.find('.inside').append(html);
asset.find('.actions a')
.attr('href', data.destroy_url)
.bind('ajax:success', function(event, data) {
self._destroyAsset(asset);
});
if ($('ul li.asset').length % 4 == 0)
asset.addClass('last');
asset.removeClass('new-asset');
$('p.no-items').hide();
},
_destroyAsset: function(asset) {
asset.remove();
if ($('ul li.asset').length == 0) {
$('p.no-items').show();
} else {
$('ul li.asset').each(function(index) {
if ((index + 1) % 4 == 0)
$(this).addClass('last');
else
$(this).removeClass('last');
});
}
this.hideSpinner();
}
};
MediafileDialog.preInit();
tinyMCEPopup.onInit.add(MediafileDialog.init, MediafileDialog);

View File

@ -1,9 +0,0 @@
tinyMCE.addI18n('de.locomedia_dlg',{
dialog_title: 'Mediendatei einfügen',
upload: 'Mediendatei hochladen',
loading: 'Laden...',
uploading: 'Hochladen...',
destroying: 'Löschen...',
confirm: 'Bist du sicher ?',
no_items: 'Momentan gibt es hier keine Mediendateien.'
});

View File

@ -1,9 +0,0 @@
tinyMCE.addI18n('en.locomedia_dlg',{
dialog_title: 'Insert media',
upload: 'Upload media',
loading: 'Loading...',
uploading: 'Uploading...',
destroying: 'Destroying...',
confirm: 'Are you sure ?',
no_items: 'There are no media for now.'
});

View File

@ -1,9 +0,0 @@
tinyMCE.addI18n('fr.locomedia_dlg',{
dialog_title: 'Insérer un média',
upload: 'Uploader média',
loading: 'Chargement...',
uploading: 'Uploading...',
destroying: 'Suppression...',
confirm: 'Êtes-vous sûr(e) ?',
no_items: 'Il n\'y a aucun média pour l\'instant'
});

View File

@ -1,9 +0,0 @@
tinyMCE.addI18n('it.locomedia_dlg',{
dialog_title: 'Inserisci immagine',
upload: 'Carica immagine',
loading: 'Caricamento...',
uploading: 'Caricamento file...',
destroying: 'Eliminazione...',
confirm: 'Sicuro?',
no_items: 'Per ora non ci sono immagini.'
});

View File

@ -1,9 +0,0 @@
tinyMCE.addI18n('no.locomedia_dlg',{
dialog_title: 'Sett inn media',
upload: 'Last opp media',
loading: 'Laster inn...',
uploading: 'Laster opp...',
destroying: 'Sletter...',
confirm: 'Er du sikker?',
no_items: 'Ingen media foreløpig.'
});

View File

@ -10,64 +10,69 @@ html {
body {
font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
font-size: 13px;
/* font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;*/
// background: #fff;
padding: 0px;
margin: 0px;
// margin: 8px 10px 0 10px;
// padding-bottom: 120px;
background: #8b8d9a;
@include border-bottom-radius(6px);
padding: 0px;
}
.title {
color: #8B8D9A;
padding: 5px 0px 10px 0px;
.tabs, .title {
display: none;
}
.tabs { display: none; }
form {
input[type=text], textarea {
// from _helpers.scss
padding: 4px 3px;
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif !important;
color: #17171B;
font-size: 12px !important;
font-weight: normal;
border: 1px solid #b5b7c4;
}
.panel > table {
width: 100%;
border-collapse: collapse;
& > tbody > tr {
& > td:first-child {
text-align: left;
padding-right: 15px;
label {
font-weight: bold;
color: #222;
}
}
& > td:last-child {
input[type=text] {
@include background-image(linear-gradient(top, #f0f0f0, #f9f9f9 25%, #f9f9f9 25%, #ffffff 50%, #ffffff));
}
}
}
}
&[name=source] {
#wrapline label {
font-weight: bold;
font-size: 12px;
}
textarea#htmlSource {
width: 718px !important;
margin-top: 10px;
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif !important;
font-size: 12px !important;
@include background-image(linear-gradient(top, #f0f0f0, #f9f9f9 4px, #f9f9f9 4px, #ffffff 12px, #ffffff));
}
}
}
.mceActionPanel {
// position: absolute;
// left: 0px;
// bottom: 0px;
height: 49px;
width: 100%;
background: #8b8d9a;
padding: 12px 0 0 0px;
text-align: right;
}
.mceMiddle span {
background: red !important;
}
.mceActionPanel input {
color: #787A89;
text-shadow: 1px 1px 1px #fff;
background: #d9dce8;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
box-shadow: 1px 1px 1px #333;
padding: 6px 9px 8px;
margin: 5px 20px 0 0;
font-size: 1em;
border: 0px;
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.01, rgb(215,219,231)),
color-stop(0.47, rgb(235,237,244)),
color-stop(0.7, rgb(235,237,244))
);
background-image: -moz-linear-gradient(
center bottom,
rgb(215,219,231) 1%,
rgb(235,237,244) 47%,
rgb(235,237,244) 70%
);
cursor: pointer;
}

View File

@ -349,6 +349,7 @@
width: 20px;
padding: 1px 2px;
display: block;
outline: none;
}
.locomotiveSkin .mceSplitButton span.mceAction {

View File

@ -219,9 +219,21 @@ ul.theme-assets {
font-size: 11px;
color: #8b8d9a;
a {
a.remove {
display: inline-block;
width: 16px;
height: 16px;
margin-left: 7px;
outline: none;
background: transparent image-url("locomotive/list/icons/trash_off.png") repeat 0 0;
text-indent: -9999px;
&:hover {
background-image: image-url("locomotive/list/icons/trash.png");
}
}
}
} // li .inner

View File

@ -39,11 +39,14 @@
@include border-radius(0px);
@include border-top-radius(6px);
.ui-dialog-title, .ui-dialog-titlebar-close {
text-align: left;
.ui-dialog-titlebar-close {
display: none;
}
h2 {
.ui-dialog-title {
float: none;
margin: 0px;
line-height: 18px;
@ -94,7 +97,7 @@
font-size: 12px;
}
.upload-button-wrapper {
.button-wrapper {
position: absolute;
top: 8px;
right: 10px;
@ -103,16 +106,18 @@
@include light-button;
}
#theme_asset_sourceUploader, #content_asset_sourceUploader {
position: absolute;
top: 0px;
right: 0px;
z-index: 1001;
}
&.upload {
#theme_asset_sourceUploader, #content_asset_sourceUploader {
position: absolute;
top: 0px;
right: 0px;
z-index: 1001;
}
a {
z-index: 1000;
}
a {
z-index: 1000;
}
} // .button-wrapper.upload
} // .button-wrapper
} // .ui-dialog-buttonpane

View File

@ -135,6 +135,12 @@ form.formtastic {
font-size: 20px;
}
}
&.em-inline-hints {
p.inline-hints {
color: #1F82BC !important;
}
}
} // li.string
&.code {

View File

@ -9,7 +9,7 @@
.dialog-actions
= link_to t('locomotive.buttons.close'), '#', :id => 'close-link'
.upload-button-wrapper
.button-wrapper.upload
= file_field_tag 'content_asset[source]'
= link_to t('.upload'), content_assets_url(:json), :class => 'new', :id => 'upload-link'

View File

@ -5,7 +5,7 @@
#editable-elements
.nav
- grouped_editable_elements.keys.each_with_index do |name, index|
= link_to name.try(:humanize).gsub('\'', '') || t('locomotive.pages.form.default_block'), "#block-#{index}", :id => "block-nav-#{index}", :class => "#{'on' if index == 0}"
= link_to (name.try(:humanize) || t('locomotive.pages.form.default_block')).gsub('\'', ''), "#block-#{index}", :id => "block-nav-#{index}", :class => "#{'on' if index == 0}"
.clear
.wrapper

View File

@ -11,7 +11,7 @@
- if not @page.index? and not @page.not_found?
= f.input :parent_id, :as => :select, :collection => parent_pages_options, :include_blank => false
= f.input :slug, :required => false, :hint => @page.slug.blank? ? t('.empty_slug') : public_page_url(@page), :input_html => { :'data-url' => get_path_pages_url, :disabled => @page.index? || @page.not_found? }, :wrapper_html => { :style => "#{'display: none' if @page.templatized?};" }
= f.input :slug, :required => false, :hint => @page.slug.blank? ? t('.empty_slug') : public_page_url(@page), :input_html => { :'data-url' => get_path_pages_url, :disabled => @page.index? || @page.not_found? }, :wrapper_html => { :style => "#{'display: none' if @page.templatized?};", :class => 'em-inline-hints' }
= render 'editable_elements', :page => @page
@ -41,6 +41,6 @@
= f.input :redirect_url, :required => true, :wrapper_html => { :style => "#{'display: none' unless @page.redirect?}" }
= f.inputs :name => :raw_template, :class => "inputs foldable" do
= f.inputs :name => :raw_template, :class => "inputs foldable #{'folded' if inputs_folded?(@page)}" do
= f.input :raw_template, :as => :'Locomotive::Code'

View File

@ -22,7 +22,7 @@
= l page.updated_at, :format => :short
- if !page.index_or_not_found? && can?(:manage, page)
= link_to image_tag('locomotive/list/icons/trash.png'), page_url(page), :class => 'remove', :confirm => t('locomotive.messages.confirm'), :method => :delete
= link_to 'x', page_url(page), :class => 'remove', :confirm => t('locomotive.messages.confirm'), :method => :delete
- if with_children
%ul{ :id => "folder-#{page._id}", :class => "page folder depth-#{(page.depth || 0) + 1}", :'data-url' => sort_page_url(page), :style => "display: #{cookies["folder-#{page._id}"] || 'block'}" }

View File

@ -8,7 +8,7 @@
.dialog-actions
= link_to t('locomotive.buttons.close'), '#', :id => 'close-link'
.upload-button-wrapper
.button-wrapper.upload
= file_field_tag 'theme_asset[source]'
= link_to t('locomotive.theme_assets.image_picker.upload'), theme_assets_url(:json), :class => 'new', :id => 'upload-link'