forked from saurabh/orbit4-5
Tags & Categories
This commit is contained in:
parent
745790244a
commit
0f0e17ef00
|
@ -0,0 +1,21 @@
|
|||
$(function() {
|
||||
$.pageslide.closeCallback(function(pageslide, item) {
|
||||
$('.filter-item').removeClass("active");
|
||||
});
|
||||
$.pageslide.loadComplete(function(pageslide, item) {
|
||||
$('.filter-item').removeClass("active");
|
||||
item.closest('li').addClass('active');
|
||||
if(item.data('id') == 'new') {
|
||||
resetForm();
|
||||
pageslide.find('form').attr('action', '/admin/module_apps/' + item.data('module') + '/categories/');
|
||||
pageslide.find('form').attr('method', 'post');
|
||||
}
|
||||
else {
|
||||
setForm(item.data('form'));
|
||||
pageslide.find('form').attr('action', '/admin/module_apps/' + item.data('module') + '/categories/' + item.data('id'));
|
||||
pageslide.find('form').attr('method', 'put');
|
||||
console.log(item.data('disable'));
|
||||
pageslide.find('input[type="checkbox"]').prop( 'checked', item.data('disable') );
|
||||
}
|
||||
});
|
||||
})
|
|
@ -1,21 +1,40 @@
|
|||
//= require lib/tags
|
||||
|
||||
$(function() {
|
||||
$('a[data-toggle="tab"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).tab('show');
|
||||
});
|
||||
|
||||
// $('#tags-list .filter-item.default .card').click(function(){
|
||||
// $('#removeDefaults').attr('rel', "<%= Rails.application.routes.url_helpers.remove_default_admin_tags_path %>" + "?module_app_id=" + $('#module_app_id').val() + "&ids=" + ids);
|
||||
// $('#removeDefaults').removeClass('hide');
|
||||
// console.log("@@");
|
||||
// });
|
||||
|
||||
$.pageslide.closeCallback(function(pageslide, item) {
|
||||
$('.filter-item').removeClass("active");
|
||||
});
|
||||
|
||||
$.pageslide.loadComplete(function(pageslide, item) {
|
||||
|
||||
$('.filter-item').removeClass("active");
|
||||
|
||||
item.closest('li').addClass('active');
|
||||
|
||||
if(item.hasClass('btn')) {
|
||||
$('#filter-default-tag').fastLiveFilter('.add-default-tags-list', '.filter-item', '.tag');
|
||||
}
|
||||
|
||||
if(item.data('id') == 'new') {
|
||||
resetForm();
|
||||
pageslide.find('form').attr('action', '/admin/tags/');
|
||||
pageslide.find('form').attr('method', 'post');
|
||||
}
|
||||
else {
|
||||
pageslide.find('form:eq(0)').attr('action', window.location.pathname);
|
||||
pageslide.find('form:eq(0)').attr('method', 'post');
|
||||
}else {
|
||||
setForm(item.data('form'));
|
||||
pageslide.find('form').attr('action', '/admin/tags/' + item.data('id'));
|
||||
pageslide.find('form').attr('method', 'put');
|
||||
pageslide.find('form:eq(0)').attr('action', window.location.pathname + '/' + item.data('id'));
|
||||
pageslide.find('form:eq(0)').attr('method', 'put');
|
||||
}
|
||||
|
||||
});
|
||||
})
|
|
@ -26,9 +26,9 @@ CKEDITOR.editorConfig = function( config ) {
|
|||
// config.filebrowserImageBrowseUrl = '/browser/browse.php?type=Images';
|
||||
// config.filebrowserUploadUrl = '/uploader/upload.php';
|
||||
|
||||
config.filebrowserBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path(:module_app_id=>ModuleApp.where(:key=>'asset').first.id) %>";
|
||||
config.filebrowserImageBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path(:type=>'image',:module_app_id=>ModuleApp.where(:key=>'asset').first.id) %>";
|
||||
// config.filebrowserUploadUrl = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>";
|
||||
config.filebrowserBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path(:module_app_id=>ModuleApp.where(:key=>'asset').first.id) rescue '' %>";
|
||||
config.filebrowserImageBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path(:type=>'image',:module_app_id=>ModuleApp.where(:key=>'asset').first.id) rescue '' %>";
|
||||
// config.filebrowserUploadUrl = "<%#= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>";
|
||||
|
||||
// config.contentsCss = '/orbit_4.0.1/assets/javascripts/lib/ckeditor/plugins/stylesheetparser/samples/assets/sample.css';
|
||||
|
||||
|
|
|
@ -1,207 +1,209 @@
|
|||
function checkTagsQuantity() {
|
||||
var $tagLead = $('.tag-lead'),
|
||||
$tagsGroups = $('.tags-groups');
|
||||
var $tagLead = $('.tag-lead'),
|
||||
$tagsGroups = $('.tags-groups');
|
||||
|
||||
$tagsGroups.each(function(i) {
|
||||
var $children = $(this).children().length;
|
||||
$tagLead.eq(i).children('.badge').text($children);
|
||||
})
|
||||
$tagsGroups.each(function(i) {
|
||||
var $children = $(this).children().length;
|
||||
$tagLead.eq(i).children('.badge').text($children);
|
||||
})
|
||||
}
|
||||
|
||||
function checkedLength() {
|
||||
var $tagsList = $('#tags-list'),
|
||||
$moduleTags,
|
||||
$defaultTags,
|
||||
$toDefault;
|
||||
function reload_links() {
|
||||
if($('.default-tags').length) {
|
||||
$moduleTags = $('.module-tags input[type="checkbox"]:checked');
|
||||
$defaultTags = $('.default-tags input[type="checkbox"]:checked');
|
||||
var $tagsList = $('#tags-list'),
|
||||
$moduleTags,
|
||||
$defaultTags,
|
||||
$toDefault;
|
||||
function reload_links() {
|
||||
if($('.default-tags').length) {
|
||||
$moduleTags = $('.module-tags input[type="checkbox"]:checked');
|
||||
$defaultTags = $('.default-tags input[type="checkbox"]:checked');
|
||||
|
||||
if($moduleTags.length > 1 || $moduleTags.length+$defaultTags.length > 1) {
|
||||
$('#mergerTags').removeClass('hide');
|
||||
} else {
|
||||
$('#mergerTags').addClass('hide');
|
||||
};
|
||||
if($moduleTags.length > 1 || $moduleTags.length+$defaultTags.length > 1) {
|
||||
$('#mergerTags').removeClass('hide');
|
||||
} else {
|
||||
$('#mergerTags').addClass('hide');
|
||||
};
|
||||
} else {
|
||||
$moduleTags = $('li.module input[type="checkbox"]:checked');
|
||||
$defaultTags = $('li.default input[type="checkbox"]:checked');
|
||||
|
||||
if ($moduleTags.length > 0 || $defaultTags.length > 0) {
|
||||
$('#deselect').removeClass('hide');
|
||||
var ids = new Array();
|
||||
$defaultTags.each(function(i) {
|
||||
ids.push($defaultTags.eq(i).parent().siblings('.tag_id').val());
|
||||
});
|
||||
$moduleTags.each(function(i) {
|
||||
ids.push($moduleTags.eq(i).parent().siblings('.tag_id').val());
|
||||
});
|
||||
$('#deleteTags').attr('rel', "<%= Rails.application.routes.url_helpers.delete_tags_admin_tags_path %>" + "?ids=" + ids);
|
||||
$('#deleteTags').removeClass('hide');
|
||||
$('#deselect').on('click', deselect);
|
||||
} else {
|
||||
$('#deselect').addClass('hide');
|
||||
$('#deleteTags').attr('rel', "");
|
||||
$('#deleteTags').addClass('hide');
|
||||
$('#deselect').off('click', deselect);
|
||||
};
|
||||
if($defaultTags.length > 0 || $moduleTags.length > 0) {
|
||||
$('#deselect').removeClass('hide');
|
||||
$('#deselect').on('click', deselect);
|
||||
if($defaultTags.length > 0 && $moduleTags.length > 0) {
|
||||
$('#deleteTags').attr('rel', "");
|
||||
$('#deleteTags').addClass('hide');
|
||||
$('#removeDefaults').attr('rel', "");
|
||||
$('#removeDefaults').addClass('hide');
|
||||
$('#mergerTags').addClass('hide');
|
||||
} else if ($defaultTags.length > 0) {
|
||||
var ids = new Array();
|
||||
$defaultTags.each(function(i) {
|
||||
ids.push($defaultTags.eq(i).parent().siblings('.tag_id').val());
|
||||
});
|
||||
$('#removeDefaults').attr('href', "<%= Rails.application.routes.url_helpers.remove_default_admin_tags_path %>" + "?module_app_id=" + $('#module_app_id').val() + "&ids=" + ids);
|
||||
$('#removeDefaults').removeClass('hide');
|
||||
} else {
|
||||
var ids = new Array();
|
||||
$moduleTags.each(function(i) {
|
||||
ids.push($moduleTags.eq(i).parent().siblings('.tag_id').val());
|
||||
});
|
||||
$('#deleteTags').attr('rel', "<%= Rails.application.routes.url_helpers.delete_tags_admin_tags_path %>" + "?ids=" + ids);
|
||||
$('#deleteTags').removeClass('hide');
|
||||
if($moduleTags.length > 1) {
|
||||
$('#mergerTags').removeClass('hide');
|
||||
} else {
|
||||
$('#mergerTags').addClass('hide');
|
||||
};
|
||||
};
|
||||
} else {
|
||||
$('#deselect').addClass('hide');
|
||||
$('#deleteTags').attr('rel', "");
|
||||
$('#deleteTags').addClass('hide');
|
||||
$('#removeDefaults').attr('rel', "");
|
||||
$('#removeDefaults').addClass('hide');
|
||||
$('#mergerTags').addClass('hide');
|
||||
$('#deselect').off('click', deselect);
|
||||
};
|
||||
};
|
||||
|
||||
if ($moduleTags.length > 0 && $defaultTags.length == 0) {
|
||||
var ids = new Array();
|
||||
$moduleTags.each(function(i) {
|
||||
ids.push($moduleTags.eq(i).parent().siblings('.tag_id').val());
|
||||
});
|
||||
$('#addDefault').attr('href', "<%= Rails.application.routes.url_helpers.add_to_default_admin_tags_path %>" + "?ids=" + ids);
|
||||
$('#addDefault').removeClass('hide');
|
||||
} else {
|
||||
$('#addDefault').attr('href', "");
|
||||
$('#addDefault').addClass('hide');
|
||||
};
|
||||
} else {
|
||||
$moduleTags = $('.module-tags li.module input[type="checkbox"]:checked');
|
||||
$defaultTags = $('.module-tags li.default input[type="checkbox"]:checked');
|
||||
if($defaultTags.length > 0 || $moduleTags.length > 0) {
|
||||
$('#deselect').removeClass('hide');
|
||||
$('#deselect').on('click', deselect);
|
||||
if($defaultTags.length > 0 && $moduleTags.length > 0) {
|
||||
$('#deleteTags').attr('rel', "");
|
||||
$('#deleteTags').addClass('hide');
|
||||
$('#removeDefaults').attr('rel', "");
|
||||
$('#removeDefaults').addClass('hide');
|
||||
$('#mergerTags').addClass('hide');
|
||||
} else if ($defaultTags.length > 0) {
|
||||
var ids = new Array();
|
||||
$defaultTags.each(function(i) {
|
||||
ids.push($defaultTags.eq(i).parent().siblings('.tag_id').val());
|
||||
});
|
||||
$('#removeDefaults').attr('rel', "<%= Rails.application.routes.url_helpers.remove_default_admin_tags_path %>" + "?module_app_id=" + $('#module_app_id').val() + "&ids=" + ids);
|
||||
$('#removeDefaults').removeClass('hide');
|
||||
} else {
|
||||
var ids = new Array();
|
||||
$moduleTags.each(function(i) {
|
||||
ids.push($moduleTags.eq(i).parent().siblings('.tag_id').val());
|
||||
});
|
||||
$('#deleteTags').attr('rel', "<%= Rails.application.routes.url_helpers.delete_tags_admin_tags_path %>" + "?module_app_id=" + $('#module_app_id').val() + "&ids=" + ids);
|
||||
$('#deleteTags').removeClass('hide');
|
||||
if($moduleTags.length > 1) {
|
||||
$('#mergerTags').removeClass('hide');
|
||||
} else {
|
||||
$('#mergerTags').addClass('hide');
|
||||
};
|
||||
};
|
||||
} else {
|
||||
$('#deselect').addClass('hide');
|
||||
$('#deleteTags').attr('rel', "");
|
||||
$('#deleteTags').addClass('hide');
|
||||
$('#removeDefaults').attr('rel', "");
|
||||
$('#removeDefaults').addClass('hide');
|
||||
$('#mergerTags').addClass('hide');
|
||||
$('#deselect').off('click', deselect);
|
||||
};
|
||||
};
|
||||
}
|
||||
$tagsList.delegate('.card', 'click', function() {
|
||||
reload_links();
|
||||
});
|
||||
$('#selectAllTags').on('click', function() {
|
||||
$('.filter-item:not(".mark") input[type="checkbox"]').attr('checked', true);
|
||||
$('.filter-item:not(".mark") .card').addClass('active');
|
||||
reload_links();
|
||||
});
|
||||
$('#deleteTags').on('click', function() {
|
||||
$('#delete_tags .tags-groups').empty();
|
||||
if ($moduleTags.length > 0 && $defaultTags.length == 0) {
|
||||
var ids = new Array();
|
||||
$moduleTags.each(function(i) {
|
||||
ids.push($moduleTags.eq(i).parent().siblings('.tag_id').val());
|
||||
});
|
||||
$('#addDefault').attr('href', "<%= Rails.application.routes.url_helpers.add_to_default_admin_tags_path %>" + "?ids=" + ids);
|
||||
$('#addDefault').removeClass('hide');
|
||||
} else {
|
||||
$('#addDefault').attr('href', "");
|
||||
$('#addDefault').addClass('hide');
|
||||
};
|
||||
|
||||
if ($moduleTags.length > 0 || $defaultTags.length > 0) {
|
||||
$('#deselect').removeClass('hide');
|
||||
var ids = new Array();
|
||||
$defaultTags.each(function(i) {
|
||||
ids.push($defaultTags.eq(i).parent().siblings('.tag_id').val());
|
||||
});
|
||||
|
||||
$moduleTags.each(function(i) {
|
||||
ids.push($moduleTags.eq(i).parent().siblings('.tag_id').val());
|
||||
});
|
||||
$('#deleteTags').attr('rel', "<%= Rails.application.routes.url_helpers.delete_tags_admin_tags_path %>" + "?ids=" + ids);
|
||||
$('#deleteTags').removeClass('hide');
|
||||
$('#deselect').on('click', deselect);
|
||||
} else {
|
||||
$('#deselect').addClass('hide');
|
||||
$('#deleteTags').attr('rel', "");
|
||||
$('#deleteTags').addClass('hide');
|
||||
$('#deselect').off('click', deselect);
|
||||
};
|
||||
}
|
||||
$tagsList.delegate('.card', 'click', function() {
|
||||
reload_links();
|
||||
});
|
||||
$('#selectAllTags').on('click', function() {
|
||||
$('.filter-item:not(".mark") input[type="checkbox"]').attr('checked', true);
|
||||
$('.filter-item:not(".mark") .card').addClass('active');
|
||||
reload_links();
|
||||
});
|
||||
$('#deleteTags').on('click', function() {
|
||||
$('#delete_tags .tags-groups').empty();
|
||||
$('#delete_tags a.delete-tags').attr("href", $(this).attr("rel"));
|
||||
if($defaultTags) {
|
||||
$defaultTags.each(function(i) {
|
||||
$defaultTags.eq(i).parents('.filter-item').clone().appendTo('#delete_tags .tags-groups');
|
||||
$('#delete_tags .tags-groups .filter-item').addClass('def');
|
||||
});
|
||||
}
|
||||
$moduleTags.each(function(i) {
|
||||
$moduleTags.eq(i).parents('.filter-item').clone().appendTo('#delete_tags .tags-groups');
|
||||
});
|
||||
$defaultTags.each(function(i) {
|
||||
$defaultTags.eq(i).parents('.filter-item').clone().appendTo('#delete_tags .tags-groups');
|
||||
$('#delete_tags .tags-groups .filter-item').addClass('def');
|
||||
});
|
||||
}
|
||||
$moduleTags.each(function(i) {
|
||||
$moduleTags.eq(i).parents('.filter-item').clone().appendTo('#delete_tags .tags-groups');
|
||||
});
|
||||
$('#delete_tags').modal('show', cleanTagInputs());
|
||||
function cleanTagInputs(){
|
||||
var $tagsDelete = $('#delete_tags'),
|
||||
$filterItem = $tagsDelete.find('.filter-item');
|
||||
$filterItem.find('.card, .amount').remove();
|
||||
$filterItem.find('a').removeAttr('class');
|
||||
$filterItem.find('a').removeAttr('href');
|
||||
var $tagsDelete = $('#delete_tags'),
|
||||
$filterItem = $tagsDelete.find('.filter-item');
|
||||
$filterItem.find('.card, .amount').remove();
|
||||
$filterItem.find('a').removeAttr('class');
|
||||
$filterItem.find('a').removeAttr('href');
|
||||
}
|
||||
});
|
||||
$('#mergerTags').on('click', function() {
|
||||
if($moduleTags || $defaultTags) {
|
||||
if($moduleTags.length > 1 || $moduleTags.length+$defaultTags.length > 1) {
|
||||
$('#tags-merger form').attr("action", $(this).attr("rel"));
|
||||
mergerTags()
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#removeDefaults').on('click', function() {
|
||||
$('#remove_defaults .tags-groups').empty();
|
||||
});
|
||||
$('#mergerTags').on('click', function() {
|
||||
if($moduleTags || $defaultTags) {
|
||||
if($moduleTags.length > 1 || $moduleTags.length+$defaultTags.length > 1) {
|
||||
$('#tags-merger form').attr("action", $(this).attr("rel"));
|
||||
mergerTags()
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#removeDefaults').on('click', function() {
|
||||
$('#remove_defaults .tags-groups').empty();
|
||||
$('#remove_defaults a.remove-defaults').attr("href", $(this).attr("rel"));
|
||||
$defaultTags.each(function(i) {
|
||||
$defaultTags.eq(i).parents('.filter-item').clone().appendTo('#remove_defaults .tags-groups');
|
||||
});
|
||||
$defaultTags.each(function(i) {
|
||||
$defaultTags.eq(i).parents('.filter-item').clone().appendTo('#remove_defaults .tags-groups');
|
||||
});
|
||||
$('#remove_defaults').modal('show', cleanTagInputs());
|
||||
function cleanTagInputs(){
|
||||
var $removeDefaults = $('#remove_defaults'),
|
||||
$filterItem = $removeDefaults.find('.filter-item');
|
||||
$filterItem.find('.card, .amount').remove();
|
||||
$filterItem.find('a').removeAttr('class');
|
||||
$filterItem.find('a').removeAttr('href');
|
||||
var $removeDefaults = $('#remove_defaults'),
|
||||
$filterItem = $removeDefaults.find('.filter-item');
|
||||
$filterItem.find('.card, .amount').remove();
|
||||
$filterItem.find('a').removeAttr('class');
|
||||
$filterItem.find('a').removeAttr('href');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function deselect() {
|
||||
$('.tags input[type="checkbox"]').attr('checked', false);
|
||||
$('.card').removeClass('active');
|
||||
$('.bottomnav .toggable').not('.open-slide').addClass('hide');
|
||||
$('#deleteTags').attr('rel', "<%= Rails.application.routes.url_helpers.delete_tags_admin_tags_path %>");
|
||||
$('#addDefault').attr('href', "<%= Rails.application.routes.url_helpers.add_to_default_admin_tags_path %>");
|
||||
}
|
||||
function deselect() {
|
||||
$('.tags input[type="checkbox"]').attr('checked', false);
|
||||
$('.card').removeClass('active');
|
||||
$('.bottomnav .toggable').not('.open-slide').addClass('hide');
|
||||
$('#deleteTags').attr('rel', "<%= Rails.application.routes.url_helpers.delete_tags_admin_tags_path %>");
|
||||
$('#addDefault').attr('href', "<%= Rails.application.routes.url_helpers.add_to_default_admin_tags_path %>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addTagsTab() {
|
||||
$('a[data-toggle="tab"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).tab('show');
|
||||
})
|
||||
$('a[data-toggle="tab"]').click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).tab('show');
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function mergerTags() {
|
||||
var $moduleTags = $('.module-tags input[type="checkbox"]:checked'),
|
||||
$defaultTags = $('.default-tags input[type="checkbox"]:checked');
|
||||
var $moduleTags = $('.module-tags input[type="checkbox"]:checked'),
|
||||
$defaultTags = $('.default-tags input[type="checkbox"]:checked');
|
||||
|
||||
$defaultTags.each(function(i) {
|
||||
$defaultTags.eq(i).parents('.filter-item').clone().appendTo('#tags-merger .tags-groups');
|
||||
$('#tags-merger .tags-groups .filter-item').addClass('def');
|
||||
});
|
||||
$moduleTags.each(function(i) {
|
||||
$moduleTags.eq(i).parents('.filter-item').clone().appendTo('#tags-merger .tags-groups');
|
||||
});
|
||||
$defaultTags.each(function(i) {
|
||||
$defaultTags.eq(i).parents('.filter-item').clone().appendTo('#tags-merger .tags-groups');
|
||||
$('#tags-merger .tags-groups .filter-item').addClass('def');
|
||||
});
|
||||
$moduleTags.each(function(i) {
|
||||
$moduleTags.eq(i).parents('.filter-item').clone().appendTo('#tags-merger .tags-groups');
|
||||
});
|
||||
|
||||
$('#tags-merger').modal('show', changeTagName());
|
||||
function changeTagName() {
|
||||
var $tagsMerger = $('#tags-merger'),
|
||||
$newTagsName = $('.new-tags-name'),
|
||||
$filterItem = $tagsMerger.find('.filter-item');
|
||||
$filterItem.find('.card, .amount').remove();
|
||||
$filterItem.find('a').removeAttr('class');
|
||||
$filterItem.find('a').removeAttr('href');
|
||||
$filterItem.on('click', function() {
|
||||
$(this).find('.tag').each(function(i) {
|
||||
$newTagsName.eq(i).val($(this).text())
|
||||
});
|
||||
});
|
||||
}
|
||||
$('#tags-merger').modal('show', changeTagName());
|
||||
function changeTagName() {
|
||||
var $tagsMerger = $('#tags-merger'),
|
||||
$newTagsName = $('.new-tags-name'),
|
||||
$filterItem = $tagsMerger.find('.filter-item');
|
||||
$filterItem.find('.card, .amount').remove();
|
||||
$filterItem.find('a').removeAttr('class');
|
||||
$filterItem.find('a').removeAttr('href');
|
||||
$filterItem.on('click', function() {
|
||||
$(this).find('.tag').each(function(i) {
|
||||
$newTagsName.eq(i).val($(this).text())
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
if($('.default-tags').length) {
|
||||
checkedLength();
|
||||
$('#tags-merger').on('hidden', function () {
|
||||
$(this).find('.filter-item').remove();
|
||||
});
|
||||
} else {
|
||||
checkedLength();
|
||||
};
|
||||
if($('.default-tags').length) {
|
||||
checkedLength();
|
||||
$('#tags-merger').on('hidden', function () {
|
||||
$(this).find('.filter-item').remove();
|
||||
});
|
||||
} else {
|
||||
checkedLength();
|
||||
};
|
||||
});
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
// Place all the styles related to the admin/categories controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
/*
|
||||
*= require lib/tags-groups
|
||||
*/
|
|
@ -55,6 +55,16 @@
|
|||
.tags-groups li.active .amount {
|
||||
color: #8cb8be;
|
||||
}
|
||||
.tags-groups li.add {
|
||||
background-color: #cccccc;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tags-groups li.add a{
|
||||
color: #333333;
|
||||
}
|
||||
.tags-groups li.disabled {
|
||||
background-color: #707070;
|
||||
}
|
||||
.tags-groups li a {
|
||||
text-decoration: none;
|
||||
color: #ededed;
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
class Admin::CategoriesController < OrbitAdminController
|
||||
before_action :setup_vars
|
||||
|
||||
def index
|
||||
unless @module_app.nil?
|
||||
@categories = Kaminari.paginate_array(@module_app.categories).page(params[:page]).per(10)
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
category = @module_app.categories.build(category_params)
|
||||
category.save
|
||||
redirect_to request.referer, :status => 303
|
||||
end
|
||||
|
||||
def create_in_form
|
||||
@category = @module_app.categories.build(category_params)
|
||||
@category.save
|
||||
render :json => {:id=>@category.id.to_s, :title=>@category.title}.to_json ,:layout => false
|
||||
end
|
||||
|
||||
def update
|
||||
@category = Category.find(params[:id])
|
||||
@category.update_attributes(category_params)
|
||||
redirect_to request.referer, :status => 303
|
||||
end
|
||||
|
||||
def toggle
|
||||
category = Category.find(params[:id])
|
||||
category.disable = category.disable ? false : true
|
||||
category.save!
|
||||
redirect_to request.referer, :status => 303
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def setup_vars
|
||||
@module_apps = params[:module_app_id].blank? ? ModuleApp.where(categorizable: true) : [ModuleApp.find(params[:module_app_id])]
|
||||
@module_app = params[:module_app_id].blank? ? ModuleApp.find_by(:key=>'category') : ModuleApp.find(params[:module_app_id])
|
||||
end
|
||||
|
||||
def category_params
|
||||
params.require(:category).permit!
|
||||
end
|
||||
|
||||
end
|
|
@ -1,39 +1,31 @@
|
|||
class Admin::TagsController < ApplicationController
|
||||
class Admin::TagsController < OrbitAdminController
|
||||
before_filter :setup_vars
|
||||
|
||||
layout "back_end"
|
||||
|
||||
def index
|
||||
@tag = Tag.new
|
||||
@tags = Tag.where(:is_default=>true)
|
||||
@module_apps = ModuleApp.where(taggable: true)
|
||||
end
|
||||
|
||||
def new
|
||||
@tag = Tag.new
|
||||
render layout: false
|
||||
end
|
||||
|
||||
def edit
|
||||
@tag = Tag.find(params[:id])
|
||||
render layout: false
|
||||
@tags = @is_module_tag ? @module_app.tags.where(:is_default=>true) : Tag.where(:is_default=>true)
|
||||
@default_tags = Tag.where(:is_default=>true).not_in(:id => @module_app.tag_ids)
|
||||
end
|
||||
|
||||
def create
|
||||
@tag = Tag.new(tag_params.merge(is_default: true))
|
||||
if @tag.save
|
||||
redirect_to admin_tags_url
|
||||
else
|
||||
@tag = Tag.new(tag_params)
|
||||
flash.now[:error] = t('create.error.tag')
|
||||
render :action => "new"
|
||||
end
|
||||
@tag = Tag.new(tag_params.merge(is_default: !@is_module_tag))
|
||||
if @tag.save
|
||||
@module_app.tags << @tag if @is_module_tag
|
||||
end
|
||||
redirect_to request.referer, :status => 303
|
||||
end
|
||||
|
||||
def create_in_form
|
||||
@tag = Tag.new(tag_params.merge(is_default: !@is_module_tag))
|
||||
@tag.save
|
||||
@module_app.tags << @tag
|
||||
render :json => {:id=>@tag.id.to_s, :name=>@tag.name}.to_json ,:layout => false
|
||||
end
|
||||
|
||||
def update
|
||||
@tag = Tag.find(params[:id])
|
||||
if @tag.update_attributes(tag_params)
|
||||
redirect_to action: :index, :status => 303
|
||||
redirect_to request.referer, :status => 303
|
||||
else
|
||||
flash.now[:error] = t('update.error.tag')
|
||||
render :action => "edit"
|
||||
|
@ -45,7 +37,15 @@ class Admin::TagsController < ApplicationController
|
|||
if tags
|
||||
tags.each(&:destroy)
|
||||
end
|
||||
redirect_to admin_tags_url
|
||||
redirect_to request.referer, :status => 303
|
||||
end
|
||||
|
||||
def add_from_default
|
||||
tags = Tag.find(params[:ids].split(',')) rescue nil
|
||||
if tags
|
||||
@module_app.tags << tags
|
||||
end
|
||||
redirect_to request.referer, :status => 303
|
||||
end
|
||||
|
||||
def add_to_default
|
||||
|
@ -55,7 +55,17 @@ class Admin::TagsController < ApplicationController
|
|||
tag.update_attribute(:is_default, true)
|
||||
end
|
||||
end
|
||||
redirect_to admin_tags_url
|
||||
redirect_to request.referer, :status => 303
|
||||
end
|
||||
|
||||
def remove_default
|
||||
tags = Tag.find(params[:ids].split(',')) rescue nil
|
||||
if tags
|
||||
tags.each do |tag|
|
||||
tag.update_attribute(:is_default, false)
|
||||
end
|
||||
end
|
||||
redirect_to request.referer, :status => 303
|
||||
end
|
||||
|
||||
def merge
|
||||
|
@ -88,17 +98,19 @@ class Admin::TagsController < ApplicationController
|
|||
|
||||
new_tag.save
|
||||
|
||||
redirect_to admin_tags_url
|
||||
redirect_to request.referer, :status => 303
|
||||
end
|
||||
|
||||
def tag_params
|
||||
params.require(:tag).permit!
|
||||
params.require(:tag).permit! unless params[:tag].blank?
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def setup_vars
|
||||
@module_app = ModuleApp.where(:key=>"tag").first
|
||||
@is_module_tag = !params[:module_app_id].blank?
|
||||
@module_apps = @is_module_tag ? [ModuleApp.find(params[:module_app_id])] : ModuleApp.where(categorizable: true)
|
||||
@module_app = @is_module_tag ? ModuleApp.find(params[:module_app_id]) : ModuleApp.find_by(:key=>'tag')
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module Admin::CategoriesHelper
|
||||
end
|
|
@ -78,6 +78,14 @@ module OrbitBackendHelper
|
|||
def is_filter_active?(field, value)
|
||||
params[:filters][field].include?(value.to_s) ? "active" : "" rescue ""
|
||||
end
|
||||
|
||||
def select_category(f, module_app)
|
||||
render :partial => '/admin/categories/select_form', :locals => {:f=> f, :module_app=>module_app }
|
||||
end
|
||||
|
||||
def select_tag(f, module_app, object)
|
||||
render :partial => '/admin/tags/tag_form', :locals => {:f=> f, :module_app=>module_app, :object=>object }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -82,11 +82,19 @@ module OrbitHelper
|
|||
res << "<li class='active'>#{params[:type].underscore.humanize.capitalize} #{t(:authorization_)}</li>"
|
||||
end
|
||||
when 'categories'
|
||||
res << "<li>#{@module_app.title}#{divider}</li>"
|
||||
res << "<li class='active'>#{t(:categories)}</li>"
|
||||
when 'module_tags'
|
||||
res << "<li>#{@module_app.title}#{divider}</li>"
|
||||
res << "<li class='active'>#{t(:tags)}</li>"
|
||||
if @module_app.key!='category'
|
||||
res << "<li>#{@module_app.title}#{divider}</li>"
|
||||
res << "<li class='active'>#{t(:categories)}</li>"
|
||||
else
|
||||
res << "<li class='active'>#{@module_app.title}</li>"
|
||||
end
|
||||
when 'tags'
|
||||
if @module_app.key!='tag'
|
||||
res << "<li>#{@module_app.title}#{divider}</li>"
|
||||
res << "<li class='active'>#{t(:tags)}</li>"
|
||||
else
|
||||
res << "<li class='active'>#{@module_app.title}</li>"
|
||||
end
|
||||
else
|
||||
if params[:action].eql?('index')
|
||||
res << "<li>#{@module_app.title}</li>"
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<li class="filter-item <%= "disabled" if category.disable %>">
|
||||
<%= hidden_field_tag "ids[]", category.id, class: "category_id" %>
|
||||
<%= link_to '#', class: "open-slide", data: {title: t(:edit_category), id: category.id.to_s, module: @mod.id.to_s, form: category.title_translations, disable: category.disable} do %>
|
||||
<% if category.disable %>
|
||||
<i class="icon-ban-circle"></i>
|
||||
<% end %>
|
||||
<%= category.title_translations.values.join(" / ") %>
|
||||
<% end %>
|
||||
</li>
|
|
@ -0,0 +1,22 @@
|
|||
<!-- categories -->
|
||||
<div class="tags">
|
||||
<div id="tags-list">
|
||||
<% @module_apps.each do |mod| %>
|
||||
<%
|
||||
@mod = mod
|
||||
categories = mod.categories
|
||||
%>
|
||||
<% icon_name = OrbitApp::Module::Registration.find_by_key(mod.key).get_icon_class rescue 'icons-daniel-bruce-2' %>
|
||||
<p class="tag-lead lead muted"><i class="<%= icon_name %>"></i> <%= mod.title %> <span class="badge pull-right"><%= categories.count %></span></p>
|
||||
<ul class="tags-groups checkbox-card module-tags">
|
||||
<li class="add">
|
||||
<%= link_to '#', class: "open-slide", data: {title: t(:add_category), id: 'new', module: mod.id.to_s} do %>
|
||||
<i class='icon-plus-sign'></i><%= t(:new_) %>
|
||||
<% end %>
|
||||
</li>
|
||||
<%= render partial: "category", collection: categories %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- categories:end -->
|
|
@ -0,0 +1,56 @@
|
|||
<span id="select_categories">
|
||||
<%= f.select :category_id, module_app.categories.collect{|t| [ t.title, t.id ]} %>
|
||||
</span>
|
||||
<button class="btn" data-toggle="modal" data-target="#categoryModal">
|
||||
<i class='icon-plus'></i> <%= t(:new_category) %>
|
||||
</button>
|
||||
|
||||
<div class="modal fade" id="categoryModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel"><%= t(:new_category) %></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<% Site.first.in_use_locales.each do |locale| %>
|
||||
<%= label_tag "name-#{locale}", "#{t(:name)} (#{t(locale)})" %>
|
||||
<input class="input-large" id="<%=locale%>" name="category[title_translations][<%=locale%>]" placeholder="<%=t(:name)%>" type="text">
|
||||
<br/><br/>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><%= t(:close) %></button>
|
||||
<button type="button" class="btn btn-primary" id="add_category"><%= t(:add) %></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#categoryModal").hide();
|
||||
|
||||
$('#categoryModal').modal('<%= module_app.categories.blank? ? "show" : "hide" %>');
|
||||
|
||||
$("#add_category").click(function(){
|
||||
createCategory();
|
||||
});
|
||||
|
||||
$("#categoryModal .modal-body").keypress(function(e) {
|
||||
if(e.which == 13) {
|
||||
createCategory();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var createCategory = function(){
|
||||
$.ajax({
|
||||
url : "<%= create_in_form_admin_module_app_categories_path(:module_app_id=>module_app.id.to_s) %>",
|
||||
type : "post",
|
||||
data: $("input[name^='category']").serialize(),
|
||||
}).done(function(data){
|
||||
$("#select_categories select").append("<option value='"+data['id']+"' selected>"+data['title']+"</option>");
|
||||
$('#categoryModal').modal('hide');
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,36 @@
|
|||
<div id="categories_index">
|
||||
<%= render 'index' %>
|
||||
</div>
|
||||
|
||||
<div id="pageslide">
|
||||
<div class="page-title clearfix">
|
||||
<a class="pull-right" href="javascript:$.pageslide.close()">
|
||||
<i class="icons-arrow-left-2"></i>
|
||||
</a>
|
||||
<span></span>
|
||||
</div>
|
||||
<div class="view-page">
|
||||
<div class="nano">
|
||||
<div class="content">
|
||||
<%= form_for :category, url: nil, remote: true do |f| %>
|
||||
<fieldset>
|
||||
<%= f.fields_for :title_translations do |f| %>
|
||||
<% Site.first.in_use_locales.each do |locale| %>
|
||||
<%= label_tag "name-#{locale}", "#{t(:name)} (#{t(locale)})" %>
|
||||
<%= f.text_field locale, :class => 'input-large', :value => (@category.title_translations[locale] rescue ''), placeholder: t(:name), id: locale %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= label_tag "disable" do %>
|
||||
<%= f.check_box :disable %>
|
||||
<%= t(:disable) %>
|
||||
<% end %>
|
||||
<div class="form-actions">
|
||||
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||
<%= f.submit t(:submit), class: 'btn btn-primary btn-small' %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
$("#categories_index").html("<%= j render 'index' %>")
|
||||
$.pageslide.close();
|
||||
openSlide();
|
|
@ -5,6 +5,7 @@
|
|||
<button id="deselect" class="btn btn-inverse toggable hide"><%= t(:deselect_all) %></button>
|
||||
<%= link_to t(:delete_), '#', id: "deleteTags", class: "btn btn-danger toggable hide", rel: '' %>
|
||||
<%= link_to t(:merge), '#', id: "mergerTags", class: "btn btn-success toggable hide", rel: merge_admin_tags_path %>
|
||||
<%= link_to t(:remove_default), '#', id: "removeDefaults", class: "btn btn-info toggable hide", method: :post, remote: true %>
|
||||
<%= link_to t(:add_to_default), add_to_default_admin_tags_path, id: "addDefault", class: "btn btn-info toggable hide", method: :post, remote: true %>
|
||||
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t('new.tag'), id: 'new'} %>
|
||||
</div>
|
||||
|
@ -14,10 +15,12 @@
|
|||
<!-- tags -->
|
||||
<div class="tags">
|
||||
<div id="tags-list">
|
||||
<p class="tag-lead lead muted"><i class="icons-tag"></i> <%= t(:default) %> <span class="badge pull-right"><%= @tags.count %></span></p>
|
||||
<ul class="tags-groups checkbox-card default-tags">
|
||||
<%= render partial: "tag", collection: @tags %>
|
||||
</ul>
|
||||
<% unless @is_module_tag %>
|
||||
<p class="tag-lead lead muted"><i class="icons-tag"></i> <%= t(:default) %> <span class="badge pull-right"><%= @tags.count %></span></p>
|
||||
<ul class="tags-groups checkbox-card default-tags">
|
||||
<%= render partial: "tag", collection: @tags %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% @module_apps.each do |mod| %>
|
||||
<%
|
||||
@mod = mod
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
<li class="filter-item <%= tag.is_default ? 'default' : '' %>">
|
||||
|
||||
<% unless defined?(in_module) && tag.is_default %>
|
||||
<li class="filter-item <%= tag.is_default ? 'default' : 'module' %>">
|
||||
<% if defined?(in_module) && tag.is_default && !@is_module_tag %>
|
||||
<a>
|
||||
<span class="amount">
|
||||
<%= tag.get_module_tagging_count @mod.taggable_model %>
|
||||
</span>
|
||||
<%= tag.show_names_slash %>
|
||||
</a>
|
||||
<% else %>
|
||||
<p class="card pull-left">
|
||||
<input type="checkbox">
|
||||
</p>
|
||||
<%= hidden_field_tag "ids[]", tag.id, class: "tag_id" %>
|
||||
<% end %>
|
||||
|
||||
<% if defined?(in_module) && tag.is_default %>
|
||||
<a>
|
||||
<span class="amount"><%= tag.get_module_tagging_count @mod.taggable_model %></span>
|
||||
<%= tag.show_names_slash %>
|
||||
</a>
|
||||
<% else %>
|
||||
<%= link_to '#', class: "open-slide", data: {title: t('editing.tag'), id: tag.id.to_s, form: tag.name_translations} do %>
|
||||
<span class="amount"><%= tag.taggings.count %></span>
|
||||
<span class="amount">
|
||||
<%= tag.taggings.count %>
|
||||
</span>
|
||||
<%= tag.show_names_slash %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<span id="select_tags">
|
||||
<% module_app.tags.each do |tag| %>
|
||||
<label class="checkbox inline btn <%= 'active' if object.tags.include?(tag) %>">
|
||||
<%= check_box_tag "#{object.class.name.camelize(:lower)}[tags][]", tag.id, object.tags.include?(tag) %> <%= tag.name %>
|
||||
</label>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<button id="add_tag_btn" class="btn" data-toggle="modal" data-target="#tagModal" style="margin-left: <%= module_app.tags.blank? ? "10" : "180" %>px">
|
||||
<i class='icon-plus'></i> <%= t(:new_tag) %>
|
||||
</button>
|
||||
|
||||
<div class="modal fade" id="tagModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel"><%= t(:new_tag) %></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<% Site.first.in_use_locales.each do |locale| %>
|
||||
<%= label_tag "name-#{locale}", "#{t(:name)} (#{t(locale)})" %>
|
||||
<input class="input-large" id="<%=locale%>" name="tag[name_translations][<%=locale%>]" placeholder="<%=t(:name)%>" type="text">
|
||||
<br/><br/>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal"><%= t(:close) %></button>
|
||||
<button type="button" class="btn btn-primary" id="add_tag"><%= t(:add) %></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#tagModal").hide();
|
||||
|
||||
$("#add_tag").click(function(){
|
||||
createTag();
|
||||
});
|
||||
|
||||
$("#tagModal .modal-body").keypress(function(e) {
|
||||
if(e.which == 13) {
|
||||
createTag();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var createTag = function(){
|
||||
$.ajax({
|
||||
url : "<%= create_in_form_admin_module_app_tags_path(:module_app_id=>module_app.id.to_s) %>",
|
||||
type : "post",
|
||||
data: $("input[name^='tag']").serialize(),
|
||||
}).done(function(data){
|
||||
$("#select_tags").append('<label class="checkbox inline btn active">'+
|
||||
'<input id="<%= object.class.name.camelize(:lower) %>_tags_" name="<%= object.class.name.camelize(:lower) %>[tags][]" type="checkbox" value="'+data.id+'" checked>'+data.name+'</label>');
|
||||
$("#add_tag_btn").css("margin-left", "180px");
|
||||
$('#tagModal').modal('hide');
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -1,3 +1,5 @@
|
|||
<%= hidden_field_tag 'module_app_id', @module_app.id.to_s %>
|
||||
|
||||
<% content_for :right_nav do %>
|
||||
<div class="searchClear pull-right">
|
||||
<input id="filter-input" class="search-query input-medium" type="text" placeholder="<%= t('search.tags') %>" value="">
|
||||
|
@ -19,15 +21,59 @@
|
|||
<div class="view-page">
|
||||
<div class="nano">
|
||||
<div class="content">
|
||||
<%= form_for :tag, url: nil, remote: true do |f| %>
|
||||
<fieldset>
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
<div class="form-actions">
|
||||
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||
<%= f.submit t(:submit), class: 'btn btn-primary btn-small' %>
|
||||
<div id="add-tags">
|
||||
|
||||
<% if @is_module_tag %>
|
||||
<ul class="nav nav-pills">
|
||||
<li class="active"><a href=".set_new" data-toggle="tab"><%= t(:create_) %></a></li>
|
||||
<li id="select_default"><a href=".select_default" data-toggle="tab"><%= t(:use_default) %></a></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="set_new tab-pane fade active in">
|
||||
<%= form_for :tag, url: nil, remote: true do |f| %>
|
||||
<fieldset>
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
<div class="form-actions">
|
||||
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||
<%= f.submit t(:submit), class: 'btn btn-primary btn-small' %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if @is_module_tag %>
|
||||
<div class="select_default tags tab-pane fade">
|
||||
<input id="filter-default-tag" class="search-query" type="text" placeholder="Search Tags" value="">
|
||||
<%= form_tag add_from_default_admin_module_app_tags_path(:module_app_id=>@module_app.id), id: "filter-default-tag", method: :post, remote: true do %>
|
||||
<fieldset>
|
||||
<ul class="add-default-tags-list tags-groups checkbox-card">
|
||||
<% @default_tags.each do |tag| %>
|
||||
<li class="filter-item default">
|
||||
<p class="card pull-left">
|
||||
<input type="checkbox">
|
||||
<%= check_box_tag "ids[]", tag.id, false, class: "tag_id" %>
|
||||
</p>
|
||||
<a>
|
||||
<span class="amount"><%= tag.taggings.count %></span>
|
||||
<%= tag.show_names_slash %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="form-actions">
|
||||
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||
<%= submit_tag t(:add), class: 'btn btn-primary btn-small' %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
$("#delete_tags").modal('hide');
|
||||
$("#tags-merger").modal('hide');
|
||||
$("#remove_defaults").modal('hide');
|
||||
$("#tags_index").html("<%= j render 'index' %>")
|
||||
$.pageslide.close();
|
||||
openSlide();
|
||||
$('.card').cardCheck({
|
||||
item: $('.card input[type="checkbox"]'),
|
||||
});
|
||||
checkedLength()
|
||||
checkedLength();
|
|
@ -1 +0,0 @@
|
|||
<%= render 'new' %>
|
|
@ -20,7 +20,26 @@ if Page.count == 0
|
|||
end
|
||||
|
||||
if User.count==0
|
||||
group = Workgroup.new
|
||||
group.title = "Administrator"
|
||||
group.key = 'admin'
|
||||
group.save
|
||||
|
||||
role = Role.new
|
||||
role.key = 'admin'
|
||||
role.title_translations = {:en=>'Administrator', :zh_tw=>'Administrator'}
|
||||
role.save
|
||||
|
||||
profile = MemberProfile.new
|
||||
profile.first_name_translations = {:en=>'Digital', :zh_tw=>'Digital'}
|
||||
profile.last_name_translations = {:en=>'Ruling', :zh_tw=>'Ruling'}
|
||||
profile.save
|
||||
|
||||
role.member_profiles << profile
|
||||
|
||||
user = User.new
|
||||
user.workgroup = group
|
||||
user.member_profile = profile
|
||||
user.user_name = "rulingcom"
|
||||
user.password = "bjo4xjp6"
|
||||
user.email = "orbit@rulingcom.com"
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
OrbitApp.registration "Category", type: 'ModuleApp' do
|
||||
module_label 'module_name.category'
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
|
||||
authorizable
|
||||
|
||||
side_bar do
|
||||
head_label_i18n 'module_name.category', icon_class: "icons-flow-cascade"
|
||||
head_link_path "admin_categories_path"
|
||||
active_for_controllers (['admin/categories'])
|
||||
|
||||
# available_for [:admin, :manager]
|
||||
|
||||
# context_link 'all',
|
||||
# link_path: "admin_categorys_path",
|
||||
# priority: 1,
|
||||
# active_for_action: {categorys: :index},
|
||||
# available_for: [:admin, :manager]
|
||||
|
||||
end
|
||||
end
|
|
@ -7,7 +7,7 @@
|
|||
side_bar do
|
||||
head_label_i18n 'module_name.tag', icon_class: "icons-tag"
|
||||
head_link_path "admin_tags_path"
|
||||
active_for_controllers ({public: ['admin/tags']})
|
||||
active_for_controllers (['admin/tags'])
|
||||
|
||||
# available_for [:admin, :manager]
|
||||
|
||||
|
|
|
@ -667,6 +667,7 @@ en:
|
|||
|
||||
module_name:
|
||||
tag: Tag
|
||||
category: Category
|
||||
|
||||
datetime_picker:
|
||||
date:
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
zh_tw:
|
||||
_locale: 中文
|
||||
en: 英文
|
||||
zh_tw: 中文
|
||||
more: "更多"
|
||||
site_: 網站
|
||||
site_info: 基本資訊
|
||||
|
@ -7,8 +9,10 @@ zh_tw:
|
|||
site_structure: 網站架構
|
||||
sitemap: 網站地圖
|
||||
site_name: 網站名稱
|
||||
submit: 送出
|
||||
mobile_settings: 行動設定
|
||||
modules: 網站模組
|
||||
name: 名稱
|
||||
search_engine: 搜尋引擎
|
||||
templates: 網站模版
|
||||
preference: 系統偏好
|
||||
|
@ -17,8 +21,10 @@ zh_tw:
|
|||
locale: 位置
|
||||
login: 登入
|
||||
logout: 登出
|
||||
cancel: 取消
|
||||
dashboard_: 儀表版
|
||||
desktop: 桌面
|
||||
disable: 停用
|
||||
password: 密碼
|
||||
all: 全部
|
||||
add: 新增
|
||||
|
@ -60,4 +66,5 @@ zh_tw:
|
|||
register: 註冊
|
||||
registered: 已註冊
|
||||
|
||||
|
||||
module_name:
|
||||
category: 類別
|
||||
|
|
|
@ -51,15 +51,41 @@ Orbit::Application.routes.draw do
|
|||
post 'toggle'
|
||||
end
|
||||
|
||||
resources :module_apps
|
||||
resources :module_apps do
|
||||
resources :categories do
|
||||
collection do
|
||||
post 'create_in_form'
|
||||
end
|
||||
member do
|
||||
post 'toggle'
|
||||
end
|
||||
end
|
||||
resources :tags do
|
||||
collection do
|
||||
post 'add_to_default'
|
||||
post 'add_from_default'
|
||||
post 'create_in_form'
|
||||
post 'delete_tags'
|
||||
post 'merge'
|
||||
post 'remove_default'
|
||||
post 'update_included_default'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
get 'authorizations(/:module(/:type(/:id)))' => 'authorizations#index', :as => :authorizations
|
||||
|
||||
resources :authorizations
|
||||
resources :items
|
||||
resources :categories do
|
||||
member do
|
||||
post 'toggle'
|
||||
end
|
||||
end
|
||||
resources :tags do
|
||||
collection do
|
||||
post 'add_to_default'
|
||||
post 'add_from_default'
|
||||
post 'delete_tags'
|
||||
post 'merge'
|
||||
post 'remove_default'
|
||||
|
|
|
@ -7,7 +7,7 @@ module ContextLinkRenderer
|
|||
@request = request
|
||||
@params = params
|
||||
@current_user = current_user
|
||||
content_tag :li, link_to(content_tag(:span, I18n.t(@label_i18n)), Rails.application.routes.url_helpers.send(@path)), :class => ( active_actions[controller] == action ? 'active' : nil)
|
||||
content_tag :li, link_to(content_tag(:span, I18n.t(@label_i18n)), Rails.application.routes.url_helpers.send(@path, @arg)), :class => ( active_actions[controller] == action ? 'active' : nil)
|
||||
end
|
||||
|
||||
end
|
|
@ -142,6 +142,7 @@ module OrbitApp
|
|||
@label_i18n = label_i18n
|
||||
@priority = options[:priority] || 0
|
||||
@path = options[:link_path] || ""
|
||||
@arg = options[:link_arg] || ""
|
||||
set_available_for_avoiding_sensitive_links(options[:available_for] )
|
||||
@active_for_action = options[:active_for_action] || []
|
||||
@active_for_app_auth = options[:active_for_app_auth] || []
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 7.4 KiB |
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class Admin::CategoriesControllerTest < ActionController::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
require 'test_helper'
|
||||
|
||||
class Admin::CategoriesHelperTest < ActionView::TestCase
|
||||
end
|
Loading…
Reference in New Issue