Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample Theme Settings
<!-- /my_theme/views/admin/settings.html.erb -->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><%= t('.top_offer', default: 'Top Offer') %></h3>
</div>
<div class="panel-body">
<div class="form-group">
<label><%= t('.top_offer_product', default: 'Offer Product') %></label><br>
<%= select_tag "theme_option[top_offer]", options_from_collection_for_select(post_type.posts.public_posts.decorate, :id, :the_title, current_theme.get_option('top_offer')), include_blank: true, class: 'form-control' %>
</div>
<div class="form-group">
<label><%= t('.top_offer_image', default: 'Offer Image') %></label><br>
<%= hidden_field_tag "theme_option[top_offer_image]", current_theme.get_option('top_offer_image'), class: 'form-control input_upload', 'data-dimension' => '275x395' %>
</div>
<div class="form-group">
<label><%= t('.top_offer_percentage', default: 'Percentage Disccount') %></label><br>
<%= text_field_tag "theme_option[top_offer_percentage]", current_theme.get_option('top_offer_percentage', 0), class: 'form-control number' %>
</div>
</div>
</div>
@owen2345

This comment has been minimized.

Copy link
Owner Author

@owen2345 owen2345 commented Nov 11, 2016

To use the values:

current_theme.the_option('top_offer')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment