<commit_before>
class Shop::ProcessorFeature < ParagraphFeature

  include ActionView::Helpers::FormTagHelper

 feature :shop_full_cart, :default_css_file => '/components/shop/stylesheets/cart.css',  :default_feature => <<-FEATURE
 <div id='shop_full_cart'>
    <cms:no_cart><div class='cart_empty'>You currently have no products in your shopping cart</div></cms:no_cart>
    <cms:cart>
     <cms:message><div class='cart_message'><cms:value/></div></cms:message>
     <table cellspacing='0'>
       <thead>
         <tr>
            <th>Product</th>
            <th>Unit Cost</th>
            <th class='last'>Quantity</th>
            <th class='last'>Cost</th>
        </tr>
       </thead>
       <tbody>
       <cms:products>
         <cms:product>
           <tr>
             <td><b><cms:name/></b><br/><cms:details/></td>
             <td><cms:unit_cost/></td>
             <td class='last'><cms:quantity/></td>
             <td class='last'><cms:product_cost/></td>
           </tr>
        </cms:product>
        <tr class='total'><td colspan='3'>Shipping:</td><td><cms:shipping/></td></tr>
        <tr class='total'><td colspan='3'>Tax:     </td><td><cms:tax/></td></tr>
        <tr class='total'><td colspan='3'>Total:   </td><td><cms:total/></td></tr>
        <tr class='total'><td colspan='3'><cms:update_quantity/></td></tr>
     </cms:products>
     <tr class='buttons'><td colspan='4'>
       <cms:coupon><cms:form>
          <br/>Promotional Code: <cms:code/> <cms:apply_button/>
       </cms:form></cms:coupon>
     </td></tr>
     <tr class='buttons'><td>&nbsp;</td></tr>
     <tr class='buttons'>
       <td colspan='2' class='last'><cms:continue_shopping>Continue Shopping</cms:continue_shopping></td>
       <td colspan='2' class='last'><cms:checkout>Checkout</cms:checkout></td>
     </tr>
     </tbody>
     </table>
    </cms:cart>
</div>
FEATURE
      
 
def shop_full_cart_feature(data)
  webiva_feature('shop_full_cart',data) do |c|
      c.value_tag('user') { |t| myself.id ? myself.name : nil }
      c.expansion_tag('anonymous') { |t| !myself.id }
      c.expansion_tag('cart') { |t| data[:cart].products_count > 0 }

      c.expansion_tag('static') { |tag| data[:static] }
      
      c.define_tag 'cart:products' do |tag|
      <<-EOTAG
            #{form_tag('')}
               <input type='hidden' name='shop#{data[:paragraph_id]}[action]' value='update_quantities'/>
          #{tag.expand}
          </form>
        EOTAG
      end
      c.define_tag('cart:product') { |tag| c.each_local_value(data[:cart].products,tag,'cart_item') }
          c.value_tag('cart:product:name') { |tag|  tag.locals.cart_item.name }
          c.value_tag('cart:product:details') { |tag| tag.locals.cart_item.details(data[:cart]) }

          c.define_tag 'cart:product:unit_cost' do |tag|
            if tag.locals.cart_item.coupon?
              ''<commit_msg>Fix to nested form on checkout<commit_after>
class Shop::ProcessorFeature < ParagraphFeature

  include ActionView::Helpers::FormTagHelper

 feature :shop_full_cart, :default_css_file => '/components/shop/stylesheets/cart.css',  :default_feature => <<-FEATURE
 <div id='shop_full_cart'>
    <cms:no_cart><div class='cart_empty'>You currently have no products in your shopping cart</div></cms:no_cart>
    <cms:cart>
     <cms:message><div class='cart_message'><cms:value/></div></cms:message>
     <table cellspacing='0'>
       <thead>
         <tr>
            <th>Product</th>
            <th>Unit Cost</th>
            <th class='last'>Quantity</th>
            <th class='last'>Cost</th>
        </tr>
       </thead>
       <tbody>
       <cms:products>
         <cms:product>
           <tr>
             <td><b><cms:name/></b><br/><cms:details/></td>
             <td><cms:unit_cost/></td>
             <td class='last'><cms:quantity/></td>
             <td class='last'><cms:product_cost/></td>
           </tr>
        </cms:product>
        <tr class='total'><td colspan='3'>Shipping:</td><td><cms:shipping/></td></tr>
        <tr class='total'><td colspan='3'>Tax:     </td><td><cms:tax/></td></tr>
        <tr class='total'><td colspan='3'>Total:   </td><td><cms:total/></td></tr>
        <tr class='total'><td colspan='3'><cms:update_quantity/></td></tr>
     </cms:products>
     <tr class='buttons'><td colspan='4'>
       <cms:coupon><cms:form>
          <br/>Promotional Code: <cms:code/> <cms:apply_button/>
       </cms:form></cms:coupon>
     </td></tr>
     <tr class='buttons'><td>&nbsp;</td></tr>
     <tr class='buttons'>
       <td colspan='2' class='last'><cms:continue_shopping>Continue Shopping</cms:continue_shopping></td>
       <td colspan='2' class='last'><cms:checkout>Checkout</cms:checkout></td>
     </tr>
     </tbody>
     </table>
    </cms:cart>
</div>
FEATURE
      
 
def shop_full_cart_feature(data)
  webiva_feature('shop_full_cart',data) do |c|
      c.value_tag('user') { |t| myself.id ? myself.name : nil }
      c.expansion_tag('anonymous') { |t| !myself.id }
      c.expansion_tag('cart') { |t| data[:cart].products_count > 0 }

      c.expansion_tag('static') { |tag| data[:static] }
      
      c.define_tag 'cart:products' do |tag|
        if data[:static]
          tag.expand
        else
      <<-EOTAG
            #{form_tag('')}
               <input type='hidden' name='shop#{data[:paragraph_id]}[action]' value='update_quantities'/>
          #{tag.expand}
          </form>
        EOTAG

        end
      end
      c.define_tag('cart:product') { |tag| c.each_local_value(data[:cart].products,tag,'cart_item') }
          c.value_tag('cart:product:name') { |tag|  tag.locals.cart_item.name }
          c.value_tag('cart:product:details') { |tag| tag.locals.cart_item.details(data[:cart]) }

          c.define_tag 'cart:product:unit_cost' do |tag|
            if tag.locals.cart_item.coupon?
              ''
{'fraction_non_alphanumeric': 0.194771911840082, 'fraction_numerical': 0.0030753459764223477, 'mean_word_length': 2.716825396825397, 'pattern_counts': {'":': 0, '<': 221, '<?xml version=': 0, '>': 217, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2221800', 'n_tokens_mistral': 2084, 'n_tokens_neox': 1999, 'n_words': 296}