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.
worked on menu entries quite a bit, as well as fixed jquery onflict i…
…n default-pink theme
- Loading branch information
Josh Adams
committed
Sep 18, 2008
1 parent
80c3aaa
commit 5db01b7
Showing
21 changed files
with
180 additions
and
6 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
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
class Ansuz | ||
class 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 | ||
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 |
2 changes: 2 additions & 0 deletions
2
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,2 @@ | ||
Name: <%= f.text_field(:name) -%><br /> | ||
Link: <%= f.text_field(:link) -%><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 -%> | ||
<% 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 -%> |
27 changes: 27 additions & 0 deletions
27
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,27 @@ | ||
<%= title "Menu Entries" -%> | ||
<% content_for :sidebar do -%> | ||
<%= link_to "New Menu Entry", new_admin_menu_entry_path -%> | ||
<% end -%> | ||
<table class='subdued'> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>URL</th> | ||
<th>Actions</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @menu_entries.each do |menu_entry| -%> | ||
<tr class='<%= cycle('odd', 'even') -%>'> | ||
<td><%= link_to h(menu_entry.name), admin_menu_entry_path(menu_entry) -%></td> | ||
<td><%= menu_entry.link -%></td> | ||
<td> | ||
<ul class='admin_actions'> | ||
<li><%= link_to "Edit", edit_admin_menu_entry_path(menu_entry) -%></li> | ||
<li><%= link_to "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> |
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 -%> | ||
<% 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 |
22 changes: 22 additions & 0 deletions
22
vendor/plugins/ansuz_photo_album/app/controllers/admin/photo_albums_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,22 @@ | ||
class Admin::PhotoAlbumsController < Admin::BaseController | ||
unloadable # This is required if you subclass a controller provided by the base rails app | ||
|
||
before_filter :load_photo_album, :only => [:show, :update] | ||
before_filter :load_photos, :only => [:show] | ||
layout 'admin' | ||
|
||
protected | ||
def load_photo_album | ||
@photo_album = Ansuz::JAdams::PhotoAlbum.find(params[:id]) | ||
end | ||
|
||
def load_photos | ||
@photos = @photo_album.photos | ||
end | ||
public | ||
def show | ||
end | ||
|
||
def update | ||
end | ||
end |
45 changes: 45 additions & 0 deletions
45
vendor/plugins/ansuz_photo_album/app/controllers/admin/photos_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,45 @@ | ||
class Admin::PhotosController < Admin::BaseController | ||
unloadable # This is required if you subclass a controller provided by the base rails app | ||
|
||
before_filter :load_photo_album | ||
before_filter :load_new_photo, :only => [:new, :create] | ||
before_filter :load_photo, :only => [:show, :edit, :update, :destroy] | ||
protected | ||
def load_photo_album | ||
@photo_album = Ansuz::JAdams::PhotoAlbum.find(params[:photo_album_id]) | ||
end | ||
|
||
def load_new_photo | ||
@photo = @photo_album.photos.build(params[:photo]) | ||
end | ||
|
||
def load_photo | ||
@photo = @photo_album.photos.find(params[:id]) | ||
end | ||
|
||
public | ||
def new | ||
end | ||
|
||
def create | ||
if @photo.save | ||
flash[:notice] = "The photo was saved successfully." | ||
redirect_to admin_photo_album_path(@photo_album) | ||
else | ||
render :action => 'new' | ||
end | ||
end | ||
|
||
def edit | ||
end | ||
|
||
def update | ||
if @photo.update_attributes(params[:photo]) | ||
flash[:notice] = "Photo was updated succesffully." | ||
redirect_to admin_photo_album_path(@photo_album) | ||
else | ||
flash.now[:error] = "There was a problem updating the photo." | ||
render :action => "edit" | ||
end | ||
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
11 changes: 11 additions & 0 deletions
11
vendor/plugins/ansuz_photo_album/app/views/admin/photo_albums/_photo_album.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,11 @@ | ||
<ul class='photos'> | ||
<% plugin_module.photos.each do |photo| -%> | ||
<li> | ||
<%= link_to image_tag(photo.photo_album_photo_image.url(:thumb)), | ||
photo.photo_album_photo_image.url(:large), | ||
:rel => "lightbox[#{plugin_module.id}]", | ||
:title => "<h2>#{photo.title}</h2>#{photo.caption}" | ||
-%> | ||
</li> | ||
<% end -%> | ||
</ul> |
10 changes: 10 additions & 0 deletions
10
vendor/plugins/ansuz_photo_album/app/views/admin/photo_albums/show.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,10 @@ | ||
<%= title "Photo Album" -%> | ||
<% content_for :sidebar do -%> | ||
<%= link_to "Add Photo", new_admin_photo_album_photo_path(@photo_album) -%> | ||
<% end -%> | ||
<h3>Photos</h3> | ||
<ul class='photos'> | ||
<% @photos.each do |photo| -%> | ||
<li><%= link_to image_tag(photo.photo_album_photo_image.url(:thumb)), edit_admin_photo_album_photo_path(@photo_album, photo) -%></li> | ||
<% end -%> | ||
</ul> |
3 changes: 3 additions & 0 deletions
3
vendor/plugins/ansuz_photo_album/app/views/admin/photos/_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,3 @@ | ||
Title: <%= f.text_field(:title) -%><br /> | ||
Caption: <%= f.text_area(:caption) -%><br /> | ||
File: <%= f.file_field(:photo_album_photo_image) -%><br /> |
5 changes: 5 additions & 0 deletions
5
vendor/plugins/ansuz_photo_album/app/views/admin/photos/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,5 @@ | ||
<%= title "Edit Photo" -%> | ||
<% form_for :photo, :url => admin_photo_album_photo_path(@photo.photo_album, @photo), :html => { :multipart => true, :method => :put } do |f| -%> | ||
<%= render :partial => 'form', :locals => { :f => f } -%> | ||
<%= submit_tag "Update photo" -%> or <%= link_to "Cancel", admin_photo_album_photo_path(@photo_album, @photo) -%> | ||
<% end -%> |
5 changes: 5 additions & 0 deletions
5
vendor/plugins/ansuz_photo_album/app/views/admin/photos/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,5 @@ | ||
<%= title "New Photo" -%> | ||
<% form_for :photo, :url => admin_photo_album_photos_path(@photo_album), :html => { :multipart => true } do |f| -%> | ||
<%= render :partial => 'form', :locals => { :f => f } -%> | ||
<%= submit_tag "Add photo" -%> or <%= link_to "Cancel", admin_photo_album_path(@photo_album) -%> | ||
<% 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 |
---|---|---|
@@ -1 +1,3 @@ | ||
resources :photo_albums, :has_many => [:photos] | ||
namespace :admin do |admin| | ||
admin.resources :photo_albums, :has_many => [:photos] | ||
end |