Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c2c271232 | ||
|
|
6f44a20843 |
No files matched your search
@@ -541,8 +541,6 @@ function changeStatusHidden() {
|
||||
|
||||
// Document Ready
|
||||
$(function() {
|
||||
showFiltersOnPageRefresh();
|
||||
|
||||
new ini();
|
||||
$('#main-wrap').on('click', '.delete', function() {
|
||||
api.modal($(this).attr('rel'));
|
||||
@@ -591,35 +589,4 @@ $(function() {
|
||||
}
|
||||
formTip()
|
||||
sidebarNav();
|
||||
});
|
||||
|
||||
var showFiltersOnPageRefresh = function(){
|
||||
var params = getUrlVars(),
|
||||
paramfilter = params['new_filter[type]'];
|
||||
|
||||
// switch (paramfilter){
|
||||
// case "role":
|
||||
// paramfilter = "status";
|
||||
// break;
|
||||
// }
|
||||
|
||||
if( paramfilter ){
|
||||
$( "#filter" ).addClass('open');
|
||||
$( '#filter a[href="#collapse-' + paramfilter + '"]').parent().parent().addClass('active');
|
||||
$( '#filter #collapse-' + paramfilter ).addClass('in');
|
||||
}
|
||||
}
|
||||
|
||||
var getUrlVars = function(){
|
||||
var vars = [], hash;
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
for(var i = 0; i < hashes.length; i++){
|
||||
hash = hashes[i].split('=');
|
||||
vars.push(decodeURIComponent(hash[0]));
|
||||
vars[decodeURIComponent(hash[0])] = decodeURIComponent(hash[1]);
|
||||
}
|
||||
if(vars[0] == window.location.href){
|
||||
vars =[];
|
||||
}
|
||||
return vars;
|
||||
}
|
||||
});
|
||||
@@ -81,7 +81,7 @@ function customOpenSlide() {
|
||||
} else {
|
||||
$('#pageslide form').prop('method', 'post')
|
||||
};
|
||||
_type == 'page' ? pageSetting(element.data('id'), _edit, pageslide) : linkSetting(element.data('id'), _edit, pageslide);
|
||||
_type == 'page' ? pageSetting(element.data('id'), _edit) : linkSetting(element.data('id'), _edit, pageslide);
|
||||
}
|
||||
});
|
||||
$iFrame.pageslide({
|
||||
@@ -130,13 +130,12 @@ function iFrameContent() {
|
||||
}).css('cursor', 'default');
|
||||
}
|
||||
$('#pageslide_iframe').load(function() {
|
||||
var $iContents = $(this).contents(),
|
||||
$pc = $iContents.find('.page_content');
|
||||
iFrameFunction($iContents, $pc);
|
||||
var $iContents = $(this).contents(),
|
||||
$pc = $iContents.find('.page_content');
|
||||
$(this).get(0).contentWindow.externalFunction(iFrameFunction, $iContents, $pc);
|
||||
});
|
||||
}
|
||||
|
||||
function pageSetting(id, edit, ps) {
|
||||
function pageSetting(id, edit) {
|
||||
$pageModule = $('#pageslide #page_module_app_id');
|
||||
$pageF2E = $('#pageslide #page_app_frontend_url');
|
||||
$pageDivF2E = $('#pageslide #front_url');
|
||||
@@ -184,30 +183,23 @@ function pageSetting(id, edit, ps) {
|
||||
|
||||
if(val.category.length > 0) {
|
||||
$.each(val.category, function(index, val) {
|
||||
var _arr = $.inArray($(this)[1], _selectData.module.category);
|
||||
var _arr = $.inArray($(this)[1], _selectData.module.category[1]);
|
||||
$pageCategory.append('<label class="checkbox"><input type="checkbox" name="page[category][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
|
||||
if(_arr !== -1) {
|
||||
if(!_selectData.module.category[0] && _arr !== -1) {
|
||||
$pageCategory.find('input[type="checkbox"]').eq(index).prop('checked', true);
|
||||
}
|
||||
var $all = $pageCategory.siblings('.checkbox').children('.select_all'),
|
||||
$hiddenInput = $pageCategory.siblings('input[type="hidden"]');
|
||||
_selectData.module.category.length ? $hiddenInput.removeAttr('name') : $hiddenInput.attr('name', 'page[category][]');
|
||||
_selectData.module.category.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
|
||||
console.log($hiddenInput, _selectData.module.category)
|
||||
_selectData.module.category[0] ? $pageCategory.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
|
||||
});
|
||||
$pageCategoryGroup.show();
|
||||
}
|
||||
if(val.tags.length > 0) {
|
||||
$.each(val.tags, function(index, val) {
|
||||
var _arr = $.inArray($(this)[1], _selectData.module.tags);
|
||||
var _arr = $.inArray($(this)[1], _selectData.module.tags[1]);
|
||||
$pageTags.append('<label class="checkbox"><input type="checkbox" name="page[tag][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
|
||||
if(_arr !== -1) {
|
||||
if(!_selectData.module.tags[0] && _arr !== -1) {
|
||||
$pageTags.find('input[type="checkbox"]').eq(index).prop('checked', true);
|
||||
}
|
||||
var $all = $pageTags.siblings('.checkbox').children('.select_all'),
|
||||
$hiddenInput = $pageTags.siblings('input[type="hidden"]');
|
||||
_selectData.module.tags.length ? $hiddenInput.removeAttr('name') : $hiddenInput.attr('name', 'page[tag][]');
|
||||
_selectData.module.tags.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
|
||||
_selectData.module.tags[0] ? $pageTags.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
|
||||
});
|
||||
$pageTagsGroup.show();
|
||||
}
|
||||
@@ -402,44 +394,36 @@ $(function() {
|
||||
|
||||
if(event.target.id == 'page_module_app_id') {
|
||||
$pageCategory.empty();
|
||||
var $hiddenInputA = $pageCategory.siblings('input[type="hidden"]');
|
||||
if(val.category.length > 0) {
|
||||
$.each(val.category, function(index, val) {
|
||||
if(val !== 0) {
|
||||
var _arr = _select ? $.inArray($(this)[1], _select.category) : '';
|
||||
var _arr = _select ? $.inArray($(this)[1], _select.category[1]) : '';
|
||||
$pageCategory.append('<label class="checkbox"><input type="checkbox" name="page[category][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
|
||||
if(_boolean && _arr !== -1) {
|
||||
if(_select && !_select.category[0] && _arr !== -1) {
|
||||
$pageCategory.find('input[type="checkbox"]').eq(index).prop('checked', true);
|
||||
}
|
||||
var $all = $pageCategory.siblings('.checkbox').children('.select_all');
|
||||
_val == _select.main && _select.category.length ? $hiddenInputA.removeAttr('name') : $hiddenInputA.attr('name', 'page[category][]');
|
||||
_boolean && _val == _select.main && _select.category.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
|
||||
_select && _val == _select.main && _select.category[0] ? $pageCategory.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
|
||||
}
|
||||
});
|
||||
$pageCategoryGroup.slideDown(300);
|
||||
$pageCategoryGroup.show();
|
||||
} else {
|
||||
$pageCategoryGroup.slideUp(300);
|
||||
$hiddenInputA.removeAttr('name');
|
||||
$pageCategoryGroup.hide();
|
||||
}
|
||||
$pageTags.empty();
|
||||
var $hiddenInputB = $pageTags.siblings('input[type="hidden"]');
|
||||
if(val.tags.length > 0) {
|
||||
$.each(val.tags, function(index, val) {
|
||||
if(val !== 0) {
|
||||
var _arr = _select ? $.inArray($(this)[1], _select.tags) : '';
|
||||
var _arr = _select ? $.inArray($(this)[1], _select.tags[1]) : '';
|
||||
$pageTags.append('<label class="checkbox"><input type="checkbox" name="page[tag][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
|
||||
if(_boolean && _arr !== -1) {
|
||||
if(_select && !_select.tags[0] && _arr !== -1) {
|
||||
$pageTags.find('input[type="checkbox"]').eq(index).prop('checked', true);
|
||||
}
|
||||
var $all = $pageTags.siblings('.checkbox').children('.select_all');
|
||||
_val == _select.main && _select.tags.length ? $hiddenInputB.removeAttr('name') : $hiddenInputB.attr('name', 'page[tag][]');
|
||||
_boolean && _val == _select.main && _select.tags.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
|
||||
_select && _val == _select.main && _select.tags[0] ? $pageTags.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
|
||||
}
|
||||
});
|
||||
$pageTagsGroup.slideDown(300);
|
||||
$pageTagsGroup.show();
|
||||
} else {
|
||||
$pageTagsGroup.slideUp(300);
|
||||
$hiddenInputB.removeAttr('name');
|
||||
$pageTagsGroup.hide();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -467,18 +451,12 @@ $(function() {
|
||||
|
||||
$('#pageslide').on('change', '.checkbox-groups input', function(event) {
|
||||
var $checked = $(this);
|
||||
|
||||
if($checked.attr('type') == 'checkbox') {
|
||||
if($checked.hasClass('select_all')) {
|
||||
if($checked.prop('checked')) {
|
||||
$checked.closest('.checkbox').siblings('.groups').find('input[type="checkbox"]').prop('checked', true);
|
||||
$checked.closest('.checkbox').siblings('input[type="hidden"]').removeAttr('name');
|
||||
} else {
|
||||
$checked.closest('.checkbox').siblings('.groups').find('input[type="checkbox"]').prop('checked', false);
|
||||
$checked.closest('.checkbox').siblings('input[type="hidden"]').attr('name', 'page['+$checked.closest('.checkbox-groups').data('for')+'][]');
|
||||
}
|
||||
} else if($checked.hasClass('lang-enable')) {
|
||||
var checkboxes = $checked.closest('.groups').find('input[type="checkbox"]');
|
||||
if($checked.hasClass('select_all') && $checked.prop('checked')) {
|
||||
$checked.closest('.checkbox').siblings('.groups').find('input[type="checkbox"]').prop('checked', false);
|
||||
} else if($checked.prop('checked') && !$checked.hasClass('lang-enable')) {
|
||||
$checked.closest('.groups').siblings('.checkbox').find('.select_all').prop('checked', false);
|
||||
} else {
|
||||
if($checked.prop('checked')) {
|
||||
$checked.closest('.active-link').addClass('active').siblings('active-link').removeClass('active').end().find('.active-mune').slideDown(300);
|
||||
if(_status) {
|
||||
@@ -492,15 +470,6 @@ $(function() {
|
||||
$(this).find('input:eq(0)').prop('checked', true);
|
||||
})
|
||||
}
|
||||
} else {
|
||||
var _l = $checked.closest('.groups').find('input[type="checkbox"]').length,
|
||||
_c = $checked.closest('.groups').find('input[type="checkbox"]:checked').length;
|
||||
if(_l == _c) {
|
||||
$checked.closest('.groups').siblings('.checkbox').find('.select_all').prop('checked', true);
|
||||
} else {
|
||||
$checked.closest('.groups').siblings('.checkbox').find('.select_all').prop('checked', false);
|
||||
};
|
||||
_c == 0 ? $checked.closest('.groups').siblings('input[type="hidden"]').attr('name', 'page['+$checked.closest('.checkbox-groups').data('for')+'][]') : $checked.closest('.groups').siblings('input[type="hidden"]').removeAttr('name');
|
||||
}
|
||||
return false;
|
||||
} else if($checked.attr('type') == 'radio' && !$(this).closest('div').hasClass('active-mune')) {
|
||||
|
||||
@@ -1,66 +1,93 @@
|
||||
//Preview need a link in form as Ex and a corresponding PUT action in controller
|
||||
//Ex preview trigger:
|
||||
// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%>
|
||||
|
||||
$(function() {
|
||||
$(".post_preview").click(function(){
|
||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||
|
||||
$.post($(this).attr('url'), $(".previewable").serialize() ,function(data){
|
||||
$('#show_preview .modal').modal();
|
||||
$('#show_preview .modal').height(function() {
|
||||
return $(window).height() * 0.7;
|
||||
});
|
||||
},'script');
|
||||
});
|
||||
$(".preview_trigger").click(function(){
|
||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: $(this).attr("href"),
|
||||
data: $(this).parents("form").serialize(),
|
||||
success: function (msg) {
|
||||
$('#show_preview .modal').modal();
|
||||
$('#show_preview .modal').height(function() {
|
||||
return $(window).height() * 0.7;
|
||||
});
|
||||
},
|
||||
error: function(){
|
||||
alert("ERROR");
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// $('#main-wrap').on(clickEvent, '.post_preview, .preview_trigger', function(e) {
|
||||
// $(".post_preview").click(function(e){
|
||||
// $("#main-wrap").after("<span id='show_preview'></span>");
|
||||
// if($(this).hasClass('post_preview')) {
|
||||
// var attrs = e.target.attributes;
|
||||
// var url = attrs['url'];
|
||||
// $("form.previewable").ajaxSubmit({
|
||||
// beforeSubmit: function(a,f,o){
|
||||
// o.dataType = 'script';
|
||||
// o.url = url.nodeValue;
|
||||
// o.type = 'post';
|
||||
// },success: function(msg) {
|
||||
// $('#show_preview .modal').modal()
|
||||
// $('#show_preview .modal').height(function() {
|
||||
// return $(window).height() * 0.7;
|
||||
// });
|
||||
// }
|
||||
|
||||
// });
|
||||
// } else if($(this).hasClass('preview_trigger')) {
|
||||
// $.ajax({
|
||||
// type: 'PUT',
|
||||
// url: $(this).attr("href"),
|
||||
// data: $(this).parents("form").serialize(),
|
||||
// success: function (msg) {
|
||||
// $('#show_preview .modal').modal();
|
||||
// $('#show_preview .modal').height(function() {
|
||||
// return $(window).height() * 0.7;
|
||||
// });
|
||||
// },
|
||||
// error: function(){
|
||||
// alert("ERROR");
|
||||
// }
|
||||
// });
|
||||
// return false;
|
||||
// }
|
||||
// e.preventDefault();
|
||||
// var form = $(this).parents("form").first()
|
||||
// //var cont = form["content"].value;
|
||||
// // $.ajax({
|
||||
// // type: 'POST',
|
||||
// // url: $(this).attr("href")+'?preview=true',
|
||||
// // data: form.serialize(),
|
||||
// // dataType: "script",
|
||||
// // success: function (msg) {
|
||||
// // $("#"+start_modal_with_id).modal('show'); },
|
||||
// // error: function(){
|
||||
// // alert("ERROR");
|
||||
// // }
|
||||
// // });
|
||||
// url = "/panel/news/back_end/news_bulletins/preview?preview=true"
|
||||
// // alert(url)
|
||||
// form.attr("action",url);
|
||||
// form.submit();
|
||||
// //return false;
|
||||
// });
|
||||
// /panel/announcement/back_end/bulletins/preview
|
||||
$('#main-wrap').on(clickEvent, '.post_preview, .preview_trigger', function(e) {
|
||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||
if($(this).hasClass('post_preview')) {
|
||||
var attrs = e.target.attributes;
|
||||
var url = attrs['url'];
|
||||
$("form.previewable").ajaxSubmit({
|
||||
beforeSubmit: function(a,f,o){
|
||||
o.dataType = 'script';
|
||||
o.url = url.nodeValue;
|
||||
o.type = 'post';
|
||||
},success: function(msg) {
|
||||
$('#show_preview .modal').modal()
|
||||
$('#show_preview .modal').height(function() {
|
||||
return $(window).height() * 0.7;
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
} else if($(this).hasClass('preview_trigger')) {
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: $(this).attr("href"),
|
||||
data: $(this).parents("form").serialize(),
|
||||
success: function (msg) {
|
||||
$('#show_preview .modal').modal();
|
||||
$('#show_preview .modal').height(function() {
|
||||
return $(window).height() * 0.7;
|
||||
});
|
||||
},
|
||||
error: function(){
|
||||
alert("ERROR");
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// $("a.preview_trigger").on('click',function(){
|
||||
// $("#main-wrap").after("<span id='show_preview'></span>");
|
||||
// $.ajax({
|
||||
// type: 'PUT',
|
||||
// url:$(this).attr("href"),
|
||||
// data:$(this).parents("form").serialize(),
|
||||
// success: function (msg) {
|
||||
// $("#"+start_modal_with_id).modal('show'); },
|
||||
// error: function(){
|
||||
// alert("ERROR");
|
||||
// }
|
||||
// });
|
||||
// return false;
|
||||
// });
|
||||
// $("form.nccu_ajax_form").ajaxForm({
|
||||
// beforeSubmit: function(a,f,o) {
|
||||
// // if(clicked_what.hasClass("post_preview")){
|
||||
// // $("#main-wrap").after("<span id='show_preview'></span>");
|
||||
// // o.dataType = 'script';
|
||||
// // o.url = clicked_what.attr("url");
|
||||
// // }
|
||||
// },
|
||||
// success: function(data) {
|
||||
// // if(!clicked_what.hasClass("post_preview")){
|
||||
// // window.location = data.redirect_url;
|
||||
// // }
|
||||
// }
|
||||
// })
|
||||
});
|
||||
@@ -23,9 +23,7 @@ class Admin::PagePartsController < OrbitBackendController
|
||||
@class_options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}
|
||||
@partial = 'default_widget'
|
||||
else
|
||||
|
||||
# @frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil
|
||||
@frontend_styles = @module_app.widgets[@part.widget_path]["style"] rescue nil
|
||||
@frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil
|
||||
@partial = 'custom_widget' if @frontend_styles.present?
|
||||
end
|
||||
end
|
||||
@@ -97,7 +95,9 @@ class Admin::PagePartsController < OrbitBackendController
|
||||
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
|
||||
flash.now[:notice] = t('update.success.content')
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {
|
||||
redirect_to admin_page_url(@part.page, edit: true)
|
||||
}
|
||||
end
|
||||
else
|
||||
@id = params[:id]
|
||||
|
||||
@@ -21,12 +21,6 @@ class Admin::PagesController < Admin::ItemsController
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:page][:category][0] == ""
|
||||
params[:page][:category] = []
|
||||
end
|
||||
if params[:page][:tag][0] == ""
|
||||
params[:page][:tag] = []
|
||||
end
|
||||
@item = Page.find(params[:id])
|
||||
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
|
||||
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
|
||||
@@ -66,8 +60,8 @@ class Admin::PagesController < Admin::ItemsController
|
||||
m = {}
|
||||
m["main"] = page.module_app_id.to_s
|
||||
m["sub"] = page.app_frontend_url
|
||||
m["category"] = page.category.present? ? page.category.map{|c| c.to_s} : []
|
||||
m["tags"] = page.tag.present? ? page.tag.map{|c| c.to_s} : []
|
||||
m["category"] = page.category.present? ? [0, page.category.map{|c| c.to_s}] : [1]
|
||||
m["tags"] = page.tag.present? ? [0, page.tag.map{|c| c.to_s}] : [1]
|
||||
m["public"] = page.is_published ? 1 : 0
|
||||
m["link"] = @site_valid_locales.inject([]) do |link, locale|
|
||||
link << [locale, (page.enabled_for && page.enabled_for.include?(locale)) ? 1 : 0, (page.menu_enabled_for && page.menu_enabled_for[locale].eql?('true')) ? 1 :0]
|
||||
|
||||
@@ -28,22 +28,20 @@
|
||||
<%= select_tag "page[app_frontend_url]", nil, class: "input-xlarge change" %>
|
||||
</div>
|
||||
|
||||
<div class="checkbox-groups hide" id="page-category-groups" data-for="category">
|
||||
<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, true, class: "select_all" %> <%= t(:all) %>
|
||||
<% end %>
|
||||
<div class="groups" id="page-category"></div>
|
||||
<input type="hidden">
|
||||
</div>
|
||||
|
||||
<div class="checkbox-groups hide" id="page-tags-groups" data-for="tag">
|
||||
<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, true, class: "select_all" %> <%= t(:all) %>
|
||||
<% end %>
|
||||
<div class="groups" id="page-tags"></div>
|
||||
<input type="hidden">
|
||||
</div>
|
||||
|
||||
<div class="display-mode"></div>
|
||||
|
||||
@@ -3,25 +3,4 @@
|
||||
<div class="controls">
|
||||
<%= select 'page_part', 'widget_style', @frontend_styles, {:selected => (@part && @part[:widget_style])}, class: "input-xlarge" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group input-content">
|
||||
<% @module_app.widget_options.tap { |widget|%>
|
||||
<% widget.each { |w|%>
|
||||
<% w.get_options.each do |key, settings| %>
|
||||
<% options = settings[:opts] %>
|
||||
<%= label_tag(t(settings[:label_i18n], :class=>"control-label muted"))%>
|
||||
<% case options%>
|
||||
<% when Hash%>
|
||||
<div class="controls">
|
||||
<%= select_tag "page_part[widget_options][#{key}]", options_from_collection_for_select(eval(options["query"]), options["value"], options["label"].to_s, :selected => (@part.widget_options[key] rescue nil)), class: "input-xlarge" %>
|
||||
</div>
|
||||
<% else%>
|
||||
<div class="controls">
|
||||
<%= select_tag "page_part[widget_options][#{key}]", options_for_select(options,(@part.widget_options[key] rescue nil)), class: "input-xlarge" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</div>
|
||||
@@ -1,18 +0,0 @@
|
||||
<% if (not(@selected[:module_app].widget_options(@selected[:app_frontend_url]).blank?) and @selected[:app_frontend_url]!='default_widget')%>
|
||||
|
||||
|
||||
<% @selected[:module_app].widget_options(@selected[:app_frontend_url]).get_options.each do |key,settings| %>
|
||||
<% options = settings[:opts] %>
|
||||
<%= label_tag(t(settings[:label_i18n]))%>
|
||||
<% case options%>
|
||||
<% when Hash%>
|
||||
<%= select_tag "page_part[widget_options][#{key}]", options_from_collection_for_select(eval(options["query"]), options["value"], options["label"].to_s, :selected => (@part.widget_options[key] rescue nil)) %>
|
||||
<% else%>
|
||||
<%= select_tag "page_part[widget_options][#{key}]", options_for_select(options,(@part.widget_options[key] rescue nil)) %>
|
||||
<!-- (@part[:widget_field][i][0] if (@part && !@part[:widget_field].blank? && !@part[:widget_field][i].blank?)) ) -->
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
@@ -3,7 +3,8 @@
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "lib/items/page_part" %>
|
||||
<% end %>
|
||||
<%= form_for @part, url: {action: "update"}, :remote=>true, html: { class: "form-horizontal main-forms"} do |f| %>
|
||||
|
||||
<%= form_for @part, url: admin_page_part_path(@part), html: { class: "form-horizontal main-forms"} do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<div class="btn-group" data-toggle="buttons-radio">
|
||||
<label href="#none" class="btn btn-large" data-toggle="tab">
|
||||
@@ -80,7 +81,7 @@
|
||||
<div class="control-group input-content">
|
||||
<%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}", class: "control-label muted" %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, class: 'input-xlarge page_title', placeholder: "#{t(:title)} #{I18nVariable.from_locale(locale)}", id: locale, :value => (@part.title_translations[locale] rescue nil) %>
|
||||
<%= f.text_field locale, class: 'input-xlarge page_title', placeholder: "#{t(:title)} #{I18nVariable.from_locale(locale)}", id: locale %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -101,13 +102,13 @@
|
||||
<%= f.label :categories, t(:categories), class: "control-label muted" %>
|
||||
<div class="controls">
|
||||
<%= 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">
|
||||
<%= content_tag_for(:label, @module_app_categories, class: "checkbox inline") do |category|%>
|
||||
<%= check_box_tag("page_part[category][]", category.id, (@part.category.include?(category.id.to_s) rescue false) ) %>
|
||||
<%= check_box_tag("page_part[tag][]", category.id, (@part.category.include?(category.id) rescue false) ) %>
|
||||
<%= category.title %>
|
||||
<% end if @module_app_categories %>
|
||||
<% end if @module_app_tags %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,7 +120,7 @@
|
||||
<% end %>
|
||||
<div class="groups" id="page-tags">
|
||||
<%= content_tag_for(:label, @module_app_tags, class: "checkbox inline") do |tag|%>
|
||||
<%= check_box_tag("page_part[tag][]", tag.id, (@part.tag.include?(tag.id.to_s) rescue false) ) %>
|
||||
<%= check_box_tag("page_part[tag][]", tag.id, (@part.tag.include?(tag.id) rescue false) ) %>
|
||||
<%= tag.name %>
|
||||
<% end if @module_app_tags %>
|
||||
</div>
|
||||
@@ -160,10 +161,3 @@
|
||||
$.getScript($(this).attr('rel') + '?type=' + $(this).val() + "&id=" + "<%= @part.id %>" );
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function toggleChecked(status) {
|
||||
$(".checkbox").each( function() {
|
||||
$(this).attr("checked",status);
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -1 +0,0 @@
|
||||
window.location.href="<%= admin_page_url(@part.page, edit: true) %>"
|
||||
@@ -24,12 +24,12 @@
|
||||
<ul class="nav nav-pills filter-nav pull-right">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
<a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filter-group accordion-group">
|
||||
<div class="accordion-body collapse" id="collapse-role">
|
||||
<div class="accordion-body collapse" id="collapse-status">
|
||||
|
||||
<%= render :partial => "filter"%>
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
<ul class="nav nav-pills filter-nav pull-right">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
<a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filter-group accordion-group">
|
||||
<div class="accordion-body collapse" id="collapse-role">
|
||||
<div class="accordion-body collapse" id="collapse-status">
|
||||
|
||||
<%= render :partial => "filter"%>
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
<ul class="nav nav-pills filter-nav pull-right">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
<a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filter-group accordion-group">
|
||||
<div class="accordion-body collapse" id="collapse-role">
|
||||
<div class="accordion-body collapse" id="collapse-status">
|
||||
|
||||
<%= render :partial => "filter"%>
|
||||
|
||||
|
||||
@@ -13,21 +13,13 @@
|
||||
<div>
|
||||
<script type="text/javascript" src="/assets/kernel.js"></script>
|
||||
<script type="text/javascript">
|
||||
var preview_img;
|
||||
|
||||
$(function() {
|
||||
$("iframe").load(function() {
|
||||
// Get the body element
|
||||
var frameBody = $("iframe").contents().find('body');
|
||||
// Get all links inside the BODY tag
|
||||
$("iframe").contents().find('#orbit-bar').hide();
|
||||
|
||||
$('.thumbnail').each(function(){
|
||||
if($(this).children('img').length) preview_img = $(this).children('img').attr('src');
|
||||
});
|
||||
|
||||
InsertPreviewImage();
|
||||
|
||||
frameBody.find('a').click(function(e){
|
||||
//Disable all default actions
|
||||
e.preventDefault();
|
||||
@@ -38,14 +30,6 @@
|
||||
$("#show_preview").remove();
|
||||
});
|
||||
});
|
||||
|
||||
function InsertPreviewImage(){
|
||||
if($("iframe").contents().find('.news_image').length){
|
||||
$("iframe").contents().find('.news_image').append("<a href='' target='_blank'><img src='"+preview_img+"' width='320' height='240' /></a>");
|
||||
}else{
|
||||
setTimeout(InsertPreviewImage,1000);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
+66
-1
@@ -32,8 +32,73 @@ var galleryAPI = function(){
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$(document).ready(function(){
|
||||
//bindHandlers();
|
||||
})
|
||||
var bindHandlers = function(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.loadAlbums = function(id){
|
||||
g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum($(this).attr("href"))});
|
||||
g.albumArea.addClass('o_gallery');
|
||||
g.albumArea.find("#imgholder").empty();
|
||||
if(id!="all"){
|
||||
var cids = [];
|
||||
var tids = [];
|
||||
var href = null;
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
for(var i = 0; i < hashes.length; i++){
|
||||
hash = hashes[i].split('=');
|
||||
if(hash[0]=="cat"){
|
||||
cids.push(hash[1]);
|
||||
href = "cat="+hash[1];
|
||||
}else if(hash[0]=="tag"){
|
||||
tids.push(hash[1]);
|
||||
href = "tag="+hash[1];
|
||||
}
|
||||
$("#filter .filter_btns a[href='"+href+"']").addClass("active");
|
||||
}
|
||||
if(cids.length == 0)
|
||||
cids = "all";
|
||||
}else{
|
||||
var cids = "all";
|
||||
}
|
||||
$.getJSON("/panel/gallery/front_end/get_albums",{"cid":cids,"tid":tids,"inner":true},function(categories){
|
||||
$.each(categories,function(x,category){
|
||||
$.each(category,function(i,album){
|
||||
album.description = (album.description?album.description:"<%= I18n.t('gallery.no_description') %>")
|
||||
if(album.cover == "default")
|
||||
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='../../../assets/gallery/default.jpg'/></a><span class='albumname'><a title='"+album.description+"' href='?album="+album._id+"'>"+album.name+"</a></span><span class='categoryname'><i class='icon-folder-close'></i> "+album.category_name+"</span><span class='tagnames'></span></div>");
|
||||
else
|
||||
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='"+album.cover_path+"'/></a><span class='albumname'><a title='"+album.description+"' href='?album="+album._id+"'>"+album.name+"</a></span><span class='categoryname'><i class='icon-folder-close'></i> "+album.category_name+"</span><span class='tagnames'></span></div>");
|
||||
var tag_string = "";
|
||||
for(tag in album.tag_names){
|
||||
if(tag == album.tag_names.length-1)
|
||||
tag_string+= '<span class="tags">' + album.tag_names[tag] + '</span>';
|
||||
else
|
||||
tag_string+= '<span class="tags">' + album.tag_names[tag] + ', </span>';
|
||||
}
|
||||
$img.find(".tagnames").html(tag_string);
|
||||
g.albumArea.find("#imgholder").append($img);
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
this.loadImages = function(id){
|
||||
g.albumArea.addClass('o_album');
|
||||
g.albumArea.find("#imgholder").empty();
|
||||
$.getJSON("panel/gallery/front_end/albums/"+id+"/imgs",{inner:true},function(album){
|
||||
$.each(album.images,function(i,image){
|
||||
var thumb = image.file.thumb.url;
|
||||
image.description = (image.description?image.description:"<%= I18n.t('gallery.no_description') %>")
|
||||
var $img = $("<div class='rgphoto'><a title='"+image.description+"' href='"+image.theater_link+"'><img src='"+thumb+"'/></a></div>");
|
||||
g.albumArea.find("#imgholder").append($img);
|
||||
})
|
||||
})
|
||||
}
|
||||
this.loadTheater = function(id){
|
||||
var imageArray;
|
||||
var imagecount = 0;
|
||||
|
||||
Vendored
+47
-2
@@ -1,11 +1,56 @@
|
||||
class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
||||
def index
|
||||
@albums = GalleryAlbum.where(:category_id.in => params[:category_id])
|
||||
end
|
||||
|
||||
def show
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@images = @album.gallery_images
|
||||
@tags = Tag.find(@album.tagged_ids).map{|t| t.name}
|
||||
end
|
||||
|
||||
def get_albums
|
||||
@categoryids = params["cid"]
|
||||
@tags = params["tid"]
|
||||
@albums = Array.new
|
||||
if @categoryids == "all"
|
||||
if @tags
|
||||
if @tags.kind_of?(Array)
|
||||
@tags.each do |tag|
|
||||
@albums << GalleryAlbum.where(tagged_ids: tag)
|
||||
end
|
||||
else
|
||||
@albums << GalleryAlbum.where(tagged_ids: @tags)
|
||||
end
|
||||
else
|
||||
@albums << GalleryAlbum.all
|
||||
end
|
||||
else
|
||||
@categoryids.each do |id|
|
||||
category = Category.find(id)
|
||||
if @tags
|
||||
if @tags.kind_of?(Array)
|
||||
@tags.each do |tag|
|
||||
@albums << category.gallery_albums.where(tagged_ids: tag)
|
||||
end
|
||||
else
|
||||
@albums << category.gallery_albums.where(tagged_ids: @tags)
|
||||
end
|
||||
else
|
||||
@albums << category.gallery_albums.all
|
||||
end
|
||||
end
|
||||
end
|
||||
@output = Array.new
|
||||
@albums.each do |album|
|
||||
@albs = Array.new
|
||||
album.each do |values|
|
||||
tags = Tag.find(values.tagged_ids).map{|t| t.name}
|
||||
category = Category.find(values.category_id).title
|
||||
|
||||
@albs << {"_id"=>values.id,"show_path"=>panel_gallery_front_end_album_path(values),"cover"=>values.cover,"cover_path"=>values.cover_path,"description"=>values.description,"category_name"=>category,"gallery_category_id" => values.category_id,"name"=>values.name,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
|
||||
end
|
||||
@output << @albs
|
||||
end
|
||||
render :json=>@output.to_json
|
||||
end
|
||||
|
||||
def imgs
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
<div class='rgalbum'>
|
||||
<a title='<%= album.name %>' href='<%= panel_gallery_front_end_album_path(album) %>'>
|
||||
<% if album.cover == "default" %>
|
||||
<%= image_tag "gallery/default.jpg" %>
|
||||
<% else %>
|
||||
<img src="<%= album.cover_path %>">
|
||||
<% end %>
|
||||
</a>
|
||||
<span class='albumname'>
|
||||
<a title='<%= album.description %>' href='<%= panel_gallery_front_end_album_path(album) %>'><%= album.name %></a>
|
||||
</span>
|
||||
<span class='categoryname'><i class='icon-folder-close'></i><%= Category.find(album.category_id).title %></span>
|
||||
<span class='tagnames'></span>
|
||||
</div>
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
<div class='rgphoto'>
|
||||
<a title='<%= image.description %>' href='<%= theater_panel_gallery_front_end_album_path(image) %>'>
|
||||
<img src='<%= image.file.thumb.url %>'/>
|
||||
</a>
|
||||
</div>
|
||||
+32
-4
@@ -1,14 +1,42 @@
|
||||
|
||||
|
||||
<%= stylesheet_link_tag "gallery_frontend" %>
|
||||
|
||||
<%#= stylesheet_link_tag "gallery" %>
|
||||
<div id="orbit_gallery" class="rg">
|
||||
|
||||
<div class="rgbody">
|
||||
<div id="imgholder">
|
||||
<% @albums.each do |album| %>
|
||||
<%= render :partial => "album", :object => album %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rghead">
|
||||
<div class="rgfn">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "galleryAPI_frontend" %>
|
||||
<%#= javascript_include_tag "jquery.tinyscrollbar" %>
|
||||
<%= javascript_include_tag "rss" %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||
var gallery = new galleryAPI();
|
||||
gallery.initialize();
|
||||
if(typeof gallery.urlVars['cat']!= "undefined"){
|
||||
gallery.loadArea = "albums";
|
||||
gallery.loadAlbums(gallery.urlVars['cat']);
|
||||
}else if(typeof gallery.urlVars['tag']!= "undefined"){
|
||||
gallery.loadArea = "albums";
|
||||
gallery.loadAlbums(gallery.urlVars['tag']);
|
||||
}else{
|
||||
gallery.loadArea = "albums";
|
||||
gallery.loadAlbums("all");
|
||||
}
|
||||
</script>
|
||||
|
||||
+36
-3
@@ -1,12 +1,45 @@
|
||||
|
||||
<%= stylesheet_link_tag "gallery_frontend" %>
|
||||
|
||||
<div id="orbit_gallery" class="rg">
|
||||
<div class="rgbody">
|
||||
<div id="imgholder">
|
||||
<% @images.each do |image| %>
|
||||
<%= render :partial => "image", :object => image %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- tag part -->
|
||||
<!-- add "album_tags" or "photo_tags" class to .taglist -->
|
||||
<div class="taglist">
|
||||
<h3 class="taglist_title"><%= t('gallery.album_tag') %></h3>
|
||||
<ul>
|
||||
<% @tags.each do |tag|%>
|
||||
<li><%= tag %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- tag end -->
|
||||
<div class="form-actions form-fixed pagination-right rghead">
|
||||
<div class="rgfn">
|
||||
<a class="bt-back rgbt" title="<%= I18n.t("gallery.back_to_albums") %>" href="<%= panel_gallery_front_end_albums_path %>"><i class="icon-arrow-left"></i> <%= I18n.t("gallery.back_to_albums") %></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "galleryAPI_frontend" %>
|
||||
<%#= javascript_include_tag "jquery.tinyscrollbar" %>
|
||||
<%= javascript_include_tag "rss" %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||
var gallery = new galleryAPI();
|
||||
gallery.initialize();
|
||||
gallery.loadArea = "images";
|
||||
gallery.loadImages("<%= params[:id] %>");
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ module Gallery
|
||||
|
||||
customize_widget "widget1" do
|
||||
widget_i18n "gallery.widget.widget1"
|
||||
style ["1","2"]
|
||||
style []
|
||||
options "vertical",:i18n => "gallery.widget_option.vertical",:options_item=>[1, 2]
|
||||
options "horizontal",:i18n => "gallery.widget_option.horizontal",:options_item=>[1, 2,3,4,5,6]
|
||||
options "album_id",:i18n =>"gallery.album",:options_item => {"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}
|
||||
|
||||
-1
@@ -50,7 +50,6 @@ module Videos
|
||||
#* customize_widget_options_fields_i18n({"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal", "album_id"=>"gallery.album"}} )
|
||||
customize_widget "channel_videos" do
|
||||
widget_i18n "videos.widget.channel_videos"
|
||||
style ["1","2"]
|
||||
options "channel_videos",:i18n =>"videos.channel_videos",:options_item => {"query"=>"ChannelVideo.all", "value"=>:id, "label"=>:channel_name}
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user