Skip to content

Commit

Permalink
Mini refactor en carga de contactos
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvega committed May 15, 2012
1 parent 58763d8 commit 129e22a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 8 additions & 1 deletion app/controllers/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,14 @@ def update
end

def load_contacts

@months = []
@years = []
MONTHS.each_with_index do |month, i|
@months << [month, i+1]
end
YEARS.each do |year|
@years << year
end
unless params[:campaign_month].nil? || params[:campaign_year].nil?
@selected_year = params[:campaign_year].to_i
@selected_month = params[:campaign_month].to_i
Expand Down
12 changes: 2 additions & 10 deletions app/views/contacts/load_contacts.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
<% months = [] %>
<% years = [] %>
<% MONTHS.each_with_index do |month, i| %>
<% months << [month, i+1] %>
<% end %>
<% YEARS.each do |year| %>
<% years << year %>
<% end %>
<div id="select_campaign">
<% unless @contact.nil? %>
<%= render :partial => 'contact' %>
Expand All @@ -15,8 +7,8 @@

<div class="field">
<%= label_tag 'Seleccione la campaña' %><br />
<%= select_tag :campaign_month, options_for_select(months, @selected_month) %>
<%= select_tag :campaign_year, options_for_select(years, @selected_year) %>
<%= select_tag :campaign_month, options_for_select(@months, @selected_month) %>
<%= select_tag :campaign_year, options_for_select(@years, @selected_year) %>
</div>
<div id="search_contact">
<%= submit_tag 'Buscar Contacto' %>
Expand Down

0 comments on commit 129e22a

Please sign in to comment.