Commit a600bfbe05d14c81204053160cd715e042a6a5d8
1 parent
a404264b
Exists in
master
and in
29 other branches
Shopping checkout interface
* Missing the send-email implementation
Showing
22 changed files
with
991 additions
and
18 deletions
Show diff stats
plugins/shopping_cart/controllers/shopping_cart_plugin_profile_controller.rb
1 | 1 | include ActionView::Helpers::NumberHelper |
2 | 2 | |
3 | 3 | class ShoppingCartPluginProfileController < ProfileController |
4 | + append_view_path File.join(File.dirname(__FILE__) + '/../views') | |
4 | 5 | |
5 | 6 | def add |
6 | 7 | session[:cart] = { :enterprise_id => profile.id, :items => {} } if session[:cart].nil? |
... | ... | @@ -79,6 +80,30 @@ class ShoppingCartPluginProfileController < ProfileController |
79 | 80 | }.to_json |
80 | 81 | end |
81 | 82 | |
83 | + def buy | |
84 | + render :layout => false | |
85 | + end | |
86 | + | |
87 | + def send_request | |
88 | + begin | |
89 | + #implement send email here | |
90 | + render :text => { | |
91 | + :ok => true, | |
92 | + :message => _('Request sent successfully. Check your email.'), | |
93 | + :error => {:code => 0} | |
94 | + }.to_json | |
95 | + rescue | |
96 | + render :text => { | |
97 | + :ok => false, | |
98 | + :message => _('Your request failed.'), | |
99 | + :error => { | |
100 | + :code => 6, | |
101 | + :message => _('Send request failed.') | |
102 | + } | |
103 | + }.to_json | |
104 | + end | |
105 | + end | |
106 | + | |
82 | 107 | private |
83 | 108 | |
84 | 109 | def validate_same_enterprise |
... | ... | @@ -86,9 +111,9 @@ class ShoppingCartPluginProfileController < ProfileController |
86 | 111 | render :text => { |
87 | 112 | :ok => false, |
88 | 113 | :error => { |
89 | - :code => 1, | |
90 | - :message => _("Can't join items from different enterprises.") | |
91 | - } | |
114 | + :code => 1, | |
115 | + :message => _("Can't join items from different enterprises.") | |
116 | + } | |
92 | 117 | }.to_json |
93 | 118 | return false |
94 | 119 | end |
... | ... | @@ -100,9 +125,9 @@ class ShoppingCartPluginProfileController < ProfileController |
100 | 125 | render :text => { |
101 | 126 | :ok => false, |
102 | 127 | :error => { |
103 | - :code => 2, | |
104 | - :message => _("There is no cart.") | |
105 | - } | |
128 | + :code => 2, | |
129 | + :message => _("There is no cart.") | |
130 | + } | |
106 | 131 | }.to_json |
107 | 132 | return false |
108 | 133 | end |
... | ... | @@ -116,9 +141,9 @@ class ShoppingCartPluginProfileController < ProfileController |
116 | 141 | render :text => { |
117 | 142 | :ok => false, |
118 | 143 | :error => { |
119 | - :code => 3, | |
120 | - :message => _("This enterprise doesn't have this product.") | |
121 | - } | |
144 | + :code => 3, | |
145 | + :message => _("This enterprise doesn't have this product.") | |
146 | + } | |
122 | 147 | }.to_json |
123 | 148 | return nil |
124 | 149 | end |
... | ... | @@ -130,9 +155,9 @@ class ShoppingCartPluginProfileController < ProfileController |
130 | 155 | render :text => { |
131 | 156 | :ok => false, |
132 | 157 | :error => { |
133 | - :code => 4, | |
134 | - :message => _("The cart doesn't have this product.") | |
135 | - } | |
158 | + :code => 4, | |
159 | + :message => _("The cart doesn't have this product.") | |
160 | + } | |
136 | 161 | }.to_json |
137 | 162 | return false |
138 | 163 | end |
... | ... | @@ -144,9 +169,9 @@ class ShoppingCartPluginProfileController < ProfileController |
144 | 169 | render :text => { |
145 | 170 | :ok => false, |
146 | 171 | :error => { |
147 | - :code => 5, | |
148 | - :message => _("Invalid quantity.") | |
149 | - } | |
172 | + :code => 5, | |
173 | + :message => _("Invalid quantity.") | |
174 | + } | |
150 | 175 | }.to_json |
151 | 176 | return false |
152 | 177 | end | ... | ... |
plugins/shopping_cart/lib/shopping_cart_plugin.rb
plugins/shopping_cart/public/cart.js
... | ... | @@ -7,12 +7,14 @@ function Cart(config) { |
7 | 7 | this.itemsBox = $("#cart1 .cart-items"); |
8 | 8 | this.items = {}; |
9 | 9 | this.visible = false; |
10 | + $(".cart-buy", this.cartElem).button({ icons: { primary: 'ui-icon-cart'} }); | |
10 | 11 | if (config.hasProducts) { |
11 | 12 | $(this.cartElem).show(); |
12 | 13 | this.enterprise = config.enterprise; |
14 | + $(".cart-buy", this.cartElem).colorbox({href: '/profile/' + this.enterprise + '/plugins/shopping_cart/buy'}); | |
13 | 15 | this.listProducts(); |
14 | 16 | } |
15 | - $(".cart-buy", this.cartElem).button({ icons: { primary: 'ui-icon-cart'} }); | |
17 | + | |
16 | 18 | } |
17 | 19 | |
18 | 20 | (function($){ |
... | ... | @@ -239,6 +241,43 @@ function Cart(config) { |
239 | 241 | }); |
240 | 242 | } |
241 | 243 | |
244 | + Cart.send_request = function(button) { | |
245 | + var params = {}; | |
246 | + params['name'] = $('#name', button.parentNode).val(); | |
247 | + params['email'] = $('#email', button.parentNode).val(); | |
248 | + params['contact_phone'] = $('#contact_phone', button.parentNode).val(); | |
249 | + params['address'] = $('#address', button.parentNode).val(); | |
250 | + Cart.instance.send_request(params); | |
251 | + } | |
252 | + | |
253 | + Cart.prototype.send_request = function(p) { | |
254 | + params = "?"; | |
255 | + for( var attribute in p ) { | |
256 | + var value = p[attribute]; | |
257 | + params += attribute+'='+value+'&'; | |
258 | + } | |
259 | + params = params.substring(0, params.length-1); | |
260 | + var me = this; | |
261 | + $.ajax({ | |
262 | + url: '/profile/'+ me.enterprise +'/plugins/shopping_cart/send_request'+params, | |
263 | + dataType: 'json', | |
264 | + success: function(data, status, ajax){ | |
265 | + if ( !data.ok ) display_notice(data.error.message); | |
266 | + else { | |
267 | + me.clean(); | |
268 | + display_notice(data.message); | |
269 | + } | |
270 | + }, | |
271 | + cache: false, | |
272 | + error: function(ajax, status, errorThrown) { | |
273 | + alert('Remove item - HTTP '+status+': '+errorThrown); | |
274 | + }, | |
275 | + complete: function() { | |
276 | + $.colorbox.close(); | |
277 | + } | |
278 | + }); | |
279 | + } | |
280 | + | |
242 | 281 | $(function(){ |
243 | 282 | $('.cart-add-item').button({ icons: { primary: 'ui-icon-cart'} }) |
244 | 283 | }); | ... | ... |
... | ... | @@ -0,0 +1,82 @@ |
1 | +/* | |
2 | + ColorBox Core Style: | |
3 | + The following CSS is consistent between example themes and should not be altered. | |
4 | +*/ | |
5 | +#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} | |
6 | +#cboxOverlay{position:fixed; width:100%; height:100%;} | |
7 | +#cboxMiddleLeft, #cboxBottomLeft{clear:left;} | |
8 | +#cboxContent{position:relative;} | |
9 | +#cboxLoadedContent{overflow:auto;} | |
10 | +#cboxTitle{margin:0;} | |
11 | +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;} | |
12 | +#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} | |
13 | +.cboxPhoto{float:left; margin:auto; border:0; display:block;} | |
14 | +.cboxIframe{width:100%; height:100%; display:block; border:0;} | |
15 | + | |
16 | +/* | |
17 | + User Style: | |
18 | + Change the following styles to modify the appearance of ColorBox. They are | |
19 | + ordered & tabbed in a way that represents the nesting of the generated HTML. | |
20 | +*/ | |
21 | +#cboxOverlay{background:url(images/overlay.png) repeat 0 0;} | |
22 | +#colorbox{} | |
23 | + #cboxTopLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -100px 0;} | |
24 | + #cboxTopRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -129px 0;} | |
25 | + #cboxBottomLeft{width:21px; height:21px; background:url(images/controls.png) no-repeat -100px -29px;} | |
26 | + #cboxBottomRight{width:21px; height:21px; background:url(images/controls.png) no-repeat -129px -29px;} | |
27 | + #cboxMiddleLeft{width:21px; background:url(images/controls.png) left top repeat-y;} | |
28 | + #cboxMiddleRight{width:21px; background:url(images/controls.png) right top repeat-y;} | |
29 | + #cboxTopCenter{height:21px; background:url(images/border.png) 0 0 repeat-x;} | |
30 | + #cboxBottomCenter{height:21px; background:url(images/border.png) 0 -29px repeat-x;} | |
31 | + #cboxContent{background:#fff; overflow:hidden;} | |
32 | + #cboxError{padding:50px; border:1px solid #ccc;} | |
33 | + #cboxLoadedContent{margin-bottom:28px;} | |
34 | + #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;} | |
35 | + #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;} | |
36 | + #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;} | |
37 | + #cboxPrevious{position:absolute; bottom:0; left:0; background:url(images/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;} | |
38 | + #cboxPrevious.hover{background-position:-75px -25px;} | |
39 | + #cboxNext{position:absolute; bottom:0; left:27px; background:url(images/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;} | |
40 | + #cboxNext.hover{background-position:-50px -25px;} | |
41 | + #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;} | |
42 | + #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} | |
43 | + #cboxClose{position:absolute; bottom:0; right:0; background:url(images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;} | |
44 | + #cboxClose.hover{background-position:-25px -25px;} | |
45 | + | |
46 | +/* | |
47 | + The following fixes a problem where IE7+ replaces a PNG's alpha transparency with a black fill | |
48 | + when an alpha filter (opacity change) is set on the element or ancestor element. | |
49 | +*/ | |
50 | +.cboxIE #cboxTopLeft, | |
51 | +.cboxIE #cboxTopCenter, | |
52 | +.cboxIE #cboxTopRight, | |
53 | +.cboxIE #cboxBottomLeft, | |
54 | +.cboxIE #cboxBottomCenter, | |
55 | +.cboxIE #cboxBottomRight, | |
56 | +.cboxIE #cboxMiddleLeft, | |
57 | +.cboxIE #cboxMiddleRight { | |
58 | + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); | |
59 | +} | |
60 | + | |
61 | +/* | |
62 | + The following provides PNG transparency support for IE6 | |
63 | +*/ | |
64 | +.cboxIE6 #cboxTopLeft{background:url(images/ie6/borderTopLeft.png);} | |
65 | +.cboxIE6 #cboxTopCenter{background:url(images/ie6/borderTopCenter.png);} | |
66 | +.cboxIE6 #cboxTopRight{background:url(images/ie6/borderTopRight.png);} | |
67 | +.cboxIE6 #cboxBottomLeft{background:url(images/ie6/borderBottomLeft.png);} | |
68 | +.cboxIE6 #cboxBottomCenter{background:url(images/ie6/borderBottomCenter.png);} | |
69 | +.cboxIE6 #cboxBottomRight{background:url(images/ie6/borderBottomRight.png);} | |
70 | +.cboxIE6 #cboxMiddleLeft{background:url(images/ie6/borderMiddleLeft.png);} | |
71 | +.cboxIE6 #cboxMiddleRight{background:url(images/ie6/borderMiddleRight.png);} | |
72 | + | |
73 | +.cboxIE6 #cboxTopLeft, | |
74 | +.cboxIE6 #cboxTopCenter, | |
75 | +.cboxIE6 #cboxTopRight, | |
76 | +.cboxIE6 #cboxBottomLeft, | |
77 | +.cboxIE6 #cboxBottomCenter, | |
78 | +.cboxIE6 #cboxBottomRight, | |
79 | +.cboxIE6 #cboxMiddleLeft, | |
80 | +.cboxIE6 #cboxMiddleRight { | |
81 | + _behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')"); | |
82 | +} | ... | ... |
112 Bytes
1.22 KB
plugins/shopping_cart/public/colorbox/images/ie6/borderBottomCenter.png
0 → 100644
111 Bytes
215 Bytes
plugins/shopping_cart/public/colorbox/images/ie6/borderBottomRight.png
0 → 100644
217 Bytes
108 Bytes
plugins/shopping_cart/public/colorbox/images/ie6/borderMiddleRight.png
0 → 100644
108 Bytes
111 Bytes
216 Bytes
214 Bytes
9.21 KB
157 Bytes
182 Bytes
plugins/shopping_cart/public/colorbox/jquery.colorbox.js
0 → 100644
... | ... | @@ -0,0 +1,814 @@ |
1 | +// ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+ | |
2 | +// Copyright (c) 2011 Jack Moore - jack@colorpowered.com | |
3 | +// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php | |
4 | +(function ($, document, window) { | |
5 | + var | |
6 | + // ColorBox Default Settings. | |
7 | + // See http://colorpowered.com/colorbox for details. | |
8 | + defaults = { | |
9 | + transition: "elastic", | |
10 | + speed: 300, | |
11 | + width: false, | |
12 | + initialWidth: "600", | |
13 | + innerWidth: false, | |
14 | + maxWidth: false, | |
15 | + height: false, | |
16 | + initialHeight: "450", | |
17 | + innerHeight: false, | |
18 | + maxHeight: false, | |
19 | + scalePhotos: true, | |
20 | + scrolling: true, | |
21 | + inline: false, | |
22 | + html: false, | |
23 | + iframe: false, | |
24 | + fastIframe: true, | |
25 | + photo: false, | |
26 | + href: false, | |
27 | + title: false, | |
28 | + rel: false, | |
29 | + opacity: 0.9, | |
30 | + preloading: true, | |
31 | + current: "image {current} of {total}", | |
32 | + previous: "previous", | |
33 | + next: "next", | |
34 | + close: "close", | |
35 | + open: false, | |
36 | + returnFocus: true, | |
37 | + loop: true, | |
38 | + slideshow: false, | |
39 | + slideshowAuto: true, | |
40 | + slideshowSpeed: 2500, | |
41 | + slideshowStart: "start slideshow", | |
42 | + slideshowStop: "stop slideshow", | |
43 | + onOpen: false, | |
44 | + onLoad: false, | |
45 | + onComplete: false, | |
46 | + onCleanup: false, | |
47 | + onClosed: false, | |
48 | + overlayClose: true, | |
49 | + escKey: true, | |
50 | + arrowKey: true | |
51 | + }, | |
52 | + | |
53 | + // Abstracting the HTML and event identifiers for easy rebranding | |
54 | + colorbox = 'colorbox', | |
55 | + prefix = 'cbox', | |
56 | + | |
57 | + // Events | |
58 | + event_open = prefix + '_open', | |
59 | + event_load = prefix + '_load', | |
60 | + event_complete = prefix + '_complete', | |
61 | + event_cleanup = prefix + '_cleanup', | |
62 | + event_closed = prefix + '_closed', | |
63 | + event_purge = prefix + '_purge', | |
64 | + | |
65 | + // Special Handling for IE | |
66 | + isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome. | |
67 | + isIE6 = isIE && $.browser.version < 7, | |
68 | + event_ie6 = prefix + '_IE6', | |
69 | + | |
70 | + // Cached jQuery Object Variables | |
71 | + $overlay, | |
72 | + $box, | |
73 | + $wrap, | |
74 | + $content, | |
75 | + $topBorder, | |
76 | + $leftBorder, | |
77 | + $rightBorder, | |
78 | + $bottomBorder, | |
79 | + $related, | |
80 | + $window, | |
81 | + $loaded, | |
82 | + $loadingBay, | |
83 | + $loadingOverlay, | |
84 | + $title, | |
85 | + $current, | |
86 | + $slideshow, | |
87 | + $next, | |
88 | + $prev, | |
89 | + $close, | |
90 | + $groupControls, | |
91 | + | |
92 | + // Variables for cached values or use across multiple functions | |
93 | + settings = {}, | |
94 | + interfaceHeight, | |
95 | + interfaceWidth, | |
96 | + loadedHeight, | |
97 | + loadedWidth, | |
98 | + element, | |
99 | + index, | |
100 | + photo, | |
101 | + open, | |
102 | + active, | |
103 | + closing = false, | |
104 | + | |
105 | + publicMethod, | |
106 | + boxElement = prefix + 'Element'; | |
107 | + | |
108 | + // **************** | |
109 | + // HELPER FUNCTIONS | |
110 | + // **************** | |
111 | + | |
112 | + // jQuery object generator to reduce code size | |
113 | + function $div(id, cssText) { | |
114 | + var div = document.createElement('div'); | |
115 | + if (id) { | |
116 | + div.id = prefix + id; | |
117 | + } | |
118 | + div.style.cssText = cssText || false; | |
119 | + return $(div); | |
120 | + } | |
121 | + | |
122 | + // Convert % values to pixels | |
123 | + function setSize(size, dimension) { | |
124 | + dimension = dimension === 'x' ? $window.width() : $window.height(); | |
125 | + return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size; | |
126 | + } | |
127 | + | |
128 | + // Checks an href to see if it is a photo. | |
129 | + // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex. | |
130 | + function isImage(url) { | |
131 | + return settings.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url); | |
132 | + } | |
133 | + | |
134 | + // Assigns function results to their respective settings. This allows functions to be used as values. | |
135 | + function process(settings) { | |
136 | + for (var i in settings) { | |
137 | + if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time. | |
138 | + settings[i] = settings[i].call(element); | |
139 | + } | |
140 | + } | |
141 | + settings.rel = settings.rel || element.rel || 'nofollow'; | |
142 | + settings.href = $.trim(settings.href || $(element).attr('href')); | |
143 | + settings.title = settings.title || element.title; | |
144 | + } | |
145 | + | |
146 | + function trigger(event, callback) { | |
147 | + if (callback) { | |
148 | + callback.call(element); | |
149 | + } | |
150 | + $.event.trigger(event); | |
151 | + } | |
152 | + | |
153 | + // Slideshow functionality | |
154 | + function slideshow() { | |
155 | + var | |
156 | + timeOut, | |
157 | + className = prefix + "Slideshow_", | |
158 | + click = "click." + prefix, | |
159 | + start, | |
160 | + stop, | |
161 | + clear; | |
162 | + | |
163 | + if (settings.slideshow && $related[1]) { | |
164 | + start = function () { | |
165 | + $slideshow | |
166 | + .text(settings.slideshowStop) | |
167 | + .unbind(click) | |
168 | + .bind(event_complete, function () { | |
169 | + if (index < $related.length - 1 || settings.loop) { | |
170 | + timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); | |
171 | + } | |
172 | + }) | |
173 | + .bind(event_load, function () { | |
174 | + clearTimeout(timeOut); | |
175 | + }) | |
176 | + .one(click + ' ' + event_cleanup, stop); | |
177 | + $box.removeClass(className + "off").addClass(className + "on"); | |
178 | + timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); | |
179 | + }; | |
180 | + | |
181 | + stop = function () { | |
182 | + clearTimeout(timeOut); | |
183 | + $slideshow | |
184 | + .text(settings.slideshowStart) | |
185 | + .unbind([event_complete, event_load, event_cleanup, click].join(' ')) | |
186 | + .one(click, start); | |
187 | + $box.removeClass(className + "on").addClass(className + "off"); | |
188 | + }; | |
189 | + | |
190 | + if (settings.slideshowAuto) { | |
191 | + start(); | |
192 | + } else { | |
193 | + stop(); | |
194 | + } | |
195 | + } | |
196 | + } | |
197 | + | |
198 | + function launch(elem) { | |
199 | + if (!closing) { | |
200 | + | |
201 | + element = elem; | |
202 | + | |
203 | + process($.extend(settings, $.data(element, colorbox))); | |
204 | + | |
205 | + $related = $(element); | |
206 | + | |
207 | + index = 0; | |
208 | + | |
209 | + if (settings.rel !== 'nofollow') { | |
210 | + $related = $('.' + boxElement).filter(function () { | |
211 | + var relRelated = $.data(this, colorbox).rel || this.rel; | |
212 | + return (relRelated === settings.rel); | |
213 | + }); | |
214 | + index = $related.index(element); | |
215 | + | |
216 | + // Check direct calls to ColorBox. | |
217 | + if (index === -1) { | |
218 | + $related = $related.add(element); | |
219 | + index = $related.length - 1; | |
220 | + } | |
221 | + } | |
222 | + | |
223 | + if (!open) { | |
224 | + open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys. | |
225 | + | |
226 | + $box.show(); | |
227 | + | |
228 | + if (settings.returnFocus) { | |
229 | + try { | |
230 | + element.blur(); | |
231 | + $(element).one(event_closed, function () { | |
232 | + try { | |
233 | + this.focus(); | |
234 | + } catch (e) { | |
235 | + // do nothing | |
236 | + } | |
237 | + }); | |
238 | + } catch (e) { | |
239 | + // do nothing | |
240 | + } | |
241 | + } | |
242 | + | |
243 | + // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5' | |
244 | + $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show(); | |
245 | + | |
246 | + // Opens inital empty ColorBox prior to content being loaded. | |
247 | + settings.w = setSize(settings.initialWidth, 'x'); | |
248 | + settings.h = setSize(settings.initialHeight, 'y'); | |
249 | + publicMethod.position(0); | |
250 | + | |
251 | + if (isIE6) { | |
252 | + $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () { | |
253 | + $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()}); | |
254 | + }).trigger('resize.' + event_ie6); | |
255 | + } | |
256 | + | |
257 | + trigger(event_open, settings.onOpen); | |
258 | + | |
259 | + $groupControls.add($title).hide(); | |
260 | + | |
261 | + $close.html(settings.close).show(); | |
262 | + } | |
263 | + | |
264 | + publicMethod.load(true); | |
265 | + } | |
266 | + } | |
267 | + | |
268 | + // **************** | |
269 | + // PUBLIC FUNCTIONS | |
270 | + // Usage format: $.fn.colorbox.close(); | |
271 | + // Usage from within an iframe: parent.$.fn.colorbox.close(); | |
272 | + // **************** | |
273 | + | |
274 | + publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) { | |
275 | + var $this = this, autoOpen; | |
276 | + | |
277 | + if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit. | |
278 | + return $this; | |
279 | + } | |
280 | + | |
281 | + options = options || {}; | |
282 | + | |
283 | + if (callback) { | |
284 | + options.onComplete = callback; | |
285 | + } | |
286 | + | |
287 | + if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox() | |
288 | + $this = $('<a/>'); | |
289 | + options.open = true; // assume an immediate open | |
290 | + } | |
291 | + | |
292 | + $this.each(function () { | |
293 | + $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options)); | |
294 | + $(this).addClass(boxElement); | |
295 | + }); | |
296 | + | |
297 | + autoOpen = options.open; | |
298 | + | |
299 | + if ($.isFunction(autoOpen)) { | |
300 | + autoOpen = autoOpen.call($this); | |
301 | + } | |
302 | + | |
303 | + if (autoOpen) { | |
304 | + launch($this[0]); | |
305 | + } | |
306 | + | |
307 | + return $this; | |
308 | + }; | |
309 | + | |
310 | + // Initialize ColorBox: store common calculations, preload the interface graphics, append the html. | |
311 | + // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only | |
312 | + // having to run once, instead of each time colorbox is opened. | |
313 | + publicMethod.init = function () { | |
314 | + // Create & Append jQuery Objects | |
315 | + $window = $(window); | |
316 | + $box = $div().attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''}); | |
317 | + $overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide(); | |
318 | + | |
319 | + $wrap = $div("Wrapper"); | |
320 | + $content = $div("Content").append( | |
321 | + $loaded = $div("LoadedContent", 'width:0; height:0; overflow:hidden'), | |
322 | + $loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")), | |
323 | + $title = $div("Title"), | |
324 | + $current = $div("Current"), | |
325 | + $next = $div("Next"), | |
326 | + $prev = $div("Previous"), | |
327 | + $slideshow = $div("Slideshow").bind(event_open, slideshow), | |
328 | + $close = $div("Close") | |
329 | + ); | |
330 | + $wrap.append( // The 3x3 Grid that makes up ColorBox | |
331 | + $div().append( | |
332 | + $div("TopLeft"), | |
333 | + $topBorder = $div("TopCenter"), | |
334 | + $div("TopRight") | |
335 | + ), | |
336 | + $div(false, 'clear:left').append( | |
337 | + $leftBorder = $div("MiddleLeft"), | |
338 | + $content, | |
339 | + $rightBorder = $div("MiddleRight") | |
340 | + ), | |
341 | + $div(false, 'clear:left').append( | |
342 | + $div("BottomLeft"), | |
343 | + $bottomBorder = $div("BottomCenter"), | |
344 | + $div("BottomRight") | |
345 | + ) | |
346 | + ).children().children().css({'float': 'left'}); | |
347 | + | |
348 | + $loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none'); | |
349 | + | |
350 | + $('body').prepend($overlay, $box.append($wrap, $loadingBay)); | |
351 | + | |
352 | + $content.children() | |
353 | + .hover(function () { | |
354 | + $(this).addClass('hover'); | |
355 | + }, function () { | |
356 | + $(this).removeClass('hover'); | |
357 | + }).addClass('hover'); | |
358 | + | |
359 | + // Cache values needed for size calculations | |
360 | + interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6 | |
361 | + interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width(); | |
362 | + loadedHeight = $loaded.outerHeight(true); | |
363 | + loadedWidth = $loaded.outerWidth(true); | |
364 | + | |
365 | + // Setting padding to remove the need to do size conversions during the animation step. | |
366 | + $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide(); | |
367 | + | |
368 | + // Setup button events. | |
369 | + $next.click(function () { | |
370 | + publicMethod.next(); | |
371 | + }); | |
372 | + $prev.click(function () { | |
373 | + publicMethod.prev(); | |
374 | + }); | |
375 | + $close.click(function () { | |
376 | + publicMethod.close(); | |
377 | + }); | |
378 | + | |
379 | + $groupControls = $next.add($prev).add($current).add($slideshow); | |
380 | + | |
381 | + // Adding the 'hover' class allowed the browser to load the hover-state | |
382 | + // background graphics. The class can now can be removed. | |
383 | + $content.children().removeClass('hover'); | |
384 | + | |
385 | + $('.' + boxElement).live('click', function (e) { | |
386 | + // checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt. | |
387 | + if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) { | |
388 | + e.preventDefault(); | |
389 | + launch(this); | |
390 | + } | |
391 | + }); | |
392 | + | |
393 | + $overlay.click(function () { | |
394 | + if (settings.overlayClose) { | |
395 | + publicMethod.close(); | |
396 | + } | |
397 | + }); | |
398 | + | |
399 | + // Set Navigation Key Bindings | |
400 | + $(document).bind('keydown.' + prefix, function (e) { | |
401 | + var key = e.keyCode; | |
402 | + if (open && settings.escKey && key === 27) { | |
403 | + e.preventDefault(); | |
404 | + publicMethod.close(); | |
405 | + } | |
406 | + if (open && settings.arrowKey && $related[1]) { | |
407 | + if (key === 37) { | |
408 | + e.preventDefault(); | |
409 | + $prev.click(); | |
410 | + } else if (key === 39) { | |
411 | + e.preventDefault(); | |
412 | + $next.click(); | |
413 | + } | |
414 | + } | |
415 | + }); | |
416 | + }; | |
417 | + | |
418 | + publicMethod.remove = function () { | |
419 | + $box.add($overlay).remove(); | |
420 | + $('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement); | |
421 | + }; | |
422 | + | |
423 | + publicMethod.position = function (speed, loadedCallback) { | |
424 | + var | |
425 | + animate_speed, | |
426 | + // keeps the top and left positions within the browser's viewport. | |
427 | + posTop = Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(), | |
428 | + posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft(); | |
429 | + | |
430 | + // setting the speed to 0 to reduce the delay between same-sized content. | |
431 | + animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed; | |
432 | + | |
433 | + // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly, | |
434 | + // but it has to be shrank down around the size of div#colorbox when it's done. If not, | |
435 | + // it can invoke an obscure IE bug when using iframes. | |
436 | + $wrap[0].style.width = $wrap[0].style.height = "9999px"; | |
437 | + | |
438 | + function modalDimensions(that) { | |
439 | + // loading overlay height has to be explicitly set for IE6. | |
440 | + $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width; | |
441 | + $loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height; | |
442 | + } | |
443 | + | |
444 | + $box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, { | |
445 | + duration: animate_speed, | |
446 | + complete: function () { | |
447 | + modalDimensions(this); | |
448 | + | |
449 | + active = false; | |
450 | + | |
451 | + // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation. | |
452 | + $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px"; | |
453 | + $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px"; | |
454 | + | |
455 | + if (loadedCallback) { | |
456 | + loadedCallback(); | |
457 | + } | |
458 | + }, | |
459 | + step: function () { | |
460 | + modalDimensions(this); | |
461 | + } | |
462 | + }); | |
463 | + }; | |
464 | + | |
465 | + publicMethod.resize = function (options) { | |
466 | + if (open) { | |
467 | + options = options || {}; | |
468 | + | |
469 | + if (options.width) { | |
470 | + settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth; | |
471 | + } | |
472 | + if (options.innerWidth) { | |
473 | + settings.w = setSize(options.innerWidth, 'x'); | |
474 | + } | |
475 | + $loaded.css({width: settings.w}); | |
476 | + | |
477 | + if (options.height) { | |
478 | + settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight; | |
479 | + } | |
480 | + if (options.innerHeight) { | |
481 | + settings.h = setSize(options.innerHeight, 'y'); | |
482 | + } | |
483 | + if (!options.innerHeight && !options.height) { | |
484 | + var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be. | |
485 | + settings.h = $child.height(); | |
486 | + $child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation | |
487 | + } | |
488 | + $loaded.css({height: settings.h}); | |
489 | + | |
490 | + publicMethod.position(settings.transition === "none" ? 0 : settings.speed); | |
491 | + } | |
492 | + }; | |
493 | + | |
494 | + publicMethod.prep = function (object) { | |
495 | + if (!open) { | |
496 | + return; | |
497 | + } | |
498 | + | |
499 | + var speed = settings.transition === "none" ? 0 : settings.speed; | |
500 | + | |
501 | + $window.unbind('resize.' + prefix); | |
502 | + $loaded.remove(); | |
503 | + $loaded = $div('LoadedContent').html(object); | |
504 | + | |
505 | + function getWidth() { | |
506 | + settings.w = settings.w || $loaded.width(); | |
507 | + settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w; | |
508 | + return settings.w; | |
509 | + } | |
510 | + function getHeight() { | |
511 | + settings.h = settings.h || $loaded.height(); | |
512 | + settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h; | |
513 | + return settings.h; | |
514 | + } | |
515 | + | |
516 | + $loaded.hide() | |
517 | + .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations. | |
518 | + .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'}) | |
519 | + .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height. | |
520 | + .prependTo($content); | |
521 | + | |
522 | + $loadingBay.hide(); | |
523 | + | |
524 | + // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width. | |
525 | + //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'}); | |
526 | + | |
527 | + $(photo).css({'float': 'none'}); | |
528 | + | |
529 | + // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay. | |
530 | + if (isIE6) { | |
531 | + $('select').not($box.find('select')).filter(function () { | |
532 | + return this.style.visibility !== 'hidden'; | |
533 | + }).css({'visibility': 'hidden'}).one(event_cleanup, function () { | |
534 | + this.style.visibility = 'inherit'; | |
535 | + }); | |
536 | + } | |
537 | + | |
538 | + function setPosition(s) { | |
539 | + publicMethod.position(s, function () { | |
540 | + var prev, prevSrc, next, nextSrc, total = $related.length, iframe, complete; | |
541 | + | |
542 | + if (!open) { | |
543 | + return; | |
544 | + } | |
545 | + | |
546 | + complete = function () { | |
547 | + $loadingOverlay.hide(); | |
548 | + trigger(event_complete, settings.onComplete); | |
549 | + }; | |
550 | + | |
551 | + if (isIE) { | |
552 | + //This fadeIn helps the bicubic resampling to kick-in. | |
553 | + if (photo) { | |
554 | + $loaded.fadeIn(100); | |
555 | + } | |
556 | + } | |
557 | + | |
558 | + $title.html(settings.title).add($loaded).show(); | |
559 | + | |
560 | + if (total > 1) { // handle grouping | |
561 | + if (typeof settings.current === "string") { | |
562 | + $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show(); | |
563 | + } | |
564 | + | |
565 | + $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next); | |
566 | + $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous); | |
567 | + | |
568 | + prev = index ? $related[index - 1] : $related[total - 1]; | |
569 | + next = index < total - 1 ? $related[index + 1] : $related[0]; | |
570 | + | |
571 | + if (settings.slideshow) { | |
572 | + $slideshow.show(); | |
573 | + } | |
574 | + | |
575 | + // Preloads images within a rel group | |
576 | + if (settings.preloading) { | |
577 | + nextSrc = $.data(next, colorbox).href || next.href; | |
578 | + prevSrc = $.data(prev, colorbox).href || prev.href; | |
579 | + | |
580 | + nextSrc = $.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc; | |
581 | + prevSrc = $.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc; | |
582 | + | |
583 | + if (isImage(nextSrc)) { | |
584 | + $('<img/>')[0].src = nextSrc; | |
585 | + } | |
586 | + | |
587 | + if (isImage(prevSrc)) { | |
588 | + $('<img/>')[0].src = prevSrc; | |
589 | + } | |
590 | + } | |
591 | + } else { | |
592 | + $groupControls.hide(); | |
593 | + } | |
594 | + | |
595 | + if (settings.iframe) { | |
596 | + iframe = $('<iframe/>').addClass(prefix + 'Iframe')[0]; | |
597 | + | |
598 | + if (settings.fastIframe) { | |
599 | + complete(); | |
600 | + } else { | |
601 | + $(iframe).load(complete); | |
602 | + } | |
603 | + iframe.name = prefix + (+new Date()); | |
604 | + iframe.src = settings.href; | |
605 | + | |
606 | + if (!settings.scrolling) { | |
607 | + iframe.scrolling = "no"; | |
608 | + } | |
609 | + | |
610 | + if (isIE) { | |
611 | + iframe.frameBorder=0; | |
612 | + iframe.allowTransparency = "true"; | |
613 | + } | |
614 | + | |
615 | + $(iframe).appendTo($loaded).one(event_purge, function () { | |
616 | + iframe.src = "//about:blank"; | |
617 | + }); | |
618 | + } else { | |
619 | + complete(); | |
620 | + } | |
621 | + | |
622 | + if (settings.transition === 'fade') { | |
623 | + $box.fadeTo(speed, 1, function () { | |
624 | + $box[0].style.filter = ""; | |
625 | + }); | |
626 | + } else { | |
627 | + $box[0].style.filter = ""; | |
628 | + } | |
629 | + | |
630 | + $window.bind('resize.' + prefix, function () { | |
631 | + publicMethod.position(0); | |
632 | + }); | |
633 | + }); | |
634 | + } | |
635 | + | |
636 | + if (settings.transition === 'fade') { | |
637 | + $box.fadeTo(speed, 0, function () { | |
638 | + setPosition(0); | |
639 | + }); | |
640 | + } else { | |
641 | + setPosition(speed); | |
642 | + } | |
643 | + }; | |
644 | + | |
645 | + publicMethod.load = function (launched) { | |
646 | + var href, setResize, prep = publicMethod.prep; | |
647 | + | |
648 | + active = true; | |
649 | + | |
650 | + photo = false; | |
651 | + | |
652 | + element = $related[index]; | |
653 | + | |
654 | + if (!launched) { | |
655 | + process($.extend(settings, $.data(element, colorbox))); | |
656 | + } | |
657 | + | |
658 | + trigger(event_purge); | |
659 | + | |
660 | + trigger(event_load, settings.onLoad); | |
661 | + | |
662 | + settings.h = settings.height ? | |
663 | + setSize(settings.height, 'y') - loadedHeight - interfaceHeight : | |
664 | + settings.innerHeight && setSize(settings.innerHeight, 'y'); | |
665 | + | |
666 | + settings.w = settings.width ? | |
667 | + setSize(settings.width, 'x') - loadedWidth - interfaceWidth : | |
668 | + settings.innerWidth && setSize(settings.innerWidth, 'x'); | |
669 | + | |
670 | + // Sets the minimum dimensions for use in image scaling | |
671 | + settings.mw = settings.w; | |
672 | + settings.mh = settings.h; | |
673 | + | |
674 | + // Re-evaluate the minimum width and height based on maxWidth and maxHeight values. | |
675 | + // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead. | |
676 | + if (settings.maxWidth) { | |
677 | + settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth; | |
678 | + settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw; | |
679 | + } | |
680 | + if (settings.maxHeight) { | |
681 | + settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight; | |
682 | + settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh; | |
683 | + } | |
684 | + | |
685 | + href = settings.href; | |
686 | + | |
687 | + $loadingOverlay.show(); | |
688 | + | |
689 | + if (settings.inline) { | |
690 | + // Inserts an empty placeholder where inline content is being pulled from. | |
691 | + // An event is bound to put inline content back when ColorBox closes or loads new content. | |
692 | + $div().hide().insertBefore($(href)[0]).one(event_purge, function () { | |
693 | + $(this).replaceWith($loaded.children()); | |
694 | + }); | |
695 | + prep($(href)); | |
696 | + } else if (settings.iframe) { | |
697 | + // IFrame element won't be added to the DOM until it is ready to be displayed, | |
698 | + // to avoid problems with DOM-ready JS that might be trying to run in that iframe. | |
699 | + prep(" "); | |
700 | + } else if (settings.html) { | |
701 | + prep(settings.html); | |
702 | + } else if (isImage(href)) { | |
703 | + $(photo = new Image()) | |
704 | + .addClass(prefix + 'Photo') | |
705 | + .error(function () { | |
706 | + settings.title = false; | |
707 | + prep($div('Error').text('This image could not be loaded')); | |
708 | + }) | |
709 | + .load(function () { | |
710 | + var percent; | |
711 | + photo.onload = null; //stops animated gifs from firing the onload repeatedly. | |
712 | + | |
713 | + if (settings.scalePhotos) { | |
714 | + setResize = function () { | |
715 | + photo.height -= photo.height * percent; | |
716 | + photo.width -= photo.width * percent; | |
717 | + }; | |
718 | + if (settings.mw && photo.width > settings.mw) { | |
719 | + percent = (photo.width - settings.mw) / photo.width; | |
720 | + setResize(); | |
721 | + } | |
722 | + if (settings.mh && photo.height > settings.mh) { | |
723 | + percent = (photo.height - settings.mh) / photo.height; | |
724 | + setResize(); | |
725 | + } | |
726 | + } | |
727 | + | |
728 | + if (settings.h) { | |
729 | + photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px'; | |
730 | + } | |
731 | + | |
732 | + if ($related[1] && (index < $related.length - 1 || settings.loop)) { | |
733 | + photo.style.cursor = 'pointer'; | |
734 | + photo.onclick = function () { | |
735 | + publicMethod.next(); | |
736 | + }; | |
737 | + } | |
738 | + | |
739 | + if (isIE) { | |
740 | + photo.style.msInterpolationMode = 'bicubic'; | |
741 | + } | |
742 | + | |
743 | + setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise. | |
744 | + prep(photo); | |
745 | + }, 1); | |
746 | + }); | |
747 | + | |
748 | + setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise. | |
749 | + photo.src = href; | |
750 | + }, 1); | |
751 | + } else if (href) { | |
752 | + $loadingBay.load(href, function (data, status, xhr) { | |
753 | + prep(status === 'error' ? $div('Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents()); | |
754 | + }); | |
755 | + } | |
756 | + }; | |
757 | + | |
758 | + // Navigates to the next page/image in a set. | |
759 | + publicMethod.next = function () { | |
760 | + if (!active && $related[1] && (index < $related.length - 1 || settings.loop)) { | |
761 | + index = index < $related.length - 1 ? index + 1 : 0; | |
762 | + publicMethod.load(); | |
763 | + } | |
764 | + }; | |
765 | + | |
766 | + publicMethod.prev = function () { | |
767 | + if (!active && $related[1] && (index || settings.loop)) { | |
768 | + index = index ? index - 1 : $related.length - 1; | |
769 | + publicMethod.load(); | |
770 | + } | |
771 | + }; | |
772 | + | |
773 | + // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close(); | |
774 | + publicMethod.close = function () { | |
775 | + if (open && !closing) { | |
776 | + | |
777 | + closing = true; | |
778 | + | |
779 | + open = false; | |
780 | + | |
781 | + trigger(event_cleanup, settings.onCleanup); | |
782 | + | |
783 | + $window.unbind('.' + prefix + ' .' + event_ie6); | |
784 | + | |
785 | + $overlay.fadeTo(200, 0); | |
786 | + | |
787 | + $box.stop().fadeTo(300, 0, function () { | |
788 | + | |
789 | + $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide(); | |
790 | + | |
791 | + trigger(event_purge); | |
792 | + | |
793 | + $loaded.remove(); | |
794 | + | |
795 | + setTimeout(function () { | |
796 | + closing = false; | |
797 | + trigger(event_closed, settings.onClosed); | |
798 | + }, 1); | |
799 | + }); | |
800 | + } | |
801 | + }; | |
802 | + | |
803 | + // A method for fetching the current element ColorBox is referencing. | |
804 | + // returns a jQuery object. | |
805 | + publicMethod.element = function () { | |
806 | + return $(element); | |
807 | + }; | |
808 | + | |
809 | + publicMethod.settings = defaults; | |
810 | + | |
811 | + // Initializes ColorBox when the DOM has loaded | |
812 | + $(publicMethod.init); | |
813 | + | |
814 | +}(jQuery, document, this)); | |
0 | 815 | \ No newline at end of file | ... | ... |
plugins/shopping_cart/public/style.css
plugins/shopping_cart/views/cart.html.erb
1 | +<% enterprise_identifier = !locals[:cart].nil? ? Enterprise.find(locals[:cart][:enterprise_id]).identifier : 'bli'%> | |
1 | 2 | <div id="cart1" class="cart" style="display:none" |
2 | 3 | data-l10nRemoveItem="<%=_('Are you sure you want to remove this item?')%>" |
3 | 4 | data-l10nCleanCart="<%=_('Are you sure you want to clean your cart?')%>"> |
... | ... | @@ -7,7 +8,7 @@ |
7 | 8 | <a href="cart:clean" onclick="Cart.clean(this); return false" class="cart-clean"><%=_('Clean cart')%></a> |
8 | 9 | <ul class="cart-items"></ul> |
9 | 10 | <div class="cart-total"><%=_('Total:')%> <b></b></div> |
10 | - <a href="cart:buy" class="cart-buy" onclick="alert('foi mô pai!'); return false"><%=_('Shopping checkout')%></a> | |
11 | + <a href="cart:buy" class="cart-buy"><%=_('Shopping checkout')%></a> | |
11 | 12 | </div> |
12 | 13 | <a href="#" onclick="Cart.toggle(this); return false" class="cart-toggle"> |
13 | 14 | <span class="str-show"><%=_('Show cart')%></span> | ... | ... |
plugins/shopping_cart/views/shopping_cart_plugin_profile/buy.html.erb
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +<% person = user.nil? ? Person.new : user %> | |
2 | +<% form_tag :action => 'send_request' do %> | |
3 | + <%= labelled_form_field( _("Full name"), text_field_tag(:name, person.name) ) %> | |
4 | + <%= labelled_form_field( _("Email"), text_field_tag(:email, person.email) ) %> | |
5 | + <%= labelled_form_field( _("Phone number"), text_field_tag(:contact_phone, person.contact_phone) ) %> | |
6 | + <%= labelled_form_field( _("Delivery address"), text_field_tag(:address, person.address) ) %> | |
7 | + <br style='clear: both'/><br style='clear: both'/> | |
8 | + <input class="button with-text icon-send" value="<%=_('Send')%>" type="submit" onclick="Cart.send_request(this); return false"> | |
9 | +<% end %> | ... | ... |
plugins/shopping_cart/views/shopping_cart_plugin_profile/send_request.html.erb
0 → 100644
... | ... | @@ -0,0 +1 @@ |
1 | +<%= _("Request sent successfully check your email.")%> | ... | ... |