e9_vendors 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -32,7 +32,8 @@ class VendorMemberDecorator < VendorsDecorator
|
|
32
32
|
<script type="text/javascript">
|
33
33
|
try {
|
34
34
|
new E9.VendorWidget({
|
35
|
-
code: "#{model.md5_hash}"
|
35
|
+
code: "#{model.md5_hash}",
|
36
|
+
url: "#{base_url}"
|
36
37
|
}).render();
|
37
38
|
} catch (e) {}
|
38
39
|
</script>
|
@@ -43,7 +44,11 @@ class VendorMemberDecorator < VendorsDecorator
|
|
43
44
|
|
44
45
|
def script_url
|
45
46
|
dir = Rails.env.development? && 'javascripts' || 'assets'
|
46
|
-
|
47
|
+
"#{base_url}/#{dir}/vendor-widget.js"
|
48
|
+
end
|
49
|
+
|
50
|
+
def base_url
|
51
|
+
h.request.protocol + h.request.host_with_port
|
47
52
|
end
|
48
53
|
|
49
54
|
def liquid_context
|
data/lib/e9_vendors/version.rb
CHANGED
@@ -9,7 +9,8 @@
|
|
9
9
|
<script type="text/javascript" src="http://%{Your Host}/assets/vendor-widget.js"></script>
|
10
10
|
<script type="text/javascript">
|
11
11
|
new E9.VendorWidget({
|
12
|
-
code: "your provided widget code"
|
12
|
+
code: "your provided widget code",
|
13
|
+
url: "%{Your Host}"
|
13
14
|
}).render();
|
14
15
|
</script>
|
15
16
|
*
|
@@ -293,15 +294,6 @@ E9 = window.E9 || {};
|
|
293
294
|
recaptchaPublicKey = "6LfGdMASAAAAAHfYpORJWsFUtqJGM7WhxMElUMlo",
|
294
295
|
|
295
296
|
defaults = {
|
296
|
-
/**
|
297
|
-
* The url of vendorboon.
|
298
|
-
*
|
299
|
-
* This is overridable mainly for testing purposes. It is one of the
|
300
|
-
* two variables included in the output of the generated widget code and
|
301
|
-
* shouldn't be changed under normal circumstances.
|
302
|
-
*/
|
303
|
-
url: 'http://www.vendorboon.com',
|
304
|
-
|
305
297
|
/**
|
306
298
|
* The element ID of the div where the widget should be written.
|
307
299
|
*
|
@@ -378,7 +370,7 @@ E9 = window.E9 || {};
|
|
378
370
|
onError: function(widget) {},
|
379
371
|
|
380
372
|
/**
|
381
|
-
* the timeout to wait for a response from the
|
373
|
+
* the timeout to wait for a response from the server before displaying
|
382
374
|
* an error.
|
383
375
|
*/
|
384
376
|
timeout: 10000,
|
@@ -423,9 +415,9 @@ E9 = window.E9 || {};
|
|
423
415
|
init: function(opts) {
|
424
416
|
var that = this, html;
|
425
417
|
|
426
|
-
|
418
|
+
opts = opts || {};
|
427
419
|
|
428
|
-
this.url = opts.url ||
|
420
|
+
this.url = opts.url || '';
|
429
421
|
|
430
422
|
// if url is protocol relative, prepend protocol
|
431
423
|
if (/^\/\//.test(this.url)) {
|
@@ -450,7 +442,9 @@ E9 = window.E9 || {};
|
|
450
442
|
}
|
451
443
|
|
452
444
|
// code must be passed
|
453
|
-
if (!opts.
|
445
|
+
if (!opts.url) {
|
446
|
+
html = tag('h3', {'class':'e9-error'}, 'E9.VendorWidget requires a script url');
|
447
|
+
} else if (!opts.code) {
|
454
448
|
html = tag('h3', {'class':'e9-error'}, 'E9.VendorWidget requires that you pass a code identifying yourself as a member');
|
455
449
|
} else {
|
456
450
|
html = tag('h3', {'class':'e9-loading'}, 'Loading...');
|
@@ -32,7 +32,7 @@ class CreateE9Vendors < ActiveRecord::Migration
|
|
32
32
|
|
33
33
|
create_table :vendor_proxies, :force => true do |t|
|
34
34
|
t.references :vendor, :vendor_member
|
35
|
-
t.boolean "display_on_widget",
|
35
|
+
t.boolean "display_on_widget", :default => true
|
36
36
|
t.string "discount_code"
|
37
37
|
t.string "sales_full_name"
|
38
38
|
t.string "sales_title"
|
@@ -60,14 +60,14 @@ class CreateE9Vendors < ActiveRecord::Migration
|
|
60
60
|
t.string "state"
|
61
61
|
t.text "website"
|
62
62
|
t.text "admin_notes"
|
63
|
-
t.boolean "display_on_widget_contact_form",
|
63
|
+
t.boolean "display_on_widget_contact_form", :default => true
|
64
64
|
t.string "sales_email"
|
65
65
|
t.string "sales_full_name"
|
66
66
|
t.string "sales_title"
|
67
67
|
t.string "sales_phone"
|
68
68
|
t.text "short_description"
|
69
69
|
t.text "long_description"
|
70
|
-
t.text "
|
70
|
+
t.text "landing_page"
|
71
71
|
t.decimal "discount_percentage", :precision => 10, :scale => 2
|
72
72
|
t.decimal "member_compensation", :precision => 10, :scale => 2
|
73
73
|
t.string "logo"
|
@@ -76,9 +76,20 @@ class CreateE9Vendors < ActiveRecord::Migration
|
|
76
76
|
|
77
77
|
add_column :settings, :e9_vendors_widget_title, :string
|
78
78
|
add_column :settings, :e9_vendors_widget_form_title, :string
|
79
|
+
add_column :settings, :e9_vendors_logo_size, :integer
|
79
80
|
add_column :settings, :e9_vendors_widget_form_text, :text
|
80
81
|
end
|
81
82
|
|
82
83
|
def self.down
|
84
|
+
remove_column :settings, :e9_vendors_widget_form_text
|
85
|
+
remove_column :settings, :e9_vendors_logo_size
|
86
|
+
remove_column :settings, :e9_vendors_widget_form_title
|
87
|
+
remove_column :settings, :e9_vendors_widget_title
|
88
|
+
|
89
|
+
drop_table :vendors
|
90
|
+
drop_table :vendor_proxies
|
91
|
+
drop_table :vendor_categories_vendors
|
92
|
+
drop_table :vendor_categories
|
93
|
+
drop_table :vendor_members
|
83
94
|
end
|
84
95
|
end
|