cable 0.9.9 → 0.9.10

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.9
1
+ 0.9.10
@@ -7,7 +7,7 @@ class Admin::SearchController < AdminController
7
7
  @results = ThinkingSphinx.search params[:term], :match_mode => :extended, :star => true
8
8
  respond_to do |format|
9
9
  format.json { render request.format.to_sym => to_json_for_autocomplete( @results) }
10
- format.html
10
+ format.html { redirect_to url_for([:admin, @results.first]) if @results.length == 1 }
11
11
  end
12
12
  end
13
13
 
@@ -2,10 +2,12 @@ module Admin::SearchControllerHelper
2
2
 
3
3
  def to_json_for_autocomplete( results )
4
4
  results.collect do |result|
5
- if result.respond_to? :to_json_for_autocomplete
6
- result.to_json_for_autocomplete
7
- else
8
- raise Cable::Errors::SearchError::MissingInterfaceMethod , "to_json_for_autocomplete method should be defined on #{result.class.name}"
5
+ unless result.nil?
6
+ if result.respond_to? :to_json_for_autocomplete
7
+ result.to_json_for_autocomplete
8
+ else
9
+ raise Cable::Errors::SearchError::MissingInterfaceMethod , "to_json_for_autocomplete method should be defined on #{result.class.name}"
10
+ end
9
11
  end
10
12
  end.to_json
11
13
  end
@@ -1,3 +1,4 @@
1
+ <% @page_title = "Search Results"%>
1
2
  <table>
2
3
  <thead>
3
4
  <tr>
@@ -27,9 +27,9 @@
27
27
 
28
28
 
29
29
  <% if @admin_layout == "single" %>
30
-
31
- <%= render :partial => "layouts/search" %>
32
-
30
+ <div class="prepend-15">
31
+ <%= render :partial => "layouts/search" %>
32
+ </div>
33
33
  <div id="main" class="span-24">
34
34
  <div class="box shadow">
35
35
  <h2 id="title"><%= @page_title %></h2>
@@ -53,7 +53,6 @@
53
53
 
54
54
  <h2 id="title"><%= @page_title %></h2>
55
55
  <div id="help"><%= yield :help %><a class="button">Help</a></div>
56
- <%= render :partial => 'layouts/breadcrumb' %>
57
56
  <%= yield :page_menu %>
58
57
  <%= render :partial => 'layouts/messages' %>
59
58
  <%= yield %>
@@ -39,6 +39,11 @@ module Cable
39
39
  def create_scaffold
40
40
  if options.views?
41
41
  if yes?("Would you like Cable to generate views for #{model_name.capitalize}?".color(:yellow))
42
+ if attributes.empty? and yes?("\tWould you like to use existing attributes?".color(:green))
43
+ self.attributes = model_name.classify.constantize.columns_hash.delete_if{|x| ["id", "created_at", "updated_at"].include? x }.collect{|c| [c.first,c.second.type]}.collect do |attri|
44
+ Rails::Generators::GeneratedAttribute.new( attri.first, attri.second )
45
+ end
46
+ end
42
47
  template 'erb/scaffold/_form.html.erb', "app/views/admin/#{plural_table_name}/_#{singular_table_name}.html.erb"
43
48
  template 'erb/scaffold/index.html.erb', "app/views/admin/#{plural_table_name}/index.html.erb"
44
49
  template 'erb/scaffold/edit.html.erb', "app/views/admin/#{plural_table_name}/edit.html.erb"
@@ -30,6 +30,7 @@ $.extend( proto, {
30
30
  },
31
31
 
32
32
  _renderItem: function( ul, item) {
33
+ console.log( "autocomplete running")
33
34
  return $( "<li></li>" )
34
35
  .data( "item.autocomplete", item )
35
36
  .append( $( "<a></a>" )[ this.options.html ? "html" : "text" ]( item.label + "<span class='search_type'>" + item.type +"</span>") )
@@ -1 +0,0 @@
1
- .mceContentBody strong { color:#BF2E1A; }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 9
10
- version: 0.9.9
9
+ - 10
10
+ version: 0.9.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Spencer Markowski