Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rosa-abf/rosa-build
base: 54804efb94
...
head fork: rosa-abf/rosa-build
compare: 89a90bda02
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 5 files changed
  • 0 commit comments
  • 2 contributors
View
5 app/controllers/advisories_controller.rb
@@ -5,9 +5,8 @@ class AdvisoriesController < ApplicationController
authorize_resource
def index
- @advisories = @advisories.scoped(include: :platforms)
- @advisories = @advisories.search_by_id(params[:q]) if params[:q]
- @advisories = @advisories.paginate(page: params[:page])
+ @advisories = @advisories.includes(:platforms).search(params[:q]).
+ uniq.paginate(page: params[:page])
respond_to do |format|
format.html
format.atom
View
9 app/models/advisory.rb
@@ -13,8 +13,13 @@ class Advisory < ActiveRecord::Base
ID_STRING_TEMPLATE = 'ROSA-%<type>s-%<year>04s:%<id>04s'
TYPES = {'security' => 'SA', 'bugfix' => 'A'}
- scope :search_by_id, lambda { |aid| where("#{table_name}.advisory_id ILIKE ?", "%#{aid.to_s.strip}%") }
- scope :by_update_type, lambda { |ut| where(update_type: ut) }
+ scope :search, lambda { |q|
+ q = q.to_s.strip
+ where("#{table_name}.advisory_id ILIKE :q OR #{table_name}.description ILIKE :q OR build_list_packages.fullname ILIKE :q", q: "%#{q}%").
+ joins(build_lists: :packages) if q.present?
+ }
+ scope :search_by_id, lambda { |aid| where("#{table_name}.advisory_id ILIKE ?", "%#{aid.to_s.strip}%") }
+ scope :by_update_type, lambda { |ut| where(update_type: ut) }
default_scope order("#{table_name}.created_at DESC")
def to_param
View
2  app/views/advisories/_list.html.haml
@@ -8,7 +8,7 @@
-# TODO: change filter to Backbone.js
%th{colspan: 3, rowspan: 1}
= form_tag advisories_path, method: :get do |f|
- = text_field_tag('q', params[:q], placeholder: t('layout.advisories.search_by_id'), class: params[:q].present? ? 'black' : 'gray', style: 'width:600px;')
+ = text_field_tag('q', params[:q], placeholder: t('layout.advisories.search'), class: params[:q].present? ? 'black' : 'gray', style: 'width:600px;')
= submit_tag t('layout.search.header'), data: {'disable-with' => t('layout.processing')}
=# link_to t('layout.back'), advisories_path, class: 'button'
= button_to t('layout.clear'), {action: :index} , method: :get
View
1  config/locales/models/advisory.en.yml
@@ -14,6 +14,7 @@ en:
new: New
existing: Existing
search_by_id: Search advisory by it's ID
+ search: Search advisory by it's ID, description or package name
search_hint: Paste full AdvisoryID into text field or enter there its uniq part.
advisory_id_info: AdvisoryID is a string %{advisory_format}, where 'XXXX' (at least 4 symbols) is a uniq part.
publication_info: Advisory might be applied only to Build Lists with [%{update_types}] update types.
View
1  config/locales/models/advisory.ru.yml
@@ -14,6 +14,7 @@ ru:
new: Новый
existing: Существующий
search_by_id: Искать бюллетень по его ID
+ search: Искать бюллетень по его ID, описанию или имени пакета
search_hint: Скопируйте в поле ввода полный AdvisoryID или введите его уникальную часть
advisory_id_info: AdvisoryID имеет формат %{advisory_format}, где 'XXXX' (минимум 4 символа) - это уникальная часть.
publication_info: Бюллетень может быть присоединен только к сборочному листу с типами обновления %{update_types}.

No commit comments for this range

Something went wrong with that request. Please try again.