card-mod-search 0.12.0 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/card/filter_query.rb +1 -1
- data/set/abstract/03_filter/filter_form.rb +1 -1
- data/set/abstract/03_filter.rb +1 -0
- data/set/abstract/06_cql_search.rb +1 -3
- data/set/abstract/filter_list.rb +11 -0
- data/set/abstract/search_views.rb +74 -0
- data/set/self/search.rb +1 -1
- data/set/type/search_type.rb +1 -73
- metadata +9 -8
- data/set/abstract/04_right_filter_form.rb +0 -26
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: b62c6363e1945d22f1a8ad2d7575801b6884437b9f8fed6b891220c434b3a052
         | 
| 4 | 
            +
              data.tar.gz: 72f33ec4982f972c9f8a6384430087d5f6703092b8e77e5358193898ea3a63d3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: db553b0e06bd1176428ad59a4baa8fb9d5b7383a852fc10d0b3340d9689d01222f076d436317d6350cc57fe6a56685e6b8a8275ae23909da7c968b9ebb5e64d8
         | 
| 7 | 
            +
              data.tar.gz: '009f9d91b870c53ace919b18a047cd91d939436cd4969e57bc45624900d810f2f10801183dd85d443f3f17e0259dba37553e5159fcd94ee3a701bbd8423bd601'
         | 
    
        data/lib/card/filter_query.rb
    CHANGED
    
    
    
        data/set/abstract/03_filter.rb
    CHANGED
    
    
| @@ -0,0 +1,74 @@ | |
| 1 | 
            +
            format do
         | 
| 2 | 
            +
              view :core, cache: :never do
         | 
| 3 | 
            +
                _render search_result_view
         | 
| 4 | 
            +
              end
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              def search_result_view
         | 
| 7 | 
            +
                case search_with_params
         | 
| 8 | 
            +
                when Exception              then :search_error
         | 
| 9 | 
            +
                when Integer                then :search_count
         | 
| 10 | 
            +
                when nest_mode == :template then :raw
         | 
| 11 | 
            +
                else                         :card_list
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
            end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            format :json do
         | 
| 17 | 
            +
              def items_for_export
         | 
| 18 | 
            +
                return [] if card.content.empty? || unexportable_tag?(card.name.tag_name.key)
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                card.item_cards
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              # avoid running the search from +:content_options (huge results)
         | 
| 24 | 
            +
              # and +:structure (errors)
         | 
| 25 | 
            +
              # TODO: make this configurable in set mods
         | 
| 26 | 
            +
              def unexportable_tag? tag_key
         | 
| 27 | 
            +
                %i[content_options structure].map { |code| code.cardname.key }.include? tag_key
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
            end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            format :rss do
         | 
| 32 | 
            +
              view :feed_body do
         | 
| 33 | 
            +
                case raw_feed_items
         | 
| 34 | 
            +
                when Exception then @xml.item(render!(:search_error))
         | 
| 35 | 
            +
                when Integer then @xml.item(render!(:search_count))
         | 
| 36 | 
            +
                else super()
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              def raw_feed_items
         | 
| 41 | 
            +
                @raw_feed_items ||= search_with_params
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
            end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            format :html do
         | 
| 46 | 
            +
              view :core do
         | 
| 47 | 
            +
                _render search_result_view
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
              view :bar do
         | 
| 51 | 
            +
                voo.hide :one_line_content
         | 
| 52 | 
            +
                super()
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
              view :one_line_content, cache: :never do
         | 
| 56 | 
            +
                if depth > max_depth
         | 
| 57 | 
            +
                  "..."
         | 
| 58 | 
            +
                else
         | 
| 59 | 
            +
                  search_params[:limit] = closed_limit
         | 
| 60 | 
            +
                  _render_core hide: "paging", items: { view: :link }
         | 
| 61 | 
            +
                  # TODO: if item is queryified to be "name", then that should work.
         | 
| 62 | 
            +
                  # otherwise use link
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
              end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
              def rss_link_tag
         | 
| 67 | 
            +
                path_opts = { format: :rss }
         | 
| 68 | 
            +
                Array(search_params[:vars]).compact.each { |k, v| opts["_#{k}"] = v }
         | 
| 69 | 
            +
                tag "link", rel: "alternate",
         | 
| 70 | 
            +
                            type: "application/rss+xml",
         | 
| 71 | 
            +
                            title: "RSS",
         | 
| 72 | 
            +
                            href: path(path_opts)
         | 
| 73 | 
            +
              end
         | 
| 74 | 
            +
            end
         | 
    
        data/set/self/search.rb
    CHANGED
    
    
    
        data/set/type/search_type.rb
    CHANGED
    
    | @@ -1,81 +1,9 @@ | |
| 1 1 | 
             
            include_set Type::Json
         | 
| 2 2 | 
             
            include_set Abstract::CqlSearch
         | 
| 3 | 
            +
            include_set Abstract::SearchViews
         | 
| 3 4 |  | 
| 4 5 | 
             
            format do
         | 
| 5 | 
            -
              view :core, cache: :never do
         | 
| 6 | 
            -
                _render search_result_view
         | 
| 7 | 
            -
              end
         | 
| 8 | 
            -
             | 
| 9 6 | 
             
              def chunk_list
         | 
| 10 7 | 
             
                :query
         | 
| 11 8 | 
             
              end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
              def search_result_view
         | 
| 14 | 
            -
                case search_with_params
         | 
| 15 | 
            -
                when Exception              then :search_error
         | 
| 16 | 
            -
                when Integer                then :search_count
         | 
| 17 | 
            -
                when nest_mode == :template then :raw
         | 
| 18 | 
            -
                else                         :card_list
         | 
| 19 | 
            -
                end
         | 
| 20 | 
            -
              end
         | 
| 21 | 
            -
            end
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            format :json do
         | 
| 24 | 
            -
              def items_for_export
         | 
| 25 | 
            -
                return [] if card.content.empty? || unexportable_tag?(card.name.tag_name.key)
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                card.item_cards
         | 
| 28 | 
            -
              end
         | 
| 29 | 
            -
             | 
| 30 | 
            -
              # avoid running the search from +:content_options (huge results)
         | 
| 31 | 
            -
              # and +:structure (errors)
         | 
| 32 | 
            -
              # TODO: make this configurable in set mods
         | 
| 33 | 
            -
              def unexportable_tag? tag_key
         | 
| 34 | 
            -
                %i[content_options structure].map { |code| code.cardname.key }.include? tag_key
         | 
| 35 | 
            -
              end
         | 
| 36 | 
            -
            end
         | 
| 37 | 
            -
             | 
| 38 | 
            -
            format :rss do
         | 
| 39 | 
            -
              view :feed_body do
         | 
| 40 | 
            -
                case raw_feed_items
         | 
| 41 | 
            -
                when Exception then @xml.item(render!(:search_error))
         | 
| 42 | 
            -
                when Integer then @xml.item(render!(:search_count))
         | 
| 43 | 
            -
                else super()
         | 
| 44 | 
            -
                end
         | 
| 45 | 
            -
              end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
              def raw_feed_items
         | 
| 48 | 
            -
                @raw_feed_items ||= search_with_params
         | 
| 49 | 
            -
              end
         | 
| 50 | 
            -
            end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
            format :html do
         | 
| 53 | 
            -
              view :core do
         | 
| 54 | 
            -
                _render search_result_view
         | 
| 55 | 
            -
              end
         | 
| 56 | 
            -
             | 
| 57 | 
            -
              view :bar do
         | 
| 58 | 
            -
                voo.hide :one_line_content
         | 
| 59 | 
            -
                super()
         | 
| 60 | 
            -
              end
         | 
| 61 | 
            -
             | 
| 62 | 
            -
              view :one_line_content, cache: :never do
         | 
| 63 | 
            -
                if depth > max_depth
         | 
| 64 | 
            -
                  "..."
         | 
| 65 | 
            -
                else
         | 
| 66 | 
            -
                  search_params[:limit] = closed_limit
         | 
| 67 | 
            -
                  _render_core hide: "paging", items: { view: :link }
         | 
| 68 | 
            -
                  # TODO: if item is queryified to be "name", then that should work.
         | 
| 69 | 
            -
                  # otherwise use link
         | 
| 70 | 
            -
                end
         | 
| 71 | 
            -
              end
         | 
| 72 | 
            -
             | 
| 73 | 
            -
              def rss_link_tag
         | 
| 74 | 
            -
                path_opts = { format: :rss }
         | 
| 75 | 
            -
                Array(search_params[:vars]).compact.each { |k, v| opts["_#{k}"] = v }
         | 
| 76 | 
            -
                tag "link", rel: "alternate",
         | 
| 77 | 
            -
                            type: "application/rss+xml",
         | 
| 78 | 
            -
                            title: "RSS",
         | 
| 79 | 
            -
                            href: path(path_opts)
         | 
| 80 | 
            -
              end
         | 
| 81 9 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: card-mod-search
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.13.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ethan McCutchen
         | 
| @@ -10,7 +10,7 @@ authors: | |
| 10 10 | 
             
            autorequire:
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date: 2021- | 
| 13 | 
            +
            date: 2021-09-24 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies:
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 16 16 | 
             
              name: card
         | 
| @@ -18,28 +18,28 @@ dependencies: | |
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - '='
         | 
| 20 20 | 
             
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            -
                    version: 1. | 
| 21 | 
            +
                    version: 1.103.3
         | 
| 22 22 | 
             
              type: :runtime
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 24 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 25 | 
             
                requirements:
         | 
| 26 26 | 
             
                - - '='
         | 
| 27 27 | 
             
                  - !ruby/object:Gem::Version
         | 
| 28 | 
            -
                    version: 1. | 
| 28 | 
            +
                    version: 1.103.3
         | 
| 29 29 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 30 30 | 
             
              name: card-mod-collection
         | 
| 31 31 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 32 32 | 
             
                requirements:
         | 
| 33 33 | 
             
                - - '='
         | 
| 34 34 | 
             
                  - !ruby/object:Gem::Version
         | 
| 35 | 
            -
                    version: 0. | 
| 35 | 
            +
                    version: 0.13.3
         | 
| 36 36 | 
             
              type: :runtime
         | 
| 37 37 | 
             
              prerelease: false
         | 
| 38 38 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 39 39 | 
             
                requirements:
         | 
| 40 40 | 
             
                - - '='
         | 
| 41 41 | 
             
                  - !ruby/object:Gem::Version
         | 
| 42 | 
            -
                    version: 0. | 
| 42 | 
            +
                    version: 0.13.3
         | 
| 43 43 | 
             
            description: ''
         | 
| 44 44 | 
             
            email:
         | 
| 45 45 | 
             
            - info@decko.org
         | 
| @@ -59,14 +59,15 @@ files: | |
| 59 59 | 
             
            - set/abstract/03_filter/query_construction.rb
         | 
| 60 60 | 
             
            - set/abstract/03_filter/quick_filters.haml
         | 
| 61 61 | 
             
            - set/abstract/03_filter/selectable_filtered_content.haml
         | 
| 62 | 
            -
            - set/abstract/04_right_filter_form.rb
         | 
| 63 62 | 
             
            - set/abstract/05_search.rb
         | 
| 64 63 | 
             
            - set/abstract/05_search/checkbox_item.haml
         | 
| 65 64 | 
             
            - set/abstract/05_search/select_item.haml
         | 
| 66 65 | 
             
            - set/abstract/05_search/views.rb
         | 
| 67 66 | 
             
            - set/abstract/06_cql_search.rb
         | 
| 67 | 
            +
            - set/abstract/filter_list.rb
         | 
| 68 68 | 
             
            - set/abstract/filterable.rb
         | 
| 69 69 | 
             
            - set/abstract/filterable_bar.rb
         | 
| 70 | 
            +
            - set/abstract/search_views.rb
         | 
| 70 71 | 
             
            - set/right/children.rb
         | 
| 71 72 | 
             
            - set/right/created.rb
         | 
| 72 73 | 
             
            - set/right/edited.rb
         | 
| @@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 108 109 | 
             
                - !ruby/object:Gem::Version
         | 
| 109 110 | 
             
                  version: '0'
         | 
| 110 111 | 
             
            requirements: []
         | 
| 111 | 
            -
            rubygems_version: 3. | 
| 112 | 
            +
            rubygems_version: 3.1.6
         | 
| 112 113 | 
             
            signing_key:
         | 
| 113 114 | 
             
            specification_version: 4
         | 
| 114 115 | 
             
            summary: search
         | 
| @@ -1,26 +0,0 @@ | |
| 1 | 
            -
            # To be included in a field card to get a filter for the parent.
         | 
| 2 | 
            -
            # The core view renders a filter for the left card.
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            include_set Set::Abstract::Filter
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            def virtual?
         | 
| 7 | 
            -
              new?
         | 
| 8 | 
            -
            end
         | 
| 9 | 
            -
             | 
| 10 | 
            -
            format :html do
         | 
| 11 | 
            -
              def filter_action_path
         | 
| 12 | 
            -
                path mark: card.name.left, view: filter_view
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
             | 
| 15 | 
            -
              view :core, cache: :never do
         | 
| 16 | 
            -
                filter_fields slot_selector: filter_selector
         | 
| 17 | 
            -
              end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
              def filter_view
         | 
| 20 | 
            -
                :filter_result
         | 
| 21 | 
            -
              end
         | 
| 22 | 
            -
             | 
| 23 | 
            -
              def filter_selector
         | 
| 24 | 
            -
                ".#{filter_view}-view"
         | 
| 25 | 
            -
              end
         | 
| 26 | 
            -
            end
         |