Committer: szhirkov
LJSUP-10156: Need to create Flag for self promoU trunk/templates/Shop/SelfPromo.tmpl
Modified: trunk/templates/Shop/SelfPromo.tmpl =================================================================== --- trunk/templates/Shop/SelfPromo.tmpl 2011-11-01 13:47:35 UTC (rev 11133) +++ trunk/templates/Shop/SelfPromo.tmpl 2011-11-01 14:40:06 UTC (rev 11134) @@ -56,13 +56,13 @@ <label for="price"><TMPL_VAR expr="ml('/shop/selfpromo.bml.label.price')"></label> <input type="text" name="price" id="price" value="<TMPL_VAR buyout_cost ESCAPE=HTML>" placeholder="<TMPL_VAR expr="ml('/shop/selfpromo.bml.placeholder.price')">" class="input-text" <TMPL_IF form_disabled>disabled="disabled"</TMPL_IF> /> </fieldset> - <fieldset class="price-description"> - <p id="price_description"><TMPL_VAR expr="ml('/shop/selfpromo.bml.price_description')"></p> - </fieldset> + <p id="price_description"><TMPL_VAR expr="ml('/shop/selfpromo.bml.price_description')"></p> <div class="selfpromo" style="display: none;"> <h3><TMPL_VAR expr="ml('/shop/selfpromo.bml.info.title.entrie')"></h3> <div id="selfpromo-preview"></div> </div> + </div> + <div class="b-selfpromo-actions"> <fieldset class="confirm"> <input type="checkbox" id="selfpromo-confirm" name="confirm"> <label for="selfpromo-confirm"><TMPL_VAR expr="ml('/shop/selfpromo.bml.confirm.label', 'confirm_link', 'http://www.livejournal.com/support/faqbrowse.bml?faqid=350')"></label> @@ -72,7 +72,9 @@ <button type="submit" id="selfpromo-promote-button" disabled="disabled"><TMPL_VAR expr="ml('/shop/selfpromo.bml.btn.submit')"></button> </fieldset> </div> + </TMPL_UNLESS> +<div id="selfpromo-preview"></div> <script type="text/javascript"> window.shop_selfpromo_ml = { @@ -81,14 +83,25 @@ }; jQuery(function($) { + var urlFieldIsEmpty = false, + confirmChecked = false; + $('#entry_link') .bind('change keyup input paste', function(e) { - var fieldIsEmpty = $(this).val() === ''; + urlFieldIsEmpty = $(this).val() === ''; + $('#entry_link').trigger('requiredfieldschange'); + }) + .bind('requiredfieldschange', function() { $('#selfpromo-preview-button, #selfpromo-promote-button') - .prop('disabled', fieldIsEmpty); + .prop('disabled', urlFieldIsEmpty || !confirmChecked); }) .change(); + $('#selfpromo-confirm').change(function() { + confirmChecked = $(this).prop('checked'); + $('#entry_link').trigger('requiredfieldschange'); + }); + $('#selfpromo-withdraw-button').click(function(e) { if (!confirm(Site.ml_text['/shop/selfpromo.bml.confirm.delete.promoted'])) { return false;