108869472-new_qieries_and_views

This commit is contained in:
Stas 2016-04-21 15:21:59 +03:00
parent ff33eaa031
commit a09e6b1a42
4 changed files with 39 additions and 21 deletions

View file

@ -30,7 +30,7 @@ class Admin::ContactVersionsController < AdminController
def show
per_page = 7
@version = ContactVersion.find(params[:id])
@q = ContactVersion.where(item_id: @version.item_id).order(created_at: :asc).search
@q = ContactVersion.where(item_id: @version.item_id).order(created_at: :desc).search
@versions = @q.result.page(params[:page])
@versions = @versions.per(per_page)
end
@ -40,7 +40,7 @@ class Admin::ContactVersionsController < AdminController
end
def create_where_string(key, value)
" AND object->>'#{key}' ~ '#{value}'"
" AND object->>'#{key}' LIKE '%#{value}%'"
end
end

View file

@ -11,7 +11,7 @@
.col-md-3
.form-group
= f.label :id
= f.search_field :id, value: params[:q][:id], class: 'form-control', placeholder: t(:id)
= f.search_field :code, value: params[:q][:code], class: 'form-control', placeholder: t(:id)
.col-md-3
.form-group
= f.label :ident

View file

@ -19,14 +19,15 @@
%dt= t(:ident)
%dd= ident_for(contact)
%dt= t(:email)
%dd= contact.email
- if contact.email.present?
%dt= t(:email)
%dd= contact.email
- if contact.phone
- if contact.phone.present?
%dt= t(:phone)
%dd= contact.phone
- if contact.fax
- if contact.fax.present?
%dt= t(:fax)
%dd= contact.fax
@ -50,20 +51,25 @@
%dt= t(:org_name)
%dd= contact.org_name
%dt= t(:street)
%dd= contact.street.to_s.gsub("\n", '<br>').html_safe
- if contact.street.present?
%dt= t(:street)
%dd= contact.street.to_s.gsub("\n", '<br>').html_safe
%dt= t(:city)
%dd= contact.city
- if contact.city.present?
%dt= t(:city)
%dd= contact.city
%dt= t(:zip)
%dd= contact.zip
- if contact.zip.present?
%dt= t(:zip)
%dd= contact.zip
%dt= t(:state)
%dd= contact.state
- if contact.state.present?
%dt= t(:state)
%dd= contact.state
%dt= t(:country)
%dd= contact.country
- if contact.country.present?
%dt= t(:country)
%dd= contact.country
%span{:style => "padding-right:10px; float: right;"}

View file

@ -13,7 +13,7 @@
.row
.col-md-8
.panel.panel-default{:style => "min-height:400px;"}
.panel.panel-default{:style => "min-height:450px;"}
.panel-heading
%h3.panel-title
= l(@version.created_at, format: :short)
@ -24,7 +24,19 @@
%dt= t(:name)
%dd= link_to(domain.name, admin_domain_path(@version.item_id))
%dt= t(:registered_at)
%dd= l(domain.registered_at, format: :short)
%dd
= l(domain.registered_at, format: :short)
%dt= t(:created)
%dd
= l(domain.created_at, format: :short)
%dt= t(:updated)
%dd
= l(domain.updated_at, format: :short)
%br
%dt= t(:statuses)
%dd
- if domain.statuses.present?
@ -63,7 +75,7 @@
%br
%dt= t(:registrar)
%dd= domain.registrar.name
%span{:style => "padding-right:10px; padding-top:40px; float: right; bottom: 10px;"}
%span{:style => "padding-right:10px; float: right; bottom: 10px;"}
- if @version.previous
= link_to(t(:previous),
admin_domain_version_path(@version.previous.id),
@ -80,7 +92,7 @@
%span= t(:next)
.col-md-4
.panel.panel-default{:style => "min-height:400px;"}
.panel.panel-default{:style => "min-height:450px;"}
%ul.nav.nav-pills.nav-stacked
- @versions.each do |vs|
- if vs.id == @version.id and vs.reify