liquor 0.1.1 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +3 -9
  5. data/Gemfile +7 -0
  6. data/Guardfile +11 -0
  7. data/MIT-LICENSE +6 -2
  8. data/README.md +4 -122
  9. data/Rakefile +20 -23
  10. data/doc/language-spec.html +768 -0
  11. data/doc/language-spec.md +698 -0
  12. data/lib/liquor.rb +39 -68
  13. data/lib/liquor/ast_tools.rb +28 -0
  14. data/lib/liquor/compiler.rb +110 -0
  15. data/lib/liquor/context.rb +76 -254
  16. data/lib/liquor/diagnostics.rb +151 -0
  17. data/lib/liquor/drop/drop.rb +168 -0
  18. data/lib/liquor/drop/drop_delegation.rb +24 -0
  19. data/lib/liquor/drop/drop_scope.rb +118 -0
  20. data/lib/liquor/drop/dropable.rb +17 -0
  21. data/lib/liquor/emitter.rb +313 -0
  22. data/lib/liquor/extensions/kaminari.rb +14 -0
  23. data/lib/liquor/extensions/pagination.rb +235 -0
  24. data/lib/liquor/extensions/rails.rb +97 -0
  25. data/lib/liquor/extensions/thinking_sphinx.rb +14 -0
  26. data/lib/liquor/extensions/tire.rb +30 -0
  27. data/lib/liquor/external.rb +79 -0
  28. data/lib/liquor/function.rb +94 -0
  29. data/lib/liquor/grammar/lexer.rb +1223 -0
  30. data/lib/liquor/grammar/lexer.rl +297 -0
  31. data/lib/liquor/grammar/parser.racc +288 -0
  32. data/lib/liquor/grammar/parser.rb +885 -0
  33. data/lib/liquor/library.rb +41 -0
  34. data/lib/liquor/manager.rb +146 -0
  35. data/lib/liquor/runtime.rb +167 -0
  36. data/lib/liquor/stdlib/builtin_functions.rb +315 -0
  37. data/lib/liquor/stdlib/builtin_tags.rb +228 -0
  38. data/lib/liquor/stdlib/html_truncater.rb +162 -0
  39. data/lib/liquor/stdlib/partial_tags.rb +76 -0
  40. data/lib/liquor/tag.rb +83 -14
  41. data/lib/liquor/version.rb +1 -1
  42. data/liquor.gemspec +29 -6
  43. data/spec/builtins_spec.rb +264 -0
  44. data/spec/compiler_spec.rb +136 -0
  45. data/spec/context_spec.rb +49 -0
  46. data/spec/drop_delegation_spec.rb +21 -0
  47. data/spec/drop_spec.rb +222 -0
  48. data/spec/errors_spec.rb +40 -0
  49. data/spec/external_spec.rb +207 -0
  50. data/spec/function_spec.rb +80 -0
  51. data/spec/lexer_spec.rb +173 -0
  52. data/spec/library_spec.rb +18 -0
  53. data/spec/manager_spec.rb +84 -0
  54. data/spec/parser_spec.rb +381 -0
  55. data/spec/partials_spec.rb +74 -0
  56. data/spec/runtime_spec.rb +97 -0
  57. data/spec/spec_helper.rb +94 -0
  58. data/spec/tag_spec.rb +7 -0
  59. metadata +216 -173
  60. data/AUTHORS +0 -2
  61. data/CHANGELOG +0 -48
  62. data/Gemfile.lock +0 -91
  63. data/History.txt +0 -44
  64. data/LICENSE +0 -23
  65. data/example/server/example_servlet.rb +0 -37
  66. data/example/server/liquid_servlet.rb +0 -28
  67. data/example/server/liquor_servlet.rb +0 -28
  68. data/example/server/server.rb +0 -12
  69. data/example/server/templates/index.liquid +0 -6
  70. data/example/server/templates/index.liquor +0 -6
  71. data/example/server/templates/products.liquid +0 -45
  72. data/example/server/templates/products.liquor +0 -45
  73. data/init.rb +0 -8
  74. data/lib/extras/liquid_view.rb +0 -51
  75. data/lib/extras/liquor_view.rb +0 -51
  76. data/lib/liquor/block.rb +0 -101
  77. data/lib/liquor/condition.rb +0 -120
  78. data/lib/liquor/document.rb +0 -17
  79. data/lib/liquor/drop.rb +0 -256
  80. data/lib/liquor/errors.rb +0 -11
  81. data/lib/liquor/extensions.rb +0 -72
  82. data/lib/liquor/file_system.rb +0 -62
  83. data/lib/liquor/htmltags.rb +0 -74
  84. data/lib/liquor/module_ex.rb +0 -60
  85. data/lib/liquor/standardfilters.rb +0 -315
  86. data/lib/liquor/strainer.rb +0 -58
  87. data/lib/liquor/tags/assign.rb +0 -33
  88. data/lib/liquor/tags/capture.rb +0 -35
  89. data/lib/liquor/tags/case.rb +0 -83
  90. data/lib/liquor/tags/comment.rb +0 -9
  91. data/lib/liquor/tags/content_for.rb +0 -54
  92. data/lib/liquor/tags/cycle.rb +0 -59
  93. data/lib/liquor/tags/for.rb +0 -136
  94. data/lib/liquor/tags/if.rb +0 -80
  95. data/lib/liquor/tags/ifchanged.rb +0 -20
  96. data/lib/liquor/tags/include.rb +0 -56
  97. data/lib/liquor/tags/unless.rb +0 -33
  98. data/lib/liquor/tags/yield.rb +0 -49
  99. data/lib/liquor/template.rb +0 -181
  100. data/lib/liquor/variable.rb +0 -52
  101. data/performance/shopify.rb +0 -92
  102. data/performance/shopify/comment_form.rb +0 -33
  103. data/performance/shopify/database.rb +0 -45
  104. data/performance/shopify/json_filter.rb +0 -7
  105. data/performance/shopify/liquid.rb +0 -18
  106. data/performance/shopify/liquor.rb +0 -18
  107. data/performance/shopify/money_filter.rb +0 -18
  108. data/performance/shopify/paginate.rb +0 -93
  109. data/performance/shopify/shop_filter.rb +0 -98
  110. data/performance/shopify/tag_filter.rb +0 -25
  111. data/performance/shopify/vision.database.yml +0 -945
  112. data/performance/shopify/weight_filter.rb +0 -11
  113. data/performance/tests/dropify/article.liquid +0 -74
  114. data/performance/tests/dropify/blog.liquid +0 -33
  115. data/performance/tests/dropify/cart.liquid +0 -66
  116. data/performance/tests/dropify/collection.liquid +0 -22
  117. data/performance/tests/dropify/index.liquid +0 -47
  118. data/performance/tests/dropify/page.liquid +0 -8
  119. data/performance/tests/dropify/product.liquid +0 -68
  120. data/performance/tests/dropify/theme.liquid +0 -105
  121. data/performance/tests/ripen/article.liquid +0 -74
  122. data/performance/tests/ripen/blog.liquid +0 -13
  123. data/performance/tests/ripen/cart.liquid +0 -54
  124. data/performance/tests/ripen/collection.liquid +0 -29
  125. data/performance/tests/ripen/index.liquid +0 -32
  126. data/performance/tests/ripen/page.liquid +0 -4
  127. data/performance/tests/ripen/product.liquid +0 -75
  128. data/performance/tests/ripen/theme.liquid +0 -85
  129. data/performance/tests/tribble/404.liquid +0 -56
  130. data/performance/tests/tribble/article.liquid +0 -98
  131. data/performance/tests/tribble/blog.liquid +0 -41
  132. data/performance/tests/tribble/cart.liquid +0 -134
  133. data/performance/tests/tribble/collection.liquid +0 -70
  134. data/performance/tests/tribble/index.liquid +0 -94
  135. data/performance/tests/tribble/page.liquid +0 -56
  136. data/performance/tests/tribble/product.liquid +0 -116
  137. data/performance/tests/tribble/search.liquid +0 -51
  138. data/performance/tests/tribble/theme.liquid +0 -90
  139. data/performance/tests/vogue/article.liquid +0 -66
  140. data/performance/tests/vogue/blog.liquid +0 -32
  141. data/performance/tests/vogue/cart.liquid +0 -58
  142. data/performance/tests/vogue/collection.liquid +0 -19
  143. data/performance/tests/vogue/index.liquid +0 -22
  144. data/performance/tests/vogue/page.liquid +0 -3
  145. data/performance/tests/vogue/product.liquid +0 -62
  146. data/performance/tests/vogue/theme.liquid +0 -122
  147. data/test/assign_test.rb +0 -11
  148. data/test/block_test.rb +0 -58
  149. data/test/capture_test.rb +0 -41
  150. data/test/condition_test.rb +0 -115
  151. data/test/content_for_test.rb +0 -15
  152. data/test/context_test.rb +0 -479
  153. data/test/drop_test.rb +0 -162
  154. data/test/error_handling_test.rb +0 -89
  155. data/test/extra/breakpoint.rb +0 -547
  156. data/test/extra/caller.rb +0 -80
  157. data/test/file_system_test.rb +0 -30
  158. data/test/filter_test.rb +0 -147
  159. data/test/helper.rb +0 -24
  160. data/test/html_tag_test.rb +0 -31
  161. data/test/if_else_test.rb +0 -139
  162. data/test/include_tag_test.rb +0 -129
  163. data/test/module_ex_test.rb +0 -89
  164. data/test/output_test.rb +0 -121
  165. data/test/parsing_quirks_test.rb +0 -54
  166. data/test/regexp_test.rb +0 -45
  167. data/test/security_test.rb +0 -41
  168. data/test/standard_filter_test.rb +0 -170
  169. data/test/standard_tag_test.rb +0 -405
  170. data/test/statements_test.rb +0 -137
  171. data/test/strainer_test.rb +0 -27
  172. data/test/template_test.rb +0 -82
  173. data/test/test_helper.rb +0 -28
  174. data/test/unless_else_test.rb +0 -27
  175. data/test/variable_test.rb +0 -173
  176. data/test/yield_test.rb +0 -24
@@ -1,13 +0,0 @@
1
- <div id="blog-page">
2
- <h2 class="heading-shaded">{{page.title}}</h2>
3
- {% for article in blog.articles %}
4
- <h4>
5
- {{ article.created_at | date: '%d %b' }}
6
- <a href="{{article.url}}">{{ article.title }}</a>
7
- </h4>
8
- {{ article.content }}
9
- {% if blog.comments_enabled? %}
10
- <p><a href="{{article.url}}#comments">{{ article.comments_count }} comments</a></p>
11
- {% endif %}
12
- {% endfor %}
13
- </div>
@@ -1,54 +0,0 @@
1
- <script type="text/javascript">
2
- function remove_item(id) {
3
- document.getElementById('updates_'+id).value = 0;
4
- document.getElementById('cart').submit();
5
- }
6
- </script>
7
-
8
- <div id="cart-page">
9
-
10
- {% if cart.item_count == 0 %}
11
- <p>Your shopping cart is empty...</p>
12
- <p><a href="/"><img src="{{ 'continue_shopping_icon.gif' | asset_url }}" alt="Continue shopping"/></a><p>
13
- {% else %}
14
-
15
- <form action="/cart" method="post" id="cart">
16
-
17
- <table class="cart">
18
- <tr>
19
- <th colspan="2">Product</th>
20
- <th class="short">Qty</th>
21
- <th>Price</th>
22
- <th>Total</th>
23
- <th class="short">Remove</th>
24
- </tr>
25
-
26
- {% for item in cart.items %}
27
- <tr class="{% cycle 'odd', 'even' %}">
28
- <td class="short">{{ item.product.featured_image | product_img_url: 'thumb' | img_tag }}</td>
29
- <td><a href="{{item.product.url}}">{{ item.title }}</a></td>
30
- <td class="short"><input type="text" class="quantity" name="updates[{{item.variant.id}}]" id="updates_{{item.variant.id}}" value="{{item.quantity}}" onfocus="this.select();"/></td>
31
- <td class="cart-price">{{ item.price | money }}</td>
32
- <td class="cart-price">{{item.line_price | money }}</td>
33
- <td class="short"><a href="#" onclick="remove_item({{item.variant.id}}); return false;" class="remove"><img src="{{ 'cancel_icon.gif' | asset_url }}" alt="Remove" /></a></td>
34
- </tr>
35
- {% endfor %}
36
- </table>
37
- <p class="updatebtn"><input type="image" value="Update Cart" name="update" src="{{ 'update_icon.gif' | asset_url }}" alt="Update" /></p>
38
- <p class="subtotal">
39
- <strong>Subtotal:</strong> {{cart.total_price | money_with_currency }}
40
- </p>
41
- <p class="checkout"><input type="image" src="{{ 'checkout_icon.gif' | asset_url }}" alt="Proceed to Checkout" value="Proceed to Checkout" name="checkout" /></p>
42
-
43
- {% if additional_checkout_buttons %}
44
- <div class="additional-checkout-buttons">
45
- <p>- or -</p>
46
- {{ content_for_additional_checkout_buttons }}
47
- </div>
48
- {% endif %}
49
-
50
- </form>
51
-
52
- {% endif %}
53
-
54
- </div>
@@ -1,29 +0,0 @@
1
- <div id="collection-page">
2
-
3
- {% if collection.description %}
4
- <div id="collection-description" class="textile">{{ collection.description }}</div>
5
- {% endif %}
6
-
7
- {% paginate collection.products by 20 %}
8
-
9
- <ul id="product-collection">
10
- {% for product in collection.products %}
11
- <li class="single-product clearfix">
12
- <div class="small">
13
- <div class="prod-image"><a href="{{product.url}}"><img src="{{ product.featured_image | product_img_url: 'small' }}" alt="{{ product.title | escape }}" /></a></div>
14
- </div>
15
- <div class="prod-list-description">
16
- <h3><a href="{{product.url}}">{{product.title}}</a></h3>
17
- <p>{{ product.description | strip_html | truncatewords: 35 }}</p>
18
- <p class="prd-price">{{ product.price_min | money }}{% if product.price_varies %} - {{ product.price_max | money }}{% endif %}</p>
19
- </div>
20
- </li>
21
- {% endfor %}
22
- </ul>
23
-
24
- <div id="pagination">
25
- {{ paginate | default_pagination }}
26
- </div>
27
-
28
- {% endpaginate %}
29
- </div>
@@ -1,32 +0,0 @@
1
- <div id="home-page">
2
- <h3 class="heading-shaded">Featured products...</h3>
3
- <div class="featured-prod-row clearfix">
4
- {% for product in collections.frontpage.products %}
5
- <div class="featured-prod-item">
6
- <p>
7
- <a href="{{product.url}}"><img src="{{ product.featured_image | product_img_url: 'small' }}" alt="{{ product.title | escape }}"/></a>
8
- </p>
9
- <h4><a href="{{product.url}}">{{product.title}}</a></h4>
10
- {% if product.compare_at_price %}
11
- {% if product.price_min != product.compare_at_price %}
12
- <p class="prd-price">Was:<del>{{product.compare_at_price | money}}</del></p>
13
- <p class="prd-price"><ins>Now: {{product.price_min | money}}</ins></p>
14
- {% endif %}
15
- {% else %}
16
- <p class="prd-price"><ins>{{product.price_min | money}}</ins></p>
17
- {% endif %}
18
- </div>
19
- {% endfor %}
20
- </div>
21
-
22
- <div id="articles">
23
- {% assign article = pages.frontpage %}
24
- {% if article.content != "" %}
25
- <h3>{{ article.title }}</h3>
26
- {{ article.content }}
27
- {% else %}
28
- In <em>Admin &gt; Blogs &amp; Pages</em>, create a page with the handle <strong><code>frontpage</code></strong> and it will show up here.<br />
29
- {{ "Learn more about handles" | link_to "http://wiki.shopify.com/Handle" }}
30
- {% endif %}
31
- </div>
32
- </div>
@@ -1,4 +0,0 @@
1
- <div id="single-page">
2
- <h2 class="heading-shaded">{{page.title}}</h2>
3
- {{ page.content }}
4
- </div>
@@ -1,75 +0,0 @@
1
- <div id="product-page">
2
- <h2 class="heading-shaded">{{ product.title }}</h2>
3
- <div id="product-details">
4
- <div id="product-images">
5
- {% for image in product.images %}
6
- {% if forloop.first %}
7
- <a href="{{ image | product_img_url: 'large' }}" class="product-image" rel="lightbox[ product]" title="">
8
- <img src="{{ image | product_img_url: 'medium'}}" alt="{{product.title | escape }}" />
9
- </a>
10
- {% else %}
11
- <a href="{{ image | product_img_url: 'large' }}" class="product-image-small" rel="lightbox[ product]" title="">
12
- <img src="{{ image | product_img_url: 'small'}}" alt="{{product.title | escape }}" />
13
- </a>
14
- {% endif %}
15
- {% endfor %}
16
- </div>
17
-
18
- <ul id="product-info">
19
- <li>Vendor: {{ product.vendor | link_to_vendor }}</li>
20
- <li>Type: {{ product.type | link_to_type }}</li>
21
- </ul>
22
-
23
- <small>{{ product.price_min | money }}{% if product.price_varies %} - {{ product.price_max | money }}{% endif %}</small>
24
-
25
- <div id="product-options">
26
- {% if product.available %}
27
-
28
- <form action="/cart/add" method="post">
29
-
30
- <select id="product-select" name='id'>
31
- {% for variant in product.variants %}
32
- <option value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money }}</option>
33
- {% endfor %}
34
- </select>
35
-
36
- <div id="price-field"></div>
37
-
38
- <div class="add-to-cart"><input type="image" name="add" value="Add to Cart" id="add" src="{{ 'add-to-cart.gif' | asset_url }}" /></div>
39
- </form>
40
- {% else %}
41
- <span>Sold Out!</span>
42
- {% endif %}
43
- </div>
44
-
45
- <div class="product-description">
46
- {{ product.description }}
47
- </div>
48
- </div>
49
- </div>
50
-
51
-
52
- <script type="text/javascript">
53
- <!--
54
- // mootools callback for multi variants dropdown selector
55
- var selectCallback = function(variant, selector) {
56
- if (variant && variant.available == true) {
57
- // selected a valid variant
58
- $('add').removeClass('disabled'); // remove unavailable class from add-to-cart button
59
- $('add').disabled = false; // reenable add-to-cart button
60
- $('price-field').innerHTML = Shopify.formatMoney(variant.price, "{{shop.money_with_currency_format}}"); // update price field
61
- } else {
62
- // variant doesn't exist
63
- $('add').addClass('disabled'); // set add-to-cart button to unavailable class
64
- $('add').disabled = true; // disable add-to-cart button
65
- $('price-field').innerHTML = (variant) ? "Sold Out" : "Unavailable"; // update price-field message
66
- }
67
- };
68
-
69
- // initialize multi selector for product
70
- window.addEvent('domready', function() {
71
- new Shopify.OptionSelectors("product-select", { product: {{ product | json }}, onVariantSelected: selectCallback });
72
- });
73
- -->
74
- </script>
75
-
@@ -1,85 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
3
- <head>
4
- <title>{{shop.name}} - {{page_title}}</title>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
-
7
- {{ 'main.css' | asset_url | stylesheet_tag }}
8
- {{ 'shop.js' | asset_url | script_tag }}
9
-
10
- {{ 'mootools.js' | asset_url | script_tag }}
11
- {{ 'slimbox.js' | asset_url | script_tag }}
12
- {{ 'option_selection.js' | shopify_asset_url | script_tag }}
13
- {{ 'slimbox.css' | asset_url | stylesheet_tag }}
14
-
15
- {{ content_for_header }}
16
- </head>
17
-
18
- <body id="page-{{template}}">
19
- <p class="hide"><a href="#navigation">Skip to navigation.</a></p>
20
- <div id="wrapper">
21
- <div class="content clearfix">
22
- <div id="header">
23
- <h2><a href="/">{{shop.name}}</a></h2>
24
- </div>
25
- <div id="left-col">
26
- {{ content_for_layout }}
27
- </div>
28
- <div id="right-col">
29
- {% if template != 'cart' %}
30
- <div id="cart-right-col">
31
- <dl id="cart-right-col-info">
32
- <dt>Shopping Cart</dt>
33
- <dd>
34
- {% if cart.item_count != 0 %}
35
- <a href="/cart">{{ cart.item_count }} {{ cart.item_count | pluralize: 'item', 'items' }}</a> in your cart
36
- {% else %}
37
- Your cart is empty
38
- {% endif %}
39
- </dd>
40
- </dl>
41
- </div>
42
- {% endif %}
43
- <div id="search">
44
- <dl id="searchbox">
45
- <dt>Search</dt>
46
- <dd>
47
- <form action="/search" method="get">
48
- <fieldset>
49
- <input class="search-input" type="text" onclick="this.select()" value="Search this shop..." name="q" />
50
- </fieldset>
51
- </form>
52
- </dd>
53
- </dl>
54
- </div>
55
- <div id="navigation">
56
- <dl class="navbar">
57
- <dt>Navigation</dt>
58
- {% for link in linklists.main-menu.links %}
59
- <dd>{{ link.title | link_to: link.url }}</dd>
60
- {% endfor %}
61
- </dl>
62
-
63
- {% if tags %}
64
- <dl class="navbar">
65
- <dt>Tags</dt>
66
- {% for tag in collection.tags %}
67
- <dd>{{ tag | highlight_active_tag | link_to_tag: tag }}</dd>
68
- {% endfor %}
69
- </dl>
70
- {% endif %}
71
- </div>
72
- </div>
73
-
74
- </div>
75
- <div id="content-padding"></div>
76
- </div>
77
-
78
- <div id="footer">
79
- {% for link in linklists.footer.links %}
80
- {{ link.title | link_to: link.url }} {% if forloop.rindex != 1 %} | {% endif %}
81
- {% endfor %}
82
- </div>
83
-
84
- </body>
85
- </html>
@@ -1,56 +0,0 @@
1
- <div id="page" class="innerpage clearfix">
2
-
3
- <div id="text-page">
4
- <div class="entry">
5
- <h1>Oh no!</h1>
6
- <div class="entry-post">
7
- Seems like you are looking for something that just isn't here. <a href="/">Try heading back to our main page</a>. Or you can checkout some of our featured products below.
8
- </div>
9
- </div>
10
- </div>
11
-
12
-
13
- <h1>Featured Products</h1>
14
- <ul class="item-list clearfix">
15
-
16
- {% for product in collections.frontpage.products %}
17
- <li>
18
- <form action="/cart/add" method="post">
19
- <div class="item-list-item">
20
- <div class="ili-top clearfix">
21
- <div class="ili-top-content">
22
- <h2><a href="{{product.url}}">{{product.title}}</a></h2>
23
- <p>{{ product.description | truncatewords: 15 }}</p>
24
- </div>
25
- <a href="{{product.url}}" class="ili-top-image"><img src="{{ product.featured_image | product_img_url: 'small' }}" alt="{{ product.title | escape }}"/></a>
26
- </div>
27
-
28
- <div class="ili-bottom clearfix">
29
- <p class="hiddenvariants" style="display: none">{% for variant in product.variants %}<span><input type="radio" name="id" value="{{variant.id}}" id="radio_{{variant.id}}" style="vertical-align: middle;" {%if forloop.first%} checked="checked" {%endif%} /><label for="radio_{{variant.id}}">{{ variant.price | money_with_currency }} - {{ variant.title }}</label></span>{% endfor %}</p>
30
- <input type="submit" class="" value="Add to Basket" />
31
- <p>
32
- <a href="{{product.url}}">View Details</a>
33
-
34
- <span>
35
- {% if product.compare_at_price %}
36
- {% if product.price_min != product.compare_at_price %}
37
- {{product.compare_at_price | money}} -
38
- {% endif %}
39
- {% endif %}
40
- <strong>
41
- {{product.price_min | money}}
42
- </strong>
43
- </span>
44
- </p>
45
- </div>
46
- </div>
47
- </form>
48
- </li>
49
- {% endfor %}
50
-
51
- </ul>
52
- </div>
53
- <!-- end page -->
54
-
55
-
56
-
@@ -1,98 +0,0 @@
1
-
2
- <div id="page" class="innerpage clearfix">
3
- <div id="text-page">
4
-
5
- <div class="entry">
6
- <h1><span>{{article.title}}</span></h1>
7
- <div class="entry-post">
8
- <div class="meta">{{ article.created_at | date: "%b %d" }}</div>
9
- {{ article.content }}
10
- </div>
11
-
12
- <!-- Comments -->
13
- {% if blog.comments_enabled? %}
14
- <div id="comments">
15
- <h2>Comments</h2>
16
-
17
- <!-- List all comments -->
18
- <ul id="comment-list">
19
- {% for comment in article.comments %}
20
- <li>
21
- <div class="comment">
22
- {{ comment.content }}
23
- </div>
24
-
25
- <div class="comment-details">
26
- Posted by <span class="comment-author">{{ comment.author }}</span> on <span class="comment-date">{{ comment.created_at | date: "%B %d, %Y" }}</span>
27
- </div>
28
- </li>
29
- {% endfor %}
30
- </ul>
31
-
32
- <!-- Comment Form -->
33
- <div id="comment-form">
34
- {% form article %}
35
- <h2>Leave a comment</h2>
36
-
37
- <!-- Check if a comment has been submitted in the last request, and if yes display an appropriate message -->
38
- {% if form.posted_successfully? %}
39
- {% if blog.moderated? %}
40
- <div class="notice">
41
- Successfully posted your comment.<br />
42
- It will have to be approved by the blog owner first before showing up.
43
- </div>
44
- {% else %}
45
- <div class="notice">Successfully posted your comment.</div>
46
- {% endif %}
47
- {% endif %}
48
-
49
- {% if form.errors %}
50
- <div class="notice error">Not all the fields have been filled out correctly!</div>
51
- {% endif %}
52
-
53
- <dl>
54
- <dt class="{% if form.errors contains 'author' %}error{% endif %}"><label for="comment_author">Your name</label></dt>
55
- <dd><input type="text" id="comment_author" name="comment[author]" size="40" value="{{form.author}}" class="{% if form.errors contains 'author' %}input-error{% endif %}" /></dd>
56
-
57
- <dt class="{% if form.errors contains 'email' %}error{% endif %}"><label for="comment_email">Your email</label></dt>
58
- <dd><input type="text" id="comment_email" name="comment[email]" size="40" value="{{form.email}}" class="{% if form.errors contains 'email' %}input-error{% endif %}" /></dd>
59
-
60
- <dt class="{% if form.errors contains 'body' %}error{% endif %}"><label for="comment_body">Your comment</label></dt>
61
- <dd><textarea id="comment_body" name="comment[body]" cols="40" rows="5" class="{% if form.errors contains 'body' %}input-error{% endif %}">{{form.body}}</textarea></dd>
62
- </dl>
63
-
64
- {% if blog.moderated? %}
65
- <p class="hint">comments have to be approved before showing up</p>
66
- {% endif %}
67
-
68
- <input type="submit" value="Post comment" id="comment-submit" />
69
- {% endform %}
70
- </div>
71
- <!-- END Comment Form -->
72
-
73
- </div>
74
- {% endif %}
75
- <!-- END Comments -->
76
-
77
-
78
- </div>
79
- </div>
80
-
81
- <div id="three-reasons" class="clearfix">
82
- <h3>Why Shop With Us?</h3>
83
- <ul>
84
- <li class="two-a">
85
- <h4>24 Hours</h4>
86
- <p>We're always here to help.</p>
87
- </li>
88
- <li class="two-c">
89
- <h4>No Spam</h4>
90
- <p>We'll never share your info.</p>
91
- </li>
92
- <li class="two-d">
93
- <h4>Secure Servers</h4>
94
- <p>Checkout is 256bit encrypted.</p>
95
- </li>
96
- </ul>
97
- </div>
98
- </div>