Class: IshManager::CategoriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ish_manager/categories_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#basic_auth, #home, #tinymce

Instance Method Details

#create_email_tagObject



25
26
27
28
29
30
# File 'app/controllers/ish_manager/categories_controller.rb', line 25

def create_email_tag
  @tag = WpTag.emailtag( params[:tag][:name] )
  authorize! :create, @tag
  @tag.persisted? ? flash_notice('persisted') : flash_alert('cannot save tag')
  redirect_to request.referrer ? request.referrer : email_conversations_path
end

#indexObject



6
7
8
9
10
11
# File 'app/controllers/ish_manager/categories_controller.rb', line 6

def index
  authorize! :categories_index, IshManager::Ability
  # @categories = Category.all_hierarchical
  @categories_flat = Category.all_flat
  @tags = Category.all_tags
end

#showObject



13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/ish_manager/categories_controller.rb', line 13

def show
  @category = WpTag.find params[:id]
  authorize! :show, @category

  ## same as in leads#index
  @leads = @category.leads
  if params[:q].present?
    @leads = @leads.where(" email LIKE ? ", "%#{params[:q]}%" )
  end
  @leads = @leads.page( params[:leads_page] ).per( current_profile.per_page )
end