spree_dash 0.60.6 → 0.70.RC1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/admin/dashboard.js +144 -0
- data/app/assets/javascripts/admin/spree_dash.js +15 -0
- data/app/assets/javascripts/store/spree_dash.js +1 -0
- data/{public/stylesheets/admin/dashboard.css → app/assets/stylesheets/admin/dashboard.css.erb} +2 -2
- data/app/assets/stylesheets/admin/spree_dash.css +4 -0
- data/app/assets/stylesheets/store/spree_dash.css +3 -0
- data/app/controllers/admin/overview_controller.rb +9 -8
- data/app/views/admin/overview/index.html.erb +20 -30
- data/lib/spree_dash.rb +1 -0
- data/{public → vendor/assets}/javascripts/jqPlot/excanvas.min.js +0 -0
- data/{public → vendor/assets}/javascripts/jqPlot/jquery.jqplot.min.js +0 -0
- data/{public → vendor/assets}/javascripts/jqPlot/plugins/jqplot.canvasAxisLabelRenderer.min.js +0 -0
- data/{public → vendor/assets}/javascripts/jqPlot/plugins/jqplot.canvasAxisTickRenderer.min.js +0 -0
- data/{public → vendor/assets}/javascripts/jqPlot/plugins/jqplot.canvasTextRenderer.min.js +0 -0
- data/{public → vendor/assets}/javascripts/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js +0 -0
- data/{public → vendor/assets}/javascripts/jqPlot/plugins/jqplot.dateAxisRenderer.min.js +0 -0
- data/{public → vendor/assets}/javascripts/jqPlot/plugins/jqplot.highlighter.min.js +0 -0
- data/{public → vendor/assets}/javascripts/jqPlot/plugins/jqplot.pieRenderer.min.js +0 -0
- metadata +39 -32
- data/lib/tasks/install.rake +0 -24
- data/public/javascripts/dashboard.js +0 -143
@@ -0,0 +1,144 @@
|
|
1
|
+
function number_with_delimiter(number, delimiter, separator) {
|
2
|
+
try {
|
3
|
+
var delimiter = delimiter || ",";
|
4
|
+
var separator = separator || ".";
|
5
|
+
|
6
|
+
var parts = number.toString().split('.');
|
7
|
+
parts[0] = parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1" + delimiter);
|
8
|
+
formatted_number = parts.join(separator);
|
9
|
+
|
10
|
+
if(formatted_number.length>=6 && formatted_number.length<=9){
|
11
|
+
var arr = formatted_number.split(",");
|
12
|
+
return arr[0] + " k";
|
13
|
+
}else if(formatted_number.length==10){
|
14
|
+
var arr = formatted_number.split(",");
|
15
|
+
return arr[0] + " m";
|
16
|
+
}else{
|
17
|
+
return formatted_number
|
18
|
+
}
|
19
|
+
} catch(e) {
|
20
|
+
return number
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
function handle_orders_by_day(r){
|
25
|
+
var new_points = eval(r);
|
26
|
+
|
27
|
+
if(new_points[0].length>0){
|
28
|
+
orders_by_day_settings.axes.xaxis.min = new_points[0][0][0].replace(/-/g, "/");
|
29
|
+
orders_by_day_settings.axes.xaxis.max = new_points[0][new_points[0].length -1][0].replace(/-/g, "/");
|
30
|
+
}
|
31
|
+
|
32
|
+
orders_by_day_settings.axes.yaxis.label = jQuery("#orders_by_day_value :selected").val();
|
33
|
+
|
34
|
+
jQuery("#order_by_day_title").text(orders + " " + jQuery("#orders_by_day_value :selected").val() + " " + by_day + " (" + jQuery("#orders_by_day_reports :selected").text() + ")");
|
35
|
+
|
36
|
+
jQuery('#orders_by_day').empty();
|
37
|
+
jQuery.jqplot('orders_by_day', new_points, orders_by_day_settings);
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
function handle_orders_total(r){
|
42
|
+
var values = eval(r);
|
43
|
+
|
44
|
+
jQuery('#orders_total').text(number_with_delimiter(values[0].orders_total));
|
45
|
+
jQuery('#orders_line_total').text(number_with_delimiter(values[0].orders_line_total));
|
46
|
+
jQuery('#orders_adjustment_total').text(number_with_delimiter(values[0].orders_adjustment_total));
|
47
|
+
jQuery('#orders_adjustment_total').text(number_with_delimiter(values[0].orders_adjustment_total));
|
48
|
+
}
|
49
|
+
|
50
|
+
jQuery(document).ready(function(){
|
51
|
+
|
52
|
+
if(typeof(orders_by_day_points)=="object"){
|
53
|
+
var orders_by_day_settings = {
|
54
|
+
title: {
|
55
|
+
textColor: '#476D9B',
|
56
|
+
fontSize: '12pt',
|
57
|
+
},
|
58
|
+
grid: {background:'#fff', gridLineColor:'#fff',borderColor: '#476D9B'},
|
59
|
+
axes:{
|
60
|
+
yaxis:{
|
61
|
+
label:'Order (Count)',
|
62
|
+
labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer,
|
63
|
+
autoscale:true,
|
64
|
+
tickOptions:{
|
65
|
+
formatString:'%d',
|
66
|
+
fontSize: '10pt',
|
67
|
+
textColor: '#476D9B'
|
68
|
+
},
|
69
|
+
min: 0
|
70
|
+
},
|
71
|
+
xaxis:{
|
72
|
+
renderer:jQuery.jqplot.DateAxisRenderer,
|
73
|
+
rendererOptions:{tickRenderer:jQuery.jqplot.CanvasAxisTickRenderer},
|
74
|
+
tickOptions:{
|
75
|
+
formatString:'%b %#d, %y',
|
76
|
+
angle: -30,
|
77
|
+
fontSize: '10pt',
|
78
|
+
textColor: '#476D9B'
|
79
|
+
},
|
80
|
+
min: orders_by_day_points[0][0][0].replace(/-/g, "/"),
|
81
|
+
max: orders_by_day_points[0][orders_by_day_points[0].length -1][0].replace(/-/g, "/")//,
|
82
|
+
//tickInterval: '1 day'
|
83
|
+
}
|
84
|
+
},
|
85
|
+
series:[{lineWidth:3, color: '#0095DA', fillAndStroke: true, fill: true, fillColor: '#E6F7FF'}],
|
86
|
+
highlighter: {
|
87
|
+
formatString: "Date: %s <br/>Value: %s ",
|
88
|
+
sizeAdjust: 7.5
|
89
|
+
}
|
90
|
+
};
|
91
|
+
|
92
|
+
|
93
|
+
jQuery.jqplot('orders_by_day', orders_by_day_points, orders_by_day_settings);
|
94
|
+
|
95
|
+
jQuery("div#orders_by_day_options select").change(function(){
|
96
|
+
var report = jQuery("#orders_by_day_reports :selected").val();
|
97
|
+
var value = jQuery("#orders_by_day_value :selected").val();
|
98
|
+
|
99
|
+
jQuery.ajax({
|
100
|
+
type: 'GET',
|
101
|
+
url: 'admin/overview/get_report_data',
|
102
|
+
data: ({report: 'orders_by_day', name: report, value: value, authenticity_token: AUTH_TOKEN}),
|
103
|
+
success: handle_orders_by_day
|
104
|
+
});
|
105
|
+
|
106
|
+
jQuery.ajax({
|
107
|
+
type: 'GET',
|
108
|
+
url: 'admin/overview/get_report_data',
|
109
|
+
data: ({report: 'orders_totals', name: report, authenticity_token: AUTH_TOKEN}),
|
110
|
+
success: handle_orders_total
|
111
|
+
});
|
112
|
+
});
|
113
|
+
|
114
|
+
best_selling_variants = jQuery.jqplot('best_selling_products', [best_selling_variants_points], {
|
115
|
+
grid: {background:'#fff',borderWidth: 0, borderColor: '#fff', shadow: false},
|
116
|
+
seriesDefaults:{
|
117
|
+
renderer:jQuery.jqplot.PieRenderer,
|
118
|
+
rendererOptions:{padding:6,sliceMargin:0}
|
119
|
+
},
|
120
|
+
seriesColors: pie_colors
|
121
|
+
});
|
122
|
+
|
123
|
+
|
124
|
+
top_grossing_variants = jQuery.jqplot('top_grossing_products', [top_grossing_variants_points], {
|
125
|
+
grid: {background:'#fff',borderWidth: 0, borderColor: '#fff', shadow: false},
|
126
|
+
seriesDefaults:{
|
127
|
+
renderer:jQuery.jqplot.PieRenderer,
|
128
|
+
rendererOptions:{padding:6,sliceMargin:0}
|
129
|
+
},
|
130
|
+
|
131
|
+
seriesColors: pie_colors
|
132
|
+
});
|
133
|
+
|
134
|
+
tbest_selling_taxons = jQuery.jqplot('best_selling_taxons', [best_selling_taxons_points], {
|
135
|
+
grid: {background:'#fff',borderWidth: 0, borderColor: '#fff', shadow: false},
|
136
|
+
seriesDefaults:{
|
137
|
+
renderer:jQuery.jqplot.PieRenderer,
|
138
|
+
rendererOptions:{padding:6,sliceMargin:0}
|
139
|
+
},
|
140
|
+
|
141
|
+
seriesColors: pie_colors
|
142
|
+
});
|
143
|
+
}
|
144
|
+
});
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require_tree .
|
8
|
+
//= require admin/spree_core
|
9
|
+
//= require jqPlot/jquery.jqplot.min
|
10
|
+
//= require jqPlot/plugins/jqplot.dateAxisRenderer.min
|
11
|
+
//= require jqPlot/plugins/jqplot.highlighter.min
|
12
|
+
//= require jqPlot/plugins/jqplot.canvasAxisTickRenderer.min
|
13
|
+
//= require jqPlot/plugins/jqplot.canvasTextRenderer.min
|
14
|
+
//= require jqPlot/plugins/jqplot.canvasAxisLabelRenderer.min
|
15
|
+
//= require jqPlot/plugins/jqplot.pieRenderer.min
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require store/spree_core
|
data/{public/stylesheets/admin/dashboard.css → app/assets/stylesheets/admin/dashboard.css.erb}
RENAMED
@@ -37,7 +37,7 @@
|
|
37
37
|
}
|
38
38
|
|
39
39
|
#order_totals{
|
40
|
-
background:#154E8C url(
|
40
|
+
background:#154E8C url(<%= asset_path("admin/bg/admin_tab_back.png") %>) repeat-x scroll left top;
|
41
41
|
-moz-border-radius-bottomleft:10px;
|
42
42
|
-moz-border-radius-bottomright:10px;
|
43
43
|
-moz-border-radius-topleft:10px;
|
@@ -140,4 +140,4 @@
|
|
140
140
|
|
141
141
|
.jqplot-table-legend{
|
142
142
|
width:60px;
|
143
|
-
}
|
143
|
+
}
|
@@ -53,9 +53,9 @@ class Admin::OverviewController < Admin::BaseController
|
|
53
53
|
|
54
54
|
def conditions(params)
|
55
55
|
if params.key? :to
|
56
|
-
["completed_at >= ? AND completed_at <= ?
|
56
|
+
["completed_at >= ? AND completed_at <= ?", params[:from], params[:to]]
|
57
57
|
else
|
58
|
-
["completed_at >= ?
|
58
|
+
["completed_at >= ?", params[:from]]
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -99,7 +99,7 @@ class Admin::OverviewController < Admin::BaseController
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def best_selling_variants
|
102
|
-
li = LineItem.includes(:order).where("orders.state = 'complete'").sum(:quantity, :group => :variant_id, :
|
102
|
+
li = LineItem.includes(:order).where("orders.state = 'complete'").sum(:quantity, :group => :variant_id, :limit => 5)
|
103
103
|
variants = li.map do |v|
|
104
104
|
variant = Variant.find(v[0])
|
105
105
|
[variant.name, v[1] ]
|
@@ -108,10 +108,11 @@ class Admin::OverviewController < Admin::BaseController
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def top_grossing_variants
|
111
|
-
|
112
|
-
|
111
|
+
quantity = LineItem.includes(:order).where("orders.state = 'complete'").sum(:quantity, :group => :variant_id, :limit => 5)
|
112
|
+
prices = LineItem.includes(:order).where("orders.state = 'complete'").sum(:price, :group => :variant_id, :limit => 5)
|
113
|
+
variants = quantity.map do |v|
|
113
114
|
variant = Variant.find(v[0])
|
114
|
-
[variant.name, v[1]]
|
115
|
+
[variant.name, v[1] * prices[v[0]]]
|
115
116
|
end
|
116
117
|
|
117
118
|
variants.sort { |x,y| y[1] <=> x[1] }
|
@@ -125,7 +126,7 @@ class Admin::OverviewController < Admin::BaseController
|
|
125
126
|
end
|
126
127
|
|
127
128
|
def last_five_orders
|
128
|
-
orders = Order.includes(:line_items).where("completed_at IS NOT NULL
|
129
|
+
orders = Order.includes(:line_items).where("completed_at IS NOT NULL").order("completed_at DESC").limit(5)
|
129
130
|
orders.map do |o|
|
130
131
|
qty = o.line_items.inject(0) {|sum,li| sum + li.quantity}
|
131
132
|
|
@@ -134,7 +135,7 @@ class Admin::OverviewController < Admin::BaseController
|
|
134
135
|
end
|
135
136
|
|
136
137
|
def biggest_spenders
|
137
|
-
spenders = Order.sum(:total, :group => :user_id, :limit => 5, :order => "sum(total) desc", :conditions => "completed_at is not null and
|
138
|
+
spenders = Order.sum(:total, :group => :user_id, :limit => 5, :order => "sum(total) desc", :conditions => "completed_at is not null and user_id is not null")
|
138
139
|
spenders = spenders.map do |o|
|
139
140
|
orders = User.find(o[0]).orders
|
140
141
|
qty = orders.size
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<h1><%= t("overview") %></h1>
|
2
2
|
|
3
|
-
|
3
|
+
<div data-hook="admin_dashboard">
|
4
4
|
<% if @show_dashboard %>
|
5
5
|
<div class="dashboard">
|
6
6
|
<div class="dashboard_left">
|
7
|
-
|
7
|
+
<div data-hook="admin_dashboard_left">
|
8
8
|
<div class="dashboard_small_wrapper">
|
9
9
|
<h2><%= t('best_selling_products') %></h2>
|
10
10
|
<div id="best_selling_products" style="width:50%;height:170px;float:left"></div>
|
@@ -38,8 +38,8 @@
|
|
38
38
|
|
39
39
|
</div>
|
40
40
|
</div>
|
41
|
-
|
42
|
-
|
41
|
+
</div>
|
42
|
+
<div data-hook="admin_dashboard_center">
|
43
43
|
<div class="dashboard_main">
|
44
44
|
<div class="dashboard_main_wrapper">
|
45
45
|
<h2 id="order_by_day_title"><%= t('orders') %> <%= t('count') %> <%= t('by_day') %> (<%= t('last_7_days') %>)</h2>
|
@@ -83,8 +83,8 @@
|
|
83
83
|
</div>
|
84
84
|
</div>
|
85
85
|
</div>
|
86
|
-
|
87
|
-
|
86
|
+
</div>
|
87
|
+
<div data-hook="admin_dashboard_right">
|
88
88
|
<div class="dashboard_right">
|
89
89
|
<h2><%= t('last_5_orders') %></h2>
|
90
90
|
<table>
|
@@ -137,38 +137,28 @@
|
|
137
137
|
</table>
|
138
138
|
</div>
|
139
139
|
</div>
|
140
|
-
|
140
|
+
</div>
|
141
141
|
<p style="clear:both;"> </p>
|
142
142
|
<% else %>
|
143
|
-
|
143
|
+
<div data-hook="admin_dashboard_welcome">
|
144
144
|
<%== t('overview_welcome') %>
|
145
|
-
|
145
|
+
</div>
|
146
146
|
<% end %>
|
147
|
-
|
147
|
+
</div>
|
148
148
|
|
149
149
|
<% content_for :head do %>
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
var best_selling_taxons_points = [<%== @best_selling_taxons.map { |t| "[\"#{h(t[0])}\",#{t[1]}]" }.join(",") %>];
|
157
|
-
|
158
|
-
var orders = "<%= t(:orders) %>";
|
159
|
-
var by_day = "<%= t(:by_day) %>";
|
150
|
+
<% if @show_dashboard %>
|
151
|
+
<script type="text/javascript">
|
152
|
+
var orders_by_day_points = [[<%== @orders_by_day.map { |day| "[\"#{day[0]}\",#{day[1]}]" }.join(",") %>]];
|
153
|
+
var best_selling_variants_points = [<%== @best_selling_variants.map { |v| "[\"#{h(v[0])}\",#{v[1]}]" }.join(",") %>];
|
154
|
+
var top_grossing_variants_points = [<%== @top_grossing_variants.map { |v| "[\"#{h(v[0])}\",#{v[1]}]" }.join(",") %>];
|
155
|
+
var best_selling_taxons_points = [<%== @best_selling_taxons.map { |t| "[\"#{h(t[0])}\",#{t[1]}]" }.join(",") %>];
|
160
156
|
|
161
|
-
|
162
|
-
|
157
|
+
var orders = "<%= t(:orders) %>";
|
158
|
+
var by_day = "<%= t(:by_day) %>";
|
163
159
|
|
164
|
-
|
165
|
-
|
166
|
-
'jqPlot/plugins/jqplot.pieRenderer.min.js', 'dashboard.js' %>
|
160
|
+
var pie_colors = [<%== @pie_colors.map{|c| "'#{c}'"}.join(",") %>];
|
161
|
+
</script>
|
167
162
|
<!--[if IE]><%= javascript_include_tag 'jqPlot/excanvas.min.js' %><![endif]-->
|
168
|
-
<% end %>
|
169
|
-
<% end %>
|
170
|
-
|
171
|
-
<%= hook :admin_dashboard_stylesheet do %>
|
172
|
-
<%= stylesheet_link_tag 'admin/dashboard.css' %>
|
173
163
|
<% end %>
|
174
164
|
<% end %>
|
data/lib/spree_dash.rb
CHANGED
File without changes
|
File without changes
|
data/{public → vendor/assets}/javascripts/jqPlot/plugins/jqplot.canvasAxisLabelRenderer.min.js
RENAMED
File without changes
|
data/{public → vendor/assets}/javascripts/jqPlot/plugins/jqplot.canvasAxisTickRenderer.min.js
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_dash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 11094103
|
5
|
+
prerelease: 5
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
8
|
+
- 70
|
9
|
+
- RC
|
10
|
+
- 1
|
11
|
+
version: 0.70.RC1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Brian Quinn
|
@@ -15,25 +16,26 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date:
|
19
|
+
date: 2011-09-09 00:00:00 Z
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
22
|
-
type: :runtime
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
23
|
none: false
|
25
24
|
requirements:
|
26
25
|
- - "="
|
27
26
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
27
|
+
hash: 11094103
|
29
28
|
segments:
|
30
29
|
- 0
|
31
|
-
-
|
32
|
-
-
|
33
|
-
|
34
|
-
|
30
|
+
- 70
|
31
|
+
- RC
|
32
|
+
- 1
|
33
|
+
version: 0.70.RC1
|
35
34
|
name: spree_core
|
36
|
-
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
requirement: *id001
|
38
|
+
description: Required dependency for Spree
|
37
39
|
email: brian@railsdog.com
|
38
40
|
executables: []
|
39
41
|
|
@@ -44,22 +46,25 @@ extra_rdoc_files: []
|
|
44
46
|
files:
|
45
47
|
- LICENSE
|
46
48
|
- README.md
|
49
|
+
- app/assets/javascripts/admin/dashboard.js
|
50
|
+
- app/assets/javascripts/admin/spree_dash.js
|
51
|
+
- app/assets/javascripts/store/spree_dash.js
|
52
|
+
- app/assets/stylesheets/admin/dashboard.css.erb
|
53
|
+
- app/assets/stylesheets/admin/spree_dash.css
|
54
|
+
- app/assets/stylesheets/store/spree_dash.css
|
47
55
|
- app/controllers/admin/overview_controller.rb
|
48
56
|
- app/views/admin/overview/index.html.erb
|
49
57
|
- config/routes.rb
|
50
58
|
- lib/spree_dash.rb
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
- public/javascripts/jqPlot/plugins/jqplot.highlighter.min.js
|
61
|
-
- public/javascripts/jqPlot/plugins/jqplot.pieRenderer.min.js
|
62
|
-
- public/stylesheets/admin/dashboard.css
|
59
|
+
- vendor/assets/javascripts/jqPlot/excanvas.min.js
|
60
|
+
- vendor/assets/javascripts/jqPlot/jquery.jqplot.min.js
|
61
|
+
- vendor/assets/javascripts/jqPlot/plugins/jqplot.canvasAxisLabelRenderer.min.js
|
62
|
+
- vendor/assets/javascripts/jqPlot/plugins/jqplot.canvasAxisTickRenderer.min.js
|
63
|
+
- vendor/assets/javascripts/jqPlot/plugins/jqplot.canvasTextRenderer.min.js
|
64
|
+
- vendor/assets/javascripts/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js
|
65
|
+
- vendor/assets/javascripts/jqPlot/plugins/jqplot.dateAxisRenderer.min.js
|
66
|
+
- vendor/assets/javascripts/jqPlot/plugins/jqplot.highlighter.min.js
|
67
|
+
- vendor/assets/javascripts/jqPlot/plugins/jqplot.pieRenderer.min.js
|
63
68
|
homepage: http://spreecommerce.com
|
64
69
|
licenses: []
|
65
70
|
|
@@ -82,16 +87,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
88
|
none: false
|
84
89
|
requirements:
|
85
|
-
- - "
|
90
|
+
- - ">"
|
86
91
|
- !ruby/object:Gem::Version
|
87
|
-
hash:
|
92
|
+
hash: 25
|
88
93
|
segments:
|
89
|
-
-
|
90
|
-
|
94
|
+
- 1
|
95
|
+
- 3
|
96
|
+
- 1
|
97
|
+
version: 1.3.1
|
91
98
|
requirements:
|
92
99
|
- none
|
93
100
|
rubyforge_project: spree_dash
|
94
|
-
rubygems_version: 1.8.
|
101
|
+
rubygems_version: 1.8.6
|
95
102
|
signing_key:
|
96
103
|
specification_version: 3
|
97
104
|
summary: Overview dashboard for use with Spree.
|
data/lib/tasks/install.rake
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
namespace :spree_dash do
|
2
|
-
desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
|
3
|
-
task :install do
|
4
|
-
Rake::Task['spree_dash:install:migrations'].invoke
|
5
|
-
Rake::Task['spree_dash:install:assets'].invoke
|
6
|
-
end
|
7
|
-
|
8
|
-
namespace :install do
|
9
|
-
|
10
|
-
desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
|
11
|
-
task :migrations do
|
12
|
-
# no migrations to migrate
|
13
|
-
end
|
14
|
-
|
15
|
-
desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
|
16
|
-
task :assets do
|
17
|
-
source = File.join(File.dirname(__FILE__), '..', '..', 'public')
|
18
|
-
destination = File.join(Rails.root, 'public')
|
19
|
-
puts "INFO: Mirroring assets from #{source} to #{destination}"
|
20
|
-
Spree::FileUtilz.mirror_files(source, destination)
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
@@ -1,143 +0,0 @@
|
|
1
|
-
jQuery(document).ready(function(){
|
2
|
-
function number_with_delimiter(number, delimiter, separator) {
|
3
|
-
try {
|
4
|
-
var delimiter = delimiter || ",";
|
5
|
-
var separator = separator || ".";
|
6
|
-
|
7
|
-
var parts = number.toString().split('.');
|
8
|
-
parts[0] = parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1" + delimiter);
|
9
|
-
formatted_number = parts.join(separator);
|
10
|
-
|
11
|
-
if(formatted_number.length>=6 && formatted_number.length<=9){
|
12
|
-
var arr = formatted_number.split(",");
|
13
|
-
return arr[0] + " k";
|
14
|
-
}else if(formatted_number.length==10){
|
15
|
-
var arr = formatted_number.split(",");
|
16
|
-
return arr[0] + " m";
|
17
|
-
}else{
|
18
|
-
return formatted_number
|
19
|
-
}
|
20
|
-
} catch(e) {
|
21
|
-
return number
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
function handle_orders_by_day(r){
|
26
|
-
var new_points = eval(r);
|
27
|
-
|
28
|
-
if(new_points[0].length>0){
|
29
|
-
orders_by_day_settings.axes.xaxis.min = new_points[0][0][0].replace(/-/g, "/");
|
30
|
-
orders_by_day_settings.axes.xaxis.max = new_points[0][new_points[0].length -1][0].replace(/-/g, "/");
|
31
|
-
}
|
32
|
-
|
33
|
-
orders_by_day_settings.axes.yaxis.label = jQuery("#orders_by_day_value :selected").val();
|
34
|
-
|
35
|
-
jQuery("#order_by_day_title").text(orders + " " + jQuery("#orders_by_day_value :selected").val() + " " + by_day + " (" + jQuery("#orders_by_day_reports :selected").text() + ")");
|
36
|
-
|
37
|
-
$('#orders_by_day').empty();
|
38
|
-
$.jqplot('orders_by_day', new_points, orders_by_day_settings);
|
39
|
-
|
40
|
-
}
|
41
|
-
|
42
|
-
function handle_orders_total(r){
|
43
|
-
var values = eval(r);
|
44
|
-
|
45
|
-
jQuery('#orders_total').text(number_with_delimiter(values[0].orders_total));
|
46
|
-
jQuery('#orders_line_total').text(number_with_delimiter(values[0].orders_line_total));
|
47
|
-
jQuery('#orders_adjustment_total').text(number_with_delimiter(values[0].orders_adjustment_total));
|
48
|
-
jQuery('#orders_adjustment_total').text(number_with_delimiter(values[0].orders_adjustment_total));
|
49
|
-
}
|
50
|
-
|
51
|
-
var orders_by_day_settings = {
|
52
|
-
title: {
|
53
|
-
textColor: '#476D9B',
|
54
|
-
fontSize: '12pt',
|
55
|
-
},
|
56
|
-
grid: {background:'#fff', gridLineColor:'#fff',borderColor: '#476D9B'},
|
57
|
-
axes:{
|
58
|
-
yaxis:{
|
59
|
-
label:'Order (Count)',
|
60
|
-
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
|
61
|
-
autoscale:true,
|
62
|
-
tickOptions:{
|
63
|
-
formatString:'%d',
|
64
|
-
fontSize: '10pt',
|
65
|
-
textColor: '#476D9B'
|
66
|
-
},
|
67
|
-
min: 0
|
68
|
-
},
|
69
|
-
xaxis:{
|
70
|
-
renderer:$.jqplot.DateAxisRenderer,
|
71
|
-
rendererOptions:{tickRenderer:$.jqplot.CanvasAxisTickRenderer},
|
72
|
-
tickOptions:{
|
73
|
-
formatString:'%b %#d, %y',
|
74
|
-
angle: -30,
|
75
|
-
fontSize: '10pt',
|
76
|
-
textColor: '#476D9B'
|
77
|
-
},
|
78
|
-
min: orders_by_day_points[0][0][0].replace(/-/g, "/"),
|
79
|
-
max: orders_by_day_points[0][orders_by_day_points[0].length -1][0].replace(/-/g, "/")//,
|
80
|
-
//tickInterval: '1 day'
|
81
|
-
}
|
82
|
-
},
|
83
|
-
series:[{lineWidth:3, color: '#0095DA', fillAndStroke: true, fill: true, fillColor: '#E6F7FF'}],
|
84
|
-
highlighter: {
|
85
|
-
formatString: "Date: %s <br/>Value: %s ",
|
86
|
-
sizeAdjust: 7.5
|
87
|
-
}
|
88
|
-
};
|
89
|
-
|
90
|
-
jQuery.jqplot('orders_by_day', orders_by_day_points, orders_by_day_settings);
|
91
|
-
|
92
|
-
jQuery("div#orders_by_day_options select").change(function(){
|
93
|
-
var report = jQuery("#orders_by_day_reports :selected").val();
|
94
|
-
var value = jQuery("#orders_by_day_value :selected").val();
|
95
|
-
|
96
|
-
jQuery.ajax({
|
97
|
-
type: 'GET',
|
98
|
-
url: 'admin/overview/get_report_data',
|
99
|
-
data: ({report: 'orders_by_day', name: report, value: value, authenticity_token: AUTH_TOKEN}),
|
100
|
-
success: handle_orders_by_day
|
101
|
-
});
|
102
|
-
|
103
|
-
jQuery.ajax({
|
104
|
-
type: 'GET',
|
105
|
-
url: 'admin/overview/get_report_data',
|
106
|
-
data: ({report: 'orders_totals', name: report, authenticity_token: AUTH_TOKEN}),
|
107
|
-
success: handle_orders_total
|
108
|
-
});
|
109
|
-
|
110
|
-
});
|
111
|
-
|
112
|
-
best_selling_variants = $.jqplot('best_selling_products', [best_selling_variants_points], {
|
113
|
-
grid: {background:'#fff',borderWidth: 0, borderColor: '#fff', shadow: false},
|
114
|
-
seriesDefaults:{
|
115
|
-
renderer:$.jqplot.PieRenderer,
|
116
|
-
rendererOptions:{padding:6,sliceMargin:0}
|
117
|
-
},
|
118
|
-
seriesColors: pie_colors
|
119
|
-
});
|
120
|
-
|
121
|
-
|
122
|
-
top_grossing_variants = $.jqplot('top_grossing_products', [top_grossing_variants_points], {
|
123
|
-
grid: {background:'#fff',borderWidth: 0, borderColor: '#fff', shadow: false},
|
124
|
-
seriesDefaults:{
|
125
|
-
renderer:$.jqplot.PieRenderer,
|
126
|
-
rendererOptions:{padding:6,sliceMargin:0}
|
127
|
-
},
|
128
|
-
|
129
|
-
seriesColors: pie_colors
|
130
|
-
});
|
131
|
-
|
132
|
-
tbest_selling_taxons = $.jqplot('best_selling_taxons', [best_selling_taxons_points], {
|
133
|
-
grid: {background:'#fff',borderWidth: 0, borderColor: '#fff', shadow: false},
|
134
|
-
seriesDefaults:{
|
135
|
-
renderer:$.jqplot.PieRenderer,
|
136
|
-
rendererOptions:{padding:6,sliceMargin:0}
|
137
|
-
},
|
138
|
-
|
139
|
-
seriesColors: pie_colors
|
140
|
-
});
|
141
|
-
|
142
|
-
|
143
|
-
});
|