cable 0.9.1 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/VERSION +1 -1
  2. data/app/controllers/admin_controller.rb +1 -0
  3. data/app/helpers/admin/menus_helper.rb +18 -0
  4. data/app/views/admin/_admin_user_login.html.erb +4 -2
  5. data/app/views/layouts/admin.html.erb +16 -0
  6. data/config/admin_navigation.rb +0 -3
  7. data/lib/generators/cable/install_generator.rb +24 -8
  8. data/lib/generators/cable/menu/menu_generator.rb +9 -11
  9. data/lib/generators/cable/menu/templates/controller.rb +33 -15
  10. data/lib/generators/cable/menu/templates/erb/menus/_menu.html.erb +7 -6
  11. data/lib/generators/cable/menu/templates/erb/menus/index.html.erb +12 -23
  12. data/lib/generators/cable/menu/templates/erb/menus/show.html.erb +21 -15
  13. data/lib/generators/cable/resource/resource_generator.rb +11 -9
  14. data/public/images/cable/new-window.png +0 -0
  15. data/public/images/cable/page.png +0 -0
  16. data/public/images/cable/{page-icon.png → search.png} +0 -0
  17. data/public/javascripts/cable_menu.js +40 -23
  18. data/public/stylesheets/cable/base.css +1 -2
  19. data/public/stylesheets/cable/buttons.css +7 -4
  20. data/public/stylesheets/cable/formtastic_changes.css +23 -11
  21. data/public/stylesheets/cable/menu.css +20 -6
  22. data/public/stylesheets/cable/regions.css +6 -4
  23. data/public/stylesheets/cable/tables.css +15 -6
  24. data/public/stylesheets/jquery/ui/jquery-ui-1.8.7.custom.css +5 -2
  25. metadata +37 -11
  26. data/lib/generators/cable/menu/templates/erb/menus/_menu_children_table.html.erb +0 -60
  27. data/lib/generators/cable/menu/templates/erb/menus/_menu_tree.html.erb +0 -10
  28. data/lib/generators/cable/menu/templates/erb/menus/_menu_vitals.html.erb +0 -30
  29. data/lib/generators/cable/menu/templates/erb/menus/_resource.html.erb +0 -29
  30. data/lib/generators/cable/menu/templates/erb/menus/_resource_fields.html.erb +0 -10
  31. data/lib/generators/cable/menu/templates/erb/menus/_tree.html.erb +0 -16
  32. data/lib/generators/cable/menu/templates/erb/menus/move.html.erb +0 -25
  33. data/lib/generators/cable/menu/templates/erb/menus/table.html.erb +0 -9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.1
1
+ 0.9.3
@@ -1,4 +1,5 @@
1
1
  class AdminController < Cable::CableAdminController
2
+ layout proc{ |c| c.request.xhr? ? false : "admin" }
2
3
  def index
3
4
  end
4
5
 
@@ -21,4 +21,22 @@ module Admin::MenusHelper
21
21
  end
22
22
  ret += "</ul>"
23
23
  end
24
+
25
+ def display_tree_plain(tree, parent_id)
26
+ unless tree.count <= 0
27
+ ret = "<ul>"
28
+ tree.each do |node|
29
+ if node.parent_id == parent_id
30
+ ret += "<li id='#{dom_id(node)}'>"
31
+ ret += "#{node.title}"
32
+ unless node.children.count <= 0
33
+ ret += display_tree_plain(node.children, node.id)
34
+ end
35
+ ret += "</li>"
36
+ end
37
+ end
38
+ ret += "</ul>"
39
+ end
40
+ end
41
+
24
42
  end
@@ -1,5 +1,7 @@
1
1
  <div class="user-session">
2
- <% if admin_user_signed_in? %>
3
- Signed in as: <%= current_admin_user.email %> <%= link_to "Sign out", destroy_admin_user_session_path, :class => 'button'%>
2
+ <% if respond_to?( :admin_user_signed_in?) %>
3
+ <% if admin_user_signed_in? %>
4
+ Signed in as: <%= current_admin_user.email %> <%= link_to "Sign out", destroy_admin_user_session_path, :class => 'button'%>
5
+ <% end %>
4
6
  <% end %>
5
7
  </div>
@@ -24,10 +24,25 @@
24
24
  </div>
25
25
  <div id="main-wrapper">
26
26
  <div class="container">
27
+
28
+
29
+ <% if @admin_layout == "single" %>
30
+ <div id="main" class="span-24">
31
+ <div class="box shadow">
32
+ <h2 id="title"><%= @page_title %></h2>
33
+ <div id="help"><%= yield :help %><a class="button">Help</a></div>
34
+ <%= render :partial => 'layouts/breadcrumb' %>
35
+ <%= yield :page_menu %>
36
+ <%= render :partial => 'layouts/messages' %>
37
+ <%= yield %>
38
+ </div>
39
+ </div>
40
+ <% else %>
27
41
  <div id="right-col" class="span-4">
28
42
  <div id="secondary-navigation" class="box shadow"><%= render_navigation(:level => 2..5, :context => :admin) %></div>
29
43
  <%= yield :sidebar %>
30
44
  </div>
45
+
31
46
  <div id="main" class="span-20 last">
32
47
  <div class="box shadow">
33
48
  <h2 id="title"><%= @page_title %></h2>
@@ -38,6 +53,7 @@
38
53
  <%= yield %>
39
54
  </div>
40
55
  </div>
56
+ <% end %>
41
57
  </div>
42
58
  </div>
43
59
  <div class="footer">
@@ -3,9 +3,6 @@ SimpleNavigation::Configuration.run do |navigation|
3
3
  admin.item :admin, "Home", '/admin'
4
4
  admin.item :admin, "Menu", "/admin/menus" do |menus|
5
5
  if Cable.class_exists? "Menu"
6
- Menu.roots.each do |tree|
7
- menus.item :edit, tree.title, "/admin/menus/show/#{tree.id}"
8
- end
9
6
  menus.item :new, "New Menu Item", new_admin_menu_path
10
7
  end
11
8
  end
@@ -17,24 +17,40 @@ module Cable
17
17
 
18
18
  def create_settings
19
19
  if options.settings?
20
- migration_template 'lib/generators/templates/create_cable_settings.rb', "db/migrate/create_cable_settings.rb"
21
- route( 'cable_to :cable_settings' ) if options.settings?
20
+ begin
21
+ migration_template 'lib/generators/templates/create_cable_settings.rb', "db/migrate/create_cable_settings.rb"
22
+ route( 'cable_to :cable_settings' )
23
+ rescue
24
+
25
+ end
22
26
  end
23
27
  end
24
28
 
25
29
  def create_blocks
26
30
  if options.blocks?
27
- migration_template 'lib/generators/templates/create_blocks.rb', 'db/migrate/create_blocks.rb'
28
- copy_file 'lib/generators/templates/block.rb', 'app/models/block.rb'
29
- copy_file 'lib/generators/templates/partials/_block.html.erb', 'app/views/admin/partials/_block.html.erb'
30
- copy_file 'lib/generators/templates/partials/_block_form.html.erb', 'app/views/admin/partials/_block_form.html.erb'
31
+ begin
32
+ migration_template 'lib/generators/templates/create_blocks.rb', 'db/migrate/create_blocks.rb'
33
+ rescue
34
+ copy_file 'lib/generators/templates/block.rb', 'app/models/block.rb'
35
+ copy_file 'lib/generators/templates/partials/_block.html.erb', 'app/views/admin/partials/_block.html.erb'
36
+ copy_file 'lib/generators/templates/partials/_block_form.html.erb', 'app/views/admin/partials/_block_form.html.erb'
37
+ end
31
38
  end
32
39
  end
33
40
 
34
41
  def copy_simple_nav
35
42
  if options.simple_nav?
36
- copy_file 'config/admin_navigation.rb', 'config/admin_navigation.rb'
37
- copy_file 'config/navigation.rb', 'config/navigation.rb'
43
+ if yes?("Would you like to install simple navigation?")
44
+ generate("navigation_config")
45
+ copy_file 'config/admin_navigation.rb', 'config/admin_navigation.rb'
46
+ # copy_file 'config/navigation.rb', 'config/navigation.rb'
47
+ end
48
+ end
49
+ end
50
+
51
+ def install_jquery
52
+ if yes?("Would you like to install jquery?")
53
+ generate("jquery:install --ui")
38
54
  end
39
55
  end
40
56
 
@@ -18,28 +18,30 @@ module Cable
18
18
 
19
19
  def create_migration_file
20
20
  if options.migration?
21
- migration_template 'migration.rb', "db/migrate/create_#{model_name.pluralize}.rb"
21
+ migration_template 'migration.rb', "db/migrate/create_#{model_name.pluralize}.rb" if yes?("Would you like to generate a migration?")
22
22
  end
23
23
  end
24
24
 
25
25
  def create_model_file
26
26
  if options.model?
27
- template 'model.rb' , "app/models/#{model_name}.rb"
27
+ template 'model.rb' , "app/models/#{model_name}.rb" if yes?("Would you like to generate a model?")
28
28
  end
29
29
  end
30
30
 
31
31
  def create_controller_file
32
32
  if options.controller?
33
- template 'controller.rb', "app/controllers/admin/#{model_name.pluralize}_controller.rb"
33
+ template 'controller.rb', "app/controllers/admin/#{model_name.pluralize}_controller.rb" if yes?("Would you like to generate a controller?")
34
34
  end
35
35
  end
36
36
 
37
37
  def create_views
38
38
  if options.views?
39
- Dir.glob(File.expand_path("../templates", __FILE__) + '/erb/menus/*.erb') do |rb_file|
40
- template rb_file, "app/views/admin/#{plural_table_name}/#{File.basename(rb_file)}"
39
+ if yes?( "Would you like Cable to generate menu views?")
40
+ Dir.glob(File.expand_path("../templates", __FILE__) + '/erb/menus/*.erb') do |rb_file|
41
+ template rb_file, "app/views/admin/#{plural_table_name}/#{File.basename(rb_file)}"
42
+ end
43
+ copy_file 'erb/partials/_menu_fields.html.erb', 'app/views/admin/partials/_menu_fields.html.erb'
41
44
  end
42
- copy_file 'erb/partials/_menu_fields.html.erb', 'app/views/admin/partials/_menu_fields.html.erb'
43
45
  end
44
46
  end
45
47
 
@@ -48,15 +50,11 @@ module Cable
48
50
  route_string = <<EOF
49
51
  cable_to :#{plural_table_name} do |menu|
50
52
  collection do
51
- get :rebuild
52
- get :table
53
53
  post :sort
54
- post :move
55
- post :remove_resource
56
54
  end
57
55
  end
58
56
  EOF
59
- route( route_string )
57
+ route( route_string ) if yes?("Would you like to generate routes?")
60
58
 
61
59
  end
62
60
 
@@ -1,8 +1,10 @@
1
1
  class Admin::<%= class_name %>sController < AdminController
2
+ respond_to :html, :xml, :json
2
3
  # GET /pages
3
4
  # GET /pages.xml
4
5
  def index
5
6
  @<%= plural_table_name %> = <%= class_name %>.roots
7
+ Menu.rebuild!
6
8
  respond_to do |format|
7
9
  format.html # index.html.erb
8
10
  format.xml { render :xml => @<%= plural_table_name %> }
@@ -19,7 +21,6 @@ class Admin::<%= class_name %>sController < AdminController
19
21
  format.html # show.html.erb
20
22
  format.xml { render :xml => @<%= singular_table_name %> }
21
23
  format.js { render :partial => "admin/menus/parents" }
22
-
23
24
  end
24
25
  end
25
26
 
@@ -28,6 +29,10 @@ class Admin::<%= class_name %>sController < AdminController
28
29
  def new
29
30
  @resources = Cable.available_resources
30
31
  @<%= singular_table_name %> = <%= class_name %>.new
32
+ if params[:parent_id] && params[:parent_id] != "0"
33
+ @parent = Menu.find(params[:parent_id])
34
+ @<%= singular_table_name %>.parent_id = @parent.id
35
+ end
31
36
  respond_to do |format|
32
37
  format.html # new.html.erb
33
38
  format.xml { render :xml => @<%= singular_table_name %> }
@@ -40,11 +45,6 @@ class Admin::<%= class_name %>sController < AdminController
40
45
  @resources = Cable.available_resources
41
46
  end
42
47
 
43
- def move
44
- @<%= singular_table_name %> = <%= class_name %>.where(:id => params[:id]).first
45
- @<%= plural_table_name %> = <%= class_name %>.roots
46
- end
47
-
48
48
  # POST /pages
49
49
  # POST /pages.xml
50
50
  def create
@@ -94,17 +94,35 @@ class Admin::<%= class_name %>sController < AdminController
94
94
  end
95
95
  end
96
96
 
97
-
98
- def table
99
- @<%= plural_table_name %> = <%= class_name %>.all
97
+ def sort
98
+ new_list = params[:ul]
99
+ previous = nil
100
+ 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)
103
+ unless previous.nil?
104
+ @previous_item = Menu.find_by_id(previous)
105
+ @current_menu.move_to_right_of(@previous_item)
106
+ else
107
+ @current_menu.move_to_root
108
+ end
109
+ unless array[1][:children].blank?
110
+ parse_children(array[1], @current_menu)
111
+ end
112
+ previous = moved_item_id
113
+ end
114
+ Menu.rebuild!
115
+ render :nothing => true
100
116
  end
101
117
 
102
- def sort
103
- @first = <%= class_name %>.find(params[:menu].first)
104
- @<%= singular_table_name %> = <%= class_name %>.find(@first.parent.id)
105
- @<%= singular_table_name %>.reorder_children(params[:menu])
106
- render :update do |page|
107
- page << "$('#status').html();"
118
+ def parse_children(mynode, menu)
119
+ 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)
123
+ unless child[1][:children].blank?
124
+ parse_children(child[1], child_menu)
125
+ end
108
126
  end
109
127
  end
110
128
 
@@ -1,7 +1,7 @@
1
1
  <%%= semantic_form_for [:admin, @<%= singular_table_name %>] do |f| %>
2
2
  <%% if @<%= singular_table_name %>.errors.any? %>
3
3
  <div id="error_explanation">
4
- <h2><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this menu from being saved:</h2>
4
+ <h3><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this menu from being saved:</h3>
5
5
  <ul>
6
6
  <%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
7
7
  <li><%%= msg %></li>
@@ -9,13 +9,14 @@
9
9
  </ul>
10
10
  </div>
11
11
  <%% end %>
12
- <%%= f.inputs do %>
12
+ <%%= f.inputs "Menu Properties" do %>
13
13
  <%%= f.input :title, :label => "Menu Title", :hint => "This will be used in the menu itself" %>
14
14
  <%%= f.input :meta_description, :label => "Meta Description", :hint => "Meta Description rendered in the head of the document" %>
15
15
  <%%= f.input :meta_keywords, :label => "Meta Keywords", :hint => "Enter Keywords with a comma separating each key" %>
16
16
  <%%= f.input :url, :label => "URL", :as => :string, :hint => "URL for this menu item, Example: /categories/canopies" %>
17
- <%%= f.input :parent_id, :as => :select, :collection => nested_set_options(<%= singular_table_name.classify %>) {|i| "#{'-' * i.level} #{i.title}" unless i.level > 1 }.to_a.reject{|i| i[0].nil?}, :hint => "You can move this later" %>
18
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 %>
19
20
  <%% unless Cable.special_actions.empty? %>
20
21
  <%%= f.input :special_action, :label => "Special Action", :as => :select, :collection => Cable.special_actions, :hint => "(Optional)" %>
21
22
  <%% end %>
@@ -25,7 +26,7 @@
25
26
  <%% unless @resources.nil? %>
26
27
  <%%= f.input :cable_menuable_id, :label => "Resource", :as => :select, :include_blank => true, :collection => @resources %>
27
28
  <%% end %>
28
-
29
- <%% end %>
29
+ <%% end %>
30
+
30
31
  <%%= f.buttons %>
31
- <%% end %>
32
+ <%% end %>
@@ -1,28 +1,17 @@
1
1
  <%% content_for :scripts do %>
2
- <script>
3
- $(document).ready(function(){
4
- $(".sortable").sortable({
5
- cursor: 'move',
6
- axis: 'y',
7
- update: function(e, ui) {
8
- sorted = $(this).sortable("serialize");
9
- $.ajax({
10
- type: 'POST',
11
- url: "/admin/<%= plural_table_name %>/sort",
12
- data: sorted
13
- });
14
- }
15
- });
16
- $(".check-all").click(function(){
17
- $("input").each(function(){
18
- $(this).attr('checked', !$(this).attr('checked'));
19
- });
20
- });
2
+ <%%= javascript_include_tag 'cable_menu.js' %>
3
+ <script type="text/javascript" charset="utf-8">
4
+ $(document).ready(function(){
5
+ $('#menu').cable_menu();
21
6
  });
22
7
  </script>
23
8
  <%% end %>
24
9
 
25
- <%% @<%= plural_table_name %>.each do |menu| %>
26
- <h3><%%= link_to menu.title, [:admin, menu] %></h3>
27
- <%%= render :partial => 'menu_vitals', :locals => {:menu => menu} %>
28
- <%% end %>
10
+ <ul id="menu">
11
+ <%% @<%= plural_table_name %>.each do |m| -%>
12
+ <li title="<%%= m.title %>" id="<%%= dom_id(m) %>">
13
+ <%%= m.title %>
14
+ <%% if m.descendants %><%%= raw display_tree_plain(m.children, m.id) %><%% end %>
15
+ </li>
16
+ <%% end %>
17
+ </ul>
@@ -1,16 +1,22 @@
1
- <%% if @<%= singular_table_name %>.ancestors.empty? %>
2
- <div><%%= link_to "Site Root", [:admin, :menus] %> &gt;</div>
3
- <%% else %>
4
- <div><%%= link_to "Site Root", [:admin, :menus] %> &gt;
5
- <%% for parent in @<%= singular_table_name %>.ancestors %>
6
- <%%= link_to h(parent.title), [:admin, parent] %> &gt;
7
- <%% end %>
8
- <%%= @<%= singular_table_name %>.title %>
9
- </div>
10
- <%% end %>
11
-
12
- <h3><%%= @<%= singular_table_name %>.title %></h3>
13
-
14
- <%%= render :partial => 'menu_vitals', :locals => {:menu => @<%= singular_table_name %> } %>
15
- <%%= render :partial => 'menu_children_table' %>
1
+ <table>
2
+ <thead>
3
+ <tr><th colspan=3>"<%%= @<%= singular_table_name %>.title %>" Properties</th></tr>
4
+ </thead>
5
+ <tbody>
6
+ <tr>
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>
16
9
 
10
+ </tr>
11
+ <%% unless @<%= singular_table_name %>.resource.nil? %>
12
+ <tr>
13
+ <th class="label">Links to:</th>
14
+ <td><%%= @<%= singular_table_name %>.cable_<%= singular_table_name %>able_type %> | <%%= link_to @<%= singular_table_name %>.resource.title, [:admin, @<%= singular_table_name %>.resource] %></td>
15
+ </tr>
16
+ <%% end %>
17
+ </tbody>
18
+ </table>
19
+ <div class="actions">
20
+ <%%= link_to "Edit", edit_admin_menu_path(@<%= singular_table_name %>) %>
21
+ <%%= link_to "Destroy", [:admin, @<%= singular_table_name %>], :confirm => 'Are you sure? This could be a really bad idea!', :method => :delete %>
22
+ </div>
@@ -22,31 +22,33 @@ module Cable
22
22
  class_option :orm, :type => :string, :default => "active_record"
23
23
 
24
24
  def create_migration_file
25
- migration_template 'migration.rb', "db/migrate/create_#{table_name}.rb" if options.migration?
25
+ migration_template 'migration.rb', "db/migrate/create_#{table_name}.rb" if options.migration? and yes?("Would you like to generate a migration?")
26
26
  end
27
27
 
28
28
  def create_model_file
29
- template 'model.rb' , "app/models/#{model_name}.rb" if options.model?
29
+ template 'model.rb' , "app/models/#{model_name}.rb" if options.model? and yes?("Would you like to generate a model?")
30
30
  end
31
31
 
32
32
  def create_controller_file
33
33
  if options.controller?
34
- template 'controller.rb' , "app/controllers/admin/#{file_name.pluralize}_controller.rb"
34
+ template 'controller.rb' , "app/controllers/admin/#{file_name.pluralize}_controller.rb" if yes?("Would you like to generate a controller?")
35
35
  end
36
36
  end
37
37
 
38
38
  def create_scaffold
39
39
  if options.views?
40
- template 'erb/scaffold/_form.html.erb', "app/views/admin/#{plural_table_name}/_#{singular_table_name}.html.erb"
41
- template 'erb/scaffold/index.html.erb', "app/views/admin/#{plural_table_name}/index.html.erb"
42
- template 'erb/scaffold/edit.html.erb', "app/views/admin/#{plural_table_name}/edit.html.erb"
43
- template 'erb/scaffold/new.html.erb', "app/views/admin/#{plural_table_name}/new.html.erb"
44
- template 'erb/scaffold/show.html.erb', "app/views/admin/#{plural_table_name}/show.html.erb"
40
+ if yes?("Would you like Cable to generate views for #{model_name.capitalize}?")
41
+ template 'erb/scaffold/_form.html.erb', "app/views/admin/#{plural_table_name}/_#{singular_table_name}.html.erb"
42
+ template 'erb/scaffold/index.html.erb', "app/views/admin/#{plural_table_name}/index.html.erb"
43
+ template 'erb/scaffold/edit.html.erb', "app/views/admin/#{plural_table_name}/edit.html.erb"
44
+ template 'erb/scaffold/new.html.erb', "app/views/admin/#{plural_table_name}/new.html.erb"
45
+ template 'erb/scaffold/show.html.erb', "app/views/admin/#{plural_table_name}/show.html.erb"
46
+ end
45
47
  end
46
48
  end
47
49
 
48
50
  def install_route
49
- route("cable_to :#{plural_table_name}") if options.routes?
51
+ route("cable_to :#{plural_table_name}") if options.routes? and yes?("Would you like to generate routes for #{model_name.capitalize}?")
50
52
  end
51
53
 
52
54
  def self.next_migration_number(dirname)
Binary file
Binary file
@@ -48,8 +48,6 @@
48
48
  $('.cable_menu_wrapper > ul').removeAttr("id");
49
49
 
50
50
  var the_menu = $('.cable_menu_wrapper > ul').serialize_list();
51
- $(".cable_menu_wrapper").removeClass();
52
-
53
51
  $.post("/admin/menus/sort", the_menu);
54
52
  }
55
53
 
@@ -57,22 +55,21 @@
57
55
  $("#add-menu").remove();
58
56
 
59
57
  var $add = $("<li id='add-menu'>Add Menu Item</li>").appendTo($(item));
60
- // $add.css({"position":"absolute","bottom":"-40px"});
61
- // $item.css({"padding-bottom":"40px","height":"300px"});
62
-
58
+
63
59
  $add.click(function(){
64
60
  var id = $(item).attr("menu");
65
61
  $("#add-menu-form").html("<img src='/images/cable/loader.gif' />");
66
- $("#add-menu-form").load("/admin/menus/new?parent_id="+id, function(){
67
- $("#save-tree").hide();
68
- $("#menu-details").hide();
69
- $("<li class='commit'><input class='cancel' id='menu_cancel' name='cancel' type='button' value='Cancel' /></li>").insertBefore("ol li.commit").click(function(){
70
- $("#add-menu-form").html("");
71
- $("#save-tree").show();
62
+ $("#add-menu-form").load("/admin/menus/new", function(){
63
+ $(this).dialog({
64
+ modal: true,
65
+ width: 600,
66
+ resizable: false,
67
+ title: "New Menu",
68
+ draggable: false
72
69
  });
73
-
74
70
  });
75
- })
71
+ });
72
+
76
73
  }
77
74
 
78
75
  function hide_add_menu(item){
@@ -170,22 +167,36 @@
170
167
  last_width = $wrapper.attr("scrollWidth");
171
168
  $wrapper.stop();
172
169
  $wrapper.animate({ 'scrollLeft': $wrapper.attr("scrollWidth") }, 2000);
173
- $("#add-menu-form").html("");
174
- $("#save-tree").show();
175
- $("#menu-details").html("<img src='/images/cable/loader.gif' />").show();
176
170
 
171
+ update_breadcrumb();
172
+ }
173
+
174
+ function zoom_item(item,wrapper){
175
+ $item = $(item);
176
+ $id = $(item).attr("menu");
177
+ $wrapper = $(wrapper);
178
+
177
179
  if(xhr != undefined) {
178
180
  xhr.abort();
179
181
  }
180
182
  xhr = $.ajax({
181
183
  url: "/admin/menus/"+$item.attr("menu"),
182
184
  success: function(data) {
183
- $("#menu-details").html(data);
185
+ $("#menu-details").html(data).dialog(
186
+ {
187
+ modal: true,
188
+ width: 600,
189
+ height: 250,
190
+ resizable: false,
191
+ draggable: false,
192
+ resizable: false,
193
+ title: "Displaying menu properties"
194
+ }
195
+ );
184
196
  }
185
197
  });
186
- update_breadcrumb();
187
198
  }
188
-
199
+
189
200
  function deselect(item) {
190
201
  var $item = $(item);
191
202
  $item.removeClass('selected');
@@ -218,16 +229,18 @@
218
229
  var $cloned_li = $(this).clone();
219
230
  if($cloned_li.children().size() > 0){
220
231
  $cloned_li.addClass("has-children");
232
+ var $id = $cloned_li.attr("id").replace("menu_","");
221
233
  $cloned_li.children().each(function(){
222
- var $id = $cloned_li.attr("id").replace("menu_","");
223
234
  build_menu(this,$wrapper,$id);
224
235
  });
225
236
  }
237
+ $cloned_li.find("ul").remove();
238
+ $cloned_li.html("<span class='menu-zoom'></span> <span class='menu-title'>"+$cloned_li.text()+"</span>");
226
239
  $cloned_li.appendTo($new_menu);
227
240
  $cloned_li.attr("menu",$cloned_li.attr("id").replace("menu_",""));
228
241
  $cloned_li.removeAttr("id");
229
242
 
230
- $cloned_li.find("ul").remove();
243
+
231
244
  });
232
245
  }
233
246
 
@@ -291,10 +304,14 @@
291
304
 
292
305
  build_menu($tree, $wrapper, 0);
293
306
 
294
- $wrapper.find("li").click(function(){
295
- select_item(this, $wrapper);
307
+ $wrapper.find("li span.menu-title").click(function(){
308
+ select_item($(this).parent(), $wrapper);
296
309
  });
297
310
 
311
+ $wrapper.find("li span.menu-zoom").click(function(){
312
+ zoom_item($(this).parent(), $wrapper);
313
+ });
314
+
298
315
  update_tree($wrapper);
299
316
  $tree.remove();
300
317
 
@@ -21,5 +21,4 @@ a:hover{
21
21
  -moz-box-shadow: 0px 2px 2px #ccc;
22
22
  -webkit-box-shadow: 0px 2px 2px #ccc;
23
23
  box-shadow: 0px 2px 2px #ccc;
24
- }
25
-
24
+ }
@@ -4,14 +4,13 @@
4
4
  .previous_page,
5
5
  .formtastic input.button,
6
6
  .formtastic input[type=button],
7
- .formtastic input[type=file],
8
7
  .formtastic input[type=submit],
9
8
  .actions a,
10
- .user-session a{
9
+ .user-session a,
10
+ form.formtastic input, form.formtastic textarea, form.formtastic select {
11
11
  display:inline-block;
12
12
  font-size: 14px;
13
13
  color: #ffffff;
14
- padding: 4px 8px;
15
14
  background: #777;
16
15
  background: -moz-linear-gradient(top,#aaa 0%,#777);
17
16
  background: -webkit-gradient(linear, left top, left bottom,from(#aaa),to(#777));
@@ -22,6 +21,11 @@
22
21
  -moz-box-shadow: 0px 1px 2px rgba(000,000,000,0.5), inset 0px 0px 1px rgba(255,255,255,1);
23
22
  -webkit-box-shadow: 0px 1px 2px rgba(000,000,000,0.5), inset 0px 0px 1px rgba(255,255,255,1);
24
23
  text-shadow: 0px -1px 0px rgba(000,000,000,0.4), 0px 1px 0px rgba(255,255,255,0.3);
24
+ padding: 4px 6px;
25
+ }
26
+ .formtastic input[type=file]{
27
+ background: white;
28
+ color: black;
25
29
  }
26
30
  .user-session a{
27
31
  margin-left:12px;
@@ -41,7 +45,6 @@
41
45
  cursor:pointer;
42
46
  }
43
47
  .formtastic input[type=button]:hover,
44
- .formtastic input[type=file]:hover,
45
48
  .formtastic input[type=submit]:hover{
46
49
  background:#333;
47
50
  text-decoration:none;
@@ -4,36 +4,45 @@ form.formtastic legend {
4
4
  white-space:normal;
5
5
  color:#333;
6
6
  font-weight: normal;
7
+ margin-bottom: 1em;
8
+ display: block;
7
9
  }
10
+ form.formtastic fieldset.buttons,
8
11
  form.formtastic fieldset.inputs {
9
12
  background: #f9f9f9;
10
13
  margin-bottom: 1em;
11
14
  padding: 1em;
12
15
  }
13
- form.formtastic fieldset.buttons {
14
- padding-left:15%;
16
+ form.formtastic fieldset.buttons{
17
+ padding-left: 100px;
18
+ margin-bottom: 0;
15
19
  }
16
20
  form.formtastic fieldset.buttons li {
17
21
  float:left;
18
- padding-right:0.5em;
22
+ padding-right:0.5em;
23
+
19
24
  }
20
25
  form.formtastic fieldset > ol > li label {
21
26
  display:block;
22
- width: 15%;
27
+ width: 90px;
23
28
  float:left;
24
29
  padding-top:.2em;
25
30
  font-weight: bold;
26
31
  color: #222;
32
+ margin-right: 10px;
33
+ }
34
+ form.formtastic fieldset > ol > li.boolean label {
35
+ padding-left:100px;
36
+ width:auto;
27
37
  }
28
-
29
-
30
38
  form.formtastic fieldset > ol > li p.inline-hints {
31
39
  color:#000;
32
- margin:0.5em 0 0 15%;
33
- padding: 10px;
40
+ margin: 0.5em 0 0 100px;
34
41
  border-radius: 4px;
35
42
  -moz-border-radius: 4px;
36
43
  -webkit-border-radius: 4px;
44
+ clear: both;
45
+ padding: .25em 10px .25em 0;
37
46
  }
38
47
 
39
48
 
@@ -43,9 +52,12 @@ form.formtastic fieldset > ol > li.password input,
43
52
  form.formtastic fieldset > ol > li.numeric input,
44
53
  form.formtastic fieldset > ol > li.url input{
45
54
  padding: .5em;
46
- font-size: 16px;
47
- min-width: 40%;
55
+ font-size: 14px;
56
+ min-width: 60%;
48
57
  -moz-box-shadow: 0px 0px 4px #ccc inset;
49
58
  -webkit-box-shadow: 0px 0px 4px #ccc inset;
50
59
  box-shadow: 0px 0px 4px #ccc inset;
51
- }
60
+ }
61
+ form.formtastic fieldset > ol > li { margin-bottom: .5em; border-bottom: 1px dotted #00; }
62
+ form.formtastic input, form.formtastic textarea, form.formtastic select { font-size:100%;
63
+ max-width: 300px;}
@@ -21,7 +21,6 @@ ul.cable_menu ul {
21
21
  margin: 0;
22
22
  width: 170px;
23
23
  background:#fff;
24
- border-left:1px solid #eee;
25
24
  }
26
25
  .cable_menu_wrapper li.has-children {
27
26
  width: 129px;
@@ -38,14 +37,32 @@ ul.cable_menu ul {
38
37
  list-style: none;
39
38
  display: block;
40
39
  overflow: hidden;
41
- text-overflow: ellipsis;
42
40
  background-color: white;
43
41
  -webkit-border-radius: 3px;
44
42
  margin-bottom: 3px;
45
43
  }
44
+ .cable_menu_wrapper li span.menu-zoom{
45
+ display:inline-block;
46
+ width:12px;
47
+ height:12px;
48
+ margin-top:2px;
49
+ background: url(/images/cable/search.png) no-repeat right center;
50
+ visibility:hidden;
51
+ padding-right:6px;
52
+ }
53
+ .cable_menu_wrapper li:hover span.menu-zoom{
54
+ visibility:visible;
55
+ }
56
+ .cable_menu_wrapper li span.menu-title{
57
+ text-overflow: ellipsis;
58
+ width:110px;
59
+ overflow:hidden;
60
+ display:inline-block;
61
+ }
62
+
46
63
  .cable_menu_wrapper li.selected.last,
47
64
  .cable_menu_wrapper li.selected.last.has-children{
48
- background-color: #2494fc;
65
+ background-color: #2494fc;
49
66
  color: white;
50
67
  }
51
68
  .cable_menu_wrapper .selected {
@@ -112,9 +129,6 @@ ul.cable_menu ul {
112
129
  ul.cable_menu.empty{
113
130
  background:url(/images/cable/empty-menu.png);
114
131
  }
115
- #add-menu-form{
116
- margin-top:1em;
117
- }
118
132
  #save-tree{
119
133
  margin-bottom:1em;
120
134
  }
@@ -1,6 +1,5 @@
1
1
  /* @override http://localhost:3000/stylesheets/cable/regions.css */
2
2
 
3
-
4
3
  /* @group Headers */
5
4
 
6
5
  #header{
@@ -123,14 +122,17 @@
123
122
  padding-top: 1em;
124
123
  }
125
124
  #main .box{
126
- min-height: 400px;
127
- -webkit-border-radius: 4px;
128
125
  }
129
- #main h2{
126
+ h2{
130
127
  font-size: 1.5em;
131
128
  display: block;
132
129
  float: left;
133
130
  }
131
+ h3{
132
+ font-size: 1.25em;
133
+ display: block;
134
+
135
+ }
134
136
  #help{
135
137
  float: right;
136
138
  }
@@ -1,30 +1,39 @@
1
1
  /* @override http://localhost:3000/stylesheets/cable/tables.css */
2
2
  table{
3
3
  border-bottom: 2px solid #ccc;
4
+ margin-bottom: 1em;
4
5
  }
5
6
  thead th{
6
7
  background: #eee;
7
8
  border-bottom: 2px solid #ccc;
8
- font-weight:normal;
9
- font-size:1.25em;
9
+ font-weight:bold;
10
+ font-size:1em;
10
11
  }
12
+ tbody th{
13
+ background: #eee;
14
+ border-right: 2px solid #ccc;
15
+ font-weight:bold;
16
+ font-size:1em;
17
+ }
18
+
11
19
 
12
20
  table td{
13
- border-bottom: 1px dashed #ccc;
14
21
  border-right: 1px dashed #ccc;
15
22
  }
16
23
 
17
24
  tbody tr:nth-child(even) td,
18
25
  tbody tr.even td {
19
- background:#eee;
26
+ background: #eee;
27
+ }
28
+ tbody tr:last td{
29
+ border-bottom:none;
20
30
  }
21
-
22
31
  th.actions,
23
32
  td.actions{
24
33
  text-align: right;
25
34
  }
26
35
  td.actions{
27
- padding-right:0px;
36
+ padding: 5px;
28
37
  }
29
38
  tbody tr td:first-child{
30
39
  border-left: none;
@@ -1,3 +1,5 @@
1
+ /* @override http://localhost:3000/stylesheets/jquery/ui/jquery-ui-1.8.7.custom.css */
2
+
1
3
  /*
2
4
  * jQuery UI CSS Framework 1.8.7
3
5
  *
@@ -60,7 +62,6 @@
60
62
  .ui-widget .ui-widget { font-size: 1em; }
61
63
  .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Helvetica,Arial,sans-serif; font-size: 1em; }
62
64
  .ui-widget-content { border: 1px solid #B6B6B6; background: #ffffff; color: #4F4F4F; }
63
- .ui-widget-content a { color: #4F4F4F; }
64
65
  .ui-widget-header { border: 1px solid #B6B6B6; color: #4F4F4F; font-weight: bold; }
65
66
  .ui-widget-header {
66
67
  background: url(images/bg_fallback.png) 0 0 repeat-x;
@@ -553,7 +554,9 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
553
554
  .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; background: url(images/icon_sprite.png) 0 -16px no-repeat; }
554
555
  .ui-dialog .ui-dialog-titlebar-close:hover span { background-position: -16px -16px; }
555
556
  .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; border: 0; }
556
- .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
557
+ .ui-dialog .ui-dialog-content { position: relative; border: 0; background: none; overflow: auto; zoom: 1;
558
+ padding: .5em;
559
+ }
557
560
  .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
558
561
  .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
559
562
  .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cable
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.1
5
+ version: 0.9.3
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-03-14 00:00:00 -04:00
15
+ date: 2011-03-15 00:00:00 -04:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -48,6 +48,39 @@ dependencies:
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: *id003
51
+ - !ruby/object:Gem::Dependency
52
+ name: formtastic
53
+ requirement: &id004 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ type: :runtime
60
+ prerelease: false
61
+ version_requirements: *id004
62
+ - !ruby/object:Gem::Dependency
63
+ name: simple-navigation
64
+ requirement: &id005 !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: *id005
73
+ - !ruby/object:Gem::Dependency
74
+ name: jquery-rails
75
+ requirement: &id006 !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ type: :runtime
82
+ prerelease: false
83
+ version_requirements: *id006
51
84
  description:
52
85
  email:
53
86
  executables: []
@@ -112,18 +145,10 @@ files:
112
145
  - lib/generators/cable/menu/menu_generator.rb
113
146
  - lib/generators/cable/menu/templates/controller.rb
114
147
  - lib/generators/cable/menu/templates/erb/menus/_menu.html.erb
115
- - lib/generators/cable/menu/templates/erb/menus/_menu_children_table.html.erb
116
- - lib/generators/cable/menu/templates/erb/menus/_menu_tree.html.erb
117
- - lib/generators/cable/menu/templates/erb/menus/_menu_vitals.html.erb
118
- - lib/generators/cable/menu/templates/erb/menus/_resource.html.erb
119
- - lib/generators/cable/menu/templates/erb/menus/_resource_fields.html.erb
120
- - lib/generators/cable/menu/templates/erb/menus/_tree.html.erb
121
148
  - lib/generators/cable/menu/templates/erb/menus/edit.html.erb
122
149
  - lib/generators/cable/menu/templates/erb/menus/index.html.erb
123
- - lib/generators/cable/menu/templates/erb/menus/move.html.erb
124
150
  - lib/generators/cable/menu/templates/erb/menus/new.html.erb
125
151
  - lib/generators/cable/menu/templates/erb/menus/show.html.erb
126
- - lib/generators/cable/menu/templates/erb/menus/table.html.erb
127
152
  - lib/generators/cable/menu/templates/erb/partials/_menu_fields.html.erb
128
153
  - lib/generators/cable/menu/templates/migration.rb
129
154
  - lib/generators/cable/menu/templates/model.rb
@@ -156,8 +181,9 @@ files:
156
181
  - public/images/cable/loader.gif
157
182
  - public/images/cable/new-window.png
158
183
  - public/images/cable/nil-icon.png
159
- - public/images/cable/page-icon.png
184
+ - public/images/cable/page.png
160
185
  - public/images/cable/product-icon.jpg
186
+ - public/images/cable/search.png
161
187
  - public/images/cable/story-icon.jpg
162
188
  - public/javascripts/admin.js
163
189
  - public/javascripts/cable_menu.js
@@ -1,60 +0,0 @@
1
- <%% content_for :scripts do %>
2
- <script>
3
- $(document).ready(function(){
4
- $(".sortable").sortable({
5
- cursor: 'move',
6
- axis: 'y',
7
- update: function(e, ui) {
8
- sorted = $(this).sortable("serialize");
9
- $.ajax({
10
- type: 'POST',
11
- url: "/admin/menus/sort",
12
- data: sorted
13
- });
14
- }
15
- });
16
- $(".check-all").click(function(){
17
- $("input").each(function(){
18
- $(this).attr('checked', !$(this).attr('checked'));
19
- });
20
- });
21
- });
22
- </script>
23
- <%% end %>
24
-
25
-
26
- <%% unless @<%= singular_table_name %>.children.blank? %>
27
- <%%= semantic_form_for :index, :url => {:controller => "menus", :action => "bulk" } do |f| %>
28
- <table id="<%%= dom_id(@<%= singular_table_name %>) %>">
29
- <thead>
30
- <tr>
31
- <th><a class="check-all">All</a></th>
32
- <th>Title</th>
33
- <th>Children</th>
34
- <th>Resource Type</th>
35
- <th class="actions">Actions</th>
36
- </tr>
37
- </thead>
38
- <tbody class="sortable">
39
- <%% @<%= singular_table_name %>.children.each do |menu| %>
40
- <tr id="<%%= dom_id(menu)%>">
41
- <td class="edit"><%%= check_box_tag 'menus[]', menu.id %></td>
42
- <td class="title"><%%= link_to menu.title, [:admin, menu] %>
43
- <%% unless menu.show_in_menu %> <span style="color:red;">[Hidden]</span> <%% end %>
44
- </td>
45
- <td class="children">
46
- <%%= menu.children.count %>
47
- </td>
48
- <td class="class"><%%= menu.resource.class unless menu.resource.class == NilClass %></td>
49
- <td class="actions"><%%= link_to "Show", [:admin,menu], :class => "button small" %> <%%= link_to 'Edit', edit_admin_menu_path(menu), :class=>"button small" %> <%%= link_to 'Destroy', [:admin, menu], :confirm => 'Are you sure?', :method => :delete, :class=>"button small" %></td>
50
- </tr>
51
- <%% end %>
52
- </tbody>
53
- </table>
54
- <%%= f.inputs :name => "Bulk Operations" do %>
55
- <%%= f.commit_button "Delete Selected" %>
56
- <%%= f.input :parent_id, :as => :select, :collection => nested_set_options(Menu) {|i| "#{'-' * i.level} #{i.title}" unless i.level > 1 }.to_a.reject{|i| i[0].nil?} %>
57
- <%%= f.commit_button "Move Selected" %>
58
- <%% end %>
59
- <%% end %>
60
- <%% end %>
@@ -1,10 +0,0 @@
1
- <%% content_for :sidebar do%>
2
- <ul id="menu-tree">
3
- <%% @<%= singular_table_name %>s.each do |menu| %>
4
- <li>
5
- <%%= link_to menu.title, [:admin, menu] %>
6
- <%%= raw display_tree_plain(menu.children, menu.id) %>
7
- </li>
8
- <%% end %>
9
- </ul>
10
- <%% end %>
@@ -1,30 +0,0 @@
1
-
2
- <div class="content box">
3
- <table>
4
- <thead>
5
- <tr><th colspan=3>Menu Properies</th></tr>
6
- </thead>
7
- <tbody>
8
- <tr><td class="label">URL: </td><td><%%= "#{menu.url}" %></td><td class="actions"><%%= link_to "Open in New Window", menu.url, :target => "_blank" %></td></tr>
9
- <%% unless menu.children.empty? %>
10
- <tr><td class="label">Children: </td><td colspan=2><%%= raw menu.children.collect{|i| link_to i.title, [:admin, i]}.join(", ") %></td></tr>
11
- <%% end %>
12
- <%% unless menu.root? %>
13
- <tr><td class="label">Root:</td><td><%%= link_to menu.root.title, [:admin, menu.root] %></td></tr>
14
- <%% end %>
15
- <%% unless menu.resource.nil? %>
16
- <tr><td class="label">Links to:</td><td><%%= menu.cable_menuable_type %> | <%%= link_to menu.resource.title, [:admin, menu.resource] %></td></tr>
17
- <%% end %>
18
- <tr>
19
- <td colspan=3 class="actions">
20
- <%%= link_to "Show", [:admin,menu], :class => "button small" %>
21
- <%%= link_to "Edit Menu Properties", edit_admin_menu_path(menu), :class => "button small" %>
22
- <%%= link_to "Move", move_admin_menus_path(menu), :class => "button small" %>
23
- <%%# if menu.is_deletable? %>
24
- <%%= link_to "Destroy", [:admin, menu], :confirm => 'Are you sure? This will also remove associated category image!', :method => :delete, :class => "button small" %>
25
- <%%# end %>
26
- </td>
27
- </tr>
28
- </tbody>
29
- </table>
30
- </div>
@@ -1,29 +0,0 @@
1
- <%% content_for :scripts do %>
2
- <script>
3
- $(function(){
4
- $("#menu_cable_menuable_type").change(function(){
5
- $.ajax({ url: "<%%= resources_admin_menus_path %>/"+$(this).val()});
6
- });
7
- });
8
- </script>
9
- <%% end %>
10
- <%%= semantic_form_for [:admin, @<%= singular_table_name %>] do |f| %>
11
- <%%= f.inputs :name => "Add a resource to this menu" do %>
12
- <%%= f.input :cable_menuable_type, :label => "Content Model", :as => :select, :collection => ['Page'] %>
13
- <%%= f.input :cable_menuable_id, :label => "Resource", :as => :select, :collection => @resources.collect{|r| ["#{r.site.name} - #{r.title}",r.id]} %>
14
- <%% end %>
15
-
16
-
17
- <%% f.buttons do %>
18
- <%% unless @<%= singular_table_name %>.resource.nil? %>
19
- <%%= f.commit_button "Update Resource" %>
20
- <li class="commit"><%%= link_to "Remove this Resource", remove_resource_admin_menus_path(@<%= singular_table_name %>), :class => "button" %></li>
21
- <%% else %>
22
- <%%= f.commit_button "Add Resource" %>
23
- <%% end %>
24
- <%% end %>
25
-
26
-
27
- <%% end %>
28
-
29
-
@@ -1,10 +0,0 @@
1
- <fieldset>
2
- <li class="select optional" id="menu_cable_menuable_type_input">
3
- <label>Resource</label>
4
- <select id="menu_cable_menuable_id" name="menu[cable_menuable_id]" MULTIPLE SIZE=10>
5
- <%% @resources.each do |resource| %>
6
- <option value="<%%= resource.id %>"> <%%= "#{resource.site.name} - #{resource.title}" %></option>
7
- <%% end %>
8
- </select>
9
- </li>
10
- </fieldset>
@@ -1,16 +0,0 @@
1
- <%% content_tag :li, :id => dom_id(menu) do %>
2
- <div>
3
- <%%= check_box_tag 'menus[]', menu.id %>
4
- <span class="handle"><%%= menu.title %></span>
5
- <%% unless menu.show_in_menu %> <span style="color:red;">[Hidden]</span> <%% end %>
6
- <%%= menu.children.count %>
7
- <%%= link_to "Show", [:admin,menu], :class => "button small" %> <%%= link_to 'Edit', edit_admin_menu_path(menu), :class=>"button small" %>
8
- <%%= link_to 'Destroy', [:admin, menu], :confirm => 'Are you sure?', :method => :delete, :class=>"button small" %>
9
- </div>
10
-
11
- <%% content_tag :ul do %>
12
- <%% for child in menu.children do %>
13
- <%%= render :partial => "admin/menus/tree", :locals => {:menu => child }%>
14
- <%% end %>
15
- <%% end unless menu.leaf? %>
16
- <%% end %>
@@ -1,25 +0,0 @@
1
- <h2>Move Menu</h2>
2
- <div id="parent">Select a parent</div><br />
3
- <%%= semantic_form_for [:admin, @<%= singular_table_name %>] do |f| %>
4
- <%%= f.inputs do %>
5
- <%%= f.input :parent_id, :as => :hidden %>
6
- <%%= f.input :id, :as => :hidden %>
7
- <li class="select optional" id="menu_parent_id_input">
8
- <div style="width:100px;">
9
- <ul id="menu-tree-list">
10
- <li>Site Root <%%= image_tag "/images/arrow-head.png" %>
11
- <ul>
12
- <%% @<%= plural_table_name %>.each do |m| -%>
13
- <li id="<%%= dom_id(m) %>" title="<%%= m.title %>"><%%= m.title %><%% if m.descendants %><%%= raw display_tree_plain(m.children, m.id) %><%% end %></li>
14
- <%% end %>
15
- </ul>
16
- </li>
17
- </ul>
18
- </div>
19
- </li>
20
-
21
- <%% end %>
22
-
23
- <%%= f.buttons %>
24
-
25
- <%% end %>
@@ -1,9 +0,0 @@
1
- <table>
2
- <%% @<%= singular_table_name %>s.each do |m|%>
3
- <tr>
4
- <td><%%= m.menu_identifier %></td>
5
- <td><%%= link_to m.name, [:admin, m] %></td>
6
- <td><%%= m.url %></td>
7
- </tr>
8
- <%% end %>
9
- </table>