<% content_for :page_title do %> <%= Spree.t(:promotions) %> <% end %> <% content_for :page_actions do %> <li> <%= button_link_to Spree.t(:new_promotion), spree.new_admin_promotion_path, :icon => 'plus' %> </li> <% end %> <%= render 'spree/admin/shared/promotion_sub_menu' %> <% content_for :table_filter_title do %> <%= Spree.t(:search) %> <% end %> <% content_for :table_filter do %> <div data-hook="admin_promotions_index_search"> <%= search_form_for [:admin, @search] do |f| %> <div class="four columns alpha"> <div class="field"> <%= label_tag :q_name_cont, Spree.t(:name) %> <%= f.text_field :name_cont, tabindex: 1 %> </div> </div> <div class="four columns"> <div class="field"> <%= label_tag :q_code_cont, Spree.t(:code) %> <%= f.text_field :code_cont, tabindex: 1 %> </div> </div> <div class="four columns"> <div class="field"> <%= label_tag :q_path_cont, Spree.t(:path) %> <%= f.text_field :path_cont, tabindex: 1 %> </div> </div> <div class="four columns omega"> <div class="field"> <%= label_tag :q_promotion_category_id_eq, 'promotion category' %><br> <%= f.collection_select(:promotion_category_id_eq, @promotion_categories, :id, :name, { :include_blank => Spree.t('match_choices.all') }, { :class => 'select2 fullwidth' }) %> </div> </div> <div class="clearfix"></div> <div class="actions filter-actions"> <div data-hook="admin_promotions_index_search_buttons"> <%= button Spree.t(:filter_results), 'search' %> </div> </div> <% end %> </div> <% end %> <%= paginate @promotions %> <% if @promotions.any? %> <table class="index"> <colgroup> <col style="width: 20%"> <col style="width: 10%"> <col style="width: 30%"> <col style="width: 10%"> <col style="width: 10%"> <col style="width: 10%"> <col style="width: 10%"> </colgroup> <thead> <tr> <th><%= Spree.t(:name) %></th> <th><%= Spree.t(:code) %></th> <th><%= Spree.t(:description) %></th> <th><%= Spree.t(:usage_limit) %></th> <th><%= Spree.t(:promotion_uses) %></th> <th><%= Spree.t(:expiration) %></th> <th class="actions"></th> </tr> </thead> <tbody> <% @promotions.each do |promotion| %> <tr id="<%= spree_dom_id promotion %>" class="<%= cycle('odd', 'even')%>"> <td><%= promotion.name %></td> <td class="align-center"><%= promotion.code %></td> <td><%= promotion.description %></td> <td class="align-center"><%= promotion.usage_limit.nil? ? "∞" : promotion.usage_limit %></td> <td class="align-center"><%= Spree.t(:current_promotion_usage, :count => promotion.credits_count) %></td> <td class="align-center"><%= promotion.expires_at.to_date.to_s(:short_date) if promotion.expires_at %></td> <td class="actions"> <%= link_to_edit promotion, :no_text => true %> <%= link_to_delete promotion, :no_text => true %> </td> </tr> <% end %> </tbody> </table> <% else %> <div class="alpha twelve columns no-objects-found"> <%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/promotion')) %>, <%= link_to Spree.t(:add_one), spree.new_admin_promotion_path %>! </div> <% end %>