Skip to content

Instantly share code, notes, and snippets.

@owen2345
Created November 11, 2016 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owen2345/10eecb77a9adce02dca2b5b8321cf280 to your computer and use it in GitHub Desktop.
Save owen2345/10eecb77a9adce02dca2b5b8321cf280 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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