Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f744bf266c |
No files matched your search
@@ -12,7 +12,6 @@ $(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');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ function getView(module_id, id) {
|
|||||||
cache: false,
|
cache: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$pageModule = null,
|
$pageModule = null,
|
||||||
$pageF2E = null,
|
$pageF2E = null,
|
||||||
@@ -321,12 +322,11 @@ $(function() {
|
|||||||
disableNesting: 'no-nest',
|
disableNesting: 'no-nest',
|
||||||
update: function(event, ui) {
|
update: function(event, ui) {
|
||||||
var position = null;
|
var position = null;
|
||||||
// if($(ui.item).closest('ol').hasClass('item-groups')) {
|
if($(ui.item).closest('ol').hasClass('item-groups')) {
|
||||||
// position = $(ui.item).index() - 1;
|
position = $(ui.item).index() - 1;
|
||||||
// } else {
|
} else {
|
||||||
// position = $(ui.item).index();
|
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 } );
|
$.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 } );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,10 +56,4 @@
|
|||||||
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;
|
|
||||||
}
|
}
|
||||||
@@ -50,16 +50,6 @@ class Admin::DashboardsController < OrbitBackendController
|
|||||||
render :json => @usw.uw_diskused_perc.to_s
|
render :json => @usw.uw_diskused_perc.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_month_traffic
|
|
||||||
result = []
|
|
||||||
(0..31).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.strftime("%b-%d")=>visits})
|
|
||||||
end
|
|
||||||
render :js => result.to_json
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def get_module_app_count(*args)
|
def get_module_app_count(*args)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -242,6 +242,17 @@ module ApplicationHelper
|
|||||||
display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year})
|
display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_month_traffic
|
||||||
|
result = [['Date','Visits']]
|
||||||
|
(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.strftime("%b-%d"), visits])
|
||||||
|
# result.push({'x'=> i, 'y'=> visits})
|
||||||
|
end
|
||||||
|
result.to_json
|
||||||
|
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
|
||||||
|
|||||||
@@ -2,399 +2,399 @@
|
|||||||
<h2>
|
<h2>
|
||||||
<i class="icons-book-2"></i>
|
<i class="icons-book-2"></i>
|
||||||
<span class="break"></span>
|
<span class="break"></span>
|
||||||
Server Loading
|
Server Status
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-content" style='overflow: hidden;'>
|
<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>
|
<span id="cpu_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></span>
|
||||||
<div id="mem_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></div>
|
<span id="mem_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></span>
|
||||||
<div id="disk_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></div>
|
<span id="disk_usage" style="min-width: 230px; max-width: 220px; height: 220px; display: inline-block; margin-left: -5px;"></span>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
get_cpu_usage();
|
// get_cpu_usage();
|
||||||
get_mem_usage();
|
// get_mem_usage();
|
||||||
get_disk_usage();
|
// get_disk_usage();
|
||||||
});
|
});
|
||||||
|
|
||||||
function get_cpu_usage(){
|
// function get_cpu_usage(){
|
||||||
$('#cpu_usage').highcharts({
|
// $('#cpu_usage').highcharts({
|
||||||
chart: {
|
// chart: {
|
||||||
type: 'gauge',
|
// type: 'gauge',
|
||||||
plotBackgroundColor: null,
|
// plotBackgroundColor: null,
|
||||||
plotBackgroundImage: null,
|
// plotBackgroundImage: null,
|
||||||
plotBorderWidth: 0,
|
// plotBorderWidth: 0,
|
||||||
plotShadow: false
|
// plotShadow: false
|
||||||
},
|
// },
|
||||||
|
|
||||||
title: {
|
// title: {
|
||||||
text: 'CPU Usage'
|
// text: 'CPU Usage'
|
||||||
},
|
// },
|
||||||
|
|
||||||
pane: {
|
// pane: {
|
||||||
startAngle: -150,
|
// startAngle: -150,
|
||||||
endAngle: 150,
|
// endAngle: 150,
|
||||||
background: [{
|
// background: [{
|
||||||
backgroundColor: {
|
// backgroundColor: {
|
||||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
// linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
stops: [
|
// stops: [
|
||||||
[0, '#FFF'],
|
// [0, '#FFF'],
|
||||||
[1, '#333']
|
// [1, '#333']
|
||||||
]
|
// ]
|
||||||
},
|
// },
|
||||||
borderWidth: 0,
|
// borderWidth: 0,
|
||||||
outerRadius: '109%'
|
// outerRadius: '109%'
|
||||||
}, {
|
// }, {
|
||||||
backgroundColor: {
|
// backgroundColor: {
|
||||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
// linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
stops: [
|
// stops: [
|
||||||
[0, '#333'],
|
// [0, '#333'],
|
||||||
[1, '#FFF']
|
// [1, '#FFF']
|
||||||
]
|
// ]
|
||||||
},
|
// },
|
||||||
borderWidth: 1,
|
// borderWidth: 1,
|
||||||
outerRadius: '107%'
|
// outerRadius: '107%'
|
||||||
}, {
|
// }, {
|
||||||
// default background
|
// // default background
|
||||||
}, {
|
// }, {
|
||||||
backgroundColor: '#DDD',
|
// backgroundColor: '#DDD',
|
||||||
borderWidth: 0,
|
// borderWidth: 0,
|
||||||
outerRadius: '105%',
|
// outerRadius: '105%',
|
||||||
innerRadius: '103%'
|
// innerRadius: '103%'
|
||||||
}]
|
// }]
|
||||||
},
|
// },
|
||||||
|
|
||||||
// the value axis
|
// // the value axis
|
||||||
yAxis: {
|
// yAxis: {
|
||||||
min: 0,
|
// min: 0,
|
||||||
max: 100,
|
// max: 100,
|
||||||
|
|
||||||
minorTickInterval: 'auto',
|
// minorTickInterval: 'auto',
|
||||||
minorTickWidth: 1,
|
// minorTickWidth: 1,
|
||||||
minorTickLength: 10,
|
// minorTickLength: 10,
|
||||||
minorTickPosition: 'inside',
|
// minorTickPosition: 'inside',
|
||||||
minorTickColor: '#666',
|
// minorTickColor: '#666',
|
||||||
|
|
||||||
tickPixelInterval: 30,
|
// tickPixelInterval: 30,
|
||||||
tickWidth: 2,
|
// tickWidth: 2,
|
||||||
tickPosition: 'inside',
|
// tickPosition: 'inside',
|
||||||
tickLength: 10,
|
// tickLength: 10,
|
||||||
tickColor: '#666',
|
// tickColor: '#666',
|
||||||
labels: {
|
// labels: {
|
||||||
step: 2,
|
// step: 2,
|
||||||
rotation: 'auto'
|
// rotation: 'auto'
|
||||||
},
|
// },
|
||||||
title: {
|
// title: {
|
||||||
text: ''
|
// text: ''
|
||||||
},
|
// },
|
||||||
plotBands: [{
|
// plotBands: [{
|
||||||
from: 0,
|
// from: 0,
|
||||||
to: 60,
|
// to: 60,
|
||||||
color: '#55BF3B' // green
|
// color: '#55BF3B' // green
|
||||||
}, {
|
// }, {
|
||||||
from: 60,
|
// from: 60,
|
||||||
to: 80,
|
// to: 80,
|
||||||
color: '#DDDF0D' // yellow
|
// color: '#DDDF0D' // yellow
|
||||||
}, {
|
// }, {
|
||||||
from: 80,
|
// from: 80,
|
||||||
to: 100,
|
// to: 100,
|
||||||
color: '#DF5353' // red
|
// color: '#DF5353' // red
|
||||||
}]
|
// }]
|
||||||
},
|
// },
|
||||||
|
|
||||||
series: [{
|
// series: [{
|
||||||
name: 'CPU Usage',
|
// name: 'CPU Usage',
|
||||||
data: [0],
|
// data: [0],
|
||||||
dataLabels: {
|
// dataLabels: {
|
||||||
formatter: function () {
|
// formatter: function () {
|
||||||
var usage = this.y;
|
// var usage = this.y;
|
||||||
return '<span style="color:#339">'+ usage + ' %</span><br/>';
|
// return '<span style="color:#339">'+ usage + ' %</span><br/>';
|
||||||
},
|
// },
|
||||||
backgroundColor: {
|
// backgroundColor: {
|
||||||
linearGradient: {
|
// linearGradient: {
|
||||||
x1: 0,
|
// x1: 0,
|
||||||
y1: 0,
|
// y1: 0,
|
||||||
x2: 0,
|
// x2: 0,
|
||||||
y2: 1
|
// y2: 1
|
||||||
},
|
// },
|
||||||
stops: [
|
// stops: [
|
||||||
[0, '#DDD'],
|
// [0, '#DDD'],
|
||||||
[1, '#FFF']
|
// [1, '#FFF']
|
||||||
]
|
// ]
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
tooltip: {
|
// tooltip: {
|
||||||
valueSuffix: ' %'
|
// valueSuffix: ' %'
|
||||||
}
|
// }
|
||||||
}]
|
// }]
|
||||||
},
|
// },
|
||||||
function(chart) {
|
// function(chart) {
|
||||||
update_cpu_usage(chart);
|
// update_cpu_usage(chart);
|
||||||
setInterval(function() {
|
// setInterval(function() {
|
||||||
update_cpu_usage(chart);
|
// update_cpu_usage(chart);
|
||||||
}, 2000);
|
// }, 2000);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
function update_cpu_usage(chart){
|
// function update_cpu_usage(chart){
|
||||||
$.get('/admin/dashboards/get_cpu_usage',function(usage){
|
// $.get('/admin/dashboards/get_cpu_usage',function(usage){
|
||||||
var point = chart.series[0].points[0],
|
// var point = chart.series[0].points[0],
|
||||||
newVal = Math.round(usage);
|
// newVal = Math.round(usage);
|
||||||
point.update(newVal);
|
// point.update(newVal);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
function get_mem_usage(){
|
// function get_mem_usage(){
|
||||||
$('#mem_usage').highcharts({
|
// $('#mem_usage').highcharts({
|
||||||
chart: {
|
// chart: {
|
||||||
type: 'gauge',
|
// type: 'gauge',
|
||||||
plotBackgroundColor: null,
|
// plotBackgroundColor: null,
|
||||||
plotBackgroundImage: null,
|
// plotBackgroundImage: null,
|
||||||
plotBorderWidth: 0,
|
// plotBorderWidth: 0,
|
||||||
plotShadow: false
|
// plotShadow: false
|
||||||
},
|
// },
|
||||||
|
|
||||||
title: {
|
// title: {
|
||||||
text: 'Memory Usage'
|
// text: 'Memory Usage'
|
||||||
},
|
// },
|
||||||
|
|
||||||
pane: {
|
// pane: {
|
||||||
startAngle: -150,
|
// startAngle: -150,
|
||||||
endAngle: 150,
|
// endAngle: 150,
|
||||||
background: [{
|
// background: [{
|
||||||
backgroundColor: {
|
// backgroundColor: {
|
||||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
// linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
stops: [
|
// stops: [
|
||||||
[0, '#FFF'],
|
// [0, '#FFF'],
|
||||||
[1, '#333']
|
// [1, '#333']
|
||||||
]
|
// ]
|
||||||
},
|
// },
|
||||||
borderWidth: 0,
|
// borderWidth: 0,
|
||||||
outerRadius: '109%'
|
// outerRadius: '109%'
|
||||||
}, {
|
// }, {
|
||||||
backgroundColor: {
|
// backgroundColor: {
|
||||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
// linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
stops: [
|
// stops: [
|
||||||
[0, '#333'],
|
// [0, '#333'],
|
||||||
[1, '#FFF']
|
// [1, '#FFF']
|
||||||
]
|
// ]
|
||||||
},
|
// },
|
||||||
borderWidth: 1,
|
// borderWidth: 1,
|
||||||
outerRadius: '107%'
|
// outerRadius: '107%'
|
||||||
}, {
|
// }, {
|
||||||
// default background
|
// // default background
|
||||||
}, {
|
// }, {
|
||||||
backgroundColor: '#DDD',
|
// backgroundColor: '#DDD',
|
||||||
borderWidth: 0,
|
// borderWidth: 0,
|
||||||
outerRadius: '105%',
|
// outerRadius: '105%',
|
||||||
innerRadius: '103%'
|
// innerRadius: '103%'
|
||||||
}]
|
// }]
|
||||||
},
|
// },
|
||||||
|
|
||||||
// the value axis
|
// // the value axis
|
||||||
yAxis: {
|
// yAxis: {
|
||||||
min: 0,
|
// min: 0,
|
||||||
max: 100,
|
// max: 100,
|
||||||
|
|
||||||
minorTickInterval: 'auto',
|
// minorTickInterval: 'auto',
|
||||||
minorTickWidth: 1,
|
// minorTickWidth: 1,
|
||||||
minorTickLength: 10,
|
// minorTickLength: 10,
|
||||||
minorTickPosition: 'inside',
|
// minorTickPosition: 'inside',
|
||||||
minorTickColor: '#666',
|
// minorTickColor: '#666',
|
||||||
|
|
||||||
tickPixelInterval: 30,
|
// tickPixelInterval: 30,
|
||||||
tickWidth: 2,
|
// tickWidth: 2,
|
||||||
tickPosition: 'inside',
|
// tickPosition: 'inside',
|
||||||
tickLength: 10,
|
// tickLength: 10,
|
||||||
tickColor: '#666',
|
// tickColor: '#666',
|
||||||
labels: {
|
// labels: {
|
||||||
step: 2,
|
// step: 2,
|
||||||
rotation: 'auto'
|
// rotation: 'auto'
|
||||||
},
|
// },
|
||||||
title: {
|
// title: {
|
||||||
text: ''
|
// text: ''
|
||||||
},
|
// },
|
||||||
plotBands: [{
|
// plotBands: [{
|
||||||
from: 0,
|
// from: 0,
|
||||||
to: 60,
|
// to: 60,
|
||||||
color: '#55BF3B' // green
|
// color: '#55BF3B' // green
|
||||||
}, {
|
// }, {
|
||||||
from: 60,
|
// from: 60,
|
||||||
to: 80,
|
// to: 80,
|
||||||
color: '#DDDF0D' // yellow
|
// color: '#DDDF0D' // yellow
|
||||||
}, {
|
// }, {
|
||||||
from: 80,
|
// from: 80,
|
||||||
to: 100,
|
// to: 100,
|
||||||
color: '#DF5353' // red
|
// color: '#DF5353' // red
|
||||||
}]
|
// }]
|
||||||
},
|
// },
|
||||||
|
|
||||||
series: [{
|
// series: [{
|
||||||
name: 'Memory Usage',
|
// name: 'Memory Usage',
|
||||||
data: [0],
|
// data: [0],
|
||||||
dataLabels: {
|
// dataLabels: {
|
||||||
formatter: function () {
|
// formatter: function () {
|
||||||
var usage = this.y;
|
// var usage = this.y;
|
||||||
return '<span style="color:#339">'+ usage + ' %</span><br/>';
|
// return '<span style="color:#339">'+ usage + ' %</span><br/>';
|
||||||
},
|
// },
|
||||||
backgroundColor: {
|
// backgroundColor: {
|
||||||
linearGradient: {
|
// linearGradient: {
|
||||||
x1: 0,
|
// x1: 0,
|
||||||
y1: 0,
|
// y1: 0,
|
||||||
x2: 0,
|
// x2: 0,
|
||||||
y2: 1
|
// y2: 1
|
||||||
},
|
// },
|
||||||
stops: [
|
// stops: [
|
||||||
[0, '#DDD'],
|
// [0, '#DDD'],
|
||||||
[1, '#FFF']
|
// [1, '#FFF']
|
||||||
]
|
// ]
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
tooltip: {
|
// tooltip: {
|
||||||
valueSuffix: ' %'
|
// valueSuffix: ' %'
|
||||||
}
|
// }
|
||||||
}]
|
// }]
|
||||||
},
|
// },
|
||||||
function(chart) {
|
// function(chart) {
|
||||||
update_mem_usage(chart)
|
// update_mem_usage(chart)
|
||||||
setInterval(function() {
|
// setInterval(function() {
|
||||||
update_mem_usage(chart);
|
// update_mem_usage(chart);
|
||||||
}, 5000);
|
// }, 5000);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
function update_mem_usage(chart){
|
// function update_mem_usage(chart){
|
||||||
$.get('/admin/dashboards/get_mem_usage',function(usage){
|
// $.get('/admin/dashboards/get_mem_usage',function(usage){
|
||||||
var point = chart.series[0].points[0],
|
// var point = chart.series[0].points[0],
|
||||||
newVal = Math.round(usage);
|
// newVal = Math.round(usage);
|
||||||
point.update(newVal);
|
// point.update(newVal);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
function get_disk_usage(){
|
// function get_disk_usage(){
|
||||||
$('#disk_usage').highcharts({
|
// $('#disk_usage').highcharts({
|
||||||
chart: {
|
// chart: {
|
||||||
type: 'gauge',
|
// type: 'gauge',
|
||||||
plotBackgroundColor: null,
|
// plotBackgroundColor: null,
|
||||||
plotBackgroundImage: null,
|
// plotBackgroundImage: null,
|
||||||
plotBorderWidth: 0,
|
// plotBorderWidth: 0,
|
||||||
plotShadow: false
|
// plotShadow: false
|
||||||
},
|
// },
|
||||||
|
|
||||||
title: {
|
// title: {
|
||||||
text: 'Disk Usage'
|
// text: 'Disk Usage'
|
||||||
},
|
// },
|
||||||
|
|
||||||
pane: {
|
// pane: {
|
||||||
startAngle: -150,
|
// startAngle: -150,
|
||||||
endAngle: 150,
|
// endAngle: 150,
|
||||||
background: [{
|
// background: [{
|
||||||
backgroundColor: {
|
// backgroundColor: {
|
||||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
// linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
stops: [
|
// stops: [
|
||||||
[0, '#FFF'],
|
// [0, '#FFF'],
|
||||||
[1, '#333']
|
// [1, '#333']
|
||||||
]
|
// ]
|
||||||
},
|
// },
|
||||||
borderWidth: 0,
|
// borderWidth: 0,
|
||||||
outerRadius: '109%'
|
// outerRadius: '109%'
|
||||||
}, {
|
// }, {
|
||||||
backgroundColor: {
|
// backgroundColor: {
|
||||||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
// linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
stops: [
|
// stops: [
|
||||||
[0, '#333'],
|
// [0, '#333'],
|
||||||
[1, '#FFF']
|
// [1, '#FFF']
|
||||||
]
|
// ]
|
||||||
},
|
// },
|
||||||
borderWidth: 1,
|
// borderWidth: 1,
|
||||||
outerRadius: '107%'
|
// outerRadius: '107%'
|
||||||
}, {
|
// }, {
|
||||||
// default background
|
// // default background
|
||||||
}, {
|
// }, {
|
||||||
backgroundColor: '#DDD',
|
// backgroundColor: '#DDD',
|
||||||
borderWidth: 0,
|
// borderWidth: 0,
|
||||||
outerRadius: '105%',
|
// outerRadius: '105%',
|
||||||
innerRadius: '103%'
|
// innerRadius: '103%'
|
||||||
}]
|
// }]
|
||||||
},
|
// },
|
||||||
|
|
||||||
// the value axis
|
// // the value axis
|
||||||
yAxis: {
|
// yAxis: {
|
||||||
min: 0,
|
// min: 0,
|
||||||
max: 100,
|
// max: 100,
|
||||||
|
|
||||||
minorTickInterval: 'auto',
|
// minorTickInterval: 'auto',
|
||||||
minorTickWidth: 1,
|
// minorTickWidth: 1,
|
||||||
minorTickLength: 10,
|
// minorTickLength: 10,
|
||||||
minorTickPosition: 'inside',
|
// minorTickPosition: 'inside',
|
||||||
minorTickColor: '#666',
|
// minorTickColor: '#666',
|
||||||
|
|
||||||
tickPixelInterval: 30,
|
// tickPixelInterval: 30,
|
||||||
tickWidth: 2,
|
// tickWidth: 2,
|
||||||
tickPosition: 'inside',
|
// tickPosition: 'inside',
|
||||||
tickLength: 10,
|
// tickLength: 10,
|
||||||
tickColor: '#666',
|
// tickColor: '#666',
|
||||||
labels: {
|
// labels: {
|
||||||
step: 2,
|
// step: 2,
|
||||||
rotation: 'auto'
|
// rotation: 'auto'
|
||||||
},
|
// },
|
||||||
title: {
|
// title: {
|
||||||
text: ''
|
// text: ''
|
||||||
},
|
// },
|
||||||
plotBands: [{
|
// plotBands: [{
|
||||||
from: 0,
|
// from: 0,
|
||||||
to: 60,
|
// to: 60,
|
||||||
color: '#55BF3B' // green
|
// color: '#55BF3B' // green
|
||||||
}, {
|
// }, {
|
||||||
from: 60,
|
// from: 60,
|
||||||
to: 80,
|
// to: 80,
|
||||||
color: '#DDDF0D' // yellow
|
// color: '#DDDF0D' // yellow
|
||||||
}, {
|
// }, {
|
||||||
from: 80,
|
// from: 80,
|
||||||
to: 100,
|
// to: 100,
|
||||||
color: '#DF5353' // red
|
// color: '#DF5353' // red
|
||||||
}]
|
// }]
|
||||||
},
|
// },
|
||||||
|
|
||||||
series: [{
|
// series: [{
|
||||||
name: 'Disk Usage',
|
// name: 'Disk Usage',
|
||||||
data: [0],
|
// data: [0],
|
||||||
dataLabels: {
|
// dataLabels: {
|
||||||
formatter: function () {
|
// formatter: function () {
|
||||||
var usage = this.y;
|
// var usage = this.y;
|
||||||
return '<span style="color:#339">'+ usage + ' %</span><br/>';
|
// return '<span style="color:#339">'+ usage + ' %</span><br/>';
|
||||||
},
|
// },
|
||||||
backgroundColor: {
|
// backgroundColor: {
|
||||||
linearGradient: {
|
// linearGradient: {
|
||||||
x1: 0,
|
// x1: 0,
|
||||||
y1: 0,
|
// y1: 0,
|
||||||
x2: 0,
|
// x2: 0,
|
||||||
y2: 1
|
// y2: 1
|
||||||
},
|
// },
|
||||||
stops: [
|
// stops: [
|
||||||
[0, '#DDD'],
|
// [0, '#DDD'],
|
||||||
[1, '#FFF']
|
// [1, '#FFF']
|
||||||
]
|
// ]
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
tooltip: {
|
// tooltip: {
|
||||||
valueSuffix: ' %'
|
// valueSuffix: ' %'
|
||||||
}
|
// }
|
||||||
}]
|
// }]
|
||||||
},
|
// },
|
||||||
function(chart) {
|
// function(chart) {
|
||||||
update_disk_usage(chart);
|
// update_disk_usage(chart);
|
||||||
setInterval(function() {
|
// setInterval(function() {
|
||||||
update_disk_usage(chart);
|
// update_disk_usage(chart);
|
||||||
}, 60000);
|
// }, 60000);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
function update_disk_usage(chart){
|
// function update_disk_usage(chart){
|
||||||
$.get('/admin/dashboards/get_disk_usage',function(usage){
|
// $.get('/admin/dashboards/get_disk_usage',function(usage){
|
||||||
var point = chart.series[0].points[0],
|
// var point = chart.series[0].points[0],
|
||||||
newVal = Math.round(usage);
|
// newVal = Math.round(usage);
|
||||||
point.update(newVal);
|
// point.update(newVal);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
</script>
|
</script>
|
||||||
@@ -2,61 +2,58 @@
|
|||||||
<h2>
|
<h2>
|
||||||
<i class="icons-book-2"></i>
|
<i class="icons-book-2"></i>
|
||||||
<span class="break"></span>
|
<span class="break"></span>
|
||||||
Traffic Loading
|
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"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
google.load("visualization", "1", {packages:["corechart"]});
|
||||||
$.getJSON('/admin/dashboards/get_month_traffic', function (data) {
|
|
||||||
// console.log(data);
|
var chart;
|
||||||
dates = [];
|
var datas =<%= raw(get_month_traffic) %>;
|
||||||
visits = [];
|
var initData;
|
||||||
$.each(data,function(key,value){
|
|
||||||
// console.log(value);
|
google.setOnLoadCallback(init);
|
||||||
$.each(value,function(date,visit){
|
window.onresize = drawChart;
|
||||||
dates.push(date);
|
|
||||||
visits.push(visit);
|
function init() {
|
||||||
});
|
initData = new google.visualization.DataTable();
|
||||||
});
|
|
||||||
|
$.each(datas,function(idx,data){
|
||||||
$('#month_traffic').highcharts({
|
initData.setValue(idx,1,[data[0],0]);
|
||||||
chart: {
|
});
|
||||||
type: 'spline'
|
|
||||||
},
|
var options = {
|
||||||
title: {
|
title: 'Monthly Visits',
|
||||||
text: 'Monthly Traffic',
|
titlePosition: 'in',
|
||||||
x: 0 //center
|
fontSize: 10,
|
||||||
},
|
curveType: 'function',
|
||||||
xAxis: {
|
hAxis:{
|
||||||
categories: dates
|
slantedText: true,
|
||||||
},
|
slantedTextAngle: 35
|
||||||
yAxis: {
|
},
|
||||||
title: {
|
chartArea:{
|
||||||
text: 'Number of visits'
|
width: '90%',
|
||||||
},
|
left: 50,
|
||||||
plotLines: [{
|
right: 0
|
||||||
value: 0,
|
},
|
||||||
width: 1,
|
animation:{
|
||||||
color: '#808080'
|
duration: 1000,
|
||||||
}]
|
easing: 'out',
|
||||||
},
|
}
|
||||||
tooltip: {
|
};
|
||||||
valueSuffix: ''
|
|
||||||
},
|
drawChart();
|
||||||
legend: {
|
}
|
||||||
layout: 'vertical',
|
|
||||||
align: 'right',
|
function drawChart() {
|
||||||
verticalAlign: 'middle',
|
chart = new google.visualization.AreaChart(document.getElementById('month_traffic'));
|
||||||
borderWidth: 0
|
chart.draw(google.visualization.arrayToDataTable(initData), options);
|
||||||
},
|
|
||||||
series: [{
|
// $.each(datas,function(idx,data){
|
||||||
name: 'Visits',
|
// initData.push([data[0],0]);
|
||||||
data: visits
|
// });
|
||||||
}]
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
<script src="http://code.highcharts.com/highcharts.js"></script>
|
<script type="text/javascript" src="https://www.google.com/jsapi"></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" />
|
|
||||||
|
|
||||||
<section id="main-wrap">
|
<section id="main-wrap">
|
||||||
<div class="wrap-inner initial">
|
<div class="wrap-inner initial">
|
||||||
@@ -14,11 +8,6 @@
|
|||||||
<%= render 'server_loading' %>
|
<%= render 'server_loading' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box span4">
|
|
||||||
<div id='traffic'>
|
|
||||||
<%= render 'traffic' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="box span">
|
<div class="box span">
|
||||||
@@ -47,6 +36,11 @@
|
|||||||
<%= render 'most_visited' %>
|
<%= render 'most_visited' %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="box span4">
|
||||||
|
<div id='traffic'>
|
||||||
|
<%= render 'traffic' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -76,18 +76,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</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">
|
||||||
@@ -105,14 +93,6 @@
|
|||||||
<%= 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} %>
|
||||||
|
|||||||
@@ -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,:class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(locale)}", disabled: true } %>
|
<%= 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 } %>
|
||||||
<% 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','roles') do -%>
|
<%= content_tag :li, :class => active_for_controllers('users_new_interface') 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('roles', '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_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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ Orbit::Application.routes.draw do
|
|||||||
get 'get_cpu_usage'
|
get 'get_cpu_usage'
|
||||||
get 'get_mem_usage'
|
get 'get_mem_usage'
|
||||||
get 'get_disk_usage'
|
get 'get_disk_usage'
|
||||||
get 'get_month_traffic'
|
# get 'get_month_traffic'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :designs do
|
resources :designs do
|
||||||
|
|||||||
+65
-9
@@ -4,22 +4,78 @@ class Panel::CalendarNew::BackEnd::EventCategoriesController < OrbitBackendContr
|
|||||||
# GET /events
|
# GET /events
|
||||||
# GET /events.json
|
# GET /events.json
|
||||||
def index
|
def index
|
||||||
@module_app_id = @module_app.id rescue nil
|
@event_categories = EventCategory.all
|
||||||
|
|
||||||
@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: @categories }
|
format.json { render json: @event_categories }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def list
|
# GET /events/1
|
||||||
@module_app_id = @module_app.id rescue nil
|
# GET /events/1.json
|
||||||
|
def show
|
||||||
|
@event_category = EventCategory.find(params[:id])
|
||||||
|
|
||||||
@categories = get_categories_for_index
|
respond_to do |format|
|
||||||
@categories = @categories.page(params[:page]).per(10)
|
format.html # show.html.erb
|
||||||
render :layout => false
|
format.json { render json: @event_category }
|
||||||
|
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
|
||||||
+10
-5
@@ -40,7 +40,6 @@ 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;
|
||||||
@@ -62,13 +61,15 @@ 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
|
||||||
@@ -79,8 +80,12 @@ 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
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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
|
||||||
@@ -13,11 +12,13 @@ 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"
|
||||||
|
|
||||||
@@ -41,8 +42,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.category_id,
|
:calendar => self.event_category_id,
|
||||||
:color => Category.find(self.category_id).custom_value,
|
:color => EventCategory.find(self.event_category_id).color,
|
||||||
: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)
|
||||||
}
|
}
|
||||||
@@ -63,13 +64,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.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)}
|
@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)}
|
||||||
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.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)}
|
@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)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
when "Weekly"
|
when "Weekly"
|
||||||
@@ -80,7 +81,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.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)}
|
@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)}
|
||||||
end
|
end
|
||||||
when "Monthly"
|
when "Monthly"
|
||||||
if !(start_date..end_date).cover?(re.start)
|
if !(start_date..end_date).cover?(re.start)
|
||||||
@@ -90,7 +91,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.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)}
|
@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)}
|
||||||
end
|
end
|
||||||
when "Yearly"
|
when "Yearly"
|
||||||
if !(start_date..end_date).cover?(re.start)
|
if !(start_date..end_date).cover?(re.start)
|
||||||
@@ -100,7 +101,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.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)}
|
@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)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
<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>
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
<%= 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 %>
|
|
||||||
+21
-58
@@ -1,65 +1,28 @@
|
|||||||
<%= stylesheet_link_tag "jquery.miniColors" %>
|
<table class="table main-list">
|
||||||
|
|
||||||
<%= javascript_include_tag "jquery.miniColors.min" %>
|
|
||||||
|
|
||||||
<%= javascript_include_tag "admin/categories" %>
|
|
||||||
|
|
||||||
<div id="categories_index">
|
|
||||||
<table class="table main-list">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="sort-header">
|
<tr>
|
||||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
<th class="span1"><%= t('event_category.name') %></th>
|
||||||
<th class="<%= 'span5' if i <= 1 %>"><a href="#"><%= t(:_locale, :locale => locale) %></a></th>
|
<th class="span1"><%= t('event_category.color') %></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>
|
<tbody id="tbody_locations" class="sort-holder">
|
||||||
<%= render partial: 'category', collection: @categories %>
|
<% @event_categories.each do |event_category| %>
|
||||||
|
<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>
|
||||||
|
|
||||||
<div class="bottomnav clearfix">
|
<%= 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="action pull-right">
|
</p>
|
||||||
<%= 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>
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
<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>
|
|
||||||
Vendored
+1
-1
@@ -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.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %>
|
<%= f.collection_select :event_category_id, EventCategory.all, :id, :name%>
|
||||||
</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>
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ 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
|
||||||
|
|||||||
+6
-6
@@ -28,18 +28,18 @@ module CalendarNew
|
|||||||
|
|
||||||
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.categories',
|
context_link 'calendar.color',
|
||||||
: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_tag => 'CalendarNew',
|
||||||
|
|||||||
Reference in new issue
Block a user