spree_dash 1.2.4 → 1.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
1
  module Spree
2
2
  class Admin::AnalyticsController < Admin::BaseController
3
- before_filter :redirect_if_registered
4
3
 
5
4
  def sign_up
5
+ redirect_if_registered and return
6
6
  @store = {
7
7
  :first_name => '',
8
8
  :last_name => '',
@@ -15,6 +15,7 @@ module Spree
15
15
  end
16
16
 
17
17
  def register
18
+ redirect_if_registered and return
18
19
  @store = params[:store]
19
20
  @store[:url] = format_url(@store[:url])
20
21
 
@@ -34,17 +35,34 @@ module Spree
34
35
  Spree::Dash::Config.app_token = @store[:app_token]
35
36
  Spree::Dash::Config.site_id = @store[:site_id]
36
37
  Spree::Dash::Config.token = @store[:site_token]
37
- redirect_to admin_path, :notice => t(:successfully_signed_up_for_analytics)
38
+ flash[:notice] = t(:successfully_signed_up_for_analytics)
39
+ redirect_to admin_path
38
40
  rescue Spree::Dash::JirafeException => e
39
41
  flash[:error] = e.message
40
42
  render :sign_up
41
43
  end
42
44
  end
43
45
 
46
+ def edit
47
+
48
+ end
49
+
50
+ def update
51
+ Spree::Dash::Config.app_id = params[:app_id]
52
+ Spree::Dash::Config.app_token = params[:app_token]
53
+ Spree::Dash::Config.site_id = params[:site_id]
54
+ Spree::Dash::Config.token = params[:token]
55
+ flash[:success] = t(:jirafe_settings_updated, :scope => "spree.dash")
56
+ redirect_to admin_analytics_path
57
+ end
58
+
44
59
  private
45
60
 
46
61
  def redirect_if_registered
47
- redirect_to admin_path, :notice => t(:already_signed_up_for_analytics) if Spree::Dash::Config.configured?
62
+ if Spree::Dash::Config.configured?
63
+ flash[:success] = t(:already_signed_up_for_analytics)
64
+ redirect_to admin_path and return true
65
+ end
48
66
  end
49
67
 
50
68
  def format_url(url)
@@ -4,7 +4,7 @@ module Spree
4
4
 
5
5
  def jirafe_locale_links
6
6
  Spree::Admin::OverviewController::JIRAFE_LOCALES.collect do |langage, locale|
7
- link_to t(langage), admin_path(:locale => locale)
7
+ link_to image_tag("flags/#{locale.split('_')[1].downcase}.png", :alt => langage.to_s.titleize), admin_path(:locale => locale), :class => 'with-tip', :title => langage.to_s.titleize, :data => {:'tip-color' => 'green'}
8
8
  end
9
9
  end
10
10
 
@@ -42,7 +42,7 @@ module Spree
42
42
  end
43
43
 
44
44
  def completed_analytics_tags
45
- return {} unless flash[:commerce_tracking] and @order and @order.complete?
45
+ return {} unless @order and @order.complete?
46
46
  { :confirm => { :orderid => @order.number,
47
47
  :total => @order.total,
48
48
  :shipping => @order.ship_total,
@@ -1,5 +1,5 @@
1
- Deface::Override.new(:virtual_path => Spree::Config[:layout],
2
- :name => "add_analytics_header",
3
- :insert_bottom => "head",
4
- :partial => "spree/analytics/header",
5
- :original => '6f23c8af6e863d0499835c00b3f2763cb98e1d75')
1
+ Deface::Override.new(:virtual_path => "spree/admin/shared/_configuration_menu",
2
+ :name => "add_dashboard_sidebar_link",
3
+ :insert_bottom => ".sidebar",
4
+ :text => "<%= configurations_sidebar_menu_item t(:jirafe), admin_analytics_path %>",
5
+ :original => 'a74f177275dc303c9cd5994b2e24e027434c3cbb')
@@ -0,0 +1,26 @@
1
+ <h2><%= t(:header, :scope => "spree.dash.jirafe") %></h2>
2
+
3
+ <p><%= t(:explanation, :scope => "spree.dash.jirafe") %></p>
4
+
5
+ <%= form_tag admin_analytics_path, :method => :put do %>
6
+ <div class="field">
7
+ <%= label_tag 'app_id', t(:app_id, :scope => "spree.dash.jirafe") %><br>
8
+ <%= text_field_tag 'app_id', Spree::Dash::Config.app_id %>
9
+ </div>
10
+ <div class="field">
11
+ <%= label_tag 'app_token', t(:app_token, :scope => "spree.dash.jirafe") %><br>
12
+ <%= text_field_tag 'app_token', Spree::Dash::Config.app_token, :size => 40 %>
13
+ </div>
14
+ <div class="field">
15
+ <%= label_tag 'site_id', t(:site_id, :scope => "spree.dash.jirafe") %><br>
16
+ <%= text_field_tag 'site_id', Spree::Dash::Config.site_id %>
17
+ </div>
18
+ <div class="field">
19
+ <%= label_tag 'token', t(:token, :scope => "spree.dash.jirafe") %><br>
20
+ <%= text_field_tag 'token', Spree::Dash::Config.token, :size => 40 %>
21
+ </div>
22
+ <div class="form-buttons" data-hook="buttons">
23
+ <%= submit_tag "Update" %>
24
+ </div>
25
+ <% end %>
26
+
@@ -1,45 +1,61 @@
1
+ <% content_for :page_title do %>
2
+ <%= t(:analytics_sign_up) %>
3
+ <% end %>
4
+
5
+ <% content_for :page_title_classes do %>
6
+ align-center
7
+ <% end %>
8
+
1
9
  <%= form_tag admin_analytics_register_path do %>
2
- <fieldset id="analytics_signup" data-hook>
3
- <legend><%= t(:analytics_sign_up) %></legend>
4
- <p>
5
- <%= check_box_tag 'store[terms_of_service]', @store[:terms_of_service], @store.has_key?(:terms_of_service), :size => 50 %>
6
- <%= label_tag 'store[terms_of_service]', t(:agree_to_terms_of_service) %> (<a href="http://jirafe.com/about/terms" target="_new"><%= t(:review) %></a>)
7
- </p>
8
- <p>
9
- <%= check_box_tag 'store[privacy_policy]', @store[:privacy_policy], @store.has_key?(:privacy_policy), :size => 50 %>
10
- <%= label_tag 'store[privacy_policy]', t(:agree_to_privacy_policy) %> (<a href="http://jirafe.com/about/privacy" target="_new"><%= t(:review) %></a>)
11
- </p>
12
- <p>
13
- <%= label_tag :first_name %><br>
10
+ <div id="analytics_signup" data-hook class="align-center label-block">
11
+ <div class="field">
12
+ <%= label_tag :first_name %>
14
13
  <%= text_field_tag 'store[first_name]', @store[:first_name], :size => 50 %>
15
- </p>
16
- <p>
17
- <%= label_tag :last_name %><br>
14
+ </div>
15
+
16
+ <div class="field">
17
+ <%= label_tag :last_name %>
18
18
  <%= text_field_tag 'store[last_name]', @store[:last_name], :size => 50 %>
19
- </p>
20
- <p>
21
- <%= label_tag :email %><br>
19
+ </div>
20
+
21
+ <div class="field">
22
+ <%= label_tag :email %>
22
23
  <%= email_field_tag 'store[email]', @store[:email], :size => 50 %>
23
- </p>
24
- <p>
25
- <%= label_tag :store_name %><br>
24
+ </div>
25
+
26
+ <div class="field">
27
+ <%= label_tag :store_name %>
26
28
  <%= text_field_tag 'store[name]', @store[:name], :size => 50 %>
27
- </p>
28
- <p>
29
- <%= label_tag :store_url %><br>
29
+ </div>
30
+
31
+ <div class="field">
32
+ <%= label_tag :store_url %>
30
33
  <%= url_field_tag 'store[url]', @store[:url], :size => 50 %>
31
- </p>
32
- <p>
33
- <%= label_tag :currency %><br>
34
- <%= select_tag 'store[currency]', options_for_select(Spree::AnalyticsHelper::CURRENCIES, @store[:currency]) %>
35
- </p>
36
- <p>
37
- <%= label_tag :time_zone %><br>
38
- <%= select_tag 'store[time_zone]', time_zone_options_for_select(@store[:time_zone]) %>
39
- </p>
40
- </fieldset>
41
- <p class="form-buttons" data-hook="buttons">
42
- <%= button t(:activate) %>
43
- <%= t(:or) %> <%= link_to t(:cancel), admin_path %>
44
- </p>
34
+ </div>
35
+
36
+ <div class="field">
37
+ <%= label_tag :currency %>
38
+ <%= select_tag 'store[currency]', options_for_select(Spree::AnalyticsHelper::CURRENCIES, @store[:currency]), :class => 'select2' %>
39
+ </div>
40
+
41
+ <div class="field">
42
+ <%= label_tag :time_zone %>
43
+ <%= select_tag 'store[time_zone]', time_zone_options_for_select(@store[:time_zone]), :class => 'select2' %>
44
+ </div>
45
+
46
+ <div class="field">
47
+ <%= check_box_tag 'store[terms_of_service]', @store[:terms_of_service], @store.has_key?(:terms_of_service), :size => 50 %>
48
+ <%= label_tag 'store[terms_of_service]', t(:agree_to_terms_of_service) %> (<a href="http://jirafe.com/about/terms" target="_new"><%= t(:review) %></a>)
49
+ </div>
50
+
51
+ <div class="field">
52
+ <%= check_box_tag 'store[privacy_policy]', @store[:privacy_policy], @store.has_key?(:privacy_policy), :size => 50 %>
53
+ <%= label_tag 'store[privacy_policy]', t(:agree_to_privacy_policy) %> (<a href="http://jirafe.com/about/privacy" target="_new"><%= t(:review) %></a>)
54
+ </div>
55
+ </div>
56
+ <div class="form-buttons" data-hook="buttons">
57
+ <%= button t(:activate), 'icon-ok' %>
58
+ <%= t(:or) %>
59
+ <%= link_to_with_icon 'icon-remove', t(:cancel), admin_path, :class => 'button' %>
60
+ </div>
45
61
  <% end %>
@@ -4,7 +4,13 @@
4
4
  <% end %>
5
5
 
6
6
  <% if Spree::Dash::Config.configured? %>
7
- <h1><%= t(:overview) %></h1>
7
+
8
+ <% content_for :page_actions do %>
9
+ <li id="jirafe_locales">
10
+ <i class="icon-globe"></i> <%= t(:choose_dashboard_locale) %>: <%= raw jirafe_locale_links.join(' ') %>
11
+ </li>
12
+ <% end %>
13
+
8
14
  <div id="jirafe"></div>
9
15
  <%= javascript_tag :defer => 'defer' do %>
10
16
  jirafe.jQuery('#jirafe').jirafe({
@@ -19,17 +25,27 @@
19
25
  }
20
26
  }, 10000);
21
27
  <% end %>
22
- <div id="jirafe_locales">
23
- <%= raw jirafe_locale_links.join(' | ') %>
24
- </div>
25
28
  <% else %>
26
- <div class="analytics_splash">
27
- <%= image_tag 'analytics_dashboard_preview.png', :alt => 'Spree Analytics' %>
28
- </div>
29
- <br/>
30
- <div class="preview-buttons">
31
- <%= link_to content_tag(:span, t(:activate)), admin_analytics_sign_up_path, :class => 'button green' %>
32
- <%= t(:or) %> &nbsp;
33
- <%= link_to content_tag(:span, t(:learn_more)), "http://spreecommerce.com/blog/2012/01/31/introducing-spree-analytics/", :class => 'button', :target => '_blank' %>
29
+ <div class="no-border-top analytics-description">
30
+ <div class="description-text">
31
+ <hgroup>
32
+ <h1><%= t(:analytics_desc_header_1)%></h1>
33
+ <h6><%= t(:analytics_desc_header_2)%></h6>
34
+ </hgroup>
35
+
36
+ <ul>
37
+ <li><%= t(:analytics_desc_list_1)%></li>
38
+ <li><%= t(:analytics_desc_list_2)%></li>
39
+ <li><%= t(:analytics_desc_list_3)%></li>
40
+ <li><%= t(:analytics_desc_list_4)%></li>
41
+ </ul>
42
+ </div>
43
+ <div class="preview-buttons filter-actions actions">
44
+ <%= link_to_with_icon 'icon-ok', t(:activate), admin_analytics_sign_up_path, :class => 'button' %>
45
+ <span class="or">&nbsp; <%= t(:or) %> &nbsp;</span>
46
+ <%= link_to_with_icon 'icon-info-sign', t(:learn_more), "http://spreecommerce.com/blog/2012/01/31/introducing-spree-analytics/", :class => 'button', :target => '_blank' %>
47
+ </div>
34
48
  </div>
49
+
50
+ <div class="analytics_splash"></div>
35
51
  <% end %>
@@ -2,4 +2,21 @@ en:
2
2
  agree_to_terms_of_service: Agree to Terms of Service
3
3
  agree_to_privacy_policy: Agree to Privacy Policy
4
4
  already_signed_up_for_analytics: You have already signed up for Spree Analytics
5
- successfully_signed_up_for_analytics: Successfully signed up for Spree Analytics
5
+ successfully_signed_up_for_analytics: Successfully signed up for Spree Analytics
6
+ analytics_desc_header_1: Spree Analytics
7
+ analytics_desc_header_2: Live analytics integrated into your Spree dashboard
8
+ analytics_desc_list_1: Get live sales information as it happens
9
+ analytics_desc_list_2: Requires only a free Spree account to activate
10
+ analytics_desc_list_3: Absolutely no code to install
11
+ analytics_desc_list_4: It's completely free!
12
+
13
+ spree:
14
+ dash:
15
+ jirafe:
16
+ header: Jirafe Analytics Settings
17
+ app_id: App ID
18
+ app_token: App Token
19
+ site_id: Site ID
20
+ token: Token
21
+ explanation: The fields below may already be populated if you chose to register with Jirafe from the admin dashboard.
22
+ jirafe_settings_updated: Jirafe Settings have been updated.
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_dash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
5
- prerelease:
4
+ version: 1.3.0.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Quinn
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-04 00:00:00.000000000 Z
12
+ date: 2012-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.2.4
21
+ version: 1.3.0.rc1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.2.4
29
+ version: 1.3.0.rc1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: httparty
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -51,14 +51,14 @@ extra_rdoc_files: []
51
51
  files:
52
52
  - LICENSE
53
53
  - README.md
54
- - app/assets/images/analytics_dashboard_preview.png
54
+ - app/assets/images/analytics_dashboard_preview.jpg
55
55
  - app/controllers/spree/admin/analytics_controller.rb
56
56
  - app/controllers/spree/admin/overview_controller.rb
57
57
  - app/helpers/spree/admin/overview_helper.rb
58
58
  - app/helpers/spree/analytics_helper.rb
59
59
  - app/models/spree/dash_configuration.rb
60
60
  - app/overrides/analytics_header.rb
61
- - app/overrides/configuration_menu_link.rb
61
+ - app/views/spree/admin/analytics/edit.html.erb
62
62
  - app/views/spree/admin/analytics/sign_up.html.erb
63
63
  - app/views/spree/admin/overview/index.html.erb
64
64
  - app/views/spree/analytics/_header.html.erb
@@ -69,8 +69,7 @@ files:
69
69
  - lib/spree/dash.rb
70
70
  - lib/spree_dash.rb
71
71
  homepage: http://spreecommerce.com
72
- licenses:
73
- - BSD-3
72
+ licenses: []
74
73
  post_install_message:
75
74
  rdoc_options: []
76
75
  require_paths:
@@ -84,12 +83,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
83
  required_rubygems_version: !ruby/object:Gem::Requirement
85
84
  none: false
86
85
  requirements:
87
- - - ! '>='
86
+ - - ! '>'
88
87
  - !ruby/object:Gem::Version
89
- version: '0'
90
- segments:
91
- - 0
92
- hash: -656834076944566421
88
+ version: 1.3.1
93
89
  requirements:
94
90
  - none
95
91
  rubyforge_project:
@@ -1,5 +0,0 @@
1
- Deface::Override.new(:virtual_path => "spree/admin/shared/_configuration_menu",
2
- :name => "add_dashboard_sidebar_link",
3
- :insert_bottom => ".sidebar",
4
- :text => "<%= configurations_sidebar_menu_item t(:jirafe), admin_analytics_path %>",
5
- :original => 'a74f177275dc303c9cd5994b2e24e027434c3cbb')