Item control iframe dom

Css for preview
This commit is contained in:
chris 2013-10-24 21:29:02 +08:00
parent 13da6fc6a1
commit f3b3c94b42
13 changed files with 105 additions and 124 deletions

View File

@ -111,10 +111,27 @@ function customOpenSlide() {
.closest('.navbar-inner')
.addClass('active');
pageslide.find('.content').css('padding', 0);
iFrameContent()
}
});
}
function iFrameContent() {
$('#pageslide_iframe').load(function() {
var $iContents = $(this).contents(),
$pc = $iContents.find('.page_content');
$pc.each(function(index, el) {
if($(this).siblings('*').length == 0) {
var _parentH = $(this).parent('*').outerHeight();
$(this).css('height', _parentH);
}
});
$iContents.find('#orbit-bar').hide();
$iContents.find('.main_wrap').css('margin-top', 0);
$iContents.find('a').not('.edit_link a').on('click', function(event) {
event.preventDefault();
});
});
}
function pageSetting(id, edit) {
$pageModule = $('#pageslide #page_module_app_id');
$pageF2E = $('#pageslide #page_app_frontend_url');
@ -149,7 +166,6 @@ function pageSetting(id, edit) {
});
};
});
$pageModule.append('<option/>');
$.each(_pageData.module, function(index, val) {
$pageModule.append('<option value="' + val.main[1] + '" ' + (val.main[1] == _selectData.module.main ? 'selected="selected"' : '') + '>' + val.main[0] + '</option>');
if(_selectData.module.main && val.main[1] == _selectData.module.main) {
@ -193,7 +209,7 @@ function pageSetting(id, edit) {
$('#pageslide .active-link.' + val[0]).find('input[type="radio"]').eq(val[2]).prop('checked', true);
}
});
changeSetting(id);
changeSetting(id, _status);
$('#pageslide').find('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
})
.fail(function(jqXHR, textStatus) {
@ -211,11 +227,10 @@ function pageSetting(id, edit) {
});
};
});
$pageModule.append('<option/>');
$.each(_pageData.module, function(index, val) {
$pageModule.append('<option value="' + val.main[1] + '">' + val.main[0] + '</option>');
});
changeSetting(id);
changeSetting(id, _status);
};
};
@ -250,8 +265,8 @@ function linkSetting(id, edit) {
}
}
function changeSetting(id) {
getView(id);
function changeSetting(id, edit) {
edit ? getView(id) : '';
$pagePublishedTrue.prop('checked') ? $('.link-options').slideDown(300) : $('.link-options').slideUp(300);
}
@ -368,7 +383,7 @@ $(function() {
$subSelete.append('<option value="' + $(this)[1] + '" ' + _selected + '>' + $(this)[0] + '</option>');
});
$.each(val.count, function(index, val) {
$pageCount.append('<option value="' + val + '" ' + (_select.main == _val && val == _selectData.module.count ? 'selected="selected"' : '') + '>' + val+ '</option>');
$pageCount.append('<option value="' + val + '" ' + (_select && _select.main == _val && val == _selectData.module.count ? 'selected="selected"' : '') + '>' + val+ '</option>');
});
$pageDivCount.show();

View File

@ -54,7 +54,7 @@
// Load a URL. Into an iframe?
if(settings.iframe) {
window.console.log("iFrame");
var iframe = $("<iframe />").attr({
var iframe = $('<iframe id="pageslide_iframe" />').attr({
src: settings.href,
frameborder: 0,
hspace: 0
@ -63,7 +63,7 @@
width: "100%",
height: "100%"
});
$pageslide.find('.content').html(iframe).show();
$pageslide.find('.content').css('overflow', 'hidden').html(iframe).show();
if(settings.loadComplete)settings.loadComplete.call(this, $pageslide, $element);
} else {
window.console.log("Load");

View File

@ -191,7 +191,7 @@ legend {
}
#sidebar .sidebar-nav > li i {
font-size: 1.6em;
line-height: 45px;
line-height: 60px;
}
#sidebar .sidebar-nav > li.active i {
font-size: 2.2em;
@ -443,77 +443,72 @@ legend {
/* Edit link in structure */
.editable {
position: relative;
padding: 0px;
margin: 0px;
min-height: 50px;
.page_content {
width: 100%;
height: 100%;
}
.editable {
position: relative;
width: 100%;
height: 100%;
min-height: 50px;
}
.edit_link {
position: absolute;
left: 2px;
right: 2px;
top: 2px;
right: 2px;
bottom: 2px;
border: 2px dashed #1769ff;
border-radius: 5px;
left: 2px;
outline: 1px dashed #0090D5;
z-index: 1000;
opacity: .3;
filter: alpha(opacity = 30);
background-color: #FFF;
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear;
}
.edit_link a {
color: #333;
position: absolute;
left: 0px;
top: 0px;
right: 0px;
bottom: 0px;
.edit_link:hover {
outline: 2px dashed #E47E6B;
}
.edit_link:hover > a:before {
display: block;
}
.edit_link > a {
text-indent: -99999px;
text-align: left;
margin: 0!important;
padding: 0!important;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.edit_link a:before {
.edit_link > a:before {
display: none;
text-indent: 0;
color: #FFF;
content: attr(title);
padding: 5px;
font-size: 12px;
line-height: 10px;
position: absolute;
top: -2px;
left: -2px;
height: 10px;
background-color: #E47E6B;
}
.edit_link > a:after {
content: "\f044";
color: #0090D5;
font-family: FontAwesome;
position: absolute;
font-style: normal;
top: 50%;
left: 50%;
display: block;
font-size: 1.5em;
font-size: 1em;
width: 24px;
height: 24px;
margin: -12px 0 0 -12px;
margin: -8px 0 0 -12px;
text-indent: 0px;
opacity: .4;
filter: alpha(opacity = 40);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear;
}
.editable:hover .edit_link {
opacity: .8;
border: 3px dashed #1769ff;
border-radius: 8px;
filter: alpha(opacity = 80);
}
.editable:hover .edit_link a:before {
font-size: 1.8em;
width: 28px;
height: 28px;
margin: -10px 0 0 -14px;
opacity: 1;
filter: alpha(opacity = 100);
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-o-transition: all .2s linear;
transition: all .2s linear;
.edit_link:hover > a:after {
color: #E47E6B;
}
/* tooltip */
@ -702,4 +697,4 @@ legend {
#main-wrap .wrap-inner {
padding: 20px 0;
}
}
}

View File

@ -20,6 +20,9 @@
.nano .content::-webkit-scrollbar {
visibility: hidden;
}
.nano .content iframe {
position: absolute;
}
.has-scrollbar .content::-webkit-scrollbar {
visibility: visible;
}

View File

@ -1,55 +0,0 @@
/** initial setup **/
.nano {
position : relative;
width : 100%;
height : 100%;
overflow : hidden;
}
.nano .content {
position : absolute;
overflow : scroll;
overflow-x : hidden;
top : 0;
right : 0;
bottom : 0;
left : 0;
}
.nano .content:focus {
outline: thin dotted;
}
.nano .content::-webkit-scrollbar {
visibility: hidden;
}
.has-scrollbar .content::-webkit-scrollbar {
visibility: visible;
}
.nano > .pane {
/*background : rgba(0,0,0,.25);*/
position : absolute;
width : 10px;
right : 0;
top : 0;
bottom : 0;
visibility : hidden\9; /* Target only IE7 and IE8 with this hack */
opacity : .01;
-webkit-transition : .2s;
-moz-transition : .2s;
-o-transition : .2s;
transition : .2s;
-moz-border-radius : 5px;
-webkit-border-radius : 5px;
border-radius : 5px;
}
.nano > .pane > .slider {
background: #444;
background: rgba(0,0,0,.5);
position : relative;
margin : 0 1px;
-moz-border-radius : 3px;
-webkit-border-radius : 3px;
border-radius : 3px;
}
.nano:hover > .pane, .pane.active, .pane.flashed {
visibility : visible\9; /* Target only IE7 and IE8 with this hack */
opacity : 0.99;
}

View File

@ -135,4 +135,10 @@
margin-top: 5px;
color: #8A8A8A;
float: left;
}
/* iFrame */
#pageslide_iframe .page_content {
background-color: #000;
}

View File

@ -52,6 +52,19 @@ class PagePart
end
end
def edit_title
case self.kind
when 'text'
I18n.t(:text)
when 'public_r_tag'
self.public_r_tag.humanize
when 'module_widget'
self.module_app.title
else
I18n.t(:undefined)
end
end
protected
def delete_empty_widget_field

View File

@ -18,10 +18,10 @@
<%= select_tag "page[design]", nil, class: "input-xlarge change" %>
<%= f.label :theme, t(:theme) %>
<%= select_tag "page[theme_id]", nil, class: "input-xlarge" %>
<%= select_tag "page[theme_id]", nil, class: "input-xlarge", include_blank: true %>
<%= f.label :module_app_id, t(:module) %>
<%= select_tag "page[module_app_id]", nil, class: "input-xlarge change" %>
<%= select_tag "page[module_app_id]", nil, class: "input-xlarge change", include_blank: true %>
<div id="front_url" class="hide">
<%= f.label :app_frontend_url, t('front_page.display_mode') %>
@ -31,7 +31,7 @@
<div class="checkbox-groups hide" id="page-category-groups">
<%= f.label :categories, t(:categories) %>
<%= content_tag :label, class: "checkbox" do %>
<%= check_box_tag nil, nil, false, class: "select_all" %> <%= t(:all) %>
<%= check_box_tag nil, nil, true, class: "select_all" %> <%= t(:all) %>
<% end %>
<div class="groups" id="page-category"></div>
</div>
@ -39,7 +39,7 @@
<div class="checkbox-groups hide" id="page-tags-groups">
<%= f.label :tags, t(:tags) %>
<%= content_tag :label, class: "checkbox" do %>
<%= check_box_tag nil, nil, false, class: "select_all" %> <%= t(:all) %>
<%= check_box_tag nil, nil, true, class: "select_all" %> <%= t(:all) %>
<% end %>
<div class="groups" id="page-tags"></div>
</div>

View File

@ -23,8 +23,8 @@
<% elsif node.class.to_s.downcase.eql?("link") %>
<%= link_to content_tag(:i, nil, class: "icon-edit"), "#link", class: "open-slide tip link edit", title: t('editing.link'), data: {title: t('editing.link'), id: node.id.to_s, parent: node.parent_id.to_s, form: {name: node.name}.merge(node.title_translations).merge(node.urls)} %>
<% end %>
<%= link_to content_tag(:i, nil, class: "icons-newspaper"), "#page", class: "open-slide tip page", title: t(:add_page), data: {title: t(:add_page), id: 'new', parent: node.parent_id.to_s} if node.class.to_s.eql?('Page') %>
<%= link_to content_tag(:i, nil, class: "icon-link"), "#link", class: "open-slide tip link", title: t(:add_link), data: {title: t(:add_link)} if node.class.to_s.eql?('Page') %>
<%= link_to content_tag(:i, nil, class: "icons-newspaper"), "#page", class: "open-slide tip page", title: t(:add_page), data: {title: t(:add_page), id: 'new', parent: node.id.to_s} if node.class.to_s.eql?('Page') %>
<%= link_to content_tag(:i, nil, class: "icon-link"), "#link", class: "open-slide tip link", title: t(:add_link), data: {title: t(:add_link), id: 'new', parent: node.id.to_s} if node.class.to_s.eql?('Page') %>
<%= link_to content_tag(:i, nil, class: "icon-trash"), nil, rel: eval("admin_#{node.class.to_s.downcase}_path(node)"), class: "delete tip", title: t(:delete_), data: {title: t(:delete_)} unless node.root? %>
</div>
</div>

View File

@ -70,6 +70,7 @@ en:
warning:
delete: This action can not be restored, are you sure you want to delete these tags?
remove_default: Are you sure you want to remove the default tags?
undefined: Undefined
update:
error:
category: Error when updating category

View File

@ -67,6 +67,7 @@ zh_tw:
warning:
delete: 刪除後無法還原,您確定要刪除嗎?
remove_default: 您確定要移除此預設標籤嗎?
undefined: 尚未定義
update:
error:
category: 更新類別時發生錯誤

View File

@ -28,10 +28,11 @@ module ParserFrontEnd
if @edit
body.css('.page_part').each do |page_part|
part = PagePart.find(page_part['part_id']) rescue nil
ret = ''
ret << "<div class='editable'>"
ret << "<div class='edit_link'>"
ret << "<a href='#{edit_admin_page_part_path(page_part['part_id'])}' class='nav'>#{t(:edit)}</a>"
ret << "<a href='#{edit_admin_page_part_path(page_part['part_id'])}' title='#{part ? part.edit_title : ''}'>#{t(:edit)}</a>"
ret << '</div>'
ret << page_part.child.to_html rescue nil
ret << '</div>'

View File

@ -27,6 +27,7 @@ namespace :new_ui do
migrate_ad_banners
save_pages
menu_enabled_for_to_hash
link_url_to_hash
end
# :category_name is optional, depends on the naming of the category model: if no conventional, specify it