Compare commits

...
Author SHA1 Message Date
harrybomrah 6e809ff2b3 changed the frontend loading to more rails specific. and also fixed the filter reload in thumbnali and summary view of members 2013-11-07 14:13:55 +08:00
saurabhbhatia 4e706fab0c Fixed gallery and video widgets 2013-11-07 11:00:10 +08:00
harrybomrah 8c532e7241 fixed gallery frontend for category display 2013-11-07 09:34:52 +08:00
harrybomrah 49217d4705 fixed all button for page settings and also filter display after page refresh 2013-11-06 22:36:59 +08:00
saurabhbhatia 591a3e0bc4 Updated redirect path after saving a page 2013-11-06 17:20:40 +08:00
Manson Wang 3744e1c3e7 By Ray, Fix structure page editinh bug 2013-11-06 17:16:14 +08:00
Manson Wang 5df8ff2e52 By Ray, Fix structure page editing bug 2013-11-06 16:48:56 +08:00
harrybomrah f191029279 design change in album view 2013-11-06 16:39:21 +08:00
harrybomrah c158108576 gallery all bugs fixed.. 2013-11-06 16:39:18 +08:00
saurabhbhatia 9760100b69 Removed the logger 2013-11-06 16:38:55 +08:00
Manson Wang ff6eb5d674 Fix annoucement preview image bug 2013-11-06 16:31:27 +08:00
saurabhbhatia 2d0fd1d2e4 Fixed select all checkboxes 2013-11-06 15:29:15 +08:00
saurabhbhatia ef67941ba5 Fix for widgets edit form 2013-11-06 15:11:09 +08:00
Manson Wang 18d0657321 Fix dashboard system usage refresh bug 2013-11-06 09:29:57 +08:00
harrybomrah 3c4f22234b fixed template updation from site preferences 2013-11-05 20:50:05 +08:00
harrybomrah bae1c0da7d now only approved announcement can be viewed when backend is open 2013-11-05 20:50:02 +08:00
Manson Wang 7401a6ae59 Update for dashboard and Fix site.rake,new_site.rake for missing "menu_enabled_for" 2013-11-05 19:38:47 +08:00
harrybomrah 9d7af2ccac fixed the edit link problem in site settings 2013-11-05 16:54:33 +08:00
harrybomrah af103fa427 gallery frontend ui fixed. 2013-11-05 13:28:10 +08:00
saurabhbhatia 1945921fcb authorized user now able edit page context 2013-11-05 13:01:58 +08:00
Spen ced7a59555 fix new ui archive and link frontend 2013-11-05 11:27:35 +08:00
saurabhbhatia 3d758cabb3 Updated orbit core lib for module app 2013-11-05 11:25:35 +08:00
saurabhbhatia 54f778f17d Updated Calendar frontend 2013-11-04 23:03:28 +08:00
rulingcom b1867dd47a new code logic for saving tree.. should work fine even if the node positions fail 2013-11-04 22:20:50 +08:00
harrybomrah 3db075b9d2 side bar for calendar fixed. 2013-11-04 18:31:10 +08:00
Manson Wang 7ad05ef034 Dashboard with Google Chart 2013-11-04 17:48:51 +08:00
harrybomrah 2c8705ac3e fixed site structure and also member roles side bar problem. 2013-11-04 17:39:16 +08:00
saurabhbhatia 2b97d4ca22 Updated Theme in design 2013-11-04 16:31:09 +08:00
saurabhbhatia 3816314b5b Fixed Temaplte Module with Info and Images 2013-11-04 16:12:30 +08:00
saurabhbhatia 1f3f9831ad Fixed Openness Issue 2013-11-04 15:44:51 +08:00
harrybomrah eaa87b3dd8 new categories for calendar with colors inside.. plus changed the working of calendar. it has now categories like all other modules 2013-11-04 15:17:50 +08:00
saurabhbhatia 17f31d1e25 Fix for Site preference 2013-11-04 09:41:28 +08:00
68 changed files with 706 additions and 953 deletions

No files matched your search

+1 -2
View File
@@ -71,8 +71,7 @@ gem 'redis-search'
gem 'syslog-logger' gem 'syslog-logger'
gem "recaptcha", :require => "recaptcha/rails" gem "recaptcha", :require => "recaptcha/rails"
gem 'puma' gem "chartkick"
gem 'request-log-analyzer'
gem 'usagewatch' gem 'usagewatch'
# Gems used only for assets and not required # Gems used only for assets and not required
@@ -12,6 +12,7 @@ $(function() {
} }
else { else {
setForm(item.data('form')); setForm(item.data('form'));
if( $( ".color-picker" ).length ) $(".color-picker").miniColors("value",item.data("form").color);
pageslide.find('form').attr('action', '/admin/module_apps/' + item.data('module') + '/categories/' + item.data('id')); pageslide.find('form').attr('action', '/admin/module_apps/' + item.data('module') + '/categories/' + item.data('id'));
pageslide.find('form').attr('method', 'put'); pageslide.find('form').attr('method', 'put');
} }
+34 -1
View File
@@ -541,6 +541,8 @@ function changeStatusHidden() {
// Document Ready // Document Ready
$(function() { $(function() {
showFiltersOnPageRefresh();
new ini(); new ini();
$('#main-wrap').on('click', '.delete', function() { $('#main-wrap').on('click', '.delete', function() {
api.modal($(this).attr('rel')); api.modal($(this).attr('rel'));
@@ -589,4 +591,35 @@ $(function() {
} }
formTip() formTip()
sidebarNav(); 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;
}
+47 -26
View File
@@ -81,7 +81,7 @@ function customOpenSlide() {
} else { } else {
$('#pageslide form').prop('method', 'post') $('#pageslide form').prop('method', 'post')
}; };
_type == 'page' ? pageSetting(element.data('id'), _edit) : linkSetting(element.data('id'), _edit); _type == 'page' ? pageSetting(element.data('id'), _edit, pageslide) : linkSetting(element.data('id'), _edit, pageslide);
} }
}); });
$iFrame.pageslide({ $iFrame.pageslide({
@@ -130,12 +130,13 @@ function iFrameContent() {
}).css('cursor', 'default'); }).css('cursor', 'default');
} }
$('#pageslide_iframe').load(function() { $('#pageslide_iframe').load(function() {
var $iContents = $(this).contents(), var $iContents = $(this).contents(),
$pc = $iContents.find('.page_content'); $pc = $iContents.find('.page_content');
$(this).get(0).contentWindow.externalFunction(iFrameFunction, $iContents, $pc); iFrameFunction($iContents, $pc);
}); });
} }
function pageSetting(id, edit) {
function pageSetting(id, edit, ps) {
$pageModule = $('#pageslide #page_module_app_id'); $pageModule = $('#pageslide #page_module_app_id');
$pageF2E = $('#pageslide #page_app_frontend_url'); $pageF2E = $('#pageslide #page_app_frontend_url');
$pageDivF2E = $('#pageslide #front_url'); $pageDivF2E = $('#pageslide #front_url');
@@ -183,23 +184,25 @@ function pageSetting(id, edit) {
if(val.category.length > 0) { if(val.category.length > 0) {
$.each(val.category, function(index, val) { $.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>'); $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); $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(); $pageCategoryGroup.show();
} }
if(val.tags.length > 0) { if(val.tags.length > 0) {
$.each(val.tags, function(index, val) { $.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>'); $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); $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(); $pageTagsGroup.show();
} }
@@ -237,8 +240,8 @@ function pageSetting(id, edit) {
}; };
}; };
function linkSetting(id, edit) { function linkSetting(id, edit, ps) {
$linkPublishedTrue = $('#link_is_published_true'); $linkPublishedTrue = ps.find('#link_is_published_true');
_status = edit; _status = edit;
if(_status) { if(_status) {
$.ajax({ $.ajax({
@@ -250,6 +253,7 @@ function linkSetting(id, edit) {
}) })
.done(function(data) { .done(function(data) {
_linkData = data; _linkData = data;
console.log($linkPublishedTrue)
data.public ? $linkPublishedTrue.prop('checked', true) : $linkPublishedTrue.prop('checked', false); data.public ? $linkPublishedTrue.prop('checked', true) : $linkPublishedTrue.prop('checked', false);
$linkPublishedTrue.prop('checked') ? $('.link-options').slideDown(300) : $('.link-options').slideUp(300); $linkPublishedTrue.prop('checked') ? $('.link-options').slideDown(300) : $('.link-options').slideUp(300);
$.each(_linkData.link, function(index, val) { $.each(_linkData.link, function(index, val) {
@@ -286,7 +290,6 @@ function getView(module_id, id) {
cache: false, cache: false,
}); });
} }
$(function() { $(function() {
$pageModule = null, $pageModule = null,
$pageF2E = null, $pageF2E = null,
@@ -327,7 +330,11 @@ $(function() {
} else { } else {
position = $(ui.item).index(); position = $(ui.item).index();
}; };
$.post("<%= Rails.application.routes.url_helpers.update_position_admin_items_path %>", { id: ui.item.attr('id'), parent_id: (ui.item.parent().closest('li').attr('id') || ui.item.parent().closest('ol').attr('id')), position: position } ); var next_sibling = $(ui.item).next(),
next_sibling_id = null;
if( next_sibling )
next_sibling_id = next_sibling.attr("id");
$.post("<%= Rails.application.routes.url_helpers.update_position_admin_items_path %>", { id: ui.item.attr('id'), parent_id: (ui.item.parent().closest('li').attr('id') || ui.item.parent().closest('ol').attr('id')), position: position, "next_sibling_id" : next_sibling_id } );
} }
}); });
$(".sortable").delegate(".brand, .delete", clickEvent, function(e){ $(".sortable").delegate(".brand, .delete", clickEvent, function(e){
@@ -393,12 +400,13 @@ $(function() {
if(val.category.length > 0) { if(val.category.length > 0) {
$.each(val.category, function(index, val) { $.each(val.category, function(index, val) {
if(val !== 0) { 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>'); $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); $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(); $pageCategoryGroup.show();
@@ -409,12 +417,13 @@ $(function() {
if(val.tags.length > 0) { if(val.tags.length > 0) {
$.each(val.tags, function(index, val) { $.each(val.tags, function(index, val) {
if(val !== 0) { 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>'); $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); $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(); $pageTagsGroup.show();
@@ -447,12 +456,16 @@ $(function() {
$('#pageslide').on('change', '.checkbox-groups input', function(event) { $('#pageslide').on('change', '.checkbox-groups input', function(event) {
var $checked = $(this); var $checked = $(this);
if($checked.attr('type') == 'checkbox') { if($checked.attr('type') == 'checkbox') {
if($checked.hasClass('select_all') && $checked.prop('checked')) { if($checked.hasClass('select_all')) {
$checked.closest('.checkbox').siblings('.groups').find('input[type="checkbox"]').prop('checked', false); if($checked.prop('checked')) {
} else if($checked.prop('checked') && !$checked.hasClass('lang-enable')) { $checked.closest('.checkbox').siblings('.groups').find('input[type="checkbox"]').prop('checked', true);
$checked.closest('.groups').siblings('.checkbox').find('.select_all').prop('checked', false); } else {
} 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')) { if($checked.prop('checked')) {
$checked.closest('.active-link').addClass('active').siblings('active-link').removeClass('active').end().find('.active-mune').slideDown(300); $checked.closest('.active-link').addClass('active').siblings('active-link').removeClass('active').end().find('.active-mune').slideDown(300);
if(_status) { if(_status) {
@@ -466,6 +479,14 @@ $(function() {
$(this).find('input:eq(0)').prop('checked', true); $(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; return false;
} else if($checked.attr('type') == 'radio' && !$(this).closest('div').hasClass('active-mune')) { } else if($checked.attr('type') == 'radio' && !$(this).closest('div').hasClass('active-mune')) {
+57 -84
View File
@@ -1,93 +1,66 @@
//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() { $(function() {
// $(".post_preview").click(function(e){ $(".post_preview").click(function(){
// $("#main-wrap").after("<span id='show_preview'></span>");
// 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>"); $("#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;
});
}
$.post($(this).attr('url'), $(".previewable").serialize() ,function(data){
$('#show_preview .modal').modal();
$('#show_preview .modal').height(function() {
return $(window).height() * 0.7;
}); });
} else if($(this).hasClass('preview_trigger')) { },'script');
$.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(){ $(".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) {
// $("#main-wrap").after("<span id='show_preview'></span>"); // $("#main-wrap").after("<span id='show_preview'></span>");
// $.ajax({ // if($(this).hasClass('post_preview')) {
// type: 'PUT', // var attrs = e.target.attributes;
// url:$(this).attr("href"), // var url = attrs['url'];
// data:$(this).parents("form").serialize(), // $("form.previewable").ajaxSubmit({
// success: function (msg) { // beforeSubmit: function(a,f,o){
// $("#"+start_modal_with_id).modal('show'); }, // o.dataType = 'script';
// error: function(){ // o.url = url.nodeValue;
// alert("ERROR"); // 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; // 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;
// // }
// }
// })
}); });
@@ -56,4 +56,10 @@
width: 26px; width: 26px;
height: 3px; height: 3px;
background: url(miniColors/line.gif) center no-repeat; background: url(miniColors/line.gif) center no-repeat;
}
.miniColors-trigger.btn {
background-image: none;
height: 16px;
width: 0px;
} }
+1 -2
View File
@@ -54,10 +54,9 @@ class Admin::DesignsController < OrbitBackendController
when 'javascripts', 'themes'#, 'images' when 'javascripts', 'themes'#, 'images'
@object = @design.send(params[:type]).find(params[:object_id]) @object = @design.send(params[:type]).find(params[:object_id])
end end
Dir.mktmpdir('f_path') { |dir| Dir.mktmpdir('f_path') { |dir|
temp_file = File.new(dir + '/' + File.basename(@object.file.url), 'w+') temp_file = File.new(dir + '/' + File.basename(@object.file.url), 'w+')
temp_file.write(params[:file][:content].force_encoding('UTF-8')) temp_file.write(params[:html_code].force_encoding('UTF-8'))
@object.remove_file! @object.remove_file!
@object.file = temp_file @object.file = temp_file
@object.save @object.save
+1 -1
View File
@@ -24,7 +24,7 @@ class Admin::ItemsController < OrbitBackendController
def update_position def update_position
item = Item.find(params[:id]) item = Item.find(params[:id])
item.shift_to(params[:parent_id], params[:position].to_i) item.shift_to(params[:parent_id], params[:position].to_i, params[:next_sibling_id])
render :nothing => true, status: 200 render :nothing => true, status: 200
end end
@@ -95,9 +95,7 @@ class Admin::PagePartsController < OrbitBackendController
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu') set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
flash.now[:notice] = t('update.success.content') flash.now[:notice] = t('update.success.content')
respond_to do |format| respond_to do |format|
format.html { format.js
redirect_to admin_page_url(@part.page, edit: true)
}
end end
else else
@id = params[:id] @id = params[:id]
+2 -2
View File
@@ -60,8 +60,8 @@ class Admin::PagesController < Admin::ItemsController
m = {} m = {}
m["main"] = page.module_app_id.to_s m["main"] = page.module_app_id.to_s
m["sub"] = page.app_frontend_url m["sub"] = page.app_frontend_url
m["category"] = page.category.present? ? [0, page.category.map{|c| c.to_s}] : [1] m["category"] = page.category.present? ? page.category.map{|c| c.to_s} : []
m["tags"] = page.tag.present? ? [0, page.tag.map{|c| c.to_s}] : [1] m["tags"] = page.tag.present? ? page.tag.map{|c| c.to_s} : []
m["public"] = page.is_published ? 1 : 0 m["public"] = page.is_published ? 1 : 0
m["link"] = @site_valid_locales.inject([]) do |link, locale| 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] 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]
+10 -1
View File
@@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base
helper_attr :site_valid_locales helper_attr :site_valid_locales
def check_backend_openness def check_backend_openness
if Site.first.backend_openness_on if !Site.first.backend_openness_on
redirect_to '/users/sign_in' if not (authenticate_user! and is_member? ) redirect_to '/users/sign_in' if not (authenticate_user! and is_member? )
end end
end end
@@ -341,9 +341,18 @@ class ApplicationController < ActionController::Base
else else
objects = get_viewable(object_class, query) objects = get_viewable(object_class, query)
end end
if (!user_signed_in? && object_class == "bulletin")
objects = get_bulletins_for_open_backend(objects)
end
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10) Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
end end
def get_bulletins_for_open_backend(objects)
objects.select{|object| object.is_rejected == false && object.is_pending == false}
end
def get_string_value_from_object(object) def get_string_value_from_object(object)
s = object.name_translations[I18n.locale.to_s] unless s rescue nil s = object.name_translations[I18n.locale.to_s] unless s rescue nil
s = object.title_translations[I18n.locale.to_s] unless s rescue nil s = object.title_translations[I18n.locale.to_s] unless s rescue nil
+1 -1
View File
@@ -130,7 +130,7 @@ class PagesController < ApplicationController
end end
def check_frontend_open def check_frontend_open
if Site.first.frontend_open && current_user.nil? #Need to be change if !Site.first.frontend_open && current_user.nil? #Need to be change
redirect_to '/admin/dashboards' redirect_to '/admin/dashboards'
end end
end end
+30 -6
View File
@@ -1,5 +1,5 @@
module ApplicationHelper module ApplicationHelper
Time.zone = ActiveSupport::TimeZone[+8.hours]
FLASH_NOTICE_KEYS = [:error, :notice, :warning] FLASH_NOTICE_KEYS = [:error, :notice, :warning]
@@ -223,25 +223,49 @@ module ApplicationHelper
end end
def display_visitors(options={}) def display_visitors(options={})
Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count Impression.where(options).count
end end
def display_visitors_today def display_visitors_today
display_visitors(created_at: {'$gte' => Date.today.beginning_of_day, '$lte' => Date.today.end_of_day}) display_visitors(created_at: {'$gte' => Time.now.beginning_of_day, '$lte' => Time.now})
end end
def display_visitors_this_week def display_visitors_this_week
display_visitors(created_at: {'$gte' => Date.today.beginning_of_week, '$lte' => Date.today.end_of_week}) display_visitors(created_at: {'$gte' => Time.now-7.days, '$lte' => Time.now})
end end
def display_visitors_this_month def display_visitors_this_month
display_visitors(created_at: {'$gte' => Date.today.beginning_of_month, '$lte' => Date.today.end_of_month}) display_visitors(created_at: {'$gte' => Time.now-30.days, '$lte' => Time.now})
end end
def display_visitors_this_year def display_visitors_this_year
display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year}) display_visitors(created_at: {'$gte' => Time.now-365.days, '$lte' => Time.now})
end end
def get_month_traffic
result = []
(0..30).each do |i|
visits = Impression.where( created_at: {
'$gte' => Time.now.beginning_of_day-i.days,
'$lte' => Time.now.end_of_day-i.days}
).count
result.push([ Time.now.beginning_of_day-i.days, visits])
end
[:name=> t(:visitors_count),:data=>result]
end
# def get_today_traffic
# result = []
# (0..30).each do |i|
# the_day = i.day.ago
# visits = Impression.where( created_at: {'$gte' => the_day.beginning_of_day, '$lte' => the_day.end_of_day}).count
# # result.push([ the_day.to_time.to_i, visits])
# result.push([ the_day.strftime("%m %d"), visits])
# # result.push({'x'=> i, 'y'=> visits})
# end
# result
# end
def display_date_time(object) def display_date_time(object)
object.strftime("%Y-%m-%d %H:%M") object.strftime("%Y-%m-%d %H:%M")
end end
+15 -13
View File
@@ -44,17 +44,23 @@ class Item
a a
end end
def shift_to(new_parent, position) def find_by_parent_and_position(parent, position)
parent.children.detect{|child| child.position == position}
end
def shift_to(new_parent, position, next_sibling_id)
position = position.to_i position = position.to_i
new_parent = Item.find(new_parent) new_parent = Item.find(new_parent)
current_position_sibling = find_by_parent_and_position(new_parent, position)
if current_position_sibling if next_sibling_id
if self.position > current_position_sibling.position next_sibling = Item.find(next_sibling_id)
self.move_above(current_position_sibling) self.move_above(next_sibling)
else else
self.move_below(current_position_sibling) self.move_to_bottom
end end
elsif self.parent != new_parent
if self.parent != new_parent
self.parent = new_parent self.parent = new_parent
save save
end end
@@ -86,10 +92,6 @@ class Item
end end
end end
def find_by_parent_and_position(parent, position)
parent.children.detect{|child| child.position == position}
end
# Enable the validation for parent_id # Enable the validation for parent_id
def validates_presence_of_parent_id? def validates_presence_of_parent_id?
true true
+51 -386
View File
@@ -2,399 +2,64 @@
<h2> <h2>
<i class="icons-book-2"></i> <i class="icons-book-2"></i>
<span class="break"></span> <span class="break"></span>
Server Loading <%= t(:server_usage) %>
</h2> </h2>
</div> </div>
<div class="box-content" style='overflow: hidden;'> <div class="box-content" style='overflow: hidden; text-align:center;'>
<div id="cpu_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></div> <div id="cpu_usage" class="pull-left" style="width:200px; height:160px; display: inline-block;"></div>
<div id="mem_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></div> <div id="mem_usage" style="width:200px; height:160px; display: inline-block;"></div>
<div id="disk_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></div> <div id="disk_usage" class="pull-right" style="width:200px; height:160px; display: inline-block;"></div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
var Gages = { 'CPU':{
'JustGage': null,
'container': 'cpu_usage',
'title': 'CPU Usage',
'fn': 'get_cpu_usage',
'update_interval': 2000
},
'Mem':{
'JustGage': null,
'container': 'mem_usage',
'title': 'Memory Usage',
'fn': 'get_mem_usage',
'update_interval': 10000
},
'Disk':{
'JustGage': null,
'container': 'disk_usage',
'title': 'Disk Usage',
'fn': 'get_disk_usage',
'update_interval': 30000
}
};
$(function () { $(function () {
get_cpu_usage(); $.each(Gages,function(id,Gage){
get_mem_usage(); Gage['JustGage'] = new JustGage({
get_disk_usage(); id: Gage['container'],
value: 0,
min: 0,
max: 100,
title: Gage['title'],
shadowVerticalOffset: 10,
levelColors: ['#39D824','#FFC33F','#F51F1F'],
titleFontColor: '#666',
valueFontColor: '#666',
labelFontColor: '#666',
label: '%',
refreshAnimationTime: 800
});
update_usage(Gage);
});
}); });
function get_cpu_usage(){ function update_usage(Gage){
$('#cpu_usage').highcharts({ $.get('/admin/dashboards/'+Gage['fn'],function(usage){
chart: { Gage['JustGage'].refresh(parseInt(usage));
type: 'gauge', setTimeout(function(){update_usage(Gage);},Gage['update_interval']);
plotBackgroundColor: null, });
plotBackgroundImage: null,
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: 'CPU Usage'
},
pane: {
startAngle: -150,
endAngle: 150,
background: [{
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
stops: [
[0, '#FFF'],
[1, '#333']
]
},
borderWidth: 0,
outerRadius: '109%'
}, {
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
stops: [
[0, '#333'],
[1, '#FFF']
]
},
borderWidth: 1,
outerRadius: '107%'
}, {
// default background
}, {
backgroundColor: '#DDD',
borderWidth: 0,
outerRadius: '105%',
innerRadius: '103%'
}]
},
// the value axis
yAxis: {
min: 0,
max: 100,
minorTickInterval: 'auto',
minorTickWidth: 1,
minorTickLength: 10,
minorTickPosition: 'inside',
minorTickColor: '#666',
tickPixelInterval: 30,
tickWidth: 2,
tickPosition: 'inside',
tickLength: 10,
tickColor: '#666',
labels: {
step: 2,
rotation: 'auto'
},
title: {
text: ''
},
plotBands: [{
from: 0,
to: 60,
color: '#55BF3B' // green
}, {
from: 60,
to: 80,
color: '#DDDF0D' // yellow
}, {
from: 80,
to: 100,
color: '#DF5353' // red
}]
},
series: [{
name: 'CPU Usage',
data: [0],
dataLabels: {
formatter: function () {
var usage = this.y;
return '<span style="color:#339">'+ usage + ' %</span><br/>';
},
backgroundColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [
[0, '#DDD'],
[1, '#FFF']
]
}
},
tooltip: {
valueSuffix: ' %'
}
}]
},
function(chart) {
update_cpu_usage(chart);
setInterval(function() {
update_cpu_usage(chart);
}, 2000);
});
} }
function update_cpu_usage(chart){
$.get('/admin/dashboards/get_cpu_usage',function(usage){
var point = chart.series[0].points[0],
newVal = Math.round(usage);
point.update(newVal);
});
}
function get_mem_usage(){
$('#mem_usage').highcharts({
chart: {
type: 'gauge',
plotBackgroundColor: null,
plotBackgroundImage: null,
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: 'Memory Usage'
},
pane: {
startAngle: -150,
endAngle: 150,
background: [{
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
stops: [
[0, '#FFF'],
[1, '#333']
]
},
borderWidth: 0,
outerRadius: '109%'
}, {
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
stops: [
[0, '#333'],
[1, '#FFF']
]
},
borderWidth: 1,
outerRadius: '107%'
}, {
// default background
}, {
backgroundColor: '#DDD',
borderWidth: 0,
outerRadius: '105%',
innerRadius: '103%'
}]
},
// the value axis
yAxis: {
min: 0,
max: 100,
minorTickInterval: 'auto',
minorTickWidth: 1,
minorTickLength: 10,
minorTickPosition: 'inside',
minorTickColor: '#666',
tickPixelInterval: 30,
tickWidth: 2,
tickPosition: 'inside',
tickLength: 10,
tickColor: '#666',
labels: {
step: 2,
rotation: 'auto'
},
title: {
text: ''
},
plotBands: [{
from: 0,
to: 60,
color: '#55BF3B' // green
}, {
from: 60,
to: 80,
color: '#DDDF0D' // yellow
}, {
from: 80,
to: 100,
color: '#DF5353' // red
}]
},
series: [{
name: 'Memory Usage',
data: [0],
dataLabels: {
formatter: function () {
var usage = this.y;
return '<span style="color:#339">'+ usage + ' %</span><br/>';
},
backgroundColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [
[0, '#DDD'],
[1, '#FFF']
]
}
},
tooltip: {
valueSuffix: ' %'
}
}]
},
function(chart) {
update_mem_usage(chart)
setInterval(function() {
update_mem_usage(chart);
}, 5000);
});
}
function update_mem_usage(chart){
$.get('/admin/dashboards/get_mem_usage',function(usage){
var point = chart.series[0].points[0],
newVal = Math.round(usage);
point.update(newVal);
});
}
function get_disk_usage(){
$('#disk_usage').highcharts({
chart: {
type: 'gauge',
plotBackgroundColor: null,
plotBackgroundImage: null,
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: 'Disk Usage'
},
pane: {
startAngle: -150,
endAngle: 150,
background: [{
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
stops: [
[0, '#FFF'],
[1, '#333']
]
},
borderWidth: 0,
outerRadius: '109%'
}, {
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
stops: [
[0, '#333'],
[1, '#FFF']
]
},
borderWidth: 1,
outerRadius: '107%'
}, {
// default background
}, {
backgroundColor: '#DDD',
borderWidth: 0,
outerRadius: '105%',
innerRadius: '103%'
}]
},
// the value axis
yAxis: {
min: 0,
max: 100,
minorTickInterval: 'auto',
minorTickWidth: 1,
minorTickLength: 10,
minorTickPosition: 'inside',
minorTickColor: '#666',
tickPixelInterval: 30,
tickWidth: 2,
tickPosition: 'inside',
tickLength: 10,
tickColor: '#666',
labels: {
step: 2,
rotation: 'auto'
},
title: {
text: ''
},
plotBands: [{
from: 0,
to: 60,
color: '#55BF3B' // green
}, {
from: 60,
to: 80,
color: '#DDDF0D' // yellow
}, {
from: 80,
to: 100,
color: '#DF5353' // red
}]
},
series: [{
name: 'Disk Usage',
data: [0],
dataLabels: {
formatter: function () {
var usage = this.y;
return '<span style="color:#339">'+ usage + ' %</span><br/>';
},
backgroundColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1
},
stops: [
[0, '#DDD'],
[1, '#FFF']
]
}
},
tooltip: {
valueSuffix: ' %'
}
}]
},
function(chart) {
update_disk_usage(chart);
setInterval(function() {
update_disk_usage(chart);
}, 60000);
});
}
function update_disk_usage(chart){
$.get('/admin/dashboards/get_disk_usage',function(usage){
var point = chart.series[0].points[0],
newVal = Math.round(usage);
point.update(newVal);
});
}
</script> </script>
+11 -55
View File
@@ -2,61 +2,17 @@
<h2> <h2>
<i class="icons-book-2"></i> <i class="icons-book-2"></i>
<span class="break"></span> <span class="break"></span>
Traffic Loading <%= t(:monthly_traffic)%>
</h2> </h2>
</div> </div>
<div class="box-content"> <div class="box-content">
<div id="month_traffic" style="min-width: 310px; height: 230px; margin: 0 auto"></div> <div id="month_traffic" style="min-width: 310px; margin: 0 auto">
</div> <%= line_chart get_month_traffic, :height => "200px", :name => 'Visit',
<script type="text/javascript"> :library => {
$(function () { legend: 'none',
$.getJSON('/admin/dashboards/get_month_traffic', function (data) { chartArea:{ width: '95%', left: 50, right: 0},
// console.log(data); hAxis:{format:'MMM-d',gridlines:{color: '#CCC', count: 31}},
dates = []; vAxis:{minValue:-100,viewWindowMode: 'maximized'}
visits = []; } %>
$.each(data,function(key,value){ </div>
// console.log(value); </div>
$.each(value,function(date,visit){
dates.push(date);
visits.push(visit);
});
});
$('#month_traffic').highcharts({
chart: {
type: 'spline'
},
title: {
text: 'Monthly Traffic',
x: 0 //center
},
xAxis: {
categories: dates
},
yAxis: {
title: {
text: 'Number of visits'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: ''
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [{
name: 'Visits',
data: visits
}]
});
});
});
</script>
+7 -9
View File
@@ -1,20 +1,18 @@
<script src="http://code.highcharts.com/highcharts.js"></script> <%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %>
<script src="http://code.highcharts.com/highcharts-more.js"></script> <%= javascript_include_tag "/static/justgage.1.0.1.min.js" %>
<script src="http://code.highcharts.com/modules/exporting.js"></script> <%= javascript_include_tag "/static/raphael.2.1.0.min.js" %>
<script type="text/javascript" src="http://www.highcharts.com/highslide/highslide-full.min.js"></script>
<script type="text/javascript" src="http://www.highcharts.com/highslide/highslide.config.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="http://www.highcharts.com/highslide/highslide.css" />
<section id="main-wrap"> <section id="main-wrap">
<div class="wrap-inner initial"> <div class="wrap-inner initial">
<div class="row-fluid"> <div class="row-fluid">
<div class="box span6"> <% if is_admin? %>
<div class="box span7">
<div id='server_loading'> <div id='server_loading'>
<%= render 'server_loading' %> <%= render 'server_loading' %>
</div> </div>
</div> </div>
<div class="box span4"> <% end %>
<div class="box span5">
<div id='traffic'> <div id='traffic'>
<%= render 'traffic' %> <%= render 'traffic' %>
</div> </div>
+33 -1
View File
@@ -64,6 +64,10 @@
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">CSS <b class="caret"></b></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown">CSS <b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li class="active"><a href="#html_0" data-toggle="tab"><%= @design.layout.name %></a></li>
<% @design.themes.each do |theme| %>
<li><a href="#<%= dom_id theme %>" data-toggle="tab"><%= theme.name %></a></li>
<%end%>
<li><a href="#css_0" data-toggle="tab"><%= @design.css_default.name %></a></li> <li><a href="#css_0" data-toggle="tab"><%= @design.css_default.name %></a></li>
<li><a href="#css_1" data-toggle="tab"><%= @design.css_reset.name %></a></li> <li><a href="#css_1" data-toggle="tab"><%= @design.css_reset.name %></a></li>
</ul> </ul>
@@ -76,6 +80,26 @@
<% end %> <% end %>
</ul> </ul>
</li> </li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Theme <b class="caret"></b></a>
<ul class="dropdown-menu">
<% @design.themes.each do |theme| %>
<li><a href="#<%= dom_id theme %>" data-toggle="tab"><%= theme.name %></a></li>
<% end %>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Images <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#images" data-toggle="tab">Images</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Template Info<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#info" data-toggle="tab">Template Info</a></li>
</ul>
</li>
</ul> </ul>
<div id="code-groups" class="tab-content"> <div id="code-groups" class="tab-content">
<div class="clearfix tab-pane fade active in" id="html_0"> <div class="clearfix tab-pane fade active in" id="html_0">
@@ -93,8 +117,16 @@
<%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => @design.css_reset} %> <%= render :partial => 'tab_form', :locals => {:type => :css_reset, :object => @design.css_reset} %>
</div> </div>
<div class="clearfix tab-pane fade active in" id="images">
<%= render :partial => 'images' %>
</div>
<div class="clearfix tab-pane fade active in" id="info">
<%= render :partial => 'form' %>
</div>
<% @design.javascripts.each do |js| %> <% @design.javascripts.each do |js| %>
<div class="clearfix tab-pane fade active in" id="#<%= dom_id js %>"> <div class="clearfix tab-pane fade active in" id="<%= dom_id js %>">
<%= render :partial => 'tab_form', :locals => {:type => :javascripts, :object => js} %> <%= render :partial => 'tab_form', :locals => {:type => :javascripts, :object => js} %>
</div> </div>
<% end %> <% end %>
@@ -3,4 +3,25 @@
<div class="controls"> <div class="controls">
<%= select 'page_part', 'widget_style', @frontend_styles, {:selected => (@part && @part[:widget_style])}, class: "input-xlarge" %> <%= select 'page_part', 'widget_style', @frontend_styles, {:selected => (@part && @part[:widget_style])}, class: "input-xlarge" %>
</div> </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> </div>
@@ -0,0 +1,18 @@
<% 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 %>
+13 -7
View File
@@ -3,8 +3,7 @@
<% content_for :page_specific_javascript do %> <% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/items/page_part" %> <%= javascript_include_tag "lib/items/page_part" %>
<% end %> <% 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 %> <%= f.error_messages %>
<div class="btn-group" data-toggle="buttons-radio"> <div class="btn-group" data-toggle="buttons-radio">
<label href="#none" class="btn btn-large" data-toggle="tab"> <label href="#none" class="btn btn-large" data-toggle="tab">
@@ -81,7 +80,7 @@
<div class="control-group input-content"> <div class="control-group input-content">
<%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}", class: "control-label muted" %> <%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}", class: "control-label muted" %>
<div class="controls"> <div class="controls">
<%= f.text_field locale, class: 'input-xlarge page_title', placeholder: "#{t(:title)} #{I18nVariable.from_locale(locale)}", id: locale %> <%= 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) %>
</div> </div>
</div> </div>
<% end %> <% end %>
@@ -102,13 +101,13 @@
<%= f.label :categories, t(:categories), class: "control-label muted" %> <%= f.label :categories, t(:categories), class: "control-label muted" %>
<div class="controls"> <div class="controls">
<%= content_tag :label, class: "checkbox" do %> <%= content_tag :label, class: "checkbox" do %>
<%= check_box_tag nil, nil, true, class: "select_all" %> <%= t(:all) %> <%= check_box_tag nil, nil, false, class: "select_all" %> <%= t(:all) %>
<% end %> <% end %>
<div class="groups" id="page-category"> <div class="groups" id="page-category">
<%= content_tag_for(:label, @module_app_categories, class: "checkbox inline") do |category|%> <%= content_tag_for(:label, @module_app_categories, class: "checkbox inline") do |category|%>
<%= check_box_tag("page_part[tag][]", category.id, (@part.category.include?(category.id) rescue false) ) %> <%= check_box_tag("page_part[category][]", category.id, (@part.category.include?(category.id.to_s) rescue false) ) %>
<%= category.title %> <%= category.title %>
<% end if @module_app_tags %> <% end if @module_app_categories %>
</div> </div>
</div> </div>
</div> </div>
@@ -120,7 +119,7 @@
<% end %> <% end %>
<div class="groups" id="page-tags"> <div class="groups" id="page-tags">
<%= content_tag_for(:label, @module_app_tags, class: "checkbox inline") do |tag|%> <%= 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) rescue false) ) %> <%= check_box_tag("page_part[tag][]", tag.id, (@part.tag.include?(tag.id.to_s) rescue false) ) %>
<%= tag.name %> <%= tag.name %>
<% end if @module_app_tags %> <% end if @module_app_tags %>
</div> </div>
@@ -161,3 +160,10 @@
$.getScript($(this).attr('rel') + '?type=' + $(this).val() + "&id=" + "<%= @part.id %>" ); $.getScript($(this).attr('rel') + '?type=' + $(this).val() + "&id=" + "<%= @part.id %>" );
}); });
</script> </script>
<script>
function toggleChecked(status) {
$(".checkbox").each( function() {
$(this).attr("checked",status);
})
}
</script>
+1
View File
@@ -0,0 +1 @@
window.location.href="<%= admin_page_url(@part.page, edit: true) %>"
+1 -1
View File
@@ -164,7 +164,7 @@
<label class="control-label muted">Default Language</label> <label class="control-label muted">Default Language</label>
<div class="controls"> <div class="controls">
<% @site_in_use_locales.each do |locale| %> <% @site_in_use_locales.each do |locale| %>
<%= radio_button_tag "site[default_locale]", locale, @locale == locale , @site.in_use_locales.include?(locale),:class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(locale)}", disabled: true } %> <%= radio_button_tag "site[default_locale]", locale, @locale == locale,:class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(locale)}", disabled: true } %>
<% end %> <% end %>
</div> </div>
</div> </div>
@@ -6,7 +6,7 @@
<div id="sidebar-menu"> <div id="sidebar-menu">
<div class="scroller"> <div class="scroller">
<%= content_tag :ul, :class => "sidebar-nav" do -%> <%= content_tag :ul, :class => "sidebar-nav" do -%>
<%= content_tag :li, :class => active_for_controllers('users_new_interface') do -%> <%= content_tag :li, :class => active_for_controllers('users_new_interface','roles') do -%>
<%= link_to( ( content_tag(:span, content_tag(:i, nil, :class => 'icons-user'))), admin_users_new_interface_index_path) %> <%= link_to( ( content_tag(:span, content_tag(:i, nil, :class => 'icons-user'))), admin_users_new_interface_index_path) %>
<% end -%> <% end -%>
<%= content_tag :li, :class => active_for_controllers('plugins') do -%> <%= content_tag :li, :class => active_for_controllers('plugins') do -%>
@@ -30,7 +30,7 @@
<%= content_tag :li, link_to((content_tag(:span, t(:add_member))), new_admin_users_new_interface_path), :class => active_for_action('users_new_interface', 'new') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((content_tag(:span, t(:add_member))), new_admin_users_new_interface_path), :class => active_for_action('users_new_interface', 'new') if (is_admin? rescue nil) %>
<%= content_tag :li, link_to((content_tag(:span, t(:member_authorization))), '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((content_tag(:span, t(:member_authorization))), '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
<%= content_tag :li, link_to((content_tag(:span, t(:member_registration))), '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((content_tag(:span, t(:member_registration))), '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %>
<%= content_tag :li, link_to((content_tag(:span, t(:member_role))),admin_roles_path ), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((content_tag(:span, t(:member_role))),admin_roles_path ), :class => active_for_action('roles', 'index') if (is_admin? rescue nil) %>
<%= content_tag :li, link_to((content_tag(:span, t(:member_info))), edit_admin_info_path(Info.first.id.to_s)), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) and Info.first %> <%= content_tag :li, link_to((content_tag(:span, t(:member_info))), edit_admin_info_path(Info.first.id.to_s)), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) and Info.first %>
<% end -%> <% end -%>
</div> </div>
@@ -24,12 +24,12 @@
<ul class="nav nav-pills filter-nav pull-right"> <ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group"> <li class="accordion-group">
<div class="accordion-heading"> <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> </div>
</li> </li>
</ul> </ul>
<div class="filter-group accordion-group"> <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"%> <%= render :partial => "filter"%>
@@ -25,12 +25,12 @@
<ul class="nav nav-pills filter-nav pull-right"> <ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group"> <li class="accordion-group">
<div class="accordion-heading"> <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> </div>
</li> </li>
</ul> </ul>
<div class="filter-group accordion-group"> <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"%> <%= render :partial => "filter"%>
@@ -25,12 +25,12 @@
<ul class="nav nav-pills filter-nav pull-right"> <ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group"> <li class="accordion-group">
<div class="accordion-heading"> <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> </div>
</li> </li>
</ul> </ul>
<div class="filter-group accordion-group"> <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"%> <%= render :partial => "filter"%>
+1 -1
View File
@@ -21,7 +21,7 @@
</li> </li>
<!-- Desktop --> <!-- Desktop -->
<% if !@site.desktop_closed%> <% if @site.desktop_closed%>
<li id="orbit-desktop"> <li id="orbit-desktop">
<a href="<%= desktop_path %>" role="button"> <a href="<%= desktop_path %>" role="button">
<i class="icons-screen"></i> <span class="hide"><%= t(:desktop) %></span> <i class="icons-screen"></i> <span class="hide"><%= t(:desktop) %></span>
@@ -13,13 +13,21 @@
<div> <div>
<script type="text/javascript" src="/assets/kernel.js"></script> <script type="text/javascript" src="/assets/kernel.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var preview_img;
$(function() { $(function() {
$("iframe").load(function() { $("iframe").load(function() {
// Get the body element // Get the body element
var frameBody = $("iframe").contents().find('body'); var frameBody = $("iframe").contents().find('body');
// Get all links inside the BODY tag // Get all links inside the BODY tag
$("iframe").contents().find('#orbit-bar').hide(); $("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){ frameBody.find('a').click(function(e){
//Disable all default actions //Disable all default actions
e.preventDefault(); e.preventDefault();
@@ -30,6 +38,14 @@
$("#show_preview").remove(); $("#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> </script>
</div> </div>
</div> </div>
+2 -1
View File
@@ -1,6 +1,7 @@
defaults: &defaults defaults: &defaults
main_public_key: 'lib/main_public_key.pem' main_public_key: 'lib/main_public_key.pem'
store_ip: 'redmine.rulingcom.com:3001' # store_ip: 'redmine.rulingcom.com:3001'
store_ip: 'tp.rulingcom.com:33335'
orbit: 'Orbit' orbit: 'Orbit'
ruling_digital: 'RulingDigital' ruling_digital: 'RulingDigital'
+3
View File
@@ -289,6 +289,7 @@ en:
menu_enabled_for: Menu enabled for menu_enabled_for: Menu enabled for
module: Module module: Module
module_authorization: Module Authorization module_authorization: Module Authorization
monthly_traffic: Monthly Traffic
more_plus: more+ more_plus: more+
most_visited_page: Most Visited Page most_visited_page: Most Visited Page
multilingual: Multilingual multilingual: Multilingual
@@ -377,6 +378,7 @@ en:
search_: Search search_: Search
search_google: Search Google search_google: Search Google
setup_member: Member setup setup_member: Member setup
server_usage: Server Usage
show: Show show: Show
show_mode: show_mode:
index: Index index: Index
@@ -516,6 +518,7 @@ en:
vertical: Vertical vertical: Vertical
view: View view: View
view_count: View count view_count: View count
visitors_count: Visits
visitors_this_month: This month's visitors visitors_this_month: This month's visitors
visitors_this_week: This week's visitors visitors_this_week: This week's visitors
visitors_this_year: This year's visitors visitors_this_year: This year's visitors
+3
View File
@@ -290,6 +290,7 @@ zh_tw:
menu_enabled_for: 選單啟用 menu_enabled_for: 選單啟用
module: 模組 module: 模組
module_authorization: 模組授權 module_authorization: 模組授權
monthly_traffic: 本月流量
more_plus: 更多+ more_plus: 更多+
most_visited_page: 最多瀏覽頁面 most_visited_page: 最多瀏覽頁面
multilingual: 多語系 multilingual: 多語系
@@ -378,6 +379,7 @@ zh_tw:
search_: 搜尋 search_: 搜尋
search_google: 搜尋Google search_google: 搜尋Google
setup_member: 會員設定 setup_member: 會員設定
server_usage: 主機負載
show: 顯示 show: 顯示
show_mode: show_mode:
index: 檢索 index: 檢索
@@ -517,6 +519,7 @@ zh_tw:
vertical: 垂直的 vertical: 垂直的
view: 檢視 view: 檢視
view_count: 查看次數 view_count: 查看次數
visitors_count: 造訪人次
visitors_this_month: 本月造訪人次 visitors_this_month: 本月造訪人次
visitors_this_week: 本星期造訪人次 visitors_this_week: 本星期造訪人次
visitors_this_year: 今年造訪人次 visitors_this_year: 今年造訪人次
+2 -2
View File
@@ -279,8 +279,8 @@ module OrbitCoreLib
end end
def check_user_can_use def check_user_can_use
unless current_or_guest_user.admin? || @module_app.is_manager?(current_or_guest_user) || @module_app.is_sub_manager?(current_or_guest_user) || @module_app.can_approve?(current_or_guest_user) unless current_or_guest_user.admin? || (@module_app.is_manager?(current_or_guest_user) if @module_app.present?) || (@module_app.is_sub_manager?(current_or_guest_user) if @module_app.present?) || (@module_app.can_approve?(current_or_guest_user) if @module_app.present?)
redirect_to root_url redirect_to admin_dashboards_url
end end
end end
+1 -1
View File
@@ -93,7 +93,7 @@ def unzip_design(file, zip_name)
site.design = design site.design = design
site.save site.save
theme = design.themes.first theme = design.themes.first
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id, :menu_enabled_for => [] ) home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => nil, :menu_enabled_for => {"zh_tw"=>"true", "en"=>"true"} )
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"} home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
home.save home.save
+1 -1
View File
@@ -27,7 +27,7 @@ namespace :site do
site.design = design site.design = design
site.save site.save
theme = design.themes.first theme = design.themes.first
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id, :menu_enabled_for => [] ) home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => nil, :menu_enabled_for => {"zh_tw"=>"true", "en"=>"true"} )
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"} home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
home.save home.save
+12
View File
@@ -0,0 +1,12 @@
/**
* JustGage - a handy JavaScript plugin for generating and animating nice & clean dashboard gauges.
* Copyright (c) 2012 Bojan Djuricic - pindjur(at)gmail(dot)com | http://www.madcog.com
* Licensed under MIT.
* Date: 31/07/2012
* @author Bojan Djuricic (@Toorshia)
* @version 1.0
*
* http://www.justgage.com
*/
JustGage=function(x){if(!x.id){alert("Missing id parameter for gauge!");return false}if(!document.getElementById(x.id)){alert('No element with id: "'+x.id+'" found!');return false}this.config={id:x.id,title:(x.title)?x.title:"Title",titleFontColor:(x.titleFontColor)?x.titleFontColor:"#999999",value:(x.value)?x.value:0,valueFontColor:(x.valueFontColor)?x.valueFontColor:"#010101",min:(x.min)?x.min:0,max:(x.max)?x.max:100,showMinMax:(x.showMinMax!=null)?x.showMinMax:true,gaugeWidthScale:(x.gaugeWidthScale)?x.gaugeWidthScale:1,gaugeColor:(x.gaugeColor)?x.gaugeColor:"#edebeb",label:(x.label)?x.label:"",showInnerShadow:(x.showInnerShadow!=null)?x.showInnerShadow:true,shadowOpacity:(x.shadowOpacity)?x.shadowOpacity:0.2,shadowSize:(x.shadowSize)?x.shadowSize:5,shadowVerticalOffset:(x.shadowVerticalOffset)?x.shadowVerticalOffset:3,levelColors:(x.levelColors)?x.levelColors:percentColors,levelColorsGradient:(x.levelColorsGradient!=null)?x.levelColorsGradient:true,labelFontColor:(x.labelFontColor)?x.labelFontColor:"#b3b3b3",startAnimationTime:(x.startAnimationTime)?x.startAnimationTime:700,startAnimationType:(x.startAnimationType)?x.startAnimationType:">",refreshAnimationTime:(x.refreshAnimationTime)?x.refreshAnimationTime:700,refreshAnimationType:(x.refreshAnimationType)?x.refreshAnimationType:">"};if(x.value>this.config.max){this.config.value=this.config.max}if(x.value<this.config.min){this.config.value=this.config.min}this.originalValue=x.value;this.canvas=Raphael(this.config.id,"100%","100%");var d=getStyle(document.getElementById(this.config.id),"width").slice(0,-2)*1;var q=getStyle(document.getElementById(this.config.id),"height").slice(0,-2)*1;var c,l;if((d/q)>1.25){c=1.25*q;l=q}else{c=d;l=d/1.25}var i=(d-c)/2;var g=(q-l)/2;var s=((l/8)>10)?(l/10):10;var n=i+c/2;var m=g+l/6.5;var k=((l/6.4)>16)?(l/6.4):16;var r=i+c/2;var p=g+l/1.4;var b=((l/16)>10)?(l/16):10;var f=i+c/2;var e=p+k/2+6;var j=((l/16)>10)?(l/16):10;var w=i+(c/10)+(c/6.666666666666667*this.config.gaugeWidthScale)/2;var v=g+l/1.126760563380282;var h=((l/16)>10)?(l/16):10;var u=i+c-(c/10)-(c/6.666666666666667*this.config.gaugeWidthScale)/2;var t=g+l/1.126760563380282;this.params={canvasW:d,canvasH:q,widgetW:c,widgetH:l,dx:i,dy:g,titleFontSize:s,titleX:n,titleY:m,valueFontSize:k,valueX:r,valueY:p,labelFontSize:b,labelX:f,labelY:e,minFontSize:j,minX:w,minY:v,maxFontSize:h,maxX:u,maxY:t};this.canvas.customAttributes.pki=function(K,L,N,E,O,F,D,y){var B=(1-(K-L)/(N-L))*Math.PI,G=E/2-E/10,J=G-E/6.666666666666667*y,C=E/2+F,A=O/1.25+D,H=E/2+F+G*Math.cos(B),P=O-(O-A)+D-G*Math.sin(B),M=E/2+F+J*Math.cos(B),z=O-(O-A)+D-J*Math.sin(B),I;I+="M"+(C-J)+","+A+" ";I+="L"+(C-G)+","+A+" ";I+="A"+G+","+G+" 0 0,1 "+H+","+P+" ";I+="L"+M+","+z+" ";I+="A"+J+","+J+" 0 0,0 "+(C-J)+","+A+" ";I+="z ";return{path:I}};this.gauge=this.canvas.path().attr({stroke:"none",fill:this.config.gaugeColor,pki:[this.config.max,this.config.min,this.config.max,this.params.widgetW,this.params.widgetH,this.params.dx,this.params.dy,this.config.gaugeWidthScale]});this.gauge.id=this.config.id+"-gauge";this.level=this.canvas.path().attr({stroke:"none",fill:getColorForPercentage((this.config.value-this.config.min)/(this.config.max-this.config.min),this.config.levelColors,this.config.levelColorsGradient),pki:[this.config.min,this.config.min,this.config.max,this.params.widgetW,this.params.widgetH,this.params.dx,this.params.dy,this.config.gaugeWidthScale]});this.level.id=this.config.id+"-level";this.txtTitle=this.canvas.text(this.params.titleX,this.params.titleY,this.config.title);this.txtTitle.attr({"font-size":this.params.titleFontSize,"font-weight":"bold","font-family":"Arial",fill:this.config.titleFontColor,"fill-opacity":"1"});this.txtTitle.id=this.config.id+"-txttitle";this.txtValue=this.canvas.text(this.params.valueX,this.params.valueY,this.originalValue);this.txtValue.attr({"font-size":this.params.valueFontSize,"font-weight":"bold","font-family":"Arial",fill:this.config.valueFontColor,"fill-opacity":"0"});this.txtValue.id=this.config.id+"-txtvalue";this.txtLabel=this.canvas.text(this.params.labelX,this.params.labelY,this.config.label);this.txtLabel.attr({"font-size":this.params.labelFontSize,"font-weight":"normal","font-family":"Arial",fill:this.config.labelFontColor,"fill-opacity":"0"});this.txtLabel.id=this.config.id+"-txtlabel";this.txtMin=this.canvas.text(this.params.minX,this.params.minY,this.config.min);this.txtMin.attr({"font-size":this.params.minFontSize,"font-weight":"normal","font-family":"Arial",fill:this.config.labelFontColor,"fill-opacity":(this.config.showMinMax==true)?"1":"0"});this.txtMin.id=this.config.id+"-txtmin";this.txtMax=this.canvas.text(this.params.maxX,this.params.maxY,this.config.max);this.txtMax.attr({"font-size":this.params.maxFontSize,"font-weight":"normal","font-family":"Arial",fill:this.config.labelFontColor,"fill-opacity":(this.config.showMinMax==true)?"1":"0"});this.txtMax.id=this.config.id+"-txtmax";var a=this.canvas.canvas.childNodes[1];var o="http://www.w3.org/20 Line truncated
+10
View File
@@ -0,0 +1,10 @@
// +--------------------------------------------------------------------+ \\
// ¦ Raphaël 2.1.0 - JavaScript Vector Library ¦ \\
// +--------------------------------------------------------------------¦ \\
// ¦ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) ¦ \\
// ¦ Copyright © 2008-2012 Sencha Labs (http://sencha.com) ¦ \\
// +--------------------------------------------------------------------¦ \\
// ¦ Licensed under the MIT (http://raphaeljs.com/license.html) license.¦ \\
// +--------------------------------------------------------------------+ \\
(function(a){var b="0.3.4",c="hasOwnProperty",d=/[\.\/]/,e="*",f=function(){},g=function(a,b){return a-b},h,i,j={n:{}},k=function(a,b){var c=j,d=i,e=Array.prototype.slice.call(arguments,2),f=k.listeners(a),l=0,m=!1,n,o=[],p={},q=[],r=h,s=[];h=a,i=0;for(var t=0,u=f.length;t<u;t++)"zIndex"in f[t]&&(o.push(f[t].zIndex),f[t].zIndex<0&&(p[f[t].zIndex]=f[t]));o.sort(g);while(o[l]<0){n=p[o[l++]],q.push(n.apply(b,e));if(i){i=d;return q}}for(t=0;t<u;t++){n=f[t];if("zIndex"in n)if(n.zIndex==o[l]){q.push(n.apply(b,e));if(i)break;do{l++,n=p[o[l]],n&&q.push(n.apply(b,e));if(i)break}while(n)}else p[n.zIndex]=n;else{q.push(n.apply(b,e));if(i)break}}i=d,h=r;return q.length?q:null};k.listeners=function(a){var b=a.split(d),c=j,f,g,h,i,k,l,m,n,o=[c],p=[];for(i=0,k=b.length;i<k;i++){n=[];for(l=0,m=o.length;l<m;l++){c=o[l].n,g=[c[b[i]],c[e]],h=2;while(h--)f=g[h],f&&(n.push(f),p=p.concat(f.f||[]))}o=n}return p},k.on=function(a,b){var c=a.split(d),e=j;for(var g=0,h=c.length;g<h;g++)e=e.n,!e[c[g]]&&(e[c[g]]={n:{}}),e=e[c[g]];e.f=e.f||[];for(g=0,h=e.f.length;g<h;g++)if(e.f[g]==b)return f;e.f.push(b);return function(a){+a==+a&&(b.zIndex=+a)}},k.stop=function(){i=1},k.nt=function(a){if(a)return(new RegExp("(?:\\.|\\/|^)"+a+"(?:\\.|\\/|$)")).test(h);return h},k.off=k.unbind=function(a,b){var f=a.split(d),g,h,i,k,l,m,n,o=[j];for(k=0,l=f.length;k<l;k++)for(m=0;m<o.length;m+=i.length-2){i=[m,1],g=o[m].n;if(f[k]!=e)g[f[k]]&&i.push(g[f[k]]);else for(h in g)g[c](h)&&i.push(g[h]);o.splice.apply(o,i)}for(k=0,l=o.length;k<l;k++){g=o[k];while(g.n){if(b){if(g.f){for(m=0,n=g.f.length;m<n;m++)if(g.f[m]==b){g.f.splice(m,1);break}!g.f.length&&delete g.f}for(h in g.n)if(g.n[c](h)&&g.n[h].f){var p=g.n[h].f;for(m=0,n=p.length;m<n;m++)if(p[m]==b){p.splice(m,1);break}!p.length&&delete g.n[h].f}}else{delete g.f;for(h in g.n)g.n[c](h)&&g.n[h].f&&delete g.n[h].f}g=g.n}}},k.once=function(a,b){var c=function(){var d=b.apply(this,arguments);k.unbind(a,c);return d};return k.on(a,c)},k.version=b,k.toString=function(){return"You are running Eve "+b},typeof module!="undefined"&&module.exports?module.exports=k:typeof define!="undefined"?define("eve",[],function(){return k}):a.eve=k})(this),function(){function cF(a){for(var b=0;b<cy.length;b++)cy[b].el.paper==a&&cy.splice(b--,1)}function cE(b,d,e,f,h,i){e=Q(e);var j,k,l,m=[],o,p,q,t=b.ms,u={},v={},w={};if(f)for(y=0,z=cy.length;y<z;y++){var x=cy[y];if(x.el.id==d.id&&x.anim==b){x.percent!=e?(cy.splice(y,1),l=1):k=x,d.attr(x.totalOrigin);break}}else f=+v;for(var y=0,z=b.percents.length;y<z;y++){if(b.percents[y]==e||b.percents[y]>f*b.top){e=b.percents[y],p=b.percents[y-1]||0,t=t/b.top*(e-p),o=b.percents[y+1],j=b.anim[e];break}f&&d.attr(b.anim[b.percents[y]])}if(!!j){if(!k){for(var A in j)if(j[g](A))if(U[g](A)||d.paper.customAttributes[g](A)){u[A]=d.attr(A),u[A]==null&&(u[A]=T[A]),v[A]=j[A];switch(U[A]){case C:w[A]=(v[A]-u[A])/t;break;case"colour":u[A]=a.getRGB(u[A]);var B=a.getRGB(v[A]);w[A]={r:(B.r-u[A].r)/t,g:(B.g-u[A].g)/t,b:(B.b-u[A].b)/t};break;case"path":var D=bR(u[A],v[A]),E=D[1];u[A]=D[0],w[A]=[];for(y=0,z=u[A].length;y<z;y++){w[A][y]=[0];for(var F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(E[y][F]-u[A][y][F])/t}break;case"transform":var H=d._,I=ca(H[A],v[A]);if(I){u[A]=I.from,v[A]=I.to,w[A]=[],w[A].real=!0;for(y=0,z=u[A].length;y<z;y++){w[A][y]=[u[A][y][0]];for(F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(v[A][y][F]-u[A][y][F])/t}}else{var J=d.matrix||new cb,K={_:{transform:H.transform},getBBox:function(){return d.getBBox(1)}};u[A]=[J.a,J.b,J.c,J.d,J.e,J.f],b$(K,v[A]),v[A]=K._.transform,w[A]=[(K.matrix.a-J.a)/t,(K.matrix.b-J.b)/t,(K.matrix.c-J.c)/t,(K.matrix.d-J.d)/t,(K.matrix.e-J.e)/t,(K.matrix.f-J.f)/t]}break;case"csv":var L=r(j[A])[s](c),M=r(u[A])[s](c);if(A=="clip-rect"){u[A]=M,w[A]=[],y=M.length;while(y--)w[A][y]=(L[y]-u[A][y])/t}v[A]=L;break;default:L=[][n](j[A]),M=[][n](u[A]),w[A]=[],y=d.paper.customAttributes[A].length;while(y--)w[A][y]=((L[y]||0)-(M[y]||0))/t}}var O=j.easing,P=a.easing_formulas[O];if(!P){P=r(O).match(N);if(P&&P.length==5){var R=P;P=function(a){return cC(a,+R[1],+R[2],+R[3],+R[4],t)}}else P=bf}q=j.start||b.start||+(new Date),x={anim:b,percent:e,timestamp:q,start:q+(b.del||0),status:0,initstatus:f||0,stop:!1,ms:t,easing:P,from:u,diff:w,to:v,el:d,callback:j.callback,prev:p,next:o,repeat:i||b.times,origin:d.attr(),totalOrigin:h},cy.push(x);if(f&&!k&&!l){x.stop=!0,x.start=new Date-t*f;if(cy.length==1)return cA()}l&&(x.start=new Date-x.ms*f),cy.length==1&&cz(cA)}else k.initstatus=f,k.start=new Date-k.ms*f;eve("raphael.anim.start."+d.id,d,b)}}function cD(a,b){var c=[],d={};this.ms=b,this.times=1;if(a){for(var e in a)a[g](e)&&(d[Q(e)]=a[e],c.push(Q(e)));c.sort(bd)}this.anim=d,this.top=c[c.length-1],this.percents=c}function cC(a,b,c,d,e,f){function o(a,b){var c,d,e,f,j,k;for(e=a,k=0;k<8;k++){f=m(e)-a;if(z(f)<b)return e;j=(3*i*e+2*h)*e+g;if(z(j)<1e-6)break;e=e-f/j}c=0,d=1,e=a;if(e<c)return c;if(e>d)return d;while(c<d){f=m(e);if(z(f-a)<b)return e;a>f?c=e:d=e,e=(d-c)/2+c}return e}function n(a,b){var c=o(Line truncated
@@ -20,6 +20,8 @@ class ArchiveFile
field :title, localize: true field :title, localize: true
field :create_user_id field :create_user_id
field :update_user_id, :class_name => "User" field :update_user_id, :class_name => "User"
scope :can_display,where(is_hidden: false)
# belongs_to :archive_file_category # belongs_to :archive_file_category
@@ -4,78 +4,22 @@ class Panel::CalendarNew::BackEnd::EventCategoriesController < OrbitBackendContr
# GET /events # GET /events
# GET /events.json # GET /events.json
def index def index
@event_categories = EventCategory.all @module_app_id = @module_app.id rescue nil
@categories = get_categories_for_index
@categories = @categories.page(params[:page]).per(10)
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.json { render json: @event_categories } format.json { render json: @categories }
end end
end end
# GET /events/1 def list
# GET /events/1.json @module_app_id = @module_app.id rescue nil
def show
@event_category = EventCategory.find(params[:id])
respond_to do |format| @categories = get_categories_for_index
format.html # show.html.erb @categories = @categories.page(params[:page]).per(10)
format.json { render json: @event_category } render :layout => false
end
end
# GET /events/new
# GET /events/new.json
def new
@event_category = EventCategory.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @event_category }
end
end
# GET /events/1/edit
def edit
@event_category = EventCategory.find(params[:id])
end
def create
@event_category = EventCategory.new(params[:event_category])
respond_to do |format|
if @event_category.save
format.html { redirect_to panel_calendar_new_back_end_event_categories_path, notice: 'Category was successfully created.' }
format.json { render json: @event_category, status: :created, location: @event_category }
else
format.html { render action: "new" }
format.json { render json: @event_category.errors, status: :unprocessable_entity }
end
end
end
def update
@event_category = EventCategory.find(params[:id])
respond_to do |format|
if @event_category.update_attributes(params[:event_category])
format.html { redirect_to panel_calendar_new_back_end_event_categories_path, notice: 'Category was successfully updated.' }
format.json { head :no_content }
#format.js
else
format.html { render action: "edit" }
format.json { render json: @event_category.errors, status: :unprocessable_entity }
#format.js
end
end
end
def destroy
@event_category = EventCategory.find(params[:id])
@event_category.destroy
respond_to do |format|
format.html { redirect_to panel_calendar_new_back_end_event_categories_path }
format.json { head :no_content }
end
end end
end end
@@ -40,6 +40,7 @@ class Panel::CalendarNew::BackEnd::EventsController < OrbitBackendController
# GET /events/new.json # GET /events/new.json
def new def new
@event = Event.new @event = Event.new
@categories = get_categories_for_index
@end_d_t = "" @end_d_t = ""
@start_d_t = "" @start_d_t = ""
@all_day = false; @all_day = false;
@@ -61,15 +62,13 @@ class Panel::CalendarNew::BackEnd::EventsController < OrbitBackendController
@start_d_t = params[:startDate] @start_d_t = params[:startDate]
end end
render :layout => false render :layout => false
#respond_to do |format|
# format.html # new.html.erb
# format.json { render json: @event }
#end
end end
# GET /events/1/edit # GET /events/1/edit
def edit def edit
@event = Event.find(params[:id]) @event = Event.find(params[:id])
@categories = get_categories_for_index
@end_d_t = @event.end.strftime("%Y/%m/%d %H:%M").to_s @end_d_t = @event.end.strftime("%Y/%m/%d %H:%M").to_s
@start_d_t = @event.start.strftime("%Y/%m/%d %H:%M").to_s @start_d_t = @event.start.strftime("%Y/%m/%d %H:%M").to_s
@all_day = @event.all_day @all_day = @event.all_day
@@ -80,12 +79,8 @@ class Panel::CalendarNew::BackEnd::EventsController < OrbitBackendController
# POST /events # POST /events
# POST /events.json # POST /events.json
def create def create
@event = Event.new(params[:event]) @event = Event.new(params[:event])
# if params[:event][:period] == "Does not repeat"
#else
# @event_recurring = EventRecurring.new(params[:event])
#end
if @event.present? && @event.save if @event.present? && @event.save
render json: @event.to_json render json: @event.to_json
else else
@@ -0,0 +1,45 @@
class Panel::CalendarNew::FrontEnd::EventsController < OrbitWidgetController
# GET /events
# GET /events.json
def initialize
super
@app_title = 'calendar'
end
def index
@item = Page.find(params[:page_id])
@title = @item.title
if !@item.frontend_data_count.blank?
@page_num = @item.frontend_data_count
else
@page_num = 10
end
if params[:start].present? && params[:end].present?
sdt = Time.at(params[:start].to_i)
edt = Time.at(params[:end].to_i)
@monthly_events = Event.monthly_event(sdt,edt)
@re = Event.recurring_event(sdt,edt)
@events = @monthly_events.inject(@re, :<<)
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @events }
end
end
def show
@event = Event.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @event }
end
end
def agenda
agenda_start = Date.parse(params[:agenda_start])
agenda_end = Date.parse(params[:agenda_end])
@events = Event.agenda_events(agenda_start,agenda_end)
render :json=>@events.to_json
end
end
+8 -9
View File
@@ -4,6 +4,7 @@ require 'date'
class Event class Event
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include OrbitCategory::Categorizable
include Mongoid::MultiParameterAttributes include Mongoid::MultiParameterAttributes
field :title field :title
@@ -12,13 +13,11 @@ class Event
field :end, type: DateTime field :end, type: DateTime
field :all_day, type: Boolean field :all_day, type: Boolean
field :recurring, type: Boolean field :recurring, type: Boolean
field :event_category_id
field :frequency field :frequency
field :period field :period
attr_accessor :agenda_start, :agenda_end, :get_agenda_events attr_accessor :agenda_start, :agenda_end, :get_agenda_events
belongs_to :event_category
validates_presence_of :title, :message => "Please fill the title of the Event" validates_presence_of :title, :message => "Please fill the title of the Event"
@@ -42,8 +41,8 @@ class Event
:end => self.end.rfc822, :end => self.end.rfc822,
:allDay => self.all_day, :allDay => self.all_day,
:recurring => self.recurring, :recurring => self.recurring,
:calendar => self.event_category_id, :calendar => self.category_id,
:color => EventCategory.find(self.event_category_id).color, :color => Category.find(self.category_id).custom_value,
:edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(self.id), :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(self.id),
:delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(self.id) :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(self.id)
} }
@@ -64,13 +63,13 @@ class Event
@i = TimeDifference.between(re.start,end_date).in_days.to_i @i = TimeDifference.between(re.start,end_date).in_days.to_i
(1..@i).each do |i| (1..@i).each do |i|
@start_date = re.start + i @start_date = re.start + i
@recurring << {:id => re.id, :title=>re.title, :note=>re.note, :start=>@start_date, :end => @start_date, :allDay => re.all_day, :recurring => re.recurring, :calendar => re.event_category_id.to_s, :color => EventCategory.find(re.event_category_id).color, :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(re.id), :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(re.id)} @recurring << {:id => re.id, :title=>re.title, :note=>re.note, :start=>@start_date, :end => @start_date, :allDay => re.all_day, :recurring => re.recurring, :calendar => re.category_id.to_s, :color => Category.find(re.category_id).custom_value, :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(re.id), :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(re.id)}
end end
elsif re.start < start_date elsif re.start < start_date
@i = TimeDifference.between(start_date,end_date).in_days.to_i @i = TimeDifference.between(start_date,end_date).in_days.to_i
(0..@i-1).each do |i| (0..@i-1).each do |i|
@start_date = start_date.to_date + i @start_date = start_date.to_date + i
@recurring << {:id => re.id, :title=>re.title, :note=>re.note, :start=>@start_date, :end => @start_date, :allDay => re.all_day, :recurring => re.recurring, :calendar => re.event_category_id.to_s, :color => EventCategory.find(re.event_category_id).color, :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(re.id), :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(re.id)} @recurring << {:id => re.id, :title=>re.title, :note=>re.note, :start=>@start_date, :end => @start_date, :allDay => re.all_day, :recurring => re.recurring, :calendar => re.category_id.to_s, :color => Category.find(re.category_id).custom_value, :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(re.id), :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(re.id)}
end end
end end
when "Weekly" when "Weekly"
@@ -81,7 +80,7 @@ class Event
@start_date += (7*re.frequency.to_i) @start_date += (7*re.frequency.to_i)
@end_date += (7*re.frequency.to_i) @end_date += (7*re.frequency.to_i)
@recurring << {:id => re.id, :title=>re.title, :note=>re.note, :start=>@start_date, :end => @end_date, :allDay => re.all_day, :recurring => re.recurring, :calendar => re.event_category_id.to_s, :color => EventCategory.find(re.event_category_id).color, :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(re.id), :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(re.id)} @recurring << {:id => re.id, :title=>re.title, :note=>re.note, :start=>@start_date, :end => @end_date, :allDay => re.all_day, :recurring => re.recurring, :calendar => re.category_id.to_s, :color => Category.find(re.category_id).custom_value, :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(re.id), :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(re.id)}
end end
when "Monthly" when "Monthly"
if !(start_date..end_date).cover?(re.start) if !(start_date..end_date).cover?(re.start)
@@ -91,7 +90,7 @@ class Event
@start_date = sd @start_date = sd
sd = sd >> @i*re.frequency.to_i sd = sd >> @i*re.frequency.to_i
ed = ed >> @i*re.frequency.to_i ed = ed >> @i*re.frequency.to_i
@recurring << {:id => re.id, :title=>re.title, :note=>re.note, :start=>sd, :end => ed, :allDay => re.all_day, :recurring => re.recurring, :calendar => re.event_category_id.to_s, :color => EventCategory.find(re.event_category_id).color, :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(re.id), :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(re.id)} @recurring << {:id => re.id, :title=>re.title, :note=>re.note, :start=>sd, :end => ed, :allDay => re.all_day, :recurring => re.recurring, :calendar => re.category_id.to_s, :color => Category.find(re.category_id).custom_value, :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(re.id), :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(re.id)}
end end
when "Yearly" when "Yearly"
if !(start_date..end_date).cover?(re.start) if !(start_date..end_date).cover?(re.start)
@@ -101,7 +100,7 @@ class Event
@start_date = sd @start_date = sd
sd = sd >> 12 * @i*re.frequency.to_i sd = sd >> 12 * @i*re.frequency.to_i
ed = ed >> 12 * @i*re.frequency.to_i ed = ed >> 12 * @i*re.frequency.to_i
@recurring << {:id => re.id, :title=>re.title, :note=>re.note, :start=>sd, :end => ed, :allDay => re.all_day, :recurring => re.recurring, :calendar => re.event_category_id.to_s, :color => EventCategory.find(re.event_category_id).color, :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(re.id), :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(re.id)} @recurring << {:id => re.id, :title=>re.title, :note=>re.note, :start=>sd, :end => ed, :allDay => re.all_day, :recurring => re.recurring, :calendar => re.category_id.to_s, :color => Category.find(re.category_id).custom_value, :edit_url => Rails.application.routes.url_helpers.edit_panel_calendar_new_back_end_event_path(re.id), :delete_url => Rails.application.routes.url_helpers.panel_calendar_new_back_end_event_path(re.id)}
end end
end end
end end
@@ -0,0 +1,21 @@
<tr class="<%= 'disable' if category.disable %>">
<% @site_valid_locales.each_with_index do |locale, i| %>
<td>
<%= category.title_translations[locale] %>
<% if i == 0 %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if is_admin?%>
<li><%= link_to t(:edit), '#', class: "open-slide", data: {title: t(:edit_category), id: category.id.to_s, module: @module_app_id.to_s, form: category.title_translations.merge(color: category.custom_value)} %></li>
<li><%= link_to show_toggle_archive_btn(category), toggle_admin_module_app_category_path(@module_app_id, category), method: :post, remote: true, class: "archive_toggle" %></li>
<% end %>
<% if is_manager? || is_admin? %>
<li><%= link_to t(:category_auth), admin_authorizations_path(@module_app.key, 'category_authorization', category.id) %></li>
<% end %>
</ul>
</div>
<% end %>
</td>
<% end %>
<td><span class="badge" style="background-color: <%= category.custom_value %>;"><%= category.custom_value %></span></td>
</tr>
@@ -0,0 +1,12 @@
<%= flash_messages %>
<%= f.error_messages %>
<%= label_tag("color", t("calendar.color")) %>
<div class="input-append">
<%= f.text_field :custom_value, id: "color", :class => "color-picker miniColors input-small", :size => "7", :maxlength => "7", :autocomplete=>"off",:value=>"9100FF" %>
</div>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= label_tag "name-#{locale}", "#{t(:name)} (#{I18nVariable.from_locale(locale)})" %>
<%= f.text_field locale, :class => 'input-large', :value => (@category.title_translations[locale] rescue ''), placeholder: t(:name), id: locale %>
<% end %>
<% end %>
@@ -1,28 +1,65 @@
<table class="table main-list"> <%= stylesheet_link_tag "jquery.miniColors" %>
<%= javascript_include_tag "jquery.miniColors.min" %>
<%= javascript_include_tag "admin/categories" %>
<div id="categories_index">
<table class="table main-list">
<thead> <thead>
<tr> <tr class="sort-header">
<th class="span1"><%= t('event_category.name') %></th> <% @site_valid_locales.each_with_index do |locale, i| %>
<th class="span1"><%= t('event_category.color') %></th> <th class="<%= 'span5' if i <= 1 %>"><a href="#"><%= t(:_locale, :locale => locale) %></a></th>
<%if is_manager? %>
<th class="span1"><%= t('event_category.edit') %></th>
<th class="span1"><%= t('event_category.delete') %></th>
<% end %> <% end %>
<th class="span2"><a href="#"><%= t('event_category.color') %></a></th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody_locations" class="sort-holder"> <tbody>
<% @event_categories.each do |event_category| %> <%= render partial: 'category', collection: @categories %>
<tr class="with_action">
<td><%= event_category.name %></td>
<td><%= event_category.color%></td>
<%if is_manager? %>
<td><%= link_to 'Edit', edit_panel_calendar_new_back_end_event_category_path(event_category) %></td>
<td><%= link_to 'Destroy', panel_calendar_new_back_end_event_category_path(event_category), method: :delete , :confirm => t(:sure?) %></td>
<%end%>
</tr>
<% end %>
</tbody> </tbody>
</table> </table>
<%= link_to "Add", new_panel_calendar_new_back_end_event_category_path, :class => "btn btn-primary pull-right", :id=>"create_event_btn", :ref=>"add-btn" %> <div class="bottomnav clearfix">
</p> <div class="action pull-right">
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t(:add_category), id: 'new', module: @module_app_id.to_s } %>
</div>
<div class="pagination pagination-centered">
<%= paginate @categories unless @categories.blank? %>
</div>
</div>
</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, html:{:id=>"color"}, 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>
</div>
</div>
</div>
<script type="text/javascript">
if($('.color-picker').length > 0){
$('.color-picker').miniColors(); // just in category view
$('.miniColors-trigger').addClass('btn');
}
$("form#color").bind("ajax:complete",function(){
$.get("<%= panel_calendar_new_back_end_event_categories_list_path %>",function(data){
$("#categories_index").html(data);
openSlide();
})
})
</script>
@@ -0,0 +1,13 @@
<table class="table main-list">
<thead>
<tr class="sort-header">
<% @site_valid_locales.each_with_index do |locale, i| %>
<th class="<%= 'span5' if i <= 1 %>"><a href="#"><%= t(:_locale, :locale => locale) %></a></th>
<% end %>
<th class="span2"><a href="#"><%= t('event_category.color') %></a></th>
</tr>
</thead>
<tbody>
<%= render partial: 'category', collection: @categories %>
</tbody>
</table>
@@ -52,7 +52,7 @@
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<%= f.label "Calendar", :class=>"control-label span3" %> <%= f.label "Calendar", :class=>"control-label span3" %>
<%= f.collection_select :event_category_id, EventCategory.all, :id, :name%> <%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<label class="checkbox inline"><%= f.check_box :recurring,:id=>"recurring_checkbox", :checked => @recurring %> Recurring</label> <label class="checkbox inline"><%= f.check_box :recurring,:id=>"recurring_checkbox", :checked => @recurring %> Recurring</label>
+6 -4
View File
@@ -2,14 +2,16 @@ Rails.application.routes.draw do
namespace :panel do namespace :panel do
namespace :calendar_new do namespace :calendar_new do
namespace :back_end do namespace :back_end do
match 'event_categories/list' => "event_categories#list"
resources :event_categories resources :event_categories
match 'events/agenda' => 'events#agenda', :as => :agenda match 'events/agenda' => 'events#agenda', :as => :agenda
resources :events resources :events
end end
namespace :front_end do namespace :front_end do
match 'events/agenda' => 'events#agenda', :as => :agenda match 'events/agenda' => 'events#agenda', :as => :agenda
resources :events resources :events, except: [:new, :edit, :update, :destroy]
end end
end end
end end
end end
+9 -9
View File
@@ -16,33 +16,33 @@ module CalendarNew
front_end do front_end do
app_page 'events' do app_page 'events' do
frontend_i18n "calendar_new.frontend.events" frontend_i18n "calendar_new.frontend.events"
end end
end end
side_bar do side_bar do
head_label_i18n 'calendar.calendar',:icon_class=>"icons-calendar" head_label_i18n 'calendar.calendar',:icon_class=>"icons-calendar"
available_for [:admin,:guest,:manager,:sub_manager] available_for [:admin,:guest,:manager,:sub_manager]
active_for_controllers ({:private=>['events'],:public=>['panel/calendar_new/back_end/tags']}) active_for_controllers ({:private=>['events','event_categories'],:public=>['panel/calendar_new/back_end/tags']})
head_link_path "panel_calendar_new_back_end_events_path" head_link_path "panel_calendar_new_back_end_events_path"
context_link 'calendar.categories', # context_link 'calendar.categories',
:link_path=>"admin_module_app_categories_path(get_module_app)" , # :link_path=>"admin_module_app_categories_path(get_module_app)" ,
:priority=>2, # :priority=>2,
:active_for_category => 'CalendarNew', # :active_for_category => 'CalendarNew',
:available_for => [:manager] # :available_for => [:manager]
context_link 'tags', context_link 'tags',
:link_path=>"admin_module_tags_path(module_app_id: get_module_app)" , :link_path=>"admin_module_tags_path(module_app_id: get_module_app)" ,
:priority=>4, :priority=>4,
:active_for_tag => 'CalendarNew', :active_for_tag => 'CalendarNew',
:available_for => [:manager] :available_for => [:manager]
context_link 'calendar.color', context_link 'calendar.categories',
:link_path=>"panel_calendar_new_back_end_event_categories_path" , :link_path=>"panel_calendar_new_back_end_event_categories_path" ,
:priority=>3, :priority=>3,
:active_for_tag => 'CalendarNew', :active_for_category => 'CalendarNew',
:available_for => [:manager] :available_for => [:manager]
end end
end end
@@ -239,7 +239,7 @@ $(function() {
} }
}); });
var fetchNewImages = function(){ var fetchNewImages = function(){
var lastid = $("li.rgalbum:last").data("image-id"), var lastid = ( $("li.rgalbum:last").length ? $("li.rgalbum:last").data("image-id") : null),
albumid = $("#fileupload_aid").val(); albumid = $("#fileupload_aid").val();
$.ajax({ $.ajax({
@@ -13,6 +13,7 @@ var galleryAPI = function(){
this.loading = $("#loading"); this.loading = $("#loading");
this.loadTheater = function(id){ this.loadTheater = function(id){
$( ".breadcrumb li:eq(1) a" ).attr("href","/panel/gallery/back_end/albums");
g.loadstart(); g.loadstart();
var imageArray; var imageArray;
var imagecount = 0; var imagecount = 0;
@@ -32,73 +32,8 @@ 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){ this.loadTheater = function(id){
var imageArray; var imageArray;
var imagecount = 0; var imagecount = 0;
@@ -220,14 +155,19 @@ var galleryAPI = function(){
$img.fadeOut(200,function(){ $img.fadeOut(200,function(){
g.loadstart(); g.loadstart();
if($rslide.hasClass("fullscreen")) if($rslide.hasClass("fullscreen")){
$img.attr({"src":dom.attr("data-content")}).css("height","100%").load(function(){ $img.attr({"src":dom.attr("data-content")}).css("height","100%").load(function(){
g.loadcomplete(); g.loadcomplete();
$img.fadeIn(200); $img.fadeIn(200);
}); });
else }else{
$img.attr({"src":dom.attr("data-content")}).css("height","auto"); $img.attr({"src":dom.attr("data-content")}).css("height","auto").load(function(){
console.log(dom.attr("data-content"));
g.loadcomplete();
$img.fadeIn(200);
});;
}
if($rslide.hasClass("fullscreen")){ if($rslide.hasClass("fullscreen")){
$img.css({"padding":($rslide.height()-$img.height())/2}) $img.css({"padding":($rslide.height()-$img.height())/2})
} }
@@ -236,7 +176,7 @@ var galleryAPI = function(){
if(rcom.getInternetExplorerVersion() == -1){ if(rcom.getInternetExplorerVersion() == -1){
if(pageurl!=window.location){ if(pageurl!=window.location){
pageurl = "gallery?id="+pageurl+"&controller_action=theater"; pageurl = window.location.pathname.replace("/","")+"?id="+pageurl+"&controller_action=theater";
window.history.pushState({path:pageurl},'',pageurl); window.history.pushState({path:pageurl},'',pageurl);
} }
}else{ }else{
@@ -17,7 +17,7 @@
#orbit_gallery .rgalbum:hover { #orbit_gallery .rgalbum:hover {
box-shadow: 0px 0px 5px rgba(0,0,0,.2); box-shadow: 0px 0px 5px rgba(0,0,0,.2);
} }
#orbit_gallery .rgalbum a { #orbit_gallery .rgalbum > a {
position: relative; position: relative;
display: block; display: block;
overflow: hidden; overflow: hidden;
@@ -35,7 +35,7 @@
#orbit_gallery .rgalbum:hover a img { #orbit_gallery .rgalbum:hover a img {
-webkit-filter: blur(2px); -webkit-filter: blur(2px);
} }
#orbit_gallery .rgalbum a:after { #orbit_gallery .rgalbum > a:after {
content: ""; content: "";
position: absolute; position: absolute;
top: 0; top: 0;
@@ -95,15 +95,24 @@
display: inline-block; display: inline-block;
float: left; float: left;
color: #777777; color: #777777;
font-size: 11px; font-size: 1.2em;
line-height: 20px; line-height: 20px;
cursor: pointer; cursor: pointer;
} }
#orbit_gallery .rgalbum .gallery_info li > a {
display: inline-block;
margin-left: 5px;
color: #777777;
}
#orbit_gallery .rgalbum .gallery_info li:hover > a {
color: #E41B2B;
text-decoration: none;
}
#orbit_gallery .rgalbum .gallery_info li:hover { #orbit_gallery .rgalbum .gallery_info li:hover {
color: #0088CC; color: #0088CC;
} }
#orbit_gallery .rgalbum .gallery_info li .icons-tag { #orbit_gallery .rgalbum .gallery_info li .icons-tag {
margin-left: 10px; margin-left: 3px;
} }
#orbit_gallery .rgalbum .gallery_info li.albumcateg { #orbit_gallery .rgalbum .gallery_info li.albumcateg {
float: right; float: right;
@@ -230,6 +239,7 @@
#imgholder .rgalbum a img { #imgholder .rgalbum a img {
max-width: none; max-width: none;
} }
#imgholder .rgalbum .check { #imgholder .rgalbum .check {
position: absolute; position: absolute;
top: 0; top: 0;
@@ -144,6 +144,9 @@
-moz-transition: all 0.3s ease; -moz-transition: all 0.3s ease;
} }
.rslide.fullscreen { position: fixed; z-index: 99; } .rslide.fullscreen { position: fixed; z-index: 99; }
.rslide.fullscreen .comp img{
width: auto;
}
.rslideinside { .rslideinside {
} }
.comp { .comp {
@@ -156,7 +159,7 @@
-webkit-transition: all 0.3s ease; -webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease; -moz-transition: all 0.3s ease;
} }
.comp img{ display: block; width: auto; height: auto; margin: 0 auto; cursor: pointer; min-height: 250px; } .comp img{ display: block; width: 100%; height: auto; margin: 0 auto; cursor: pointer; min-height: 250px; }
.comp .full{ width: auto; height: auto; max-width: 100%; max-height: 100%; } .comp .full{ width: auto; height: auto; max-width: 100%; max-height: 100%; }
.rslidenav { .rslidenav {
position: absolute; position: absolute;
@@ -557,8 +557,8 @@
} }
#loading{ #loading{
background: #fff 0 center url("../../../assets/gallery/ajax-loader.gif") no-repeat; background: #fff 0 center url("../../../assets/loading.gif") no-repeat;
height: 16px; height: 16px;
margin: auto; margin: auto;
width: 32px; width: 220px;
} }
@@ -155,10 +155,15 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
render :json=>{"files"=>a}.to_json render :json=>{"files"=>a}.to_json
end end
def new_images def new_images
@lastimage = GalleryImage.find(params[:last_image_id]) if params[:last_image_id] != ""
@album = GalleryAlbum.find(params[:album_id]) @lastimage = GalleryImage.find(params[:last_image_id])
@newimages = @album.gallery_images.where(:created_at.gt => @lastimage.created_at) @album = GalleryAlbum.find(params[:album_id])
@newimages = @album.gallery_images.where(:created_at.gt => @lastimage.created_at)
else
@album = GalleryAlbum.find(params[:album_id])
@newimages = @album.gallery_images
end
render :layout=>false render :layout=>false
end end
@@ -184,9 +189,11 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
tagsToDestroy << tag tagsToDestroy << tag
end end
end end
new_tags.each do |tag| if new_tags != nil
if !old_tags.include?(tag) new_tags.each do |tag|
tagsToAdd << tag if !old_tags.include?(tag)
tagsToAdd << tag
end
end end
end end
update_children_image_tag(tagsToDestroy,tagsToAdd) update_children_image_tag(tagsToDestroy,tagsToAdd)
@@ -1,55 +1,11 @@
class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
def index def index
@albums = GalleryAlbum.where(:category_id.in => params[:category_id])
end end
def show def show
@album = GalleryAlbum.find(params[:id]) @album = GalleryAlbum.find(params[:id])
@tags = Tag.find(@album.tagged_ids).map{|t| t.name} @images = @album.gallery_images
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 = GalleryCategory.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 = GalleryCategory.find(values.gallery_category_id).name
@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.gallery_category_id,"name"=>values.name,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
end
@output << @albs
end
render :json=>@output.to_json
end end
def imgs def imgs
@@ -85,8 +41,8 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
@albumid = @image.gallery_album_id @albumid = @image.gallery_album_id
@album = GalleryAlbum.find(@albumid) @album = GalleryAlbum.find(@albumid)
@images = @album.gallery_images.all @images = @album.gallery_images.all
tags = @album.tag_ids tags = @album.tagged_ids
@tagnames = Tag.find(tags.tagged_ids).map{|t| t.name} @tagnames = Tag.find(tags).map{|t| t.name}
@back_link = panel_gallery_front_end_album_path(@albumid) @back_link = panel_gallery_front_end_album_path(@albumid)
end end
end end
@@ -8,9 +8,10 @@
<p class="albumname"><%= album.name %></p> <p class="albumname"><%= album.name %></p>
</a> </a>
<ul class="gallery_info clearfix"> <ul class="gallery_info clearfix">
<li class="view"><i class="icons-eye"></i> 321</li> <!-- <li class="view"><i class="icons-eye"></i> 321</li> -->
<li><i class="icons-tag"></i></li> <li><i class="icons-tag"></i></li>
<li class="albumcateg"></li> <li><%= link_to (content_tag(:i,"",:class=>"icon-trash danger")), panel_gallery_back_end_album_path(album), :confirm => "Are you sure?", :method=>:delete %></li>
<li class="albumcateg"><%= Category.find(album.category_id).title %></li>
</ul> </ul>
<ul class="albumtag"> <ul class="albumtag">
<% album.tagged_ids.each do |tag| %> <% album.tagged_ids.each do |tag| %>
@@ -63,15 +63,9 @@
<div class="nav-name"><strong>Language</strong></div> <div class="nav-name"><strong>Language</strong></div>
<ul class="nav nav-pills language-nav"> <ul class="nav nav-pills language-nav">
<% @site_valid_locales.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<% if i == 0 %> <li <%= (i == 0 ? 'class=active' : '') %>>
<li class="active"> <a href=".<%= locale %>" data-toggle="tab"><%= I18nVariable.from_locale(locale) %></a>
<a href=".en" data-toggle="tab">English</a>
</li> </li>
<% else %>
<li>
<a href=".tw_zh" data-toggle="tab">Chinese</a>
</li>
<% end %>
<% end %> <% end %>
</ul> </ul>
<div class="tab-content language-area"> <div class="tab-content language-area">
@@ -79,11 +73,8 @@
<% @site_valid_locales.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<% if i == 0 %>
<div class="tab-pane fade in active en"> <div class="tab-pane fade in <%= (i == 0 ? 'active' : '') %> <%= locale %>">
<% else %>
<div class="tab-pane fade tw_zh">
<% end %>
<div class="control-group input-title"> <div class="control-group input-title">
<%= f.fields_for :name_translations do |name| %> <%= f.fields_for :name_translations do |name| %>
<%= label_tag(locale, t("gallery.album_name"),:class=>"control-label muted") %> <%= label_tag(locale, t("gallery.album_name"),:class=>"control-label muted") %>
@@ -4,6 +4,12 @@
values: @tags, values: @tags,
translation: 'tags', translation: 'tags',
object_field: 'name' object_field: 'name'
filter_field type: 'objects',
values: @categories,
translation: 'category',
object_field: 'title'
footer link: 'new_panel_gallery_back_end_album_path', footer link: 'new_panel_gallery_back_end_album_path',
paginate: false paginate: false
end %> end %>
@@ -19,7 +19,7 @@
<a href="#view-photo-tags" class="btn btn-primary btn-small addtags open hide" for="batch"><i class="icons-tag"></i> Add Tags</a> <a href="#view-photo-tags" class="btn btn-primary btn-small addtags open hide" for="batch"><i class="icons-tag"></i> Add Tags</a>
<a href="<%= edit_panel_gallery_back_end_album_path(@album) %>" class="btn btn-small btn-success"><i class="icon-edit"></i> Edit</a> <a href="<%= edit_panel_gallery_back_end_album_path(@album) %>" class="btn btn-small btn-success"><i class="icon-edit"></i> Edit</a>
<b class="divider"></b> <b class="divider"></b>
<%= link_to (content_tag(:i,"",:class=>"icon-trash")), panel_gallery_back_end_album_path(@album), :class=>"btn btn-small btn-danger", :confirm => "Are you sure?", :method=>:delete %>
<a href="#" class="add-imgs btn btn-small btn-primary"><i class="icons-plus"></i> Add Image</a> <a href="#" class="add-imgs btn btn-small btn-primary"><i class="icons-plus"></i> Add Image</a>
</div> </div>
<form action="<%= panel_gallery_back_end_upload_image_path %>", id='fileupload'> <form action="<%= panel_gallery_back_end_upload_image_path %>", id='fileupload'>
@@ -0,0 +1,14 @@
<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>
@@ -0,0 +1,5 @@
<div class='rgphoto'>
<a title='<%= image.description %>' href='<%= theater_panel_gallery_front_end_album_path(image) %>'>
<img src='<%= image.file.thumb.url %>'/>
</a>
</div>
@@ -1,42 +1,14 @@
<%= stylesheet_link_tag "gallery_frontend" %> <%= stylesheet_link_tag "gallery_frontend" %>
<%#= stylesheet_link_tag "gallery" %>
<div id="orbit_gallery" class="rg"> <div id="orbit_gallery" class="rg">
<div class="rgbody"> <div class="rgbody">
<div id="imgholder"> <div id="imgholder">
<% @albums.each do |album| %>
<%= render :partial => "album", :object => album %>
<% end %>
</div> </div>
</div> </div>
<div class="rghead">
<div class="rgfn">
</div>
</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>
@@ -1,45 +1,12 @@
<%= stylesheet_link_tag "gallery_frontend" %> <%= stylesheet_link_tag "gallery_frontend" %>
<div id="orbit_gallery" class="rg"> <div id="orbit_gallery" class="rg">
<div class="rgbody"> <div class="rgbody">
<div id="imgholder"> <div id="imgholder">
<% @images.each do |image| %>
<%= render :partial => "image", :object => image %>
<% end %>
</div> </div>
</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> </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
View File
@@ -34,7 +34,7 @@ module Gallery
customize_widget "widget1" do customize_widget "widget1" do
widget_i18n "gallery.widget.widget1" widget_i18n "gallery.widget.widget1"
style [] style ["1","2"]
options "vertical",:i18n => "gallery.widget_option.vertical",:options_item=>[1, 2] 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 "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} options "album_id",:i18n =>"gallery.album",:options_item => {"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}
+1
View File
@@ -50,6 +50,7 @@ module Videos
#* customize_widget_options_fields_i18n({"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal", "album_id"=>"gallery.album"}} ) #* 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 customize_widget "channel_videos" do
widget_i18n "videos.widget.channel_videos" 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} options "channel_videos",:i18n =>"videos.channel_videos",:options_item => {"query"=>"ChannelVideo.all", "value"=>:id, "label"=>:channel_name}
end end
@@ -18,6 +18,8 @@ class WebLink
field :create_user_id field :create_user_id
field :update_user_id, :class_name => "User" field :update_user_id, :class_name => "User"
scope :can_display,where(is_hidden: false)
# belongs_to :web_link_category # belongs_to :web_link_category
before_save :clean_tags before_save :clean_tags