This repository has been archived by the owner on Aug 15, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added menu system back, we need it for now
- Loading branch information
Josh Adams
committed
Feb 14, 2009
1 parent
1229c05
commit e755210
Showing
15 changed files
with
183 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
AnsuzContentSection | ||
=================== | ||
|
||
Introduction goes here. | ||
|
||
|
||
Example | ||
======= | ||
|
||
Example goes here. | ||
|
||
|
||
Copyright (c) 2008 [name of plugin creator], released under the MIT license |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
|
||
desc 'Default: run unit tests.' | ||
task :default => :test | ||
|
||
desc 'Test the ansuz_content_section plugin.' | ||
Rake::TestTask.new(:test) do |t| | ||
t.libs << 'lib' | ||
t.pattern = 'test/**/*_test.rb' | ||
t.verbose = true | ||
end | ||
|
||
desc 'Generate documentation for the ansuz_content_section plugin.' | ||
Rake::RDocTask.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'AnsuzContentSection' | ||
rdoc.options << '--line-numbers' << '--inline-source' | ||
rdoc.rdoc_files.include('README') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end |
56 changes: 56 additions & 0 deletions
56
vendor/plugins/ansuz_menu_system/app/controllers/admin/menu_entries_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
class Admin::MenuEntriesController < Admin::BaseController | ||
unloadable # This is required if you subclass a controller provided by the base rails app | ||
|
||
layout 'admin' | ||
before_filter :load_menu_entry, :only => [:show, :edit, :update, :destroy] | ||
before_filter :load_new_menu_entry, :only => [:new, :create] | ||
before_filter :load_menu_entries, :only => [:index] | ||
|
||
protected | ||
def load_menu_entry | ||
@menu_entry = Ansuz::JAdams::MenuEntry.find(params[:id]) | ||
end | ||
|
||
def load_new_menu_entry | ||
@menu_entry = Ansuz::JAdams::MenuEntry.new(params[:menu_entry]) | ||
end | ||
|
||
def load_menu_entries | ||
@menu_entries = Ansuz::JAdams::MenuEntry.find(:all, :order => 'position') | ||
end | ||
public | ||
def new | ||
end | ||
|
||
def create | ||
if @menu_entry.save | ||
flash[:notice] = "Menu Entry was created successfully." | ||
redirect_to admin_menu_entries_path | ||
else | ||
flash.now[:error] = "There was a problem creating the menu entry." | ||
render :action => 'new' | ||
end | ||
end | ||
|
||
def show | ||
end | ||
|
||
def edit | ||
end | ||
|
||
def update | ||
if @menu_entry.update_attributes(params[:menu_entry]) | ||
flash[:notice] = "Menu Entry has been updated." | ||
redirect_to admin_menu_entries_path | ||
else | ||
flash.now[:error] = "There was a problem updating the Menu Entry. Please try again." | ||
render :action => 'edit' | ||
end | ||
end | ||
|
||
def destroy | ||
@menu_entry.destroy | ||
flash[:notice] = "Menu Entry was deleted." | ||
redirect_to admin_menu_entries_path | ||
end | ||
end |
14 changes: 14 additions & 0 deletions
14
vendor/plugins/ansuz_menu_system/app/models/ansuz/j_adams/menu_entry.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Ansuz | ||
module JAdams | ||
class MenuEntry < ActiveRecord::Base | ||
acts_as_tree :order => 'position' | ||
def self.root_entries | ||
Ansuz::JAdams::MenuEntry.find(:all, :conditions => "parent_id IS NULL", :order => 'position') | ||
end | ||
|
||
def to_s | ||
name | ||
end | ||
end | ||
end | ||
end |
1 change: 1 addition & 0 deletions
1
vendor/plugins/ansuz_menu_system/app/views/admin/menu_entries/_content_section.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= plugin_module.contents -%> |
1 change: 1 addition & 0 deletions
1
vendor/plugins/ansuz_menu_system/app/views/admin/menu_entries/_edit.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is the edit view |
7 changes: 7 additions & 0 deletions
7
vendor/plugins/ansuz_menu_system/app/views/admin/menu_entries/_form.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class='fullwidth'> | ||
<table class='form-table'> | ||
<%= form_row "Name", f.text_field(:name) -%> | ||
<%= form_row "Link", f.text_field(:link) -%> | ||
</table> | ||
</div> | ||
<br /> |
8 changes: 8 additions & 0 deletions
8
vendor/plugins/ansuz_menu_system/app/views/admin/menu_entries/edit.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<%= title "Edit Menu Entry: #{@menu_entry}" -%> | ||
<% content_for :sidebar do -%> | ||
<%= link_to "All Menu Entries", admin_menu_entries_path, :class => 'button icon back' -%> | ||
<% end -%> | ||
<% form_for :menu_entry, :url => admin_menu_entry_path(@menu_entry), :html => { :method => :put } do |f| -%> | ||
<%= render :partial => 'form', :locals => { :f => f } -%> | ||
<%= submit_tag("Update Menu Entry") -%> or <%= link_to "Cancel", admin_menu_entries_path -%> | ||
<% end -%> |
32 changes: 32 additions & 0 deletions
32
vendor/plugins/ansuz_menu_system/app/views/admin/menu_entries/index.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<%= title "Menu Entries" -%> | ||
<% content_for :sidebar do -%> | ||
<%= link_to "New Menu Entry", new_admin_menu_entry_path, :class => 'button icon add' -%> | ||
<div class='note'> | ||
OK, so this is odd. Basically, you can add freeform menu entries here. If you want to embed the 'pages' menu, you can add a menu entry with the name 'pages' and the url 'special.' <%= link_to "This is very kludgy and will be changed later.", "http://ansuz.lighthouseapp.com/projects/15780-ansuz/tickets/7-make-the-menu-editor-plugin-ui-a-lot-nicer" %> | ||
</div> | ||
<% end -%> | ||
<div class='fullwidth'> | ||
<table class='subdued'> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>URL</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @menu_entries.each do |menu_entry| -%> | ||
<tr class='<%= cycle('odd', 'even') -%>'> | ||
<td><%= link_to h(menu_entry.name), edit_admin_menu_entry_path(menu_entry) -%></td> | ||
<td><%= menu_entry.link -%></td> | ||
<td> | ||
<ul class='admin_actions'> | ||
<li><%= link_to famfamfam_icon("pencil"), edit_admin_menu_entry_path(menu_entry) -%></li> | ||
<li><%= link_to famfamfam_icon("delete"), admin_menu_entry_path(menu_entry), :method => :delete, :confirm => "Are you sure you want to delete this menu entry?" -%></li> | ||
</ul> | ||
</td> | ||
</tr> | ||
<% end -%> | ||
</tbody> | ||
</table> | ||
</div> |
8 changes: 8 additions & 0 deletions
8
vendor/plugins/ansuz_menu_system/app/views/admin/menu_entries/new.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<%= title "New Menu Entry" -%> | ||
<% content_for :sidebar do -%> | ||
<%= link_to "All Menu Entries", admin_menu_entries_path, :class => 'button icon back' -%> | ||
<% end -%> | ||
<% form_for :menu_entry, :url => admin_menu_entries_path do |f| -%> | ||
<%= render :partial => 'form', :locals => { :f => f } -%> | ||
<%= submit_tag("Create Menu Entry") -%> or <%= link_to "Cancel", admin_menu_entries_path -%> | ||
<% end -%> |
15 changes: 15 additions & 0 deletions
15
vendor/plugins/ansuz_menu_system/db/migrate/001_create_menu_entries.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class CreateMenuEntries < ActiveRecord::Migration | ||
def self.up | ||
create_table "menu_entries", :force => true do |t| | ||
t.string "name" | ||
t.string "link" | ||
t.integer "position" | ||
t.integer "parent_id" | ||
t.timestamps | ||
end | ||
end | ||
|
||
def self.end | ||
drop_table "menu_entries" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Ansuz::PluginManagerInstance.register_admin_menu_entry('Manage', 'Menu', '/admin/menu_entries') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace :admin do |admin| | ||
admin.resources :menu_entries | ||
end |