Sha256: f453746f9e9365a60ea39527a0057c18c042138c1a71ae53d64a254d40a3b259

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

module Homeland::Jobs
  class JobsController < ::ApplicationController
    before_action :set_node

    def index
      @suggest_topics = Topic.where(node_id: @node.id).suggest.limit(3)
      suggest_topic_ids = @suggest_topics.map(&:id)
      @topics = Topic.where(node_id: @node.id)

      # New ban filter by :grade column
      @topics = @topics.without_ban if @topics.respond_to?(:without_ban)

      @topics = @topics.where.not(id: suggest_topic_ids) if suggest_topic_ids.count > 0
      @topics = @topics.last_actived.includes(:user).page(params[:page])
      @topics = @topics.where("title ilike ?", "%[#{params[:location]}]%") if params[:location]
      @page_title = '招聘'
      render '/topics/index' if stale?(etag: [@node, @suggest_topics, @topics], template: '/topics/index')
    end

    def show
    end

    private

    def set_node
      @node = Node.find_builtin_node(25, '招聘')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
homeland-jobs-0.3.1 app/controllers/homeland/jobs/jobs_controller.rb