PageRenderTime 58ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/home/index.html.erb

https://github.com/dharin/Auction-Window
Ruby HTML | 286 lines | 256 code | 30 blank | 0 comment | 11 complexity | d068a45c04971b4800c275ed27ba131b MD5 | raw file
  1. <%= stylesheet_link_tag "ui-lightness/jquery-ui-1.8.custom", :media => "screen" %>
  2. <%= javascript_include_tag "jquery-ui-1.8.custom.min.js" %>
  3. <script type="text/javascript">
  4. jQuery(document).ready(function($) {
  5. $('a[rel*=facebox]').facebox({
  6. loading_image : 'facebox/loading.gif',
  7. close_image : 'facebox/closelabel.gif'
  8. })
  9. })
  10. <%#*$(function() {%>
  11. <%#*$("#variant_start_#{variant.id}").datepicker();%>
  12. <%#*});%>
  13. <%#*$(function() {%>
  14. <%#*$("#variant_end_#{variant.id}").datepicker();%>
  15. <%#*});%>
  16. function start_date_form(start){
  17. start_date_id = start;
  18. $("#"+start_date_id).datepicker();
  19. }
  20. function end_date_form(end){
  21. end_date_id = end;
  22. $("#"+end_date_id).datepicker();
  23. }
  24. function slide_form(v){
  25. $("#set_for_auction_"+v).slideToggle('fast');
  26. }
  27. function cancel_form(v){
  28. $("#set_for_auction_"+v).slideUp('fast');
  29. }
  30. </script>
  31. <div id="sidebar">
  32. <h3>Where to start</h3>
  33. <h4>Check out the <code style="font-size: 140%">home_controller</code></h4>
  34. <p class="description">
  35. The controller in this demo application fetches the latest 3 orders and products and makes them available as instance variables <code style="color: #218BCE">@orders</code> and <code style="color: #218BCE">@products</code>.
  36. </p>
  37. <h4>Check out the <code>index</code> template</h4>
  38. <p class="description">
  39. This is the Ruby template you are currently looking at. It is located at:<br />
  40. </p>
  41. <p style="background: #fff; margin-left: 4px"><code>views/home/index.html.erb</code></p>
  42. <p class="description">
  43. Have a look at the markup and Ruby code to see how the Shopify API is being used.
  44. </p>
  45. <h3>Additional documentation</h3>
  46. <p class="description">
  47. Become an expert:
  48. </p>
  49. <ul>
  50. <li>
  51. <%= link_to 'API documentation', 'http://www.shopify.com/developers/api/' %>
  52. <span class="note">The reference: what you can do with the Shopify API.</span>
  53. </li>
  54. <li>
  55. <%= link_to 'Wiki', 'http://wiki.shopify.com/' %>
  56. <span class="note">Get more information and share your knowledge.</span>
  57. </li>
  58. <li>
  59. <%= link_to 'Forum', 'http://forums.shopify.com/community' %>
  60. <span class="note">Ask questions and see what others already wanted to know.</span>
  61. </li>
  62. </ul>
  63. <h3>Once you're ready</h3>
  64. <p class="description">
  65. We'd love to see what you create using the Shopify API.
  66. Find out how to share your application with the world and read the latest information on the <%= link_to 'API Publishing Page', 'http://www.shopify.com/developers/publishing/' %>.
  67. </p>
  68. </div>
  69. <%#*<div id="orders" style="display : none;">%>
  70. <%#*<h2>Your recent orders</h2>%>
  71. <%# if @orders.blank? %>
  72. <%#*<em class="note">There are no orders in your store.</em>%>
  73. <%# else %>
  74. <%#*<ul>%>
  75. <%# @orders.each do |order| %>
  76. <%#*<li>%>
  77. <%#*<div class="order box">%>
  78. <%#*<div class="wrapper">%>
  79. <%#*<strong>%>
  80. <%#= link_to order.name, "http://#{current_shop.url}/admin/orders/#{order.id}" %>
  81. <%#*</strong>%>
  82. <%#*<span class="price">%>
  83. <%#= order.total_price %>
  84. <%#= order.currency %>
  85. <%#*</span>%>
  86. <%#*<span class="highlight">%>
  87. <%#= order.financial_status %>
  88. <%#*</span>%>
  89. <%#*by <span class="note">%>
  90. <%#= order.billing_address.name %>
  91. <%#*</span>%>
  92. <%#*</div>%>
  93. <%#*</div>%>
  94. <%#*</li>%>
  95. <%# end %>
  96. <%#*</ul>%>
  97. <%# end %>
  98. <%#*</div>%>
  99. <h2>Products for Auction</h2>
  100. <% if not @product.blank? %>
  101. <h3>Create Auction for <%= link_to @product.title, "http://#{current_shop.url}/admin/products/#{@product.id}", {:target => "_blank"} %></h3>
  102. <div class="product box">
  103. <div class="wrapper" style="height: 20px;">
  104. <div style="width:280px; margin-left: 30px;float: left;padding-top: 5px;">
  105. <strong>Title</strong>
  106. </div>
  107. <div class="price" style="width:100px; margin-right: 20px;float: left;padding-top: 5px;">
  108. <strong>Price (Per Unit)</strong>
  109. </div>
  110. <div style="width:50px; padding-right: 20px;float: left;padding-top: 5px;">
  111. <strong>Quantity</strong>
  112. <%#= text_field 'variant', 'end_date', :size => "10" %>
  113. </div>
  114. </div>
  115. </div>
  116. <div id="new_product_list">
  117. <% @product.variants.each do |variant| %>
  118. <div id='set_bid_product_<%= variant.id%>'>
  119. <div class="product box">
  120. <div class="wrapper" style="height: 20px;">
  121. <div style="width:280px; margin-right: 20px;float: left;padding-top: 5px;">
  122. <%= variant.title %>
  123. </div>
  124. <div class="price" style="width:100px; margin-right: 20px;float: left;padding-top: 5px;text-align: center">
  125. <%= variant.price %> <%= current_shop.shop.currency %>
  126. </div>
  127. <div style="width:50px; margin-left: 20px;float: left;padding-top: 5px;text-align: center">
  128. <%= variant.inventory_quantity %>
  129. </div>
  130. <div style="width: 100px;margin-left: 25px;float: left">
  131. <%#= link_to "Add to Auction", "#set_for_auction", :rel => "facebox"%>
  132. <%= link_to_function "Add to Auction", :onclick => "slide_form('#{variant.id}');" %>
  133. </div>
  134. <div style="width: 50px;margin-left: 10px;float: left">
  135. <%= link_to "Remove", "#test", :rel => "facebox" %>
  136. </div>
  137. </div>
  138. <div id="set_for_auction_<%= variant.id %>" style="display: none;" >
  139. <% remote_form_for :variant, :url => {:action => "create_auction"} do |f| %>
  140. <table style="height:200px; width:100%;" border="0">
  141. <%= hidden_field_tag 'product_id', :value => @product.id %>
  142. <%= hidden_field_tag 'shop_url', :value => params[:shop] %>
  143. <tr>
  144. <td style="height: auto; width: 100%;" colspan="4">
  145. <table border="0" style="width: 100%; height: 100%;" >
  146. <tr>
  147. <td rowspan="3" style="float: left; height: auto;">
  148. <%= image_tag @product.images.first.small rescue '' %>
  149. </td>
  150. <td style="height: 70px;width: 100%" colspan="3" >
  151. <table border="0" height="70px" width="100%" align="right">
  152. <tr>
  153. <td style="width: auto;">
  154. <table border="0" height="70px">
  155. <tr>
  156. <td style="height:20px;width: 120px;">
  157. <strong>Name</strong>
  158. </td>
  159. <td style="height:20px;width: 200px;">
  160. <%= variant.title %>
  161. </td>
  162. </tr>
  163. <tr>
  164. <td style="height:20px;width: 120px;">
  165. <strong>Rate(per unit)</strong>
  166. </td>
  167. <td style="height:20px;width: 200px;">
  168. <%= "#{variant.price}"+" "+"#{current_shop.shop.currency}" %>
  169. </td>
  170. </tr>
  171. <tr>
  172. <td style="height:20px;width: 120px;">
  173. <strong>Stock Available</strong>
  174. </td>
  175. <td style="height:20px;width: 200px;">
  176. <%= variant.inventory_quantity %>
  177. </td>
  178. </tr>
  179. </table>
  180. </td>
  181. </tr>
  182. </table>
  183. </td>
  184. <td rowspan="3" style="float: left; height: auto;">
  185. <strong>Add Deails</strong>
  186. <%= text_area "variant", "details", :rows=>"4", :size=> "25" %>
  187. </td>
  188. </tr>
  189. </table>
  190. </td>
  191. </tr>
  192. <tr>
  193. <td style="height:20px; text-align: right">
  194. <strong>Start Date for Auction</strong>
  195. </td>
  196. <td style="height:20px;">
  197. <%= text_field 'variant_start', "#{variant.id}", :onclick => "start_date_form(this.id);", :size => "10" %>
  198. </td>
  199. <td style="height:20px; text-align: right">
  200. <strong>Start Price for Auction</strong>
  201. <br>for one item</br>
  202. </td>
  203. <td style="height:20px;">
  204. <%= text_field 'variant', 'start_rate', :size => "3" %>
  205. </td>
  206. </tr>
  207. <tr>
  208. <td style="height:20px; text-align: right">
  209. <strong>End Date for Auction</strong>
  210. </td>
  211. <td style="height:20px;">
  212. <%= text_field 'variant_end', "#{variant.id}", :onclick => "end_date_form(this.id);", :size => "10" %>
  213. </td>
  214. <td style="height:20px; text-align: right">
  215. <strong>Quantity placed for Auction</strong>
  216. </td>
  217. <td style="width:50px;padding-right: 20px;">
  218. <%= text_field 'variant', 'quantity', :size => "3" %>
  219. </td>
  220. </tr>
  221. <tr>
  222. <td colspan="2"></td>
  223. <td style="text-align: right;" >
  224. <%= submit_tag "Start Auction" %>
  225. </td>
  226. <td style="text-align: left;">
  227. <%= link_to_function "Cancel", :onclick => "cancel_form('#{variant.id}');" %>
  228. </td>
  229. </tr>
  230. </table>
  231. <% end %>
  232. </div>
  233. </div>
  234. </div>
  235. <% end %>
  236. </div>
  237. <% end %>
  238. <% if @products.blank? %>
  239. <em class="note">There are no products in your store.</em>
  240. <% else %>
  241. <% @products.each do |product| %>
  242. <div class="product box">
  243. <div class="wrapper">
  244. <% all_image = product.images %>
  245. <% all_image.each do |image| %>
  246. <%= image_tag image.small rescue '' %>
  247. <% end %>
  248. <h4><%= link_to product.title, "http://#{current_shop.url}/admin/products/#{product.id}" %></h4>
  249. <p class="price"><%= product.price_range %> <%= current_shop.shop.currency %></p>
  250. <p style="margin-bottom: 0"><%= product.product_type %> <span class="note">type</span></p>
  251. <p style="margin: 0"><%= product.vendor %> <span class="note">vendor</span></p>
  252. <div style="clear:left"></div>
  253. </div>
  254. </div>
  255. <% end %>
  256. <% end %>