tramway-admin 1.9.0.3 → 1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3f5f95a727d4d9610627b5f030ce118a87c28a48096bbbc35414985f42b29c8
4
- data.tar.gz: 63f443afe3639eb604cd3df7454269996c446f6edbc0a1d1088597f11ef0f33c
3
+ metadata.gz: e3e963fa22f305797034b5f98cbc556d0cb53ab21d09ee9314a59e6828e0ef2f
4
+ data.tar.gz: d089bf2d73c27ec5dd35efe2e8b6f7a1a3feaa846c7af2f64afe6270bbdfa97d
5
5
  SHA512:
6
- metadata.gz: 77ba9156b22a038265efcaed8b8683a1e84ce5732281f8ecead7e19560ee895c187b4649c748baf86b76c820e8803c372ff8d2724cadb8cd72124f6f4a378935
7
- data.tar.gz: a79eaa156f2e7c49ae7d29b8d910080db0c3f0cacbdf84b71320f8e9f90386572a21953a916c2638db921ecdbad689ee790524ea2258b8285204edbd79d030e7
6
+ metadata.gz: 2b282fccc48f302754ccc6fcbb844d214f6a88c7b0d0713ad825278cc000b95a380a5e9ea50a48ebc6594d435cc9d7c41da67a10a4849d292c3221aed2f546c9
7
+ data.tar.gz: 074ec3863ed4acd2081ab54ee5104672ab16c858a0d026972329c5eb2ceaa1d4578ef019f759d607dc931a34a3a604f70500f95cd51609a8277d658912bc452a
@@ -1,7 +1,10 @@
1
1
  module Tramway::Admin
2
2
  class RecordsController < ApplicationController
3
3
  def index
4
- @records = decorator_class.decorate model_class.active.order(id: :desc).send(params[:scope] || :all).page params[:page]
4
+ scope = params[:scope].present? ? params[:scope] : :all
5
+ records = model_class.active.order(id: :desc).send scope
6
+ records = records.search params[:search] if params[:search]
7
+ @records = decorator_class.decorate records.page params[:page]
5
8
  end
6
9
 
7
10
  def show
@@ -34,11 +34,11 @@ module Tramway::Admin
34
34
  end
35
35
 
36
36
  def search_tab_title(count)
37
- "#{t("helpers.found")} / #{count}"
37
+ "#{t("helpers.scope.found")} / #{count}"
38
38
  end
39
39
 
40
40
  def searchable_model?(model_class)
41
- model_class.methods.include?(:search) || model_class.methods.include?(:search_everywhere)
41
+ model_class.methods.include? :search
42
42
  end
43
43
 
44
44
  def admin_index_path_of_model(model_class, tab = nil)
@@ -1,9 +1,11 @@
1
1
  - if searchable_model?(model_class)
2
2
  .col-md-6
3
3
  .search
4
- = form_tag request.fullpath, method: :get do |f|
4
+ = form_tag records_path, method: :get do |f|
5
5
  .form-group.text
6
6
  .input-group
7
7
  = text_field_tag :search, params[:search], class: 'text form-control'
8
- %span.input-group-btn
9
- = submit_tag t('helpers.search')
8
+ = hidden_field_tag :model, params[:model]
9
+ = hidden_field_tag :scope, params[:scope]
10
+ .input-group-append
11
+ = submit_tag t('helpers.actions.search'), class: 'btn btn-primary'
@@ -13,11 +13,14 @@
13
13
  %hr
14
14
  %ul.nav.nav-tabs
15
15
  - if params[:search]
16
- %li.active.nav-item
17
- = link_to search_tab_title(items.total_count), '#', class: 'nav-link'
18
- - tabs.each_with_index do |tab, index|
19
16
  %li.nav-item
20
- = link_to admin_index_path_of_model(model_class, tab), class: "#{active_tab(tab, index)} nav-link" do
21
- != tab_title(model_class, tab, @counts[tab], state_method)
17
+ = link_to search_tab_title(@records.total_count), '#', class: 'nav-link active'
18
+ %li.nav-item
19
+ = link_to t('helpers.actions.reset'), records_path(model: params[:model]), class: 'nav-link'
20
+ - else
21
+ - tabs.each_with_index do |tab, index|
22
+ %li.nav-item
23
+ = link_to admin_index_path_of_model(model_class, tab), class: "#{active_tab(tab, index)} nav-link" do
24
+ != tab_title(model_class, tab, @counts[tab], state_method)
22
25
  %div{ id: (params[:search] ? :search : params[:scope]) }
23
26
  = render 'list'
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Admin
3
- VERSION = '1.9.0.3'
3
+ VERSION = '1.10'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0.3
4
+ version: '1.10'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov