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') .closest('.navbar-inner')
.addClass('active'); .addClass('active');
pageslide.find('.content').css('padding', 0); 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) { function pageSetting(id, edit) {
$pageModule = $('#pageslide #page_module_app_id'); $pageModule = $('#pageslide #page_module_app_id');
$pageF2E = $('#pageslide #page_app_frontend_url'); $pageF2E = $('#pageslide #page_app_frontend_url');
@ -149,7 +166,6 @@ function pageSetting(id, edit) {
}); });
}; };
}); });
$pageModule.append('<option/>');
$.each(_pageData.module, function(index, val) { $.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>'); $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) { 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); $('#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 }); $('#pageslide').find('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
}) })
.fail(function(jqXHR, textStatus) { .fail(function(jqXHR, textStatus) {
@ -211,11 +227,10 @@ function pageSetting(id, edit) {
}); });
}; };
}); });
$pageModule.append('<option/>');
$.each(_pageData.module, function(index, val) { $.each(_pageData.module, function(index, val) {
$pageModule.append('<option value="' + val.main[1] + '">' + val.main[0] + '</option>'); $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) { function changeSetting(id, edit) {
getView(id); edit ? getView(id) : '';
$pagePublishedTrue.prop('checked') ? $('.link-options').slideDown(300) : $('.link-options').slideUp(300); $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>'); $subSelete.append('<option value="' + $(this)[1] + '" ' + _selected + '>' + $(this)[0] + '</option>');
}); });
$.each(val.count, function(index, val) { $.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(); $pageDivCount.show();

View File

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

View File

@ -191,7 +191,7 @@ legend {
} }
#sidebar .sidebar-nav > li i { #sidebar .sidebar-nav > li i {
font-size: 1.6em; font-size: 1.6em;
line-height: 45px; line-height: 60px;
} }
#sidebar .sidebar-nav > li.active i { #sidebar .sidebar-nav > li.active i {
font-size: 2.2em; font-size: 2.2em;
@ -443,77 +443,72 @@ legend {
/* Edit link in structure */ /* Edit link in structure */
.editable { .page_content {
position: relative;
padding: 0px;
margin: 0px;
min-height: 50px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.editable {
position: relative;
width: 100%;
height: 100%;
min-height: 50px;
}
.edit_link { .edit_link {
position: absolute; position: absolute;
left: 2px;
right: 2px;
top: 2px; top: 2px;
right: 2px;
bottom: 2px; bottom: 2px;
border: 2px dashed #1769ff; left: 2px;
border-radius: 5px; outline: 1px dashed #0090D5;
z-index: 1000; 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 { .edit_link:hover {
color: #333; outline: 2px dashed #E47E6B;
position: absolute; }
left: 0px; .edit_link:hover > a:before {
top: 0px; display: block;
right: 0px; }
bottom: 0px; .edit_link > a {
text-indent: -99999px; 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"; content: "\f044";
color: #0090D5;
font-family: FontAwesome; font-family: FontAwesome;
position: absolute; position: absolute;
font-style: normal;
top: 50%; top: 50%;
left: 50%; left: 50%;
display: block; display: block;
font-size: 1.5em; font-size: 1em;
width: 24px; width: 24px;
height: 24px; height: 24px;
margin: -12px 0 0 -12px; margin: -8px 0 0 -12px;
text-indent: 0px; 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 { .edit_link:hover > a:after {
opacity: .8; color: #E47E6B;
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;
} }
/* tooltip */ /* tooltip */

View File

@ -20,6 +20,9 @@
.nano .content::-webkit-scrollbar { .nano .content::-webkit-scrollbar {
visibility: hidden; visibility: hidden;
} }
.nano .content iframe {
position: absolute;
}
.has-scrollbar .content::-webkit-scrollbar { .has-scrollbar .content::-webkit-scrollbar {
visibility: visible; 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

@ -136,3 +136,9 @@
color: #8A8A8A; color: #8A8A8A;
float: left; float: left;
} }
/* iFrame */
#pageslide_iframe .page_content {
background-color: #000;
}

View File

@ -52,6 +52,19 @@ class PagePart
end end
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 protected
def delete_empty_widget_field def delete_empty_widget_field

View File

@ -18,10 +18,10 @@
<%= select_tag "page[design]", nil, class: "input-xlarge change" %> <%= select_tag "page[design]", nil, class: "input-xlarge change" %>
<%= f.label :theme, t(:theme) %> <%= 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) %> <%= 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"> <div id="front_url" class="hide">
<%= f.label :app_frontend_url, t('front_page.display_mode') %> <%= f.label :app_frontend_url, t('front_page.display_mode') %>
@ -31,7 +31,7 @@
<div class="checkbox-groups hide" id="page-category-groups"> <div class="checkbox-groups hide" id="page-category-groups">
<%= f.label :categories, t(:categories) %> <%= f.label :categories, t(:categories) %>
<%= content_tag :label, class: "checkbox" do %> <%= 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 %> <% end %>
<div class="groups" id="page-category"></div> <div class="groups" id="page-category"></div>
</div> </div>
@ -39,7 +39,7 @@
<div class="checkbox-groups hide" id="page-tags-groups"> <div class="checkbox-groups hide" id="page-tags-groups">
<%= f.label :tags, t(:tags) %> <%= f.label :tags, t(:tags) %>
<%= content_tag :label, class: "checkbox" do %> <%= 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 %> <% end %>
<div class="groups" id="page-tags"></div> <div class="groups" id="page-tags"></div>
</div> </div>

View File

@ -23,8 +23,8 @@
<% elsif node.class.to_s.downcase.eql?("link") %> <% 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)} %> <%= 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 %> <% 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: "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)} 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? %> <%= 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>
</div> </div>

View File

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

View File

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

View File

@ -28,10 +28,11 @@ module ParserFrontEnd
if @edit if @edit
body.css('.page_part').each do |page_part| body.css('.page_part').each do |page_part|
part = PagePart.find(page_part['part_id']) rescue nil
ret = '' ret = ''
ret << "<div class='editable'>" ret << "<div class='editable'>"
ret << "<div class='edit_link'>" 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 << '</div>'
ret << page_part.child.to_html rescue nil ret << page_part.child.to_html rescue nil
ret << '</div>' ret << '</div>'

View File

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