Page form with front end style

This commit is contained in:
chris committed 2013-10-28 16:29:23 +08:00
1 parent 2f41828abd
commit 42d0afe65c
11 files changed
+214 -194

No files matched your search

+12 -15
View File
@@ -200,6 +200,7 @@ function pageSetting(id, edit) {
});
$pageTagsGroup.show();
}
getView(_selectData.module.main, id);
};
});
_selectData.module.public ? $pagePublishedTrue.prop('checked', true) : $pagePublishedTrue.prop('checked', false);
@@ -209,8 +210,8 @@ function pageSetting(id, edit) {
$('#pageslide .active-link.' + val[0]).find('input[type="radio"]').eq(val[2]).prop('checked', true);
}
});
changeSetting(id, _status);
$('#pageslide').find('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
$pagePublishedTrue.prop('checked') ? $('.link-options').slideDown(300) : $('.link-options').slideUp(300);
})
.fail(function(jqXHR, textStatus) {
console.log(jqXHR.status, textStatus)
@@ -230,7 +231,6 @@ function pageSetting(id, edit) {
$.each(_pageData.module, function(index, val) {
$pageModule.append('<option value="' + val.main[1] + '">' + val.main[0] + '</option>');
});
changeSetting(id, _status);
};
};
@@ -265,23 +265,19 @@ function linkSetting(id, edit) {
}
}
function changeSetting(id, edit) {
edit ? getView(id) : '';
$pagePublishedTrue.prop('checked') ? $('.link-options').slideDown(300) : $('.link-options').slideUp(300);
}
function getPageData() {
$.getJSON("<%= Rails.application.routes.url_helpers.get_page_design_module_json_admin_items_path %>").done(function(data) {
_pageData = data;
});
}
function getView(id) {
function getView(module_id, id) {
var _data = {};
_data.val = $('#pageslide #page_app_frontend_url option:selected').val();
_data.id = id;
_data.module_id = module_id
$.ajax({
url: "<%#= Rails.application.routes.url_helpers.get_display_style_admin_pages_path %>",
dataType: "html",
url: "<%= Rails.application.routes.url_helpers.get_display_style_admin_pages_path %>",
dataType: "script",
data: _data,
contentType: "application/html; charset=utf-8",
cache: false,
@@ -370,6 +366,7 @@ $(function() {
_select = _boolean ? _selectData.module : null;
_subData = 'module';
$subSelete = $('#pageslide #page_app_frontend_url');
$pageDivF2E.show();
};
$(this).children("option:selected").each(function () {
var _val = $(this).val();
@@ -377,10 +374,10 @@ $(function() {
if(_val) {
$.each(_data, function(index, val) {
if(_val == val.main[1]) {
$pageDivF2E.show();
getView(val.main[1]);
$.each(val.sub, function(index, val) {
var _selected = _select && $(this)[1] == _select.sub ? 'selected="selected"' : '';
$subSelete.append('<option value="' + $(this)[1] + '" ' + _selected + '>' + $(this)[0] + '</option>');
$subSelete.append('<option value="' + $(this)[1] + '" ' + _selected.sub + '>' + $(this)[0] + '</option>');
});
$.each(val.count, function(index, val) {
$pageCount.append('<option value="' + val + '" ' + (_select && _select.main == _val && val == _selectData.module.count ? 'selected="selected"' : '') + '>' + val+ '</option>');
@@ -435,9 +432,9 @@ $(function() {
$pageDivCount.hide();
}
});
} else {
getView(_ID);
return false;
}
else {
getView($pageModule.val());
}
event.preventDefault();
});
-2
View File
@@ -2,6 +2,4 @@
//= require jquery.ui.sortable
//= require lib/jquery.ui.touch-punch.min.js
//= require lib/jquery.mjs.nestedSortable.js
//= require lib/items/update_cates_and_tags
//= require lib/items/page_widget_edit_interface
//= require lib/items/items