fix ad_banner. new ad_image with best size from ad_banner. content editable at tab
This commit is contained in:
1 parent
0647698012
commit
4981898266
9 files changed
+159
-13
No files matched your search
@@ -1,25 +1,37 @@
|
||||
<%#= encoding: utf-8 %>
|
||||
$(function() {
|
||||
var content_holder, content;
|
||||
var selector = 'li[contenteditable="true"]';
|
||||
var selector = 'a[contenteditable="true"]';
|
||||
// prevent clicks inside editable area to fire
|
||||
// a click event on the body
|
||||
// and therefor saving our content before we even edit it
|
||||
$(selector).click(function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
$(".nav-tabs").find(".icons-pencil").click(function(){
|
||||
$(this).css({
|
||||
"display" : "none"
|
||||
})
|
||||
$(this).next().attr("contenteditable",true).addClass("edit");
|
||||
// $(selector).click(function(e) {
|
||||
// e.stopPropagation();
|
||||
// });
|
||||
|
||||
// initialize the "save" function
|
||||
$(selector).focus(function(e) {
|
||||
content_holder = $(this);
|
||||
content = content_holder.html();
|
||||
|
||||
content = content_holder.html();
|
||||
// one click outside the editable area saves the content
|
||||
$('body').one('click', function(e) {
|
||||
$(selector).keypress( function(e) {
|
||||
// but not if the content didn't change
|
||||
if ($(e.target).is(selector) || content == content_holder.html()) {
|
||||
return;
|
||||
}
|
||||
//alert('out!!');
|
||||
if(e.keyCode == 13){
|
||||
$(".nav-tabs>li>a").removeClass("edit");
|
||||
$(this).prev(".icons-pencil").css({
|
||||
"display" : "block"
|
||||
})
|
||||
e.preventDefault();
|
||||
// if ($(e.target).is(selector) || content == content_holder.html()) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
$.ajax({
|
||||
url: content_holder.data('edit-url'),
|
||||
@@ -27,6 +39,7 @@ $(function() {
|
||||
dataType: 'json',
|
||||
data: { body: content_holder.html() },
|
||||
success: function(json) {
|
||||
$(selector).attr("contenteditable",false)
|
||||
alert("<%= I18n.t("admin.contenteditable.update_done") %>");
|
||||
//content_holder.effect('highlight', {'color': '#0f0'}, 3000);
|
||||
},
|
||||
@@ -36,6 +49,8 @@ $(function() {
|
||||
content_holder.html(content);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -606,6 +606,19 @@
|
||||
.news_paragraph p {
|
||||
line-height: 20px;
|
||||
}
|
||||
.nav-tabs>li>.edit, .nav-tabs>li>.edit:hover {
|
||||
background-color: #333;
|
||||
color: #FFF;
|
||||
padding-right: 12px;
|
||||
}
|
||||
.nav-tabs li .icons-pencil {
|
||||
float: right;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.nav-tabs li a {
|
||||
padding-right: 32px;
|
||||
}
|
||||
|
||||
|
||||
/*icons*/
|
||||
.the-icons i:after {
|
||||
|
||||
Reference in new issue
Block a user