cable 0.9.13 → 0.9.14
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.14
|
@@ -3,7 +3,6 @@ class Admin::SearchController < AdminController
|
|
3
3
|
respond_to :js, :html
|
4
4
|
|
5
5
|
def index
|
6
|
-
@admin_layout = "single"
|
7
6
|
@results = ThinkingSphinx.search params[:term], :match_mode => :extended, :star => true
|
8
7
|
respond_to do |format|
|
9
8
|
format.json { render request.format.to_sym => to_json_for_autocomplete( @results) }
|
File without changes
|
@@ -8,7 +8,11 @@
|
|
8
8
|
</thead>
|
9
9
|
<tbody>
|
10
10
|
<% @results.each do |result| %>
|
11
|
-
|
11
|
+
<% begin %>
|
12
|
+
<%= render :partial => "/admin/#{result.class.name.tableize}/search", :locals => {:result => result} %>
|
13
|
+
<% rescue ActionView::MissingTemplate %>
|
14
|
+
<%= render :partial => "admin/search/generic_search_result", :locals => {:result => result} %>
|
15
|
+
<% end %>
|
12
16
|
<% end %>
|
13
17
|
</tbody>
|
14
18
|
</table>
|
data/lib/cable/acts_as_cable.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails'
|
2
2
|
require 'active_record'
|
3
|
-
|
3
|
+
require 'action_view'
|
4
4
|
module Cable
|
5
5
|
module ActsAsCable
|
6
6
|
def self.included( base )
|
@@ -11,6 +11,8 @@ module Cable
|
|
11
11
|
module ClassMethods
|
12
12
|
|
13
13
|
def acts_as_cable( reflection_options = {} )
|
14
|
+
send :include, InstanceMethods
|
15
|
+
send :include, ActionView::Helpers::TextHelper
|
14
16
|
|
15
17
|
with_modules = []
|
16
18
|
with_modules << reflection_options.delete(:with) if reflection_options.has_key?(:with)
|
@@ -32,5 +34,20 @@ module Cable
|
|
32
34
|
|
33
35
|
end
|
34
36
|
|
37
|
+
module InstanceMethods
|
38
|
+
|
39
|
+
def to_json_for_autocomplete
|
40
|
+
displayable_string = first_displayable_attribute
|
41
|
+
#TODO: find first string attr or look at sphinx index# if displayable_string.nil?
|
42
|
+
{ :label => "#{truncate(displayable_string, :length => 34)}" , :value => "#{(displayable_string)}", :type => self.class.name }
|
43
|
+
end
|
44
|
+
|
45
|
+
def first_displayable_attribute
|
46
|
+
displayable_attr = [ :title, :name, :first_name, :email, :email_address ].select{|attr| self.respond_to? attr }.first
|
47
|
+
displayable_string = (displayable_attr.nil?) ? "Title not available" : self[displayable_attr]
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
35
52
|
end
|
36
53
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.14
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Spencer Markowski
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2011-04-
|
15
|
+
date: 2011-04-15 00:00:00 -04:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 0.1.0
|
125
125
|
type: :runtime
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: *id010
|
@@ -153,6 +153,8 @@ files:
|
|
153
153
|
- app/views/admin/cable_settings/edit.html.erb
|
154
154
|
- app/views/admin/cable_settings/index.html.erb
|
155
155
|
- app/views/admin/index.html.erb
|
156
|
+
- app/views/admin/search/_generic_search_result.html.erb
|
157
|
+
- app/views/admin/search/_search.html.erb
|
156
158
|
- app/views/admin/search/index.html.erb
|
157
159
|
- app/views/admin/search/index.json.erb
|
158
160
|
- app/views/attachable_assets/index.html.erb
|