Merge branch 'dev' into sxw-dev

Conflicts:
	template/admin/announcement/announcement.html
This commit is contained in:
sxw
2015-08-08 11:31:20 +08:00
11 changed files with 122 additions and 146 deletions

View File

@@ -1,42 +1,47 @@
define("admin", ["jquery", "avalon"], function($, avalon){
function li_active(selector){
$(selector).attr("class", "list-group-item active");
}
define("admin", ["jquery", "avalon"], function ($, avalon) {
function li_inactive(selector){
$(".list-group-item").attr("class", "list-group-item");
}
avalon.ready(function () {
function show_template(url){
$("#loading-gif").show();
vm.template_url = url;
}
var vm = avalon.define({
$id: "admin",
template_url: "template/index/index.html",
hide_loading: function(){
$("#loading-gif").hide();
function li_active(selector) {
$(selector).attr("class", "list-group-item active");
}
});
var hash = window.location.hash.substring(1);
function li_inactive(selector) {
$(".list-group-item").attr("class", "list-group-item");
}
if(hash){
li_active("#li-" + hash.replace("/", "-"));
show_template("template/" + hash + ".html");
}else {
li_active("#li-index-index");
}
function show_template(url) {
$("#loading-gif").show();
vm.template_url = url;
}
window.onhashchange = function() {
var hash = window.location.hash.substring(1);
if(hash){
li_inactive(".list-group-item");
li_active("#li-" + hash.replace("/", "-"));
show_template("template/" + hash + ".html");
if (!hash) {
hash = "index/index";
}
};
var vm = avalon.define({
$id: "admin",
template_url: "template/" + hash + ".html",
hide_loading: function () {
$("#loading-gif").hide();
}
});
avalon.scan();
li_active("#li-" + hash.replace("/", "-"));
window.onhashchange = function () {
var hash = window.location.hash.substring(1);
if (hash) {
li_inactive(".list-group-item");
li_active("#li-" + hash.replace("/", "-"));
show_template("template/" + hash + ".html");
}
};
});
});

View File

@@ -0,0 +1,56 @@
require(["jquery", "chart"], function ($, Chart) {
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July",
"January", "February", "March", "April", "January", "February", "March", "April"],
datasets: [
{
label: "11111111",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
},
{
label: "2222222",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [3, 7, 8, 9, 1, 4, 10, 10, 9, 8, 7, 10, 10, 10, 10]
}
]
};
Chart.defaults.global.responsive = true;
var myLineChart = new Chart($("#myChart").get(0).getContext("2d")).Line(data);
var data1 = [
{
value: 300,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
{
value: 50,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
},
{
value: 100,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
}
];
new Chart($("#c1").get(0).getContext("2d")).Pie(data1);
new Chart($("#c2").get(0).getContext("2d")).Pie(data1);
});

View File

@@ -16,6 +16,7 @@ var require = {
contest: "app/admin/contest/contest",
csrf: "utils/csrf",
admin: "app/admin/admin",
chart: "lib/chart/Chart",
//formValidation 不要在代码中单独使用而是使用和修改utils/validation
base: "lib/formValidation/base",