cable 0.9.10 → 0.9.11

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.10
1
+ 0.9.11
@@ -1,8 +1,10 @@
1
1
  class AdminController < Cable::CableAdminController
2
2
  layout proc{ |c| c.request.xhr? ? false : "admin" }
3
+
3
4
  def index
4
5
  end
5
6
 
6
7
  protected
8
+
7
9
  # Add protected methods here
8
10
  end
@@ -1,7 +1,7 @@
1
1
  module Cable
2
2
  class CableAdminController < ApplicationController
3
3
  unloadable
4
-
4
+
5
5
  protected
6
6
  # Add protected methods here
7
7
  end
@@ -4,4 +4,8 @@ module AdminHelper
4
4
  content_for( :admin_login ){ render 'admin/admin_user_login' }
5
5
  end
6
6
 
7
+ def single_column?
8
+ !content_for?(:sidebar) and !content_for?(:admin_sub_navigation)
9
+ end
10
+
7
11
  end
@@ -24,40 +24,14 @@
24
24
  </div>
25
25
  <div id="main-wrapper">
26
26
  <div class="container">
27
+ <% content_for :admin_sub_navigation do %>
28
+ <%= render_navigation(:level => 2..5, :context => :admin) %>
29
+ <% end %>
27
30
 
28
-
29
- <% if @admin_layout == "single" %>
30
- <div class="prepend-15">
31
- <%= render :partial => "layouts/search" %>
32
- </div>
33
- <div id="main" class="span-24">
34
- <div class="box shadow">
35
- <h2 id="title"><%= @page_title %></h2>
36
- <div id="help"><%= yield :help %><a class="button">Help</a></div>
37
- <%= yield :page_menu %>
38
- <%= render :partial => 'layouts/messages' %>
39
- <%= yield %>
40
- </div>
41
- </div>
31
+ <% if single_column? %>
32
+ <%= render :partial => "layouts/admin/single_column_layout" %>
42
33
  <% else %>
43
- <div id="right-col" class="span-4">
44
- <div id="secondary-navigation" class="box shadow"><%= render_navigation(:level => 2..5, :context => :admin) %></div>
45
- <%= yield :sidebar %>
46
- </div>
47
-
48
- <div class='span-11'><%= render :partial => 'layouts/breadcrumb' %></div>
49
- <%= render :partial => "layouts/search" %>
50
-
51
- <div id="main" class="span-20 last">
52
- <div class="box shadow">
53
-
54
- <h2 id="title"><%= @page_title %></h2>
55
- <div id="help"><%= yield :help %><a class="button">Help</a></div>
56
- <%= yield :page_menu %>
57
- <%= render :partial => 'layouts/messages' %>
58
- <%= yield %>
59
- </div>
60
- </div>
34
+ <%= render :partial => "layouts/admin/dual_column_layout" %>
61
35
  <% end %>
62
36
  </div>
63
37
  </div>
@@ -0,0 +1,18 @@
1
+ <div id="right-col" class="span-4">
2
+ <div id="secondary-navigation" class="box shadow"><%= yield :admin_sub_navigation %></div>
3
+ <%= yield :sidebar %>
4
+ </div>
5
+
6
+ <div class='span-11'><%= render :partial => 'layouts/breadcrumb' %></div>
7
+ <%= render :partial => "layouts/search" %>
8
+
9
+ <div id="main" class="span-20 last">
10
+ <div class="box shadow">
11
+
12
+ <h2 id="title"><%= @page_title %></h2>
13
+ <div id="help"><%= yield :help %><a class="button">Help</a></div>
14
+ <%= yield :page_menu %>
15
+ <%= render :partial => 'layouts/messages' %>
16
+ <%= yield %>
17
+ </div>
18
+ </div>
@@ -0,0 +1,12 @@
1
+ <div class="prepend-15">
2
+ <%= render :partial => "layouts/search" %>
3
+ </div>
4
+ <div id="main" class="span-24">
5
+ <div class="box shadow">
6
+ <h2 id="title"><%= @page_title %></h2>
7
+ <div id="help"><%= yield :help %><a class="button">Help</a></div>
8
+ <%= yield :page_menu %>
9
+ <%= render :partial => 'layouts/messages' %>
10
+ <%= yield %>
11
+ </div>
12
+ </div>
@@ -62,6 +62,7 @@ module Cable
62
62
 
63
63
  def install_admin
64
64
  copy_file "app/views/layouts/admin.html.erb", 'app/views/layouts/admin.html.erb'
65
+ directory 'app/views/layouts/admin', 'app/views/layouts/admin'
65
66
  directory "public/stylesheets/tinymce", "public/stylesheets/tinymce"
66
67
  end
67
68
 
@@ -78,9 +79,9 @@ module Cable
78
79
  puts ""
79
80
  puts "Run rake db:migrate to complete setup.".color(:yellow)
80
81
  puts ""
81
- puts "To begin using Cable Menu and Pages use:"
82
+ puts "To begin using Cable Menu and Resources use:".color(:green)
82
83
  puts "rails generate cable:menu MENU_NAME"
83
- puts "rails generate cable:resource PAGE_NAME field:type field:type ..."
84
+ puts "rails generate cable:resource RESOURCE_NAME field:type field:type ..."
84
85
  puts ""
85
86
  end
86
87
 
@@ -3,11 +3,12 @@ class Admin::<%= class_name %>sController < AdminController
3
3
  # GET /pages
4
4
  # GET /pages.xml
5
5
  def index
6
- @<%= plural_table_name %> = <%= class_name %>.roots
7
- Menu.rebuild!
6
+ @<%= singular_table_name %>s = <%= class_name %>.roots
7
+ @admin_layout = "single"
8
+ <%= class_name %>.rebuild!
8
9
  respond_to do |format|
9
10
  format.html # index.html.erb
10
- format.xml { render :xml => @<%= plural_table_name %> }
11
+ format.xml { render :xml => @<%= singular_table_name %>s }
11
12
  end
12
13
  end
13
14
 
@@ -15,22 +16,24 @@ class Admin::<%= class_name %>sController < AdminController
15
16
  # GET /pages/1.xml
16
17
  def show
17
18
  @<%= singular_table_name %> = <%= class_name %>.where( :id => params[:id]).first
18
- @<%= plural_table_name %> = Menu.roots
19
+ @<%= singular_table_name %>s = <%= class_name %>.roots
19
20
 
20
21
  respond_to do |format|
21
22
  format.html # show.html.erb
22
23
  format.xml { render :xml => @<%= singular_table_name %> }
23
- format.js { render :partial => "admin/menus/parents" }
24
+ format.js { render :partial => "admin/<%= singular_table_name %>s/parents" }
24
25
  end
25
26
  end
26
27
 
27
28
  # GET /pages/new
28
29
  # GET /pages/new.xml
29
30
  def new
30
- @resources = Cable.available_resources
31
+ @resource_types = Cable.resource_types.collect{|resource| ["#{resource.name}","#{resource.name.pluralize}"]}
32
+ @resources = @resource_types.first[0].classify.constantize.find(:all).sort{|x,y| x.title <=> y.title}
33
+
31
34
  @<%= singular_table_name %> = <%= class_name %>.new
32
35
  if params[:parent_id] && params[:parent_id] != "0"
33
- @parent = Menu.find(params[:parent_id])
36
+ @parent = <%= class_name %>.find(params[:parent_id])
34
37
  @<%= singular_table_name %>.parent_id = @parent.id
35
38
  end
36
39
  respond_to do |format|
@@ -41,15 +44,16 @@ class Admin::<%= class_name %>sController < AdminController
41
44
 
42
45
  # GET /pages/1/edit
43
46
  def edit
44
- @<%= singular_table_name %> = <%= class_name %>.includes(:cable_menuable).where( :id => params[:id]).first
45
- @resources = Cable.available_resources
47
+ @<%= singular_table_name %> = <%= class_name %>.includes(:cable_<%= singular_table_name %>able).where( :id => params[:id]).first
48
+ @resource_types = Cable.resource_types.collect{|resource| ["#{resource.name}","#{resource.name.pluralize}"]}
49
+ @resources = @<%= singular_table_name %>.cable_<%= singular_table_name %>able_type.classify.constantize.find(:all).sort{|x,y| x.title <=> y.title}
46
50
  end
47
51
 
48
52
  # POST /pages
49
53
  # POST /pages.xml
50
54
  def create
51
55
 
52
- @<%= singular_table_name %> = <%= class_name %>.new(params[:menu])
56
+ @<%= singular_table_name %> = <%= class_name %>.new(params[:<%= singular_table_name %>])
53
57
 
54
58
  respond_to do |format|
55
59
  if @<%= singular_table_name %>.save
@@ -66,12 +70,12 @@ class Admin::<%= class_name %>sController < AdminController
66
70
  # PUT /pages/1
67
71
  # PUT /pages/1.xml
68
72
  def update
69
- @<%= singular_table_name %> = <%= class_name %>.includes(:cable_menuable).where( :id => params[:id]).first
73
+ @<%= singular_table_name %> = <%= class_name %>.includes(:cable_<%= singular_table_name %>able).where( :id => params[:id]).first
70
74
 
71
- params[:menu][:tree_id] = <%= class_name %>.find(params[:menu][:parent_id]).tree_id unless params[:menu][:parent_id].blank?
75
+ params[:<%= singular_table_name %>][:tree_id] = <%= class_name %>.find(params[:<%= singular_table_name %>][:parent_id]).tree_id unless params[:<%= singular_table_name %>][:parent_id].blank?
72
76
 
73
77
  respond_to do |format|
74
- if @<%= singular_table_name %>.update_attributes(params[:menu])
78
+ if @<%= singular_table_name %>.update_attributes(params[:<%= singular_table_name %>])
75
79
  <%= class_name %>.rebuild!
76
80
  format.html { redirect_to([:admin, @<%= singular_table_name %>], :notice => '<%= class_name %> was successfully updated.') }
77
81
  format.xml { head :ok }
@@ -89,7 +93,7 @@ class Admin::<%= class_name %>sController < AdminController
89
93
  @<%= singular_table_name %>.destroy
90
94
 
91
95
  respond_to do |format|
92
- format.html { redirect_to(admin_menus_url) }
96
+ format.html { redirect_to(admin_<%= singular_table_name %>s_url) }
93
97
  format.xml { head :ok }
94
98
  end
95
99
  end
@@ -98,39 +102,39 @@ class Admin::<%= class_name %>sController < AdminController
98
102
  new_list = params[:ul]
99
103
  previous = nil
100
104
  new_list.each_with_index do |array, index|
101
- moved_item_id = array[1][:id].split(/menu_/)
102
- @current_menu = Menu.find_by_id(moved_item_id)
105
+ moved_item_id = array[1][:id].split(/<%= singular_table_name %>_/)
106
+ @current_<%= singular_table_name %> = <%= class_name %>.find_by_id(moved_item_id)
103
107
  unless previous.nil?
104
- @previous_item = Menu.find_by_id(previous)
105
- @current_menu.move_to_right_of(@previous_item)
108
+ @previous_item = <%= class_name %>.find_by_id(previous)
109
+ @current_<%= singular_table_name %>.move_to_right_of(@previous_item)
106
110
  else
107
- @current_menu.move_to_root
111
+ @current_<%= singular_table_name %>.move_to_root
108
112
  end
109
113
  unless array[1][:children].blank?
110
- parse_children(array[1], @current_menu)
114
+ parse_children(array[1], @current_<%= singular_table_name %>)
111
115
  end
112
116
  previous = moved_item_id
113
117
  end
114
- Menu.rebuild!
118
+ <%= class_name %>.rebuild!
115
119
  render :nothing => true
116
120
  end
117
121
 
118
- def parse_children(mynode, menu)
122
+ def parse_children(mynode, <%= singular_table_name %>)
119
123
  for child in mynode[:children]
120
- child_id = child[1][:id].split(/menu_/)
121
- child_menu = Menu.find_by_id(child_id)
122
- child_menu.move_to_child_of(menu)
124
+ child_id = child[1][:id].split(/<%= singular_table_name %>_/)
125
+ child_<%= singular_table_name %> = <%= class_name %>.find_by_id(child_id)
126
+ child_<%= singular_table_name %>.move_to_child_of(<%= singular_table_name %>)
123
127
  unless child[1][:children].blank?
124
- parse_children(child[1], child_menu)
128
+ parse_children(child[1], child_<%= singular_table_name %>)
125
129
  end
126
130
  end
127
131
  end
128
132
 
129
133
  def resources
130
134
  resource_type = params[:resource]
131
- @resources = "#{resource_type}".classify.constantize.find(:all)
132
- render :update do |page|
133
- page << "$('#menu_cable_menuable_id_input').html('#{escape_javascript(render(:partial => 'admin/menus/resource_fields'))}')"
135
+ @resources = "#{resource_type}".classify.constantize.find(:all).sort{|x,y| x.title <=> y.title}
136
+ respond_to do |format|
137
+ format.js
134
138
  end
135
139
  end
136
- end
140
+ end
@@ -1,7 +1,35 @@
1
+ <%%= javascript_include_tag 'jquery.quicksearch.js' %>
2
+ <script>
3
+ $(document).ready(function(){
4
+ $(".tabs").tabs();
5
+ $("#types li").click(function(){
6
+ $("#types .selected").removeClass();
7
+ resource_type = $(this).attr("id").replace("type_", "");
8
+ $(this).addClass("selected");
9
+ update_resources(resource_type);
10
+ });
11
+ });
12
+ function update_fields(id,type){
13
+ $("#<%= singular_table_name %>_cable_menuable_type").val(type);
14
+ $("#<%= singular_table_name %>_cable_menuable_id").val(id);
15
+ }
16
+ function update_resources(resource_type){
17
+ $.ajax({
18
+ type: 'POST',
19
+ url: "/admin/<%= singular_table_name %>s/resources",
20
+ data: {resource : resource_type},
21
+ success: function(){
22
+ console.log("Done");
23
+ }
24
+ });
25
+ }
26
+ </script>
27
+
1
28
  <%%= semantic_form_for [:admin, @<%= singular_table_name %>] do |f| %>
29
+
2
30
  <%% if @<%= singular_table_name %>.errors.any? %>
3
31
  <div id="error_explanation">
4
- <h3><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this menu from being saved:</h3>
32
+ <h3><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h3>
5
33
  <ul>
6
34
  <%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
7
35
  <li><%%= msg %></li>
@@ -9,24 +37,67 @@
9
37
  </ul>
10
38
  </div>
11
39
  <%% end %>
12
- <%%= f.inputs "Menu Properties" do %>
13
- <%%= f.input :title, :label => "Menu Title", :hint => "This will be used in the menu itself" %>
14
- <%%= f.input :meta_description, :label => "Meta Description", :hint => "Meta Description rendered in the head of the document" %>
15
- <%%= f.input :meta_keywords, :label => "Meta Keywords", :hint => "Enter Keywords with a comma separating each key" %>
16
- <%%= f.input :url, :label => "URL", :as => :string, :hint => "URL for this menu item, Example: /categories/canopies" %>
17
- <%%= f.input :show_in_menu, :as => :boolean, :wrapper_html => { :class => "yes_no" }, :hint => "You can hide the menu item by unchecking this box." %>
18
- <%% end %>
19
- <%%= f.inputs "Template and Resource" do %>
20
- <%% unless Cable.special_actions.empty? %>
21
- <%%= f.input :special_action, :label => "Special Action", :as => :select, :collection => Cable.special_actions, :hint => "(Optional)" %>
22
- <%% end %>
23
- <%% unless Cable.templates.empty? %>
24
- <%%= f.input :template, :as => :select, :collection => Cable.templates, :selected => f.object.template || "default", :hint => "Which page template should be used?"%>
25
- <%% end %>
26
- <%% unless @resources.nil? %>
27
- <%%= f.input :cable_menuable_id, :label => "Resource", :as => :select, :include_blank => true, :collection => @resources %>
28
- <%% end %>
29
- <%% end %>
30
40
 
41
+ <div class="tabs">
42
+ <ul>
43
+ <li><a href="#tabs-1">Menu Properties</a></li>
44
+ <li><a href="#tabs-2">Template and Special Actions</a></li>
45
+ <li><a href="#tabs-3">Resource</a></li>
46
+ </ul>
47
+ <div id="tabs-1">
48
+ <%%= f.inputs do %>
49
+ <%%= f.input :title, :label => "Menu Title", :hint => "This will be used in the <%= singular_table_name %> itself" %>
50
+ <%%= f.input :meta_description, :label => "Meta Description", :hint => "Meta Description rendered in the head of the document" %>
51
+ <%%= f.input :meta_keywords, :label => "Meta Keywords", :hint => "Enter Keywords with a comma separating each key" %>
52
+ <%%= f.input :url, :label => "URL", :as => :string, :hint => "URL for this <%= singular_table_name %> item, Example: /categories/canopies" %>
53
+ <%%= f.input :show_in_<%= singular_table_name %>, :as => :boolean, :wrapper_html => { :class => "yes_no" }, :hint => "You can hide the <%= singular_table_name %> item by unchecking this box." %>
54
+ <%% end %>
55
+ </div>
56
+ <div id="tabs-2">
57
+ <%%= f.inputs do %>
58
+ <%% unless Cable.special_actions.empty? %>
59
+ <%%= f.input :special_action, :label => "Special Action", :as => :select, :collection => Cable.special_actions, :hint => "(Optional)" %>
60
+ <%% end %>
61
+ <%% unless Cable.templates.empty? %>
62
+ <%%= f.input :template, :as => :select, :collection => Cable.templates, :selected => f.object.template || "default", :hint => "Which page template should be used?"%>
63
+ <%% end %>
64
+ <%% end %>
65
+ </div>
66
+ <div id="tabs-3">
67
+ <%%= f.inputs do %>
68
+ <%%= f.input :cable_menuable_type, :as => :hidden %>
69
+ <%%= f.input :cable_menuable_id, :as => :hidden %>
70
+ <li><div id="selected-resource"><%%= @<%= singular_table_name %>.cable_menuable_type %> &raquo; <%%= @<%= singular_table_name %>.resource.title unless @<%= singular_table_name %>.resource.nil? %></div></li>
71
+ <li>
72
+ <table id="resources">
73
+ <thead>
74
+ <tr>
75
+ <th>Type</th>
76
+ <th>Resources <input type="text" name="search" value="" id="search_resources" placeholder="Search" /> </th>
77
+ </tr>
78
+ </thead>
79
+ <tbody>
80
+ <tr>
81
+ <td id="types">
82
+ <ul>
83
+ <%% @resource_types.each do |type| %>
84
+ <li id="type_<%%= type[0] %>"><%%= type[1] %></li>
85
+ <%% end %>
86
+ </ul>
87
+ </td>
88
+ <td id="resources-data">
89
+ <div>
90
+ <%%= render(:partial => "admin/<%= singular_table_name %>s/resources", :locals => {:resources => @resources})%>
91
+ </div>
92
+ </td>
93
+ </tr>
94
+ </tbody>
95
+ </table>
96
+ </li>
97
+ <%% end %>
98
+ </div>
99
+ </div>
100
+
31
101
  <%%= f.buttons %>
102
+
32
103
  <%% end %>
@@ -0,0 +1,21 @@
1
+ <table id="resources-table">
2
+ <tbody>
3
+ <%% @resources.each do |resource| %>
4
+ <tr>
5
+ <td menu_id="<%%= resource.id %>" resource_type="<%%= resource.class.name %>" class="resource"><%%= resource.title %></td>
6
+ <td><%%= link_to image_tag("cable/search.png"), [:admin, resource], :target => "_blank" %></td>
7
+ </tr>
8
+ <%% end %>
9
+ </tbody>
10
+ </table>
11
+ <script>
12
+ $('input#search_resources').quicksearch('#resources-data tr');
13
+ $("#resources-data td.resource").click(function(){
14
+ $("#resources-data .selected").removeClass();
15
+ $("#selected-resource").html($(this).attr("resource_type")+" &raquo; "+$(this).text());
16
+ $(this).parent().addClass("selected");
17
+ menu_id = $(this).attr("menu_id");
18
+ resource_type = $(this).attr("resource_type");
19
+ update_fields(menu_id, resource_type);
20
+ });
21
+ </script>
@@ -0,0 +1 @@
1
+ $("#resources-data div").html('<%%= escape_javascript(render(:partial => "admin/menus/resources")) %>');
@@ -5,7 +5,7 @@
5
5
  <tbody>
6
6
  <tr>
7
7
  <th>URL:</th>
8
- <td><%%= link_to "#{@<%= singular_table_name %>.url}", @<%= singular_table_name %>.url, :target => "_blank" %> <%%= link_to image_tag('/images/cable/new-window.png'), @<%= singular_table_name %>.url, :target => "_blank" %> </td>
8
+ <td><%%= link_to "#{@<%= singular_table_name %>.url}", @<%= singular_table_name %>.url %> <%%= link_to image_tag('/images/cable/new-window.png'), @<%= singular_table_name %>.url, :target => "_blank" %> </td>
9
9
 
10
10
  </tr>
11
11
  <%% unless @<%= singular_table_name %>.resource.nil? %>
@@ -0,0 +1 @@
1
+ location.reload(true);
@@ -36,6 +36,7 @@
36
36
  };
37
37
 
38
38
  function save_tree(){
39
+
39
40
  $(".cable_menu_wrapper li").each(function() {
40
41
  $li = $(this);
41
42
  $ul = $("ul[menu="+$li.attr("menu")+"]");
@@ -48,7 +49,10 @@
48
49
  $('.cable_menu_wrapper > ul').removeAttr("id");
49
50
 
50
51
  var the_menu = $('.cable_menu_wrapper > ul').serialize_list();
51
- $.post("/admin/menus/sort", the_menu);
52
+ $('.cable_menu_wrapper').html("Saving ...");
53
+ $.post("/admin/menus/sort", the_menu, function(){
54
+ location.reload(true);
55
+ });
52
56
  }
53
57
 
54
58
  function show_add_menu(item){
@@ -0,0 +1,150 @@
1
+ (function($, window, document, undefined) {
2
+ $.fn.quicksearch = function (target, opt) {
3
+
4
+ var timeout, cache, rowcache, jq_results, val = '', e = this, options = $.extend({
5
+ delay: 100,
6
+ selector: null,
7
+ stripeRows: null,
8
+ loader: null,
9
+ noResults: '',
10
+ bind: 'keyup',
11
+ onBefore: function () {
12
+ return;
13
+ },
14
+ onAfter: function () {
15
+ return;
16
+ },
17
+ show: function () {
18
+ this.style.display = "";
19
+ },
20
+ hide: function () {
21
+ this.style.display = "none";
22
+ },
23
+ prepareQuery: function (val) {
24
+ return val.toLowerCase().split(' ');
25
+ },
26
+ testQuery: function (query, txt, _row) {
27
+ for (var i = 0; i < query.length; i += 1) {
28
+ if (txt.indexOf(query[i]) === -1) {
29
+ return false;
30
+ }
31
+ }
32
+ return true;
33
+ }
34
+ }, opt);
35
+
36
+ this.go = function () {
37
+
38
+ var i = 0,
39
+ noresults = true,
40
+ query = options.prepareQuery(val),
41
+ val_empty = (val.replace(' ', '').length === 0);
42
+
43
+ for (var i = 0, len = rowcache.length; i < len; i++) {
44
+ if (val_empty || options.testQuery(query, cache[i], rowcache[i])) {
45
+ options.show.apply(rowcache[i]);
46
+ noresults = false;
47
+ } else {
48
+ options.hide.apply(rowcache[i]);
49
+ }
50
+ }
51
+
52
+ if (noresults) {
53
+ this.results(false);
54
+ } else {
55
+ this.results(true);
56
+ this.stripe();
57
+ }
58
+
59
+ this.loader(false);
60
+ options.onAfter();
61
+
62
+ return this;
63
+ };
64
+
65
+ this.stripe = function () {
66
+
67
+ if (typeof options.stripeRows === "object" && options.stripeRows !== null)
68
+ {
69
+ var joined = options.stripeRows.join(' ');
70
+ var stripeRows_length = options.stripeRows.length;
71
+
72
+ jq_results.not(':hidden').each(function (i) {
73
+ $(this).removeClass(joined).addClass(options.stripeRows[i % stripeRows_length]);
74
+ });
75
+ }
76
+
77
+ return this;
78
+ };
79
+
80
+ this.strip_html = function (input) {
81
+ var output = input.replace(new RegExp('<[^<]+\>', 'g'), "");
82
+ output = $.trim(output.toLowerCase());
83
+ return output;
84
+ };
85
+
86
+ this.results = function (bool) {
87
+ if (typeof options.noResults === "string" && options.noResults !== "") {
88
+ if (bool) {
89
+ $(options.noResults).hide();
90
+ } else {
91
+ $(options.noResults).show();
92
+ }
93
+ }
94
+ return this;
95
+ };
96
+
97
+ this.loader = function (bool) {
98
+ if (typeof options.loader === "string" && options.loader !== "") {
99
+ (bool) ? $(options.loader).show() : $(options.loader).hide();
100
+ }
101
+ return this;
102
+ };
103
+
104
+ this.cache = function () {
105
+
106
+ jq_results = $(target);
107
+
108
+ if (typeof options.noResults === "string" && options.noResults !== "") {
109
+ jq_results = jq_results.not(options.noResults);
110
+ }
111
+
112
+ var t = (typeof options.selector === "string") ? jq_results.find(options.selector) : $(target).not(options.noResults);
113
+ cache = t.map(function () {
114
+ return e.strip_html(this.innerHTML);
115
+ });
116
+
117
+ rowcache = jq_results.map(function () {
118
+ return this;
119
+ });
120
+
121
+ return this.go();
122
+ };
123
+
124
+ this.trigger = function () {
125
+ this.loader(true);
126
+ options.onBefore();
127
+
128
+ window.clearTimeout(timeout);
129
+ timeout = window.setTimeout(function () {
130
+ e.go();
131
+ }, options.delay);
132
+
133
+ return this;
134
+ };
135
+
136
+ this.cache();
137
+ this.results(true);
138
+ this.stripe();
139
+ this.loader(false);
140
+
141
+ return this.each(function () {
142
+ $(this).bind(options.bind, function () {
143
+ val = $(this).val();
144
+ e.trigger();
145
+ });
146
+ });
147
+
148
+ };
149
+
150
+ }(jQuery, this, document));
@@ -13,4 +13,9 @@ form.formtastic fieldset > ol > li.search input {
13
13
 
14
14
 
15
15
 
16
- form.formtastic fieldset.buttons { padding-top:1em; }
16
+ form.formtastic fieldset.buttons { padding-top:1em; }
17
+
18
+ .inline-hints {
19
+ display: block;
20
+ clear: both;
21
+ }
@@ -26,12 +26,18 @@ ul.cable_menu ul {
26
26
  width: 129px;
27
27
  padding: 4px 20px 4px 4px;
28
28
  }
29
+ #resources-table tr:hover,
30
+ #types li:hover,
29
31
  .cable_menu_wrapper li:hover{
30
32
  background-color: #f4f4f4;
31
33
  cursor: pointer;
32
34
  }
33
- .cable_menu_wrapper li {
35
+ .cable_menu_wrapper li{
34
36
  width: 145px;
37
+ }
38
+
39
+ #types li,
40
+ .cable_menu_wrapper li {
35
41
  padding: 4px 4px 4px 4px;
36
42
  white-space: nowrap;
37
43
  list-style: none;
@@ -60,8 +66,10 @@ ul.cable_menu ul {
60
66
  display:inline-block;
61
67
  }
62
68
 
69
+ #resources-table tr.selected td,
63
70
  .cable_menu_wrapper li.selected.last,
64
- .cable_menu_wrapper li.selected.last.has-children{
71
+ .cable_menu_wrapper li.selected.last.has-children,
72
+ #types li.selected{
65
73
  background-color: #2494fc;
66
74
  color: white;
67
75
  }
@@ -101,34 +109,53 @@ ul.cable_menu ul {
101
109
  #add-menu:hover{
102
110
  background-color:#ddd;
103
111
  }
104
- ::-webkit-scrollbar {
105
- height: 8px;
106
- width: 8px;
112
+ ul.cable_menu.empty{
113
+ background:url(/images/cable/empty-menu.png);
114
+ }
115
+ #save-tree{
116
+ margin-bottom:1em;
107
117
  }
108
118
 
109
- ::-webkit-scrollbar-track-piece {
110
- margin-bottom: 10px;
111
- border-bottom-left-radius: 4px 4px;
112
- border-bottom-right-radius: 4px 4px;
113
- border-top-left-radius: 4px 4px;
114
- border-top-right-radius: 4px 4px;
119
+ #resources-data {
120
+ padding: 0;
115
121
  }
116
122
 
117
- ::-webkit-scrollbar-thumb:vertical {
118
- height: 25px;
119
- background-color: #ccc;
120
- -webkit-border-radius: 4px;
121
- -webkit-box-shadow: 0 1px 1px rgba(255,255,255,1);
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+ #search_resources{
131
+ float: right;
132
+ display: block;
133
+ font-weight: normal;
122
134
  }
123
135
 
124
- ::-webkit-scrollbar-thumb:horizontal {
125
- width: 25px;
126
- background-color: #ccc;
127
- -webkit-border-radius: 4px;
136
+ #selected-resource {
137
+ font-size: 1.25em;
138
+ font-weight: bold;
128
139
  }
129
- ul.cable_menu.empty{
130
- background:url(/images/cable/empty-menu.png);
140
+ #types {
141
+ vertical-align: top;
142
+ width: 200px;
143
+ padding: 0;
131
144
  }
132
- #save-tree{
133
- margin-bottom:1em;
145
+
146
+ #resources-table tbody .resource{
147
+ width: 300px;
148
+ }
149
+
150
+ #types li{
151
+ display: block;
152
+ font-size: 1.25em;
153
+ padding: .25em;
154
+ border: 1px solid white;
155
+ }
156
+
157
+ #resources-table tbody {
158
+ height:300px;
159
+ display: block;
160
+ overflow:auto;
134
161
  }
@@ -126,7 +126,7 @@
126
126
  h2{
127
127
  font-size: 1.5em;
128
128
  display: block;
129
- float: left;
129
+ /* float: left;*/
130
130
  }
131
131
  h3{
132
132
  font-size: 1.25em;
@@ -247,4 +247,6 @@ h3{
247
247
  padding: 1em;
248
248
  }
249
249
 
250
+ #right-col {margin-bottom:80px;}
251
+
250
252
  /* @end */
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 47
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 9
9
- - 10
10
- version: 0.9.10
5
+ version: 0.9.11
11
6
  platform: ruby
12
7
  authors:
13
8
  - Spencer Markowski
@@ -17,137 +12,108 @@ autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
14
 
20
- date: 2011-04-07 00:00:00 -04:00
15
+ date: 2011-04-10 00:00:00 -04:00
21
16
  default_executable:
22
17
  dependencies:
23
18
  - !ruby/object:Gem::Dependency
24
- type: :runtime
19
+ name: rails
25
20
  requirement: &id001 !ruby/object:Gem::Requirement
26
21
  none: false
27
22
  requirements:
28
23
  - - ~>
29
24
  - !ruby/object:Gem::Version
30
- hash: 7
31
- segments:
32
- - 3
33
- - 0
34
- - 0
35
25
  version: 3.0.0
36
- name: rails
37
- version_requirements: *id001
26
+ type: :runtime
38
27
  prerelease: false
28
+ version_requirements: *id001
39
29
  - !ruby/object:Gem::Dependency
40
- type: :runtime
30
+ name: orm_adapter
41
31
  requirement: &id002 !ruby/object:Gem::Requirement
42
32
  none: false
43
33
  requirements:
44
34
  - - ">="
45
35
  - !ruby/object:Gem::Version
46
- hash: 3
47
- segments:
48
- - 0
49
36
  version: "0"
50
- name: orm_adapter
51
- version_requirements: *id002
37
+ type: :runtime
52
38
  prerelease: false
39
+ version_requirements: *id002
53
40
  - !ruby/object:Gem::Dependency
54
- type: :runtime
41
+ name: awesome_nested_set
55
42
  requirement: &id003 !ruby/object:Gem::Requirement
56
43
  none: false
57
44
  requirements:
58
45
  - - ">="
59
46
  - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
47
  version: "0"
64
- name: awesome_nested_set
65
- version_requirements: *id003
48
+ type: :runtime
66
49
  prerelease: false
50
+ version_requirements: *id003
67
51
  - !ruby/object:Gem::Dependency
68
- type: :runtime
52
+ name: formtastic
69
53
  requirement: &id004 !ruby/object:Gem::Requirement
70
54
  none: false
71
55
  requirements:
72
56
  - - ">="
73
57
  - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
58
  version: "0"
78
- name: formtastic
79
- version_requirements: *id004
59
+ type: :runtime
80
60
  prerelease: false
61
+ version_requirements: *id004
81
62
  - !ruby/object:Gem::Dependency
82
- type: :runtime
63
+ name: simple-navigation
83
64
  requirement: &id005 !ruby/object:Gem::Requirement
84
65
  none: false
85
66
  requirements:
86
67
  - - ">="
87
68
  - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
69
  version: "0"
92
- name: simple-navigation
93
- version_requirements: *id005
70
+ type: :runtime
94
71
  prerelease: false
72
+ version_requirements: *id005
95
73
  - !ruby/object:Gem::Dependency
96
- type: :runtime
74
+ name: jquery-rails
97
75
  requirement: &id006 !ruby/object:Gem::Requirement
98
76
  none: false
99
77
  requirements:
100
78
  - - ">="
101
79
  - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
80
  version: "0"
106
- name: jquery-rails
107
- version_requirements: *id006
81
+ type: :runtime
108
82
  prerelease: false
83
+ version_requirements: *id006
109
84
  - !ruby/object:Gem::Dependency
110
- type: :runtime
85
+ name: rainbow
111
86
  requirement: &id007 !ruby/object:Gem::Requirement
112
87
  none: false
113
88
  requirements:
114
89
  - - ">="
115
90
  - !ruby/object:Gem::Version
116
- hash: 3
117
- segments:
118
- - 0
119
91
  version: "0"
120
- name: rainbow
121
- version_requirements: *id007
92
+ type: :runtime
122
93
  prerelease: false
94
+ version_requirements: *id007
123
95
  - !ruby/object:Gem::Dependency
124
- type: :runtime
96
+ name: kaminari
125
97
  requirement: &id008 !ruby/object:Gem::Requirement
126
98
  none: false
127
99
  requirements:
128
100
  - - ">="
129
101
  - !ruby/object:Gem::Version
130
- hash: 3
131
- segments:
132
- - 0
133
102
  version: "0"
134
- name: kaminari
135
- version_requirements: *id008
103
+ type: :runtime
136
104
  prerelease: false
105
+ version_requirements: *id008
137
106
  - !ruby/object:Gem::Dependency
138
- type: :runtime
107
+ name: cocoon
139
108
  requirement: &id009 !ruby/object:Gem::Requirement
140
109
  none: false
141
110
  requirements:
142
111
  - - ">="
143
112
  - !ruby/object:Gem::Version
144
- hash: 3
145
- segments:
146
- - 0
147
113
  version: "0"
148
- name: cocoon
149
- version_requirements: *id009
114
+ type: :runtime
150
115
  prerelease: false
116
+ version_requirements: *id009
151
117
  description:
152
118
  email:
153
119
  executables: []
@@ -185,6 +151,8 @@ files:
185
151
  - app/views/layouts/_messages.html.erb
186
152
  - app/views/layouts/_search.html.erb
187
153
  - app/views/layouts/admin.html.erb
154
+ - app/views/layouts/admin/_dual_column_layout.html.erb
155
+ - app/views/layouts/admin/_single_column_layout.html.erb
188
156
  - config/admin_navigation.rb
189
157
  - config/navigation.rb
190
158
  - config/routes.rb
@@ -218,10 +186,13 @@ files:
218
186
  - lib/generators/cable/menu/menu_generator.rb
219
187
  - lib/generators/cable/menu/templates/controller.rb
220
188
  - lib/generators/cable/menu/templates/erb/menus/_menu.html.erb
189
+ - lib/generators/cable/menu/templates/erb/menus/_resources.html.erb
221
190
  - lib/generators/cable/menu/templates/erb/menus/edit.html.erb
222
191
  - lib/generators/cable/menu/templates/erb/menus/index.html.erb
223
192
  - lib/generators/cable/menu/templates/erb/menus/new.html.erb
193
+ - lib/generators/cable/menu/templates/erb/menus/resources.js.erb
224
194
  - lib/generators/cable/menu/templates/erb/menus/show.html.erb
195
+ - lib/generators/cable/menu/templates/erb/menus/sort.js.erb
225
196
  - lib/generators/cable/menu/templates/erb/partials/_menu_fields.html.erb
226
197
  - lib/generators/cable/menu/templates/migration.rb
227
198
  - lib/generators/cable/menu/templates/model.rb
@@ -262,6 +233,7 @@ files:
262
233
  - public/images/cable/story-icon.jpg
263
234
  - public/javascripts/admin.js
264
235
  - public/javascripts/cable_menu.js
236
+ - public/javascripts/jquery.quicksearch.js
265
237
  - public/javascripts/jquery.tablesorter.min.js
266
238
  - public/javascripts/jquery.tagsinput.js
267
239
  - public/javascripts/jquery.ui.autocomplete.html.js
@@ -577,18 +549,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
577
549
  requirements:
578
550
  - - ">="
579
551
  - !ruby/object:Gem::Version
580
- hash: 3
581
- segments:
582
- - 0
583
552
  version: "0"
584
553
  required_rubygems_version: !ruby/object:Gem::Requirement
585
554
  none: false
586
555
  requirements:
587
556
  - - ">="
588
557
  - !ruby/object:Gem::Version
589
- hash: 3
590
- segments:
591
- - 0
592
558
  version: "0"
593
559
  requirements: []
594
560