Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e11a46112 | ||
|
|
49217d4705 |
No files matched your search
@@ -541,6 +541,8 @@ function changeStatusHidden() {
|
||||
|
||||
// Document Ready
|
||||
$(function() {
|
||||
showFiltersOnPageRefresh();
|
||||
|
||||
new ini();
|
||||
$('#main-wrap').on('click', '.delete', function() {
|
||||
api.modal($(this).attr('rel'));
|
||||
@@ -589,4 +591,35 @@ $(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) : linkSetting(element.data('id'), _edit, pageslide);
|
||||
_type == 'page' ? pageSetting(element.data('id'), _edit, pageslide) : linkSetting(element.data('id'), _edit, pageslide);
|
||||
}
|
||||
});
|
||||
$iFrame.pageslide({
|
||||
@@ -135,7 +135,8 @@ function iFrameContent() {
|
||||
iFrameFunction($iContents, $pc);
|
||||
});
|
||||
}
|
||||
function pageSetting(id, edit) {
|
||||
|
||||
function pageSetting(id, edit, ps) {
|
||||
$pageModule = $('#pageslide #page_module_app_id');
|
||||
$pageF2E = $('#pageslide #page_app_frontend_url');
|
||||
$pageDivF2E = $('#pageslide #front_url');
|
||||
@@ -183,23 +184,25 @@ function pageSetting(id, edit) {
|
||||
|
||||
if(val.category.length > 0) {
|
||||
$.each(val.category, function(index, val) {
|
||||
var _arr = $.inArray($(this)[1], _selectData.module.category[1]);
|
||||
var _arr = $.inArray($(this)[1], _selectData.module.category);
|
||||
$pageCategory.append('<label class="checkbox"><input type="checkbox" name="page[category][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
|
||||
if(!_selectData.module.category[0] && _arr !== -1) {
|
||||
if(_arr !== -1) {
|
||||
$pageCategory.find('input[type="checkbox"]').eq(index).prop('checked', true);
|
||||
}
|
||||
_selectData.module.category[0] ? $pageCategory.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
|
||||
var $all = $pageCategory.siblings('.checkbox').children('.select_all')
|
||||
_selectData.module.category.length > 1 && _selectData.module.category.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
|
||||
});
|
||||
$pageCategoryGroup.show();
|
||||
}
|
||||
if(val.tags.length > 0) {
|
||||
$.each(val.tags, function(index, val) {
|
||||
var _arr = $.inArray($(this)[1], _selectData.module.tags[1]);
|
||||
var _arr = $.inArray($(this)[1], _selectData.module.tags);
|
||||
$pageTags.append('<label class="checkbox"><input type="checkbox" name="page[tag][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
|
||||
if(!_selectData.module.tags[0] && _arr !== -1) {
|
||||
if(_arr !== -1) {
|
||||
$pageTags.find('input[type="checkbox"]').eq(index).prop('checked', true);
|
||||
}
|
||||
_selectData.module.tags[0] ? $pageTags.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
|
||||
var $all = $pageTags.siblings('.checkbox').children('.select_all')
|
||||
_selectData.module.tags.length > 1 && _selectData.module.tags.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
|
||||
});
|
||||
$pageTagsGroup.show();
|
||||
}
|
||||
@@ -397,12 +400,13 @@ $(function() {
|
||||
if(val.category.length > 0) {
|
||||
$.each(val.category, function(index, val) {
|
||||
if(val !== 0) {
|
||||
var _arr = _select ? $.inArray($(this)[1], _select.category[1]) : '';
|
||||
var _arr = _select ? $.inArray($(this)[1], _select.category) : '';
|
||||
$pageCategory.append('<label class="checkbox"><input type="checkbox" name="page[category][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
|
||||
if(_select && !_select.category[0] && _arr !== -1) {
|
||||
if(_boolean && _arr !== -1) {
|
||||
$pageCategory.find('input[type="checkbox"]').eq(index).prop('checked', true);
|
||||
}
|
||||
_select && _val == _select.main && _select.category[0] ? $pageCategory.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
|
||||
var $all = $pageCategory.siblings('.checkbox').children('.select_all');
|
||||
_boolean && _val == _select.main && _select.category.length > 1 && _select.category.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
|
||||
}
|
||||
});
|
||||
$pageCategoryGroup.show();
|
||||
@@ -413,12 +417,13 @@ $(function() {
|
||||
if(val.tags.length > 0) {
|
||||
$.each(val.tags, function(index, val) {
|
||||
if(val !== 0) {
|
||||
var _arr = _select ? $.inArray($(this)[1], _select.tags[1]) : '';
|
||||
var _arr = _select ? $.inArray($(this)[1], _select.tags) : '';
|
||||
$pageTags.append('<label class="checkbox"><input type="checkbox" name="page[tag][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
|
||||
if(_select && !_select.tags[0] && _arr !== -1) {
|
||||
if(_boolean && _arr !== -1) {
|
||||
$pageTags.find('input[type="checkbox"]').eq(index).prop('checked', true);
|
||||
}
|
||||
_select && _val == _select.main && _select.tags[0] ? $pageTags.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
|
||||
var $all = $pageTags.siblings('.checkbox').children('.select_all');
|
||||
_boolean && _val == _select.main && _select.tags.length > 1 && _select.tags.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
|
||||
}
|
||||
});
|
||||
$pageTagsGroup.show();
|
||||
@@ -451,12 +456,16 @@ $(function() {
|
||||
|
||||
$('#pageslide').on('change', '.checkbox-groups input', function(event) {
|
||||
var $checked = $(this);
|
||||
|
||||
if($checked.attr('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.hasClass('select_all')) {
|
||||
if($checked.prop('checked')) {
|
||||
$checked.closest('.checkbox').siblings('.groups').find('input[type="checkbox"]').prop('checked', true);
|
||||
} else {
|
||||
$checked.closest('.checkbox').siblings('.groups').find('input[type="checkbox"]').prop('checked', false);
|
||||
}
|
||||
} else if($checked.hasClass('lang-enable')) {
|
||||
var checkboxes = $checked.closest('.groups').find('input[type="checkbox"]');
|
||||
if($checked.prop('checked')) {
|
||||
$checked.closest('.active-link').addClass('active').siblings('active-link').removeClass('active').end().find('.active-mune').slideDown(300);
|
||||
if(_status) {
|
||||
@@ -470,6 +479,14 @@ $(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)
|
||||
};
|
||||
}
|
||||
return false;
|
||||
} else if($checked.attr('type') == 'radio' && !$(this).closest('div').hasClass('active-mune')) {
|
||||
|
||||
@@ -60,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? ? [0, page.category.map{|c| c.to_s}] : [1]
|
||||
m["tags"] = page.tag.present? ? [0, page.tag.map{|c| c.to_s}] : [1]
|
||||
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["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]
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
<ul class="nav nav-pills filter-nav pull-right">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
<a href="#collapse-role" 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-status">
|
||||
<div class="accordion-body collapse" id="collapse-role">
|
||||
|
||||
<%= render :partial => "filter"%>
|
||||
|
||||
|
||||
+2
-23
@@ -41,32 +41,11 @@ var galleryAPI = function(){
|
||||
|
||||
}
|
||||
|
||||
this.loadAlbums = function(id){
|
||||
this.loadAlbums = function(cids){
|
||||
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){
|
||||
$.getJSON("/panel/gallery/front_end/get_albums",{"cid":cids,"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') %>")
|
||||
|
||||
Vendored
+4
-29
@@ -1,5 +1,6 @@
|
||||
class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
||||
def index
|
||||
@categories = params[:category_id]
|
||||
end
|
||||
|
||||
def show
|
||||
@@ -9,36 +10,10 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
||||
|
||||
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
|
||||
@albums << GalleryAlbum.where(:category_id.in => @categoryids)
|
||||
|
||||
|
||||
@output = Array.new
|
||||
@albums.each do |album|
|
||||
@albs = Array.new
|
||||
|
||||
+3
-10
@@ -27,16 +27,9 @@
|
||||
<script type="text/javascript">
|
||||
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||
var gallery = new galleryAPI();
|
||||
var categories = <%= @categories.to_json.html_safe %>;
|
||||
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");
|
||||
}
|
||||
gallery.loadArea = "albums";
|
||||
gallery.loadAlbums(categories);
|
||||
</script>
|
||||
|
||||
+1
-4
@@ -18,10 +18,7 @@
|
||||
</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>
|
||||
|
||||
|
||||
Reference in new issue
Block a user