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
54 changed files with 543 additions and 840 deletions

No files matched your search

+1 -2
View File
@@ -71,8 +71,7 @@ gem 'redis-search'
gem 'syslog-logger'
gem "recaptcha", :require => "recaptcha/rails"
gem 'puma'
gem 'request-log-analyzer'
gem "chartkick"
gem 'usagewatch'
# Gems used only for assets and not required
+34 -1
View File
@@ -541,6 +541,8 @@ function changeStatusHidden() {
// Document Ready
$(function() {
showFiltersOnPageRefresh();
new ini();
$('#main-wrap').on('click', '.delete', function() {
api.modal($(this).attr('rel'));
@@ -589,4 +591,35 @@ $(function() {
}
formTip()
sidebarNav();
});
});
var showFiltersOnPageRefresh = function(){
var params = getUrlVars(),
paramfilter = params['new_filter[type]'];
// switch (paramfilter){
// case "role":
// paramfilter = "status";
// break;
// }
if( paramfilter ){
$( "#filter" ).addClass('open');
$( '#filter a[href="#collapse-' + paramfilter + '"]').parent().parent().addClass('active');
$( '#filter #collapse-' + paramfilter ).addClass('in');
}
}
var getUrlVars = function(){
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
vars.push(decodeURIComponent(hash[0]));
vars[decodeURIComponent(hash[0])] = decodeURIComponent(hash[1]);
}
if(vars[0] == window.location.href){
vars =[];
}
return vars;
}
+52 -31
View File
@@ -81,7 +81,7 @@ function customOpenSlide() {
} else {
$('#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({
@@ -130,12 +130,13 @@ function iFrameContent() {
}).css('cursor', 'default');
}
$('#pageslide_iframe').load(function() {
var $iContents = $(this).contents(),
$pc = $iContents.find('.page_content');
$(this).get(0).contentWindow.externalFunction(iFrameFunction, $iContents, $pc);
var $iContents = $(this).contents(),
$pc = $iContents.find('.page_content');
iFrameFunction($iContents, $pc);
});
}
function pageSetting(id, edit) {
function pageSetting(id, edit, ps) {
$pageModule = $('#pageslide #page_module_app_id');
$pageF2E = $('#pageslide #page_app_frontend_url');
$pageDivF2E = $('#pageslide #front_url');
@@ -183,23 +184,25 @@ function pageSetting(id, edit) {
if(val.category.length > 0) {
$.each(val.category, function(index, val) {
var _arr = $.inArray($(this)[1], _selectData.module.category[1]);
var _arr = $.inArray($(this)[1], _selectData.module.category);
$pageCategory.append('<label class="checkbox"><input type="checkbox" name="page[category][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
if(!_selectData.module.category[0] && _arr !== -1) {
if(_arr !== -1) {
$pageCategory.find('input[type="checkbox"]').eq(index).prop('checked', true);
}
_selectData.module.category[0] ? $pageCategory.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
var $all = $pageCategory.siblings('.checkbox').children('.select_all')
_selectData.module.category.length > 1 && _selectData.module.category.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
});
$pageCategoryGroup.show();
}
if(val.tags.length > 0) {
$.each(val.tags, function(index, val) {
var _arr = $.inArray($(this)[1], _selectData.module.tags[1]);
var _arr = $.inArray($(this)[1], _selectData.module.tags);
$pageTags.append('<label class="checkbox"><input type="checkbox" name="page[tag][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
if(!_selectData.module.tags[0] && _arr !== -1) {
if(_arr !== -1) {
$pageTags.find('input[type="checkbox"]').eq(index).prop('checked', true);
}
_selectData.module.tags[0] ? $pageTags.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
var $all = $pageTags.siblings('.checkbox').children('.select_all')
_selectData.module.tags.length > 1 && _selectData.module.tags.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
});
$pageTagsGroup.show();
}
@@ -237,8 +240,8 @@ function pageSetting(id, edit) {
};
};
function linkSetting(id, edit) {
$linkPublishedTrue = $('#link_is_published_true');
function linkSetting(id, edit, ps) {
$linkPublishedTrue = ps.find('#link_is_published_true');
_status = edit;
if(_status) {
$.ajax({
@@ -250,6 +253,7 @@ function linkSetting(id, edit) {
})
.done(function(data) {
_linkData = data;
console.log($linkPublishedTrue)
data.public ? $linkPublishedTrue.prop('checked', true) : $linkPublishedTrue.prop('checked', false);
$linkPublishedTrue.prop('checked') ? $('.link-options').slideDown(300) : $('.link-options').slideUp(300);
$.each(_linkData.link, function(index, val) {
@@ -321,13 +325,16 @@ $(function() {
disableNesting: 'no-nest',
update: function(event, ui) {
var position = null;
// if($(ui.item).closest('ol').hasClass('item-groups')) {
// position = $(ui.item).index() - 1;
// } 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 } );
if($(ui.item).closest('ol').hasClass('item-groups')) {
position = $(ui.item).index() - 1;
} else {
position = $(ui.item).index();
};
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){
@@ -393,12 +400,13 @@ $(function() {
if(val.category.length > 0) {
$.each(val.category, function(index, val) {
if(val !== 0) {
var _arr = _select ? $.inArray($(this)[1], _select.category[1]) : '';
var _arr = _select ? $.inArray($(this)[1], _select.category) : '';
$pageCategory.append('<label class="checkbox"><input type="checkbox" name="page[category][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
if(_select && !_select.category[0] && _arr !== -1) {
if(_boolean && _arr !== -1) {
$pageCategory.find('input[type="checkbox"]').eq(index).prop('checked', true);
}
_select && _val == _select.main && _select.category[0] ? $pageCategory.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
var $all = $pageCategory.siblings('.checkbox').children('.select_all');
_boolean && _val == _select.main && _select.category.length > 1 && _select.category.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
}
});
$pageCategoryGroup.show();
@@ -409,12 +417,13 @@ $(function() {
if(val.tags.length > 0) {
$.each(val.tags, function(index, val) {
if(val !== 0) {
var _arr = _select ? $.inArray($(this)[1], _select.tags[1]) : '';
var _arr = _select ? $.inArray($(this)[1], _select.tags) : '';
$pageTags.append('<label class="checkbox"><input type="checkbox" name="page[tag][]" value="'+ $(this)[1] + '">'+ $(this)[0] +'</label>');
if(_select && !_select.tags[0] && _arr !== -1) {
if(_boolean && _arr !== -1) {
$pageTags.find('input[type="checkbox"]').eq(index).prop('checked', true);
}
_select && _val == _select.main && _select.tags[0] ? $pageTags.siblings('.checkbox').children('.select_all').prop('checked', true) : '';
var $all = $pageTags.siblings('.checkbox').children('.select_all');
_boolean && _val == _select.main && _select.tags.length > 1 && _select.tags.length == index + 1 ? $all.prop('checked', true) : $all.prop('checked', false);
}
});
$pageTagsGroup.show();
@@ -447,12 +456,16 @@ $(function() {
$('#pageslide').on('change', '.checkbox-groups input', function(event) {
var $checked = $(this);
if($checked.attr('type') == 'checkbox') {
if($checked.hasClass('select_all') && $checked.prop('checked')) {
$checked.closest('.checkbox').siblings('.groups').find('input[type="checkbox"]').prop('checked', false);
} else if($checked.prop('checked') && !$checked.hasClass('lang-enable')) {
$checked.closest('.groups').siblings('.checkbox').find('.select_all').prop('checked', false);
} else {
if($checked.hasClass('select_all')) {
if($checked.prop('checked')) {
$checked.closest('.checkbox').siblings('.groups').find('input[type="checkbox"]').prop('checked', true);
} else {
$checked.closest('.checkbox').siblings('.groups').find('input[type="checkbox"]').prop('checked', false);
}
} else if($checked.hasClass('lang-enable')) {
var checkboxes = $checked.closest('.groups').find('input[type="checkbox"]');
if($checked.prop('checked')) {
$checked.closest('.active-link').addClass('active').siblings('active-link').removeClass('active').end().find('.active-mune').slideDown(300);
if(_status) {
@@ -466,6 +479,14 @@ $(function() {
$(this).find('input:eq(0)').prop('checked', true);
})
}
} else {
var _l = $checked.closest('.groups').find('input[type="checkbox"]').length,
_c = $checked.closest('.groups').find('input[type="checkbox"]:checked').length;
if(_l == _c) {
$checked.closest('.groups').siblings('.checkbox').find('.select_all').prop('checked', true)
} else {
$checked.closest('.groups').siblings('.checkbox').find('.select_all').prop('checked', false)
};
}
return false;
} else if($checked.attr('type') == 'radio' && !$(this).closest('div').hasClass('active-mune')) {
+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() {
// $(".post_preview").click(function(e){
// $("#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) {
$(".post_preview").click(function(){
$("#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')) {
$.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;
}
},'script');
});
// $("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>");
// $.ajax({
// type: 'PUT',
// url:$(this).attr("href"),
// data:$(this).parents("form").serialize(),
// success: function (msg) {
// $("#"+start_modal_with_id).modal('show'); },
// error: function(){
// alert("ERROR");
// if($(this).hasClass('post_preview')) {
// var attrs = e.target.attributes;
// var url = attrs['url'];
// $("form.previewable").ajaxSubmit({
// beforeSubmit: function(a,f,o){
// o.dataType = 'script';
// o.url = url.nodeValue;
// o.type = 'post';
// },success: function(msg) {
// $('#show_preview .modal').modal()
// $('#show_preview .modal').height(function() {
// return $(window).height() * 0.7;
// });
// }
// });
// } else if($(this).hasClass('preview_trigger')) {
// $.ajax({
// type: 'PUT',
// url: $(this).attr("href"),
// data: $(this).parents("form").serialize(),
// success: function (msg) {
// $('#show_preview .modal').modal();
// $('#show_preview .modal').height(function() {
// return $(window).height() * 0.7;
// });
// },
// error: function(){
// alert("ERROR");
// }
// });
// return false;
// });
// 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;
// // }
// }
// })
});
+1 -2
View File
@@ -54,10 +54,9 @@ class Admin::DesignsController < OrbitBackendController
when 'javascripts', 'themes'#, 'images'
@object = @design.send(params[:type]).find(params[:object_id])
end
Dir.mktmpdir('f_path') { |dir|
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.file = temp_file
@object.save
+1 -1
View File
@@ -24,7 +24,7 @@ class Admin::ItemsController < OrbitBackendController
def update_position
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
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')
flash.now[:notice] = t('update.success.content')
respond_to do |format|
format.html {
redirect_to admin_page_url(@part.page, edit: true)
}
format.js
end
else
@id = params[:id]
+2 -2
View File
@@ -60,8 +60,8 @@ class Admin::PagesController < Admin::ItemsController
m = {}
m["main"] = page.module_app_id.to_s
m["sub"] = page.app_frontend_url
m["category"] = page.category.present? ? [0, page.category.map{|c| c.to_s}] : [1]
m["tags"] = page.tag.present? ? [0, page.tag.map{|c| c.to_s}] : [1]
m["category"] = page.category.present? ? page.category.map{|c| c.to_s} : []
m["tags"] = page.tag.present? ? page.tag.map{|c| c.to_s} : []
m["public"] = page.is_published ? 1 : 0
m["link"] = @site_valid_locales.inject([]) do |link, locale|
link << [locale, (page.enabled_for && page.enabled_for.include?(locale)) ? 1 : 0, (page.menu_enabled_for && page.menu_enabled_for[locale].eql?('true')) ? 1 :0]
@@ -341,9 +341,18 @@ class ApplicationController < ActionController::Base
else
objects = get_viewable(object_class, query)
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)
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)
s = object.name_translations[I18n.locale.to_s] unless s rescue nil
s = object.title_translations[I18n.locale.to_s] unless s rescue nil
+30 -6
View File
@@ -1,5 +1,5 @@
module ApplicationHelper
Time.zone = ActiveSupport::TimeZone[+8.hours]
FLASH_NOTICE_KEYS = [:error, :notice, :warning]
@@ -223,25 +223,49 @@ module ApplicationHelper
end
def display_visitors(options={})
Impression.where(options).and(:referrer.ne => nil).distinct(:session_hash).count
Impression.where(options).count
end
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
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
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
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
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)
object.strftime("%Y-%m-%d %H:%M")
end
+15 -13
View File
@@ -44,17 +44,23 @@ class Item
a
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
new_parent = Item.find(new_parent)
current_position_sibling = find_by_parent_and_position(new_parent, position)
if current_position_sibling
if self.position > current_position_sibling.position
self.move_above(current_position_sibling)
else
self.move_below(current_position_sibling)
end
elsif self.parent != new_parent
if next_sibling_id
next_sibling = Item.find(next_sibling_id)
self.move_above(next_sibling)
else
self.move_to_bottom
end
if self.parent != new_parent
self.parent = new_parent
save
end
@@ -86,10 +92,6 @@ class Item
end
end
def find_by_parent_and_position(parent, position)
parent.children.detect{|child| child.position == position}
end
# Enable the validation for parent_id
def validates_presence_of_parent_id?
true
+51 -386
View File
@@ -2,399 +2,64 @@
<h2>
<i class="icons-book-2"></i>
<span class="break"></span>
Server Loading
<%= t(:server_usage) %>
</h2>
</div>
<div class="box-content" style='overflow: hidden;'>
<div id="cpu_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></div>
<div id="mem_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></div>
<div id="disk_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></div>
<div class="box-content" style='overflow: hidden; text-align:center;'>
<div id="cpu_usage" class="pull-left" style="width:200px; height:160px; display: inline-block;"></div>
<div id="mem_usage" style="width:200px; height:160px; display: inline-block;"></div>
<div id="disk_usage" class="pull-right" style="width:200px; height:160px; display: inline-block;"></div>
</div>
<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 () {
get_cpu_usage();
get_mem_usage();
get_disk_usage();
$.each(Gages,function(id,Gage){
Gage['JustGage'] = new JustGage({
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(){
$('#cpu_usage').highcharts({
chart: {
type: 'gauge',
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_usage(Gage){
$.get('/admin/dashboards/'+Gage['fn'],function(usage){
Gage['JustGage'].refresh(parseInt(usage));
setTimeout(function(){update_usage(Gage);},Gage['update_interval']);
});
}
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>
+11 -55
View File
@@ -2,61 +2,17 @@
<h2>
<i class="icons-book-2"></i>
<span class="break"></span>
Traffic Loading
<%= t(:monthly_traffic)%>
</h2>
</div>
<div class="box-content">
<div id="month_traffic" style="min-width: 310px; height: 230px; margin: 0 auto"></div>
</div>
<script type="text/javascript">
$(function () {
$.getJSON('/admin/dashboards/get_month_traffic', function (data) {
// console.log(data);
dates = [];
visits = [];
$.each(data,function(key,value){
// console.log(value);
$.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>
<div id="month_traffic" style="min-width: 310px; margin: 0 auto">
<%= line_chart get_month_traffic, :height => "200px", :name => 'Visit',
:library => {
legend: 'none',
chartArea:{ width: '95%', left: 50, right: 0},
hAxis:{format:'MMM-d',gridlines:{color: '#CCC', count: 31}},
vAxis:{minValue:-100,viewWindowMode: 'maximized'}
} %>
</div>
</div>
+7 -9
View File
@@ -1,20 +1,18 @@
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<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" />
<%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %>
<%= javascript_include_tag "/static/justgage.1.0.1.min.js" %>
<%= javascript_include_tag "/static/raphael.2.1.0.min.js" %>
<section id="main-wrap">
<div class="wrap-inner initial">
<div class="row-fluid">
<div class="box span6">
<% if is_admin? %>
<div class="box span7">
<div id='server_loading'>
<%= render 'server_loading' %>
</div>
</div>
<div class="box span4">
<% end %>
<div class="box span5">
<div id='traffic'>
<%= render 'traffic' %>
</div>
+13 -1
View File
@@ -64,6 +64,10 @@
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">CSS <b class="caret"></b></a>
<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_1" data-toggle="tab"><%= @design.css_reset.name %></a></li>
</ul>
@@ -76,6 +80,14 @@
<% end %>
</ul>
</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">
@@ -114,7 +126,7 @@
</div>
<% @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} %>
</div>
<% end %>
@@ -3,4 +3,25 @@
<div class="controls">
<%= select 'page_part', 'widget_style', @frontend_styles, {:selected => (@part && @part[:widget_style])}, class: "input-xlarge" %>
</div>
</div>
<div class="control-group input-content">
<% @module_app.widget_options.tap { |widget|%>
<% widget.each { |w|%>
<% w.get_options.each do |key, settings| %>
<% options = settings[:opts] %>
<%= label_tag(t(settings[:label_i18n], :class=>"control-label muted"))%>
<% case options%>
<% when Hash%>
<div class="controls">
<%= select_tag "page_part[widget_options][#{key}]", options_from_collection_for_select(eval(options["query"]), options["value"], options["label"].to_s, :selected => (@part.widget_options[key] rescue nil)), class: "input-xlarge" %>
</div>
<% else%>
<div class="controls">
<%= select_tag "page_part[widget_options][#{key}]", options_for_select(options,(@part.widget_options[key] rescue nil)), class: "input-xlarge" %>
<% end %>
</div>
<% end %>
<% } %>
<% } %>
</div>
@@ -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 %>
<%= javascript_include_tag "lib/items/page_part" %>
<% end %>
<%= form_for @part, url: admin_page_part_path(@part), html: { class: "form-horizontal main-forms"} do |f| %>
<%= form_for @part, url: {action: "update"}, :remote=>true, html: { class: "form-horizontal main-forms"} do |f| %>
<%= f.error_messages %>
<div class="btn-group" data-toggle="buttons-radio">
<label href="#none" class="btn btn-large" data-toggle="tab">
@@ -81,7 +80,7 @@
<div class="control-group input-content">
<%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}", class: "control-label muted" %>
<div class="controls">
<%= f.text_field locale, class: 'input-xlarge page_title', placeholder: "#{t(:title)} #{I18nVariable.from_locale(locale)}", id: locale %>
<%= 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>
<% end %>
@@ -102,13 +101,13 @@
<%= f.label :categories, t(:categories), class: "control-label muted" %>
<div class="controls">
<%= 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 %>
<div class="groups" id="page-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 %>
<% end if @module_app_tags %>
<% end if @module_app_categories %>
</div>
</div>
</div>
@@ -120,7 +119,7 @@
<% end %>
<div class="groups" id="page-tags">
<%= content_tag_for(:label, @module_app_tags, class: "checkbox inline") do |tag|%>
<%= check_box_tag("page_part[tag][]", tag.id, (@part.tag.include?(tag.id) rescue false) ) %>
<%= check_box_tag("page_part[tag][]", tag.id, (@part.tag.include?(tag.id.to_s) rescue false) ) %>
<%= tag.name %>
<% end if @module_app_tags %>
</div>
@@ -161,3 +160,10 @@
$.getScript($(this).attr('rel') + '?type=' + $(this).val() + "&id=" + "<%= @part.id %>" );
});
</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) %>"
@@ -24,12 +24,12 @@
<ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
</div>
</li>
</ul>
<div class="filter-group accordion-group">
<div class="accordion-body collapse" id="collapse-status">
<div class="accordion-body collapse" id="collapse-role">
<%= render :partial => "filter"%>
@@ -25,12 +25,12 @@
<ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
</div>
</li>
</ul>
<div class="filter-group accordion-group">
<div class="accordion-body collapse" id="collapse-status">
<div class="accordion-body collapse" id="collapse-role">
<%= render :partial => "filter"%>
@@ -25,12 +25,12 @@
<ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
</div>
</li>
</ul>
<div class="filter-group accordion-group">
<div class="accordion-body collapse" id="collapse-status">
<div class="accordion-body collapse" id="collapse-role">
<%= render :partial => "filter"%>
@@ -13,13 +13,21 @@
<div>
<script type="text/javascript" src="/assets/kernel.js"></script>
<script type="text/javascript">
var preview_img;
$(function() {
$("iframe").load(function() {
// Get the body element
var frameBody = $("iframe").contents().find('body');
// Get all links inside the BODY tag
$("iframe").contents().find('#orbit-bar').hide();
$('.thumbnail').each(function(){
if($(this).children('img').length) preview_img = $(this).children('img').attr('src');
});
InsertPreviewImage();
frameBody.find('a').click(function(e){
//Disable all default actions
e.preventDefault();
@@ -30,6 +38,14 @@
$("#show_preview").remove();
});
});
function InsertPreviewImage(){
if($("iframe").contents().find('.news_image').length){
$("iframe").contents().find('.news_image').append("<a href='' target='_blank'><img src='"+preview_img+"' width='320' height='240' /></a>");
}else{
setTimeout(InsertPreviewImage,1000);
}
}
</script>
</div>
</div>
+2 -1
View File
@@ -1,6 +1,7 @@
defaults: &defaults
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'
ruling_digital: 'RulingDigital'
+3
View File
@@ -289,6 +289,7 @@ en:
menu_enabled_for: Menu enabled for
module: Module
module_authorization: Module Authorization
monthly_traffic: Monthly Traffic
more_plus: more+
most_visited_page: Most Visited Page
multilingual: Multilingual
@@ -377,6 +378,7 @@ en:
search_: Search
search_google: Search Google
setup_member: Member setup
server_usage: Server Usage
show: Show
show_mode:
index: Index
@@ -516,6 +518,7 @@ en:
vertical: Vertical
view: View
view_count: View count
visitors_count: Visits
visitors_this_month: This month's visitors
visitors_this_week: This week's visitors
visitors_this_year: This year's visitors
+3
View File
@@ -290,6 +290,7 @@ zh_tw:
menu_enabled_for: 選單啟用
module: 模組
module_authorization: 模組授權
monthly_traffic: 本月流量
more_plus: 更多+
most_visited_page: 最多瀏覽頁面
multilingual: 多語系
@@ -378,6 +379,7 @@ zh_tw:
search_: 搜尋
search_google: 搜尋Google
setup_member: 會員設定
server_usage: 主機負載
show: 顯示
show_mode:
index: 檢索
@@ -517,6 +519,7 @@ zh_tw:
vertical: 垂直的
view: 檢視
view_count: 查看次數
visitors_count: 造訪人次
visitors_this_month: 本月造訪人次
visitors_this_week: 本星期造訪人次
visitors_this_year: 今年造訪人次
+2 -2
View File
@@ -279,8 +279,8 @@ module OrbitCoreLib
end
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)
redirect_to root_url
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 admin_dashboards_url
end
end
+1 -1
View File
@@ -93,7 +93,7 @@ def unzip_design(file, zip_name)
site.design = design
site.save
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.save
+1 -1
View File
@@ -27,7 +27,7 @@ namespace :site do
site.design = design
site.save
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.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 :create_user_id
field :update_user_id, :class_name => "User"
scope :can_display,where(is_hidden: false)
# belongs_to :archive_file_category
@@ -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
+4 -4
View File
@@ -8,10 +8,10 @@ Rails.application.routes.draw do
resources :events
end
namespace :front_end do
match 'events/agenda' => 'events#agenda', :as => :agenda
resources :events
end
namespace :front_end do
match 'events/agenda' => 'events#agenda', :as => :agenda
resources :events, except: [:new, :edit, :update, :destroy]
end
end
end
end
+3 -3
View File
@@ -16,14 +16,14 @@ module CalendarNew
front_end do
app_page 'events' do
frontend_i18n "calendar_new.frontend.events"
frontend_i18n "calendar_new.frontend.events"
end
end
side_bar do
head_label_i18n 'calendar.calendar',:icon_class=>"icons-calendar"
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"
@@ -42,7 +42,7 @@ module CalendarNew
context_link 'calendar.categories',
:link_path=>"panel_calendar_new_back_end_event_categories_path" ,
:priority=>3,
:active_for_tag => 'CalendarNew',
:active_for_category => 'CalendarNew',
:available_for => [:manager]
end
end
@@ -239,7 +239,7 @@ $(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();
$.ajax({
@@ -13,6 +13,7 @@ var galleryAPI = function(){
this.loading = $("#loading");
this.loadTheater = function(id){
$( ".breadcrumb li:eq(1) a" ).attr("href","/panel/gallery/back_end/albums");
g.loadstart();
var imageArray;
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){
var imageArray;
var imagecount = 0;
@@ -220,14 +155,19 @@ var galleryAPI = function(){
$img.fadeOut(200,function(){
g.loadstart();
if($rslide.hasClass("fullscreen"))
if($rslide.hasClass("fullscreen")){
$img.attr({"src":dom.attr("data-content")}).css("height","100%").load(function(){
g.loadcomplete();
$img.fadeIn(200);
});
else
$img.attr({"src":dom.attr("data-content")}).css("height","auto");
}else{
$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")){
$img.css({"padding":($rslide.height()-$img.height())/2})
}
@@ -236,7 +176,7 @@ var galleryAPI = function(){
if(rcom.getInternetExplorerVersion() == -1){
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);
}
}else{
@@ -17,7 +17,7 @@
#orbit_gallery .rgalbum:hover {
box-shadow: 0px 0px 5px rgba(0,0,0,.2);
}
#orbit_gallery .rgalbum a {
#orbit_gallery .rgalbum > a {
position: relative;
display: block;
overflow: hidden;
@@ -35,7 +35,7 @@
#orbit_gallery .rgalbum:hover a img {
-webkit-filter: blur(2px);
}
#orbit_gallery .rgalbum a:after {
#orbit_gallery .rgalbum > a:after {
content: "";
position: absolute;
top: 0;
@@ -95,15 +95,24 @@
display: inline-block;
float: left;
color: #777777;
font-size: 11px;
font-size: 1.2em;
line-height: 20px;
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 {
color: #0088CC;
}
#orbit_gallery .rgalbum .gallery_info li .icons-tag {
margin-left: 10px;
margin-left: 3px;
}
#orbit_gallery .rgalbum .gallery_info li.albumcateg {
float: right;
@@ -230,6 +239,7 @@
#imgholder .rgalbum a img {
max-width: none;
}
#imgholder .rgalbum .check {
position: absolute;
top: 0;
@@ -144,6 +144,9 @@
-moz-transition: all 0.3s ease;
}
.rslide.fullscreen { position: fixed; z-index: 99; }
.rslide.fullscreen .comp img{
width: auto;
}
.rslideinside {
}
.comp {
@@ -156,7 +159,7 @@
-webkit-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%; }
.rslidenav {
position: absolute;
@@ -557,8 +557,8 @@
}
#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;
margin: auto;
width: 32px;
width: 220px;
}
@@ -155,10 +155,15 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
render :json=>{"files"=>a}.to_json
end
def new_images
@lastimage = GalleryImage.find(params[:last_image_id])
@album = GalleryAlbum.find(params[:album_id])
@newimages = @album.gallery_images.where(:created_at.gt => @lastimage.created_at)
def new_images
if params[:last_image_id] != ""
@lastimage = GalleryImage.find(params[:last_image_id])
@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
end
@@ -184,9 +189,11 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
tagsToDestroy << tag
end
end
new_tags.each do |tag|
if !old_tags.include?(tag)
tagsToAdd << tag
if new_tags != nil
new_tags.each do |tag|
if !old_tags.include?(tag)
tagsToAdd << tag
end
end
end
update_children_image_tag(tagsToDestroy,tagsToAdd)
@@ -1,55 +1,11 @@
class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
def index
@albums = GalleryAlbum.where(:category_id.in => params[:category_id])
end
def show
@album = GalleryAlbum.find(params[:id])
@tags = Tag.find(@album.tagged_ids).map{|t| t.name}
end
def get_albums
@categoryids = params["cid"]
@tags = params["tid"]
@albums = Array.new
if @categoryids == "all"
if @tags
if @tags.kind_of?(Array)
@tags.each do |tag|
@albums << GalleryAlbum.where(tagged_ids: tag)
end
else
@albums << GalleryAlbum.where(tagged_ids: @tags)
end
else
@albums << GalleryAlbum.all
end
else
@categoryids.each do |id|
category = 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
@images = @album.gallery_images
end
def imgs
@@ -85,8 +41,8 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
@albumid = @image.gallery_album_id
@album = GalleryAlbum.find(@albumid)
@images = @album.gallery_images.all
tags = @album.tag_ids
@tagnames = Tag.find(tags.tagged_ids).map{|t| t.name}
tags = @album.tagged_ids
@tagnames = Tag.find(tags).map{|t| t.name}
@back_link = panel_gallery_front_end_album_path(@albumid)
end
end
@@ -8,9 +8,10 @@
<p class="albumname"><%= album.name %></p>
</a>
<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 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 class="albumtag">
<% album.tagged_ids.each do |tag| %>
@@ -63,15 +63,9 @@
<div class="nav-name"><strong>Language</strong></div>
<ul class="nav nav-pills language-nav">
<% @site_valid_locales.each_with_index do |locale, i| %>
<% if i == 0 %>
<li class="active">
<a href=".en" data-toggle="tab">English</a>
<li <%= (i == 0 ? 'class=active' : '') %>>
<a href=".<%= locale %>" data-toggle="tab"><%= I18nVariable.from_locale(locale) %></a>
</li>
<% else %>
<li>
<a href=".tw_zh" data-toggle="tab">Chinese</a>
</li>
<% end %>
<% end %>
</ul>
<div class="tab-content language-area">
@@ -79,11 +73,8 @@
<% @site_valid_locales.each_with_index do |locale, i| %>
<% if i == 0 %>
<div class="tab-pane fade in active en">
<% else %>
<div class="tab-pane fade tw_zh">
<% end %>
<div class="tab-pane fade in <%= (i == 0 ? 'active' : '') %> <%= locale %>">
<div class="control-group input-title">
<%= f.fields_for :name_translations do |name| %>
<%= label_tag(locale, t("gallery.album_name"),:class=>"control-label muted") %>
@@ -4,6 +4,12 @@
values: @tags,
translation: 'tags',
object_field: 'name'
filter_field type: 'objects',
values: @categories,
translation: 'category',
object_field: 'title'
footer link: 'new_panel_gallery_back_end_album_path',
paginate: false
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="<%= 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>
<%= 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>
</div>
<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" %>
<div id="orbit_gallery" class="rg">
<div class="rgbody">
<div id="imgholder">
<% @albums.each do |album| %>
<%= render :partial => "album", :object => album %>
<% end %>
</div>
</div>
<div class="rghead">
<div class="rgfn">
</div>
</div>
</div>
<script type="text/javascript">
</script>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "galleryAPI_frontend" %>
<%= javascript_include_tag "jquery.tinyscrollbar" %>
<%= javascript_include_tag "rss" %>
<% end %>
<script type="text/javascript">
galleryAPI.prototype.locale = "<%= I18n.locale %>";
var gallery = new galleryAPI();
gallery.initialize();
if(typeof gallery.urlVars['cat']!= "undefined"){
gallery.loadArea = "albums";
gallery.loadAlbums(gallery.urlVars['cat']);
}else if(typeof gallery.urlVars['tag']!= "undefined"){
gallery.loadArea = "albums";
gallery.loadAlbums(gallery.urlVars['tag']);
}else{
gallery.loadArea = "albums";
gallery.loadAlbums("all");
}
</script>
@@ -1,45 +1,12 @@
<%= stylesheet_link_tag "gallery_frontend" %>
<div id="orbit_gallery" class="rg">
<div class="rgbody">
<div id="imgholder">
<% @images.each do |image| %>
<%= render :partial => "image", :object => image %>
<% end %>
</div>
</div>
<!-- tag part -->
<!-- add "album_tags" or "photo_tags" class to .taglist -->
<div class="taglist">
<h3 class="taglist_title"><%= t('gallery.album_tag') %></h3>
<ul>
<% @tags.each do |tag|%>
<li><%= tag %></li>
<% end %>
</ul>
</div>
<!-- tag end -->
<div class="form-actions form-fixed pagination-right rghead">
<div class="rgfn">
<a class="bt-back rgbt" title="<%= I18n.t("gallery.back_to_albums") %>" href="<%= panel_gallery_front_end_albums_path %>"><i class="icon-arrow-left"></i> <%= I18n.t("gallery.back_to_albums") %></a>
</div>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "galleryAPI_frontend" %>
<%= javascript_include_tag "jquery.tinyscrollbar" %>
<%= javascript_include_tag "rss" %>
<% end %>
<script type="text/javascript">
galleryAPI.prototype.locale = "<%= I18n.locale %>";
var gallery = new galleryAPI();
gallery.initialize();
gallery.loadArea = "images";
gallery.loadImages("<%= params[:id] %>");
</script>
+1 -1
View File
@@ -34,7 +34,7 @@ module Gallery
customize_widget "widget1" do
widget_i18n "gallery.widget.widget1"
style []
style ["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 "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 "channel_videos" do
widget_i18n "videos.widget.channel_videos"
style ["1","2"]
options "channel_videos",:i18n =>"videos.channel_videos",:options_item => {"query"=>"ChannelVideo.all", "value"=>:id, "label"=>:channel_name}
end
@@ -18,6 +18,8 @@ class WebLink
field :create_user_id
field :update_user_id, :class_name => "User"
scope :can_display,where(is_hidden: false)
# belongs_to :web_link_category
before_save :clean_tags