cable 0.9.14 → 0.9.15

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.14
1
+ 0.9.15
@@ -45,7 +45,7 @@ module Cable
45
45
  if yes?("Would you like to install simple navigation?".color(:yellow) )
46
46
  generate("navigation_config")
47
47
  copy_file 'config/admin_navigation.rb', 'config/admin_navigation.rb'
48
- # copy_file 'config/navigation.rb', 'config/navigation.rb'
48
+ copy_file 'config/navigation.rb', 'config/navigation.rb'
49
49
  end
50
50
  end
51
51
  end
@@ -1,7 +1,8 @@
1
1
  (function($){
2
2
 
3
3
  var xhr;
4
-
4
+ var parent_id;
5
+
5
6
  var sortable_options = {
6
7
  items: "li:not(#add-menu)",
7
8
  connectWith: '.cable_menu_wrapper ul',
@@ -73,7 +74,6 @@
73
74
  });
74
75
  });
75
76
  });
76
-
77
77
  }
78
78
 
79
79
  function hide_add_menu(item){
@@ -144,16 +144,14 @@
144
144
  function select_item(item,wrapper){
145
145
  $item = $(item);
146
146
  $id = $(item).attr("menu");
147
+ parent_id = $id;
147
148
  $wrapper = $(wrapper);
148
149
  $child = $("ul[menu="+$id+"]");
149
150
 
150
151
  if($child.children().size() > 0){
151
152
  $child.css({ left: $item.parent().position().left + $item.parent().width()+3+$(".cable_menu_wrapper").scrollLeft(), top: 0}).show();
152
153
  }else{
153
- $("<ul class='cable_menu empty' menu="+$id+"/>").css({ left: $item.parent().position().left + $item.parent().width()+3+$(".cable_menu_wrapper").scrollLeft(), top: 0}).sortable(sortable_options).appendTo($wrapper).mouseenter(function() {
154
- show_add_menu(this);
155
- }).mouseleave(function(){
156
- hide_add_menu(this);
154
+ $("<ul class='cable_menu empty' menu="+$id+"/>").css({ left: $item.parent().position().left + $item.parent().width()+3+$(".cable_menu_wrapper").scrollLeft(), top: 0}).sortable(sortable_options).appendTo($wrapper).mouseenter(function() {
157
155
  });;
158
156
  }
159
157
 
@@ -305,7 +303,7 @@
305
303
  $.fn.cable_menu = function(options){
306
304
  var $tree = $(this);
307
305
  var $wrapper = $("<div class='cable_menu_wrapper'></div>").insertAfter($tree);
308
-
306
+
309
307
  build_menu($tree, $wrapper, 0);
310
308
 
311
309
  $wrapper.find("li span.menu-title").click(function(){
@@ -320,16 +318,55 @@
320
318
  $tree.remove();
321
319
 
322
320
  $wrapper.find("ul").sortable(sortable_options);
323
- $wrapper.find("ul").mouseenter(function() {
324
- show_add_menu(this);
325
- }).mouseleave(function(){
326
- hide_add_menu(this);
327
- });
321
+
328
322
  var $current_selection = $("<div id='selection'><strong>Current Selection:</strong><p>&nbsp;</p></div>").insertBefore($wrapper);
323
+ var $add1 = $("<div id='add-menu-tree1' class='actions'><a>Add Menu</a></div>").insertBefore($current_selection);
324
+ var $save1 = $("<div id='save-tree1' class='actions'><a>Save Tree</a></div>").insertBefore($current_selection);
325
+
329
326
  var $save = $("<div id='save-tree' class='actions'><a>Save Tree</a></div>").insertAfter($wrapper);
327
+ var $add = $("<div id='add-menu-tree' class='actions'><a>Add Menu</a></div>").insertAfter($wrapper);
328
+
330
329
  var $form = $("<div id='add-menu-form' />").insertAfter($save);
331
330
  var $menu_details = $("<div id='menu-details' />").insertAfter($save);
332
- $save.click(function(){save_tree();});
331
+
332
+ $save.click(function(){save_tree();});
333
+ $save1.click(function(){save_tree();});
334
+
335
+ $add.click(function(){
336
+ $("#add-menu-form").html("<img src='/images/cable/loader.gif' />");
337
+ $("#add-menu-form").load("/admin/menus/new?parent_id="+parent_id, function(){
338
+ $(this).dialog({
339
+ modal: true,
340
+ width: 600,
341
+ resizable: false,
342
+ title: "New Menu",
343
+ draggable: false
344
+ });
345
+ });
346
+ });
347
+
348
+ $add1.click(function(){
349
+ $("#add-menu-form").html("<img src='/images/cable/loader.gif' />");
350
+
351
+ var get_string;
352
+
353
+ if (parent_id > 0){
354
+ get_string = "?parent_id="+parent_id;
355
+ } else {
356
+ get_string = "?parent_id=0";
357
+ }
358
+
359
+ $("#add-menu-form").load("/admin/menus/new"+get_string, function(){
360
+ $(this).dialog({
361
+ modal: true,
362
+ width: 600,
363
+ resizable: false,
364
+ title: "New Menu",
365
+ draggable: false
366
+ });
367
+ });
368
+ });
369
+
333
370
  $("<hr />").insertAfter($wrapper);
334
371
 
335
372
  }
@@ -31,7 +31,7 @@ $.extend( proto, {
31
31
 
32
32
  _renderItem: function( ul, item) {
33
33
  console.log( "autocomplete running")
34
- return $( "<li></li>" )
34
+ return $( "<li></li>" ).addClass(item.type)
35
35
  .data( "item.autocomplete", item )
36
36
  .append( $( "<a></a>" )[ this.options.html ? "html" : "text" ]( item.label + "<span class='search_type'>" + item.type +"</span>") )
37
37
  .appendTo( ul );
@@ -1,5 +1,20 @@
1
1
  /* @override http://localhost:3000/stylesheets/cable/menu.css */
2
2
 
3
+ #selection {
4
+ margin-top:10px;
5
+ }
6
+
7
+ #add-menu-tree1 {
8
+ float:left;
9
+ margin-right:10px;
10
+ }
11
+
12
+
13
+ #add-menu-tree {
14
+ float:left;
15
+ margin-right:10px;
16
+ }
17
+
3
18
  .cable_menu_wrapper {
4
19
  position: relative;
5
20
  height: 360px;
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cable
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 37
4
5
  prerelease:
5
- version: 0.9.14
6
+ segments:
7
+ - 0
8
+ - 9
9
+ - 15
10
+ version: 0.9.15
6
11
  platform: ruby
7
12
  authors:
8
13
  - Spencer Markowski
@@ -12,119 +17,153 @@ autorequire:
12
17
  bindir: bin
13
18
  cert_chain: []
14
19
 
15
- date: 2011-04-15 00:00:00 -04:00
20
+ date: 2011-04-20 00:00:00 -04:00
16
21
  default_executable:
17
22
  dependencies:
18
23
  - !ruby/object:Gem::Dependency
19
- name: rails
24
+ type: :runtime
20
25
  requirement: &id001 !ruby/object:Gem::Requirement
21
26
  none: false
22
27
  requirements:
23
28
  - - ~>
24
29
  - !ruby/object:Gem::Version
30
+ hash: 7
31
+ segments:
32
+ - 3
33
+ - 0
34
+ - 0
25
35
  version: 3.0.0
26
- type: :runtime
27
- prerelease: false
36
+ name: rails
28
37
  version_requirements: *id001
38
+ prerelease: false
29
39
  - !ruby/object:Gem::Dependency
30
- name: orm_adapter
40
+ type: :runtime
31
41
  requirement: &id002 !ruby/object:Gem::Requirement
32
42
  none: false
33
43
  requirements:
34
44
  - - ">="
35
45
  - !ruby/object:Gem::Version
46
+ hash: 3
47
+ segments:
48
+ - 0
36
49
  version: "0"
37
- type: :runtime
38
- prerelease: false
50
+ name: orm_adapter
39
51
  version_requirements: *id002
52
+ prerelease: false
40
53
  - !ruby/object:Gem::Dependency
41
- name: awesome_nested_set
54
+ type: :runtime
42
55
  requirement: &id003 !ruby/object:Gem::Requirement
43
56
  none: false
44
57
  requirements:
45
58
  - - ">="
46
59
  - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
47
63
  version: "0"
48
- type: :runtime
49
- prerelease: false
64
+ name: awesome_nested_set
50
65
  version_requirements: *id003
66
+ prerelease: false
51
67
  - !ruby/object:Gem::Dependency
52
- name: formtastic
68
+ type: :runtime
53
69
  requirement: &id004 !ruby/object:Gem::Requirement
54
70
  none: false
55
71
  requirements:
56
72
  - - ">="
57
73
  - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
58
77
  version: "0"
59
- type: :runtime
60
- prerelease: false
78
+ name: formtastic
61
79
  version_requirements: *id004
80
+ prerelease: false
62
81
  - !ruby/object:Gem::Dependency
63
- name: simple-navigation
82
+ type: :runtime
64
83
  requirement: &id005 !ruby/object:Gem::Requirement
65
84
  none: false
66
85
  requirements:
67
86
  - - ">="
68
87
  - !ruby/object:Gem::Version
88
+ hash: 3
89
+ segments:
90
+ - 0
69
91
  version: "0"
70
- type: :runtime
71
- prerelease: false
92
+ name: simple-navigation
72
93
  version_requirements: *id005
94
+ prerelease: false
73
95
  - !ruby/object:Gem::Dependency
74
- name: jquery-rails
96
+ type: :runtime
75
97
  requirement: &id006 !ruby/object:Gem::Requirement
76
98
  none: false
77
99
  requirements:
78
100
  - - ">="
79
101
  - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
80
105
  version: "0"
81
- type: :runtime
82
- prerelease: false
106
+ name: jquery-rails
83
107
  version_requirements: *id006
108
+ prerelease: false
84
109
  - !ruby/object:Gem::Dependency
85
- name: rainbow
110
+ type: :runtime
86
111
  requirement: &id007 !ruby/object:Gem::Requirement
87
112
  none: false
88
113
  requirements:
89
114
  - - ">="
90
115
  - !ruby/object:Gem::Version
116
+ hash: 3
117
+ segments:
118
+ - 0
91
119
  version: "0"
92
- type: :runtime
93
- prerelease: false
120
+ name: rainbow
94
121
  version_requirements: *id007
122
+ prerelease: false
95
123
  - !ruby/object:Gem::Dependency
96
- name: kaminari
124
+ type: :runtime
97
125
  requirement: &id008 !ruby/object:Gem::Requirement
98
126
  none: false
99
127
  requirements:
100
128
  - - ">="
101
129
  - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
102
133
  version: "0"
103
- type: :runtime
104
- prerelease: false
134
+ name: kaminari
105
135
  version_requirements: *id008
136
+ prerelease: false
106
137
  - !ruby/object:Gem::Dependency
107
- name: cocoon
138
+ type: :runtime
108
139
  requirement: &id009 !ruby/object:Gem::Requirement
109
140
  none: false
110
141
  requirements:
111
142
  - - ">="
112
143
  - !ruby/object:Gem::Version
144
+ hash: 3
145
+ segments:
146
+ - 0
113
147
  version: "0"
114
- type: :runtime
115
- prerelease: false
148
+ name: cocoon
116
149
  version_requirements: *id009
150
+ prerelease: false
117
151
  - !ruby/object:Gem::Dependency
118
- name: schemata
152
+ type: :runtime
119
153
  requirement: &id010 !ruby/object:Gem::Requirement
120
154
  none: false
121
155
  requirements:
122
156
  - - ">="
123
157
  - !ruby/object:Gem::Version
158
+ hash: 27
159
+ segments:
160
+ - 0
161
+ - 1
162
+ - 0
124
163
  version: 0.1.0
125
- type: :runtime
126
- prerelease: false
164
+ name: schemata
127
165
  version_requirements: *id010
166
+ prerelease: false
128
167
  description:
129
168
  email:
130
169
  executables: []
@@ -561,12 +600,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
561
600
  requirements:
562
601
  - - ">="
563
602
  - !ruby/object:Gem::Version
603
+ hash: 3
604
+ segments:
605
+ - 0
564
606
  version: "0"
565
607
  required_rubygems_version: !ruby/object:Gem::Requirement
566
608
  none: false
567
609
  requirements:
568
610
  - - ">="
569
611
  - !ruby/object:Gem::Version
612
+ hash: 3
613
+ segments:
614
+ - 0
570
615
  version: "0"
571
616
  requirements: []
572
617