app/views/plugins/ecommerce/admin/payment_methods/form.html.erb in camaleon_ecommerce-0.0.4 vs app/views/plugins/ecommerce/admin/payment_methods/form.html.erb in camaleon_ecommerce-1.1

- old
+ new

@@ -7,17 +7,17 @@ <%= render partial: 'layouts/camaleon_cms/admin/form_error', locals: {data: @payment_method} %> <div class="form-group"> <%= f.label t('plugin.ecommerce.table.name') %><br> <%= f.text_field :name, :class => "form-control required" %> </div> - <div class="form-group"> + <div class="form-group hidden"> <%= f.label t('camaleon_cms.admin.table.slug') %><br> <%= f.text_field :slug, :class => "form-control slug", "data-parent" => 'plugins_ecommerce_payment_method_name' %> </div> <div class="form-group"> <%= f.label t('plugin.ecommerce.table.description') %><br> - <%= f.text_area :description, :class => "form-control", :rows => 4 %> + <%= f.text_area :description, :class => "form-control translatable", :rows => 4 %> </div> <div class="form-group"> <label><%= f.check_box :status %> &nbsp; <%= t('plugin.ecommerce.active') %> </label> </div> @@ -28,12 +28,13 @@ <hr/> <div id="tab-select-payment-method" class="panel panel-default tabs"> <ul class="nav nav-tabs nav-justified"> <li class="<%= 'active' if options[:type] == 'bank_transfer' %>"><a href="#tab8" data-toggle="tab"><%= t('plugin.ecommerce.by_bank_transfer') %></a></li> <li class="<%= 'active' if options[:type] == 'paypal' %>"><a href="#tab9" data-toggle="tab"><%= t('plugin.ecommerce.by_paypal') %></a></li> - <li class="<%= 'active' if options[:type] == 'credit_card' %>"><a href="#tab7" data-toggle="tab"><%= t('plugin.ecommerce.by_credit_card') %></a></li> + <!--<li class="<%= 'active' if options[:type] == 'credit_card' %>"><a href="#tab7" data-toggle="tab"><%= t('plugin.ecommerce.by_credit_card') %></a></li>--> <li class="<%= 'active' if options[:type] == 'authorize_net' %>"><a href="#tab10" data-toggle="tab"><%= t('plugin.ecommerce.by_authorize_net') %></a></li> + <li class="<%= 'active' if options[:type] == 'stripe' %>"><a href="#tab11" data-toggle="tab"><%= t('plugin.ecommerce.by_stripe', default: 'Stripe') %></a></li> </ul> <div class="panel-body tab-content"> <div class="tab-pane <%= 'active' if options[:type] == 'bank_transfer' %>" id="tab8"> <%= hidden_field_tag( "options[type]", 'bank_transfer') %> @@ -101,15 +102,41 @@ <input type="checkbox" name="options[authorize_net_sandbox]" value="1" <%= 'checked' if options[:authorize_net_sandbox] %>> <%= t('plugin.ecommerce.table.sandbox') %> </label> </div> </div> </div> + <div class="tab-pane <%= 'active' if options[:type] == 'stripe' %>" id="tab11"> + <%= hidden_field_tag('options[type]', 'stripe') %> + <div class="form-group"> + <label><%= t('plugin.ecommerce.stripe_scret_key', default: 'Secret Key') %></label><br> + <%= text_field_tag('options[stripe_id]', options[:stripe_id], class: 'form-control required') %> + </div> + <div class="form-group"> + <label><%= t('plugin.ecommerce.stripe_publish_key', default: 'Publishable Key') %></label><br> + <%= text_field_tag('options[stripe_key]', options[:stripe_key], class: 'form-control required') %> + </div> + </div> </div> </div> </div> <div class="panel-footer"> <a class="btn btn-default" href="<%= url_for action: :index %>" role="back"><%= t('camaleon_cms.admin.button.back')%></a> <button class="btn btn-primary pull-right" type="submit"><%= t('camaleon_cms.admin.button.submit')%></button> </div> <% end %> </div> +<script> + jQuery(function(){ + $('#tab-select-payment-method > ul a').click(function (e) { + e.preventDefault(); + disabled_inputs(this) + }); + + function disabled_inputs(dom_a){ + var attr_id = $(dom_a).attr('href') + $('#tab-select-payment-method .tab-content .tab-pane').find('input, select, textarea').attr('disabled', 'disabled'); + $(attr_id).find('input, select, textarea').removeAttr('disabled'); + } + disabled_inputs($('#tab-select-payment-method > ul li.active a')[0]); + }); +</script>