spree_froomerce_fconnect 0.70.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. data/.gitignore +11 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +20 -0
  4. data/Gemfile.lock +222 -0
  5. data/LICENSE +26 -0
  6. data/README.md +76 -0
  7. data/Rakefile +31 -0
  8. data/Versionfile +2 -0
  9. data/app/assets/images/loading.gif +0 -0
  10. data/app/assets/javascripts/admin/froomerces.js +2 -0
  11. data/app/assets/javascripts/admin/spree_froomerce_fconnect.js +1 -0
  12. data/app/assets/javascripts/froomerce_products.js +2 -0
  13. data/app/assets/javascripts/store/spree_froomerce_fconnect.js +1 -0
  14. data/app/assets/stylesheets/admin/froomerces.css +4 -0
  15. data/app/assets/stylesheets/admin/spree_froomerce_fconnect.css +3 -0
  16. data/app/assets/stylesheets/application.css +107 -0
  17. data/app/assets/stylesheets/froomerce_products.css +4 -0
  18. data/app/assets/stylesheets/store/spree_froomerce_fconnect.css +3 -0
  19. data/app/controllers/admin/froomerces_controller.rb +200 -0
  20. data/app/controllers/froomerce_products_controller.rb +79 -0
  21. data/app/helpers/admin/froomerces_helper.rb +2 -0
  22. data/app/helpers/froomerce_products_helper.rb +2 -0
  23. data/app/models/froomerce_config.rb +8 -0
  24. data/app/models/froomerce_product_status.rb +11 -0
  25. data/app/models/froomerce_user.rb +3 -0
  26. data/app/models/product_decorator.rb +4 -0
  27. data/app/models/taxon_decorator.rb +20 -0
  28. data/app/overrides/froomerce_tab.rb +5 -0
  29. data/app/views/admin/froomerces/export_facebook.html.erb +122 -0
  30. data/app/views/admin/froomerces/export_facebook_widgets.html.erb +108 -0
  31. data/app/views/admin/froomerces/export_shop.html.erb +56 -0
  32. data/app/views/admin/froomerces/index.html.erb +39 -0
  33. data/app/views/admin/shared/_froomerce_sub_menu.html.erb +8 -0
  34. data/app/views/froomerce_products/call_backs.html.erb +25 -0
  35. data/app/views/froomerce_products/feed_url.xml.builder +86 -0
  36. data/app/views/froomerce_products/index.xml.builder +83 -0
  37. data/config/locales/en.yml +72 -0
  38. data/config/routes.rb +29 -0
  39. data/db/migrate/20120111085252_create_froomerce_users.rb +11 -0
  40. data/db/migrate/20120113072837_create_froomerce_configs.rb +12 -0
  41. data/db/migrate/20120203125952_create_froomerce_product_statuses.rb +10 -0
  42. data/lib/api_calls.rb +37 -0
  43. data/lib/call_backs.rb +141 -0
  44. data/lib/generators/spree_froomerce_fconnect/install/install_generator.rb +20 -0
  45. data/lib/spree_froomerce_fconnect/engine.rb +25 -0
  46. data/lib/spree_froomerce_fconnect.rb +2 -0
  47. data/script/rails +7 -0
  48. data/spec/controllers/admin/froomerces_controller_spec.rb +5 -0
  49. data/spec/controllers/froomerce_products_controller_spec.rb +5 -0
  50. data/spec/helpers/admin/froomerces_helper_spec.rb +15 -0
  51. data/spec/helpers/froomerce_products_helper_spec.rb +15 -0
  52. data/spec/models/froomerce_config_spec.rb +5 -0
  53. data/spec/models/froomerce_product_status_spec.rb +5 -0
  54. data/spec/models/froomerce_user_spec.rb +5 -0
  55. data/spec/spec_helper.rb +31 -0
  56. data/spree_froomerce_fconnect.gemspec +20 -0
  57. metadata +113 -0
@@ -0,0 +1,200 @@
1
+ require 'api_calls'
2
+ class Admin::FroomercesController < Admin::BaseController
3
+
4
+ include Api_calls
5
+ before_filter :authenticate_user!
6
+
7
+
8
+ def index
9
+ if FroomerceUser.exists?
10
+ redirect_to :action => "export_shop"
11
+ end
12
+ end
13
+
14
+ def export_shop
15
+ unless FroomerceUser.exists?
16
+ flash[:error] = I18n.t('.error.no_session')
17
+ redirect_to :action => "index"; return
18
+ end
19
+ @user = FroomerceUser.first
20
+ @regions = ""
21
+ config = FroomerceConfig.first
22
+ if !config.nil? && config.status != 'Inprogress'
23
+ @froomerce_config = config
24
+ else
25
+ @froomerce_config = ""
26
+ call = "action_type=get_regions"
27
+ result = make_api_call(call, FroomerceConfig::VERIFICATION[:user_url], 0, @user.email)
28
+ if result != -1
29
+ if result['status'] == 'success'
30
+ @regions = result
31
+ else
32
+ flash[:error] = I18n.t(".error.e#{result['error']['code']}")
33
+ end
34
+ else
35
+ flash[:error] = I18n.t('.error.HTTPfaliure')
36
+ end
37
+ end
38
+ end
39
+
40
+ def create_shop
41
+ unless FroomerceConfig.first.nil?
42
+ redirect_to(:action => "export_products")
43
+ return
44
+ end
45
+ user = FroomerceUser.first
46
+ froomerce_config = FroomerceConfig.new(params[:froomerce_config])
47
+ unless froomerce_config.region_id == 0 || froomerce_config.shop_id == 0
48
+ if Spree::Config[:site_name].blank?
49
+ call = {'secret_token' => FroomerceConfig::VERIFICATION[:token],'user_id'=> user.froomerce_user_id, 'region_id' => froomerce_config.region_id, 'shop_name' => 'Spree Store', 'action_type' => 'create_shop' }
50
+ else
51
+ call = {'secret_token' => FroomerceConfig::VERIFICATION[:token],'user_id'=> user.froomerce_user_id, 'region_id' => froomerce_config.region_id, 'shop_name' => Spree::Config[:site_name], 'action_type' => 'create_shop' }
52
+ end
53
+ result = make_api_call(call, FroomerceConfig::VERIFICATION[:shop_url], 2, user.email)
54
+ if result != -1
55
+ if result['status'] == 'success'
56
+ froomerce_config.froomerce_shop_id = result['data']['shop_id']
57
+ froomerce_config.shop_id = 1
58
+ if froomerce_config.save
59
+ redirect_to(:action => "export_products")
60
+ return
61
+ end
62
+ else
63
+ flash[:error] = I18n.t('.error.shop_error')
64
+ redirect_to :action => "export_shop"
65
+ return
66
+ end
67
+ else
68
+ flash[:error] = I18n.t('.error.HTTPfaliure')
69
+ redirect_to :action => "export_shop"
70
+ return
71
+ end
72
+ else
73
+ flash[:error] = I18n.t('.error.invalid_selection')
74
+ redirect_to :action => "export_shop"
75
+ end
76
+ end
77
+
78
+ def export_products
79
+ user = FroomerceUser.first
80
+ config = FroomerceConfig.first
81
+ call = {'secret_token' => FroomerceConfig::VERIFICATION[:token],'user_id'=> user.froomerce_user_id, 'shop_id' => config.froomerce_shop_id, 'temp_url' => root_url + "froomerce_products?per_page=#{FroomerceConfig::FEED_CONFIG[:temp_limit]}" , 'feed_url' => root_url + "froomerce_feed?page=1&per_page=#{FroomerceConfig::FEED_CONFIG[:feed_per_page]}" ,'request_url' => root_url + 'froomerce_call_backs', 'network_id' => FroomerceConfig::FEED_CONFIG[:network_id] , 'action_type' => 'import_feed' }
82
+ result = make_api_call(call, FroomerceConfig::VERIFICATION[:feed_url], 2, user.email)
83
+ if result != -1
84
+ if result['status'] == 'success'
85
+ config.reload # reload config again!
86
+ config.update_attribute(:status , 'Exporting Products') unless config.status.eql? 'Exported'
87
+ flash[:notice] = I18n.t('shop_success')
88
+ redirect_to(:action => "export_shop")
89
+ else
90
+ flash[:error] = I18n.t('.error.shop_error')
91
+ redirect_to :action => "export_shop"
92
+ return
93
+ end
94
+ else
95
+ flash[:error] = I18n.t('.error.HTTPfaliure')
96
+ redirect_to :action => "export_shop"
97
+ return
98
+ end
99
+ end
100
+
101
+ def export_facebook
102
+ @config = FroomerceConfig.first
103
+ @user = FroomerceUser.first
104
+ @token = FroomerceConfig::VERIFICATION[:token]
105
+ if is_dummy?(@user.email)
106
+ @action = FroomerceConfig::VERIFICATION[:temp_base]+FroomerceConfig::VERIFICATION[:facebook_url]
107
+ else
108
+ @action = FroomerceConfig::VERIFICATION[:base]+FroomerceConfig::VERIFICATION[:facebook_url]
109
+ end
110
+ if !@config.blank? && @config.status != 'Inprogress'
111
+ @flag = false
112
+ call = {'secret_token' => FroomerceConfig::VERIFICATION[:token], 'shop_ids' => @config.froomerce_shop_id, 'action_type' => 'verify_shop_export'}
113
+ result = make_api_call(call, FroomerceConfig::VERIFICATION[:facebook_url], 2, @user.email)
114
+ if result != -1
115
+ if result['status'] == 'success'
116
+ @facebook_status = result['data']["#{@config.froomerce_shop_id}"]
117
+ if @facebook_status == 'exported'
118
+ @flag = true
119
+ else
120
+ @flag = false
121
+ end
122
+ else
123
+ flash[:error] = I18n.t(".error.e#{result['error']['code']}")
124
+ end
125
+ else
126
+ flash[:error] = I18n.t('.error.HTTPfaliur')
127
+ end
128
+ end
129
+ end
130
+
131
+ def export_facebook_widgets
132
+ config = FroomerceConfig.first
133
+ if !config.nil? && config.status != 'Inprogress'
134
+ params[:search] ||= {}
135
+ params[:search][:deleted_at_is_null] = true
136
+ params[:search][:count_on_hand_does_not_equal] ||= 0
137
+ params[:search][:froomerce_product_status_status_is_true] = true
138
+ @search = Product.search(params[:search])
139
+ @products = @search.relation.page(params[:page]).per(Spree::Config[:admin_products_per_page])
140
+ else
141
+ redirect_to :action => "export_shop"
142
+ end
143
+ end
144
+
145
+ def make_widget
146
+ user = FroomerceUser.first
147
+ config = FroomerceConfig.first
148
+ if params[:product_ids].blank?
149
+ flash[:notice] = I18n.t('.error.invalid_widget_selection')
150
+ redirect_to(:action => "export_facebook_widgets")
151
+ return
152
+ end
153
+ product_ids = params[:product_ids].join(',')
154
+ call = {'secret_token' => FroomerceConfig::VERIFICATION[:token], 'user_id' => user.froomerce_user_id , 'shop_id' => config.froomerce_shop_id, 'product_ids' => product_ids ,'action_type' => 'export_widget'}
155
+ result = make_api_call(call, FroomerceConfig::VERIFICATION[:facebook_url], 2, user.email)
156
+ if result != -1
157
+ if result['status'] == 'success'
158
+ widget_id = result['data']['widget_id']
159
+ if is_dummy?(user.email)
160
+ flash[:notice] = (I18n.t('widget_saved') + "<a href=\"#{FroomerceConfig::VERIFICATION[:temp_base] + FroomerceConfig::VERIFICATION[:widget_url]}?widget_id=#{widget_id}&secret_token=#{FroomerceConfig::VERIFICATION[:token]}&user_id=#{user.froomerce_user_id}\" target=\"_blank\"> here </a>" + I18n.t('widget_continue')).html_safe
161
+ else
162
+ flash[:notice] = (I18n.t('widget_saved') + "<a href=\"#{FroomerceConfig::VERIFICATION[:base] + FroomerceConfig::VERIFICATION[:widget_url]}?widget_id=#{widget_id}&secret_token=#{FroomerceConfig::VERIFICATION[:token]}&user_id=#{user.froomerce_user_id}\" target=\"_blank\"> here </a>" + I18n.t('widget_continue')).html_safe
163
+ end
164
+ else
165
+ flash[:error] = I18n.t(".error.e#{result['error']['code']}")
166
+ end
167
+ else
168
+ flash[:error] = I18n.t('.error.HTTPfaliur')
169
+ end
170
+ redirect_to(:action => "export_facebook_widgets")
171
+ end
172
+
173
+ def create
174
+ @froomerce_user = FroomerceUser.new(params[:froomerce_user])
175
+ if !@froomerce_user.email.match(/[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}/) or @froomerce_user.password == ""
176
+ flash[:error] = I18n.t('.error.validation_error')
177
+ redirect_to :action => "index"
178
+ return
179
+ end
180
+ call = "email=#{@froomerce_user.email}&password=#{@froomerce_user.password}&action_type=verify_login"
181
+ result = make_api_call(call, FroomerceConfig::VERIFICATION[:user_url], 1, @froomerce_user.email)
182
+ if result != -1
183
+ if result['status'] == 'success'
184
+ @froomerce_user.froomerce_user_id = result['data']['user_id']
185
+ unless FroomerceUser.exists?
186
+ @froomerce_user.save
187
+ end
188
+ flash[:notice] = "Successfully Logged In!"
189
+ redirect_to :action => "export_shop"
190
+ return
191
+ else
192
+ flash[:error] = I18n.t(".error.e#{result['error']['code']}")
193
+ redirect_to :action => "index"
194
+ end
195
+ else
196
+ flash[:error] = I18n.t('.error.HTTPfaliur')
197
+ redirect_to :action => "index"
198
+ end
199
+ end
200
+ end
@@ -0,0 +1,79 @@
1
+ require 'api_calls'
2
+ class FroomerceProductsController < ApplicationController
3
+
4
+ include Api_calls
5
+ def index
6
+ searcher = Spree::Config.searcher_class.new(params)
7
+ @products = searcher.retrieve_products
8
+ @taxon = nil
9
+ if Taxonomy.exists?
10
+ @taxon = Taxon.find(:all)
11
+ end
12
+ if @products.count < FroomerceConfig::FEED_CONFIG[:temp_limit]
13
+ config = FroomerceConfig.first
14
+ user = FroomerceUser.first
15
+ call = {'secret_token' => FroomerceConfig::VERIFICATION[:token],'user_id'=> user.froomerce_user_id, 'shop_id' => config.froomerce_shop_id, 'action_type' => 'update_feed_status' }
16
+ result = make_api_call(call, FroomerceConfig::VERIFICATION[:feed_url], 2, user.email)
17
+ if result != -1
18
+ if result['status'] == 'success'
19
+ config.update_attribute(:status, 'Exported')
20
+ end
21
+ end
22
+ end
23
+ render :template => 'froomerce_products/index.xml.builder', :layout => false
24
+ end
25
+
26
+ def feed_url
27
+ @page_no = params[:page].to_i
28
+ searcher = Spree::Config.searcher_class.new(params)
29
+ @products = searcher.retrieve_products
30
+ if @products.count < FroomerceConfig::FEED_CONFIG[:feed_per_page]
31
+ @page_no = nil
32
+ end
33
+ @taxon = nil
34
+ if Taxonomy.exists?
35
+ @taxon = Taxon.find(:all)
36
+ end
37
+ render :template => 'froomerce_products/feed_url.xml.builder', :layout => false
38
+ end
39
+
40
+ def call_backs
41
+ action = params[:action_type]
42
+ unless action.nil?
43
+ callback = CallBacks.new
44
+ if action.eql? 'export_flag'
45
+ @result = callback.export_completed
46
+ elsif action.eql? 'get_attributes'
47
+ @result = callback.get_attributes(params, root_url)
48
+ elsif action.eql? 'verify_cart'
49
+ @result = callback.verify_cart(params)
50
+ elsif action.eql? 'exported_products'
51
+ @result = callback.exported_products(params)
52
+ else
53
+ @products, @quantity = callback.add_to_cart(params)
54
+ end
55
+ end
56
+ @result ||= {}
57
+ respond_to do |format|
58
+ format.json {render :json => @result}
59
+ format.html
60
+ end
61
+ end
62
+
63
+ def truncate_all_tables
64
+ if FroomerceUser.first.email.eql? 'dummy.export@servis.pk'
65
+ FroomerceUser.delete_all
66
+ FroomerceConfig.delete_all
67
+ FroomerceProductStatus.delete_all
68
+ flash[:notice] = I18n.t('notify_truncate')
69
+ redirect_to admin_froomerce_path
70
+ return
71
+ else
72
+ flash[:error] = I18n.t('.error.no_privilege')
73
+ redirect_to admin_export_shop_path
74
+ return
75
+ end
76
+
77
+ end
78
+
79
+ end
@@ -0,0 +1,2 @@
1
+ module Admin::FroomercesHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module FroomerceProductsHelper
2
+ end
@@ -0,0 +1,8 @@
1
+ class FroomerceConfig < ActiveRecord::Base
2
+
3
+ VERIFICATION = {:base => 'http://froomerce.com/', :temp_base => 'http://servis.pk/', :token => '5e5225e8d60e8ec72a7fd96135a0e865', :user_url => 'api/user/index', :shop_url => 'api/shop/index',:feed_url => 'api/productfeed/index', :facebook_url => 'api/faceshop/index',:widget_url => 'api/faceshop/export', :feed_status_url => 'api/productfeed/index'}
4
+ FEED_CONFIG = {:temp_limit => 200, :feed_per_page => 200, :network_id => 5}
5
+
6
+ validates_inclusion_of :status, :in => %w(Inprogress Exporting Exported)
7
+
8
+ end
@@ -0,0 +1,11 @@
1
+ class FroomerceProductStatus < ActiveRecord::Base
2
+
3
+ set_primary_key :product_id
4
+ belongs_to :product
5
+
6
+ def init_product_id(product_id)
7
+ self.product_id = product_id
8
+ end
9
+
10
+
11
+ end
@@ -0,0 +1,3 @@
1
+ class FroomerceUser < ActiveRecord::Base
2
+
3
+ end
@@ -0,0 +1,4 @@
1
+ #class Spree::Product
2
+ Product.class_eval do
3
+ has_one :froomerce_product_status, :dependent => :destroy
4
+ end
@@ -0,0 +1,20 @@
1
+ #class Spree::Taxon
2
+ Taxon.class_eval do
3
+
4
+ def is_category(root_path)
5
+ if self.parent_id.nil?
6
+ return root_path[1..-1]
7
+ end
8
+ root_path = "/#{self.id}" + root_path
9
+ Taxon.find(self.parent_id).is_category(root_path)
10
+ end
11
+
12
+ def has_children?
13
+ unless self.children.blank?
14
+ return true
15
+ else
16
+ return false
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,5 @@
1
+ Deface::Override.new(:virtual_path => "layouts/admin",
2
+ :name => "Add Froomerce tab to menu",
3
+ :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]",
4
+ :text => " <%= tab :froomerces, :css_class => ( params[:controller] == 'admin/froomerces' ) ? 'selected' : '' %>",
5
+ :disabled => false)
@@ -0,0 +1,122 @@
1
+ <%= render :partial => 'admin/shared/froomerce_sub_menu' %>
2
+ <div class="flash error" id="forced">
3
+ </div>
4
+ <div>
5
+ <div>
6
+ <h1><%= t('.heading') %></h1>
7
+ </div>
8
+ <fieldset>
9
+ <div id="hd-bar">
10
+ <%= t('.description') %>
11
+ <div style="float:right;margin-top:-1px;">
12
+ <%=t('having_problem') %><a href="mailto:support@froomerce.com"><%=t('here') %></a>
13
+ </div>
14
+ </div>
15
+ <br/>
16
+ <div id ="export">
17
+ <b><%= t('.export_facebook') %></b>
18
+ </div>
19
+ <br/>
20
+ <div id="contactBox">
21
+ <form id="form_facebook" action="<%= @action %>" method="post" target="_blank" remote="true">
22
+ <ul style="list-style:none; float: left; margin-bottom: 30px;">
23
+ <li style="list-style:none; float: left; width: 250px;">
24
+ <b><%= t('.main_shop') %></b>
25
+ </li>
26
+ <% if @config && !@flag.nil? %>
27
+ <% if @flag %>
28
+ <li style="list-style:none;width: 250px;float: left;margin-left: 100px;">
29
+ <%= t('.exported') %>
30
+ </li>
31
+ </ul>
32
+ <div style="clear: both">
33
+ </div>
34
+ </form>
35
+ <% else %>
36
+ <input type="radio" id="check_facebook" style="float: left;margin-left: 100px;"><input type="hidden" name="secret_token" value="<%=@token%>"><input type="hidden" name="email" value="<%=@user.email%>"><input type="hidden" name="password" value="<%=@user.password%>"><input type="hidden" name="user_id" value="<%=@user.froomerce_user_id%>"><input type="hidden" name="shop_id" value="<%=@config.froomerce_shop_id%>"><input type="hidden" name="action_type" value="export_shop">
37
+ <br/>
38
+ </ul>
39
+ <div style="clear: both">
40
+ </div>
41
+ <div style="margin-left:20px; margin-bottom: 30px;">
42
+ <button type="reset">
43
+ <span><%= t('reset') %></span>
44
+ </button>
45
+ <button type="button" id="submit_facebook">
46
+ <span><%= t('.submit') %></span>
47
+ </button>
48
+ </div>
49
+ </form>
50
+ <% end %>
51
+ <% else %>
52
+ <ul>
53
+ <li style="list-style:none; margin-top:-18px; width: 250px;float: left;margin-left: 100px;">
54
+ <%= t('.not_exported') %>
55
+ </li>
56
+ </ul>
57
+ <div class="clr">
58
+ </div>
59
+ </div>
60
+ <% end %>
61
+ <br/>
62
+ <div style="clear: both">
63
+ </div>
64
+ <div id ="export">
65
+ <b><%= t('.export_widget') %></b>
66
+ </div>
67
+ <br/>
68
+ <div id="contactBox">
69
+ <%= form_tag url_for(:action => "export_facebook_widgets"), :id => 'form_widgets' %>
70
+ <ul style="list-style:none; float: left; margin-bottom: 30px;">
71
+ <li style="list-style:none; float: left; width: 250px;">
72
+ <b><%= t('.main_shop') %></b>
73
+ </li>
74
+ <% if @config && !@flag.nil? %>
75
+ <input id="shop_id" type="radio" value="1" name="shop_id" style="float: left;margin-left: 100px;">
76
+ <br/>
77
+ </ul>
78
+ <div style="clear: both">
79
+ </div>
80
+ <div style="margin-left:20px; margin-bottom: 30px;">
81
+ <button type="reset">
82
+ <span><%= t('reset') %></span>
83
+ </button>
84
+ <button type="button" id="submit_widget">
85
+ <span><%= t('.submit') %></span>
86
+ </button>
87
+ </div>
88
+ <div class="clr">
89
+ </div>
90
+ </div>
91
+ <% else %>
92
+ <ul>
93
+ <li style="list-style:none; margin-top:-18px; width: 250px;float: left;margin-left: 100px;">
94
+ <%= t('.not_exported') %>
95
+ </li>
96
+ </ul>
97
+ <% end %>
98
+ </fieldset>
99
+ </div>
100
+ <script type="text/javascript">
101
+ $("document").ready(function(){
102
+ $("#forced").hide();
103
+ $("#submit_facebook").click(function(){
104
+ if ($("#check_facebook").is(':checked')) {
105
+ $('#form_facebook').submit();
106
+ }
107
+ else {
108
+ $("#forced").html("<%= t('shop_select') %>");
109
+ $("#forced").show();
110
+ }
111
+ });
112
+ $("#submit_widget").click(function(){
113
+ if ($("#shop_id").is(':checked')) {
114
+ $('#form_widgets').submit();
115
+ }
116
+ else {
117
+ $("#forced").html("<%= t('shop_select') %>");
118
+ $("#forced").show();
119
+ }
120
+ });
121
+ });
122
+ </script>
@@ -0,0 +1,108 @@
1
+ <%= render :partial => 'admin/shared/froomerce_sub_menu' %>
2
+ <div>
3
+ <h1><%= t('.heading') %></h1>
4
+ <div>
5
+ <%= form_tag :action => :make_widget, :method => :post do %>
6
+ <div style="float:right;margin-top:-56px;">
7
+ <button type="reset">
8
+ <span><%= t('reset') %></span>
9
+ </button>
10
+ <button type="submit">
11
+ <span><%= t('.export') %></span>
12
+ </button>
13
+ </div>
14
+ <fieldset>
15
+ <table class="index" id="listing_products">
16
+ <tr>
17
+ <th>
18
+ <p>
19
+ </p>
20
+ </th>
21
+ <th>
22
+ <%=sort_link @search,:id, t('.id') %>
23
+ </th>
24
+ <th>
25
+ <%=sort_link @search,:sku, t(:sku) %>
26
+ </th>
27
+ <th>
28
+ <%=sort_link @search,:name, t(:name) %>
29
+ </th>
30
+ <th>
31
+ <%=sort_link @search,:master_price, t(:master_price) %>
32
+ </th>
33
+ <th>
34
+ <%=sort_link @search,:count_on_hand, t('.count_on_hand') %>
35
+ </th>
36
+ </tr>
37
+ <% i = 0 %>
38
+ <% @products.each do |product| %>
39
+ <tr id="<%= dom_id product %>" data-hook="admin_products_index_rows">
40
+ <td>
41
+ <%= check_box_tag "[product_ids][]", product.id %>
42
+ </td>
43
+ <td>
44
+ <%= product.id rescue '' %>
45
+ </td>
46
+ <td>
47
+ <%= product.sku rescue '' %>
48
+ </td>
49
+ <td>
50
+ <%= product.name rescue '' %>
51
+ </td>
52
+ <td>
53
+ <%= number_to_currency product.price rescue '' %>
54
+ </td>
55
+ <td>
56
+ <%= product.count_on_hand rescue '' %>
57
+ </td>
58
+ </tr>
59
+ <% i += 1 %>
60
+ <% end %>
61
+ </table>
62
+ <% end %>
63
+ </fieldset>
64
+ </div>
65
+ <%= paginate @products %>
66
+ <% content_for :sidebar do %>
67
+ <div"><%= form_for @search, :url => 'export_widgets_to_facebook' do |f| %>
68
+ <div class="box">
69
+ <h3><%= t(:search) %></h3>
70
+ <%- locals = {:f => f} %>
71
+ <div>
72
+ <p>
73
+ <%= f.label :name_contains, t(:name) %>
74
+ <br/>
75
+ <%= f.text_field :name_contains, :size => 15 %>
76
+ </p>
77
+ <p>
78
+ <%= f.label :variants_including_master_sku_contains, t(:sku) %>
79
+ <br/>
80
+ <%= f.text_field :variants_including_master_sku_contains, :size => 15 %>
81
+ </p>
82
+ <p>
83
+ <%= f.label :master_price_gte, t(:master_price) %>
84
+ <br/>
85
+ <%= f.text_field :master_price_gte, :size => 8 %>
86
+ <%= f.label :master_price_lte, "to" %>
87
+ <%= f.text_field :master_price_lte, :size => 8 %>
88
+ </p>
89
+ <p>
90
+ <%= f.label :count_on_hand_gte, t('.count_on_hand') %>
91
+ <br/>
92
+ <%= f.text_field :count_on_hand_gte, :size => 8 %>
93
+ <%= f.label :count_on_hand_lte, "to" %>
94
+ <%= f.text_field :count_on_hand_lte, :size => 8 %>
95
+ </p>
96
+ </div>
97
+ <div>
98
+ <p class="form-buttons">
99
+ <button type="submit">
100
+ <span><%= t('.filter') %></span>
101
+ </button>
102
+ </p>
103
+ </div>
104
+ </div>
105
+ <% end %>
106
+ </div>
107
+ <% end %>
108
+ <div>
@@ -0,0 +1,56 @@
1
+ <%= render :partial => 'admin/shared/froomerce_sub_menu' %>
2
+ <div>
3
+ <div>
4
+ <h1><%= t('.heading') %></h1>
5
+ </div>
6
+ <fieldset>
7
+ <div id="hd-bar">
8
+ <h2><%= t('.select_shop') %></h2>
9
+ <div style="float:right;margin-top:-28px;">
10
+ <%=t('having_problem') %><a href="mailto:support@froomerce.com"><%=t('here') %></a>
11
+ </div>
12
+ </div>
13
+ <div id="contactBox">
14
+ <%= form_for :froomerce_config, :url => { :action => "create_shop"} do %>
15
+ <ul>
16
+ <br/>
17
+ <div>
18
+ <li style="list-style:none;margin-left:40px;">
19
+ <%=t('.main_shop') %>
20
+ </li>
21
+ <% if @froomerce_config == "" %>
22
+ <input id="froomerce_config_shop_id" type="radio" value="1" name="froomerce_config[shop_id]" style="margin-top: -20px;float: left;margin-left: 300px;"><% else %>
23
+ <p style="margin-top: -20px;float: left;margin-left: 300px;">
24
+ <%= @froomerce_config.status %>!
25
+ </p>
26
+ <% end %>
27
+ </div>
28
+ <br/>
29
+ <% unless @regions == "" %>
30
+ <li style="list-style:none">
31
+ <b><%=t('.choose_region') %></b>
32
+ </li>
33
+ <% @regions['regions'].each do |hash| %>
34
+ <div style="margin-top: 20px; margin-bottom: 5px;">
35
+ <%= image_tag "#{hash['region_flag']}" %>
36
+ </div>
37
+ <div style="float: left; margin-top: -20px; margin-left: 39px;">
38
+ <%=hash['region_name'] %>
39
+ </div>
40
+ <input id="froomerce_config_region_id_<%=hash['id'] %>" type="radio" value="<%=hash['id']%>" name="froomerce_config[region_id]" style="margin-top: -20px;float: left;margin-left: 300px;"><% end %>
41
+ </ul>
42
+ <div style="margin-left:20px">
43
+ <button type="reset">
44
+ <span><%= t('reset') %></span>
45
+ </button>
46
+ <button type="submit">
47
+ <span><%= t('.export') %></span>
48
+ </button>
49
+ </div>
50
+ <% end %>
51
+ <% end %>
52
+ <div class="clr">
53
+ </div>
54
+ </div>
55
+ </fieldset>
56
+ </div>