app/helpers/opportunities_helper.rb
# Generates a select list with the first 25 campaigns
# and prepends the currently selected campaign, if any.
#----------------------------------------------------------------------------
Generates a select list with the first 25 campaigns
and prepends the currently selected campaign, if any.
Generates a select list with the first 25 campaigns and prepends the currently selected campaign if any .
def opportunity_campaign_select(options = {})
    options[:selected] ||= @opportunity.campaign_id.to_i
    selected_campaign = Campaign.find_by_id(options[:selected])
    campaigns = ([selected_campaign] + Campaign.my(current_user).order(:name).limit(25)).compact.uniq
    collection_select :opportunity, :campaign_id, campaigns, :id, :name,
                      { selected: options[:selected], prompt: t(:select_a_campaign) },
                      style: 'width:330px;', class: 'select2'
  end
def opportunity_campaign_select ( options = { } ) options [ :selected ] ||= @opportunity . campaign_id . to_i selected_campaign = Campaign . find_by_id ( options [ :selected ] ) campaigns = ( [ selected_campaign ] + Campaign . my ( current_user ) . order ( :name ) . limit ( 25 ) ) . compact . uniq collection_select :opportunity , :campaign_id , campaigns , :id , :name , { selected : options [ :selected ] , prompt : t ( :select_a_campaign ) } , style : 'width:330px;' , class : 'select2' end
Generates a select list with the first 25 campaigns
and prepends the currently selected campaign, if any.
Generates a select list with the first 25 campaigns and prepends the currently selected campaign if any .
options