Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/radiant/radiant into rails_…
Browse files Browse the repository at this point in the history
…2_1_0
  • Loading branch information
saturnflyer committed Aug 18, 2008
2 parents 30fe8d9 + e60e553 commit 4e123c9
Show file tree
Hide file tree
Showing 10 changed files with 289 additions and 58 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -1,6 +1,8 @@
== Change Log

=== Edge
* Make script/extension more friendly, adding help and info commands. [Sean Cribbs]
* Added more render regions to layout, snippet, user, and extension views. [Sean Cribbs]
* Fixed the radiant:update:scripts to find the proper directory [Jim Gay]
* Factor out dev? functionality in StandardTags, allowing other tags to access
it. [Sean Cribbs]
Expand Down
30 changes: 21 additions & 9 deletions app/views/admin/extension/index.html.haml
Expand Up @@ -11,18 +11,30 @@

%h1 Extensions

= render_region :top

%table#extensions.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0"}
%thead
%tr
%th.extension Extension
%th.website Website
%th.version Version
- render_region :thead do |thead|
- thead.title_header do
%th.extension Extension
- thead.website_header do
%th.website Website
- thead.version_header do
%th.version Version
%tbody
- @extensions.each do |extension|
%tr.node.level-1
%td.extension
%h4= h extension.extension_name
%p= h extension.description
%td.website
= extension.url.nil? || extension.url.empty? ? "" : link_to("Website", extension.url, :target => "_blank")
%td.version= h extension.version
- render_region :tbody do |tbody|
- tbody.title_cell do
%td.extension
%h4= h extension.extension_name
%p= h extension.description
- tbody.website_cell do
%td.website
= extension.url.nil? || extension.url.empty? ? "" : link_to("Website", extension.url, :target => "_blank")
- tbody.version_cell do
%td.version= h extension.version

= render_region :bottom
41 changes: 25 additions & 16 deletions app/views/admin/layout/index.html.haml
@@ -1,25 +1,34 @@
%h1 Layouts

%p
Use layouts to apply a visual look to a Web page. Layouts can contain special tags to include
page content and other elements such as the header or footer. Click on a layout name below to
edit it or click <code>Remove</code> to delete it.
- render_region :top do |top|
- top.help_text do
%p
Use layouts to apply a visual look to a Web page. Layouts can contain special tags to include
page content and other elements such as the header or footer. Click on a layout name below to
edit it or click <code>Remove</code> to delete it.

%table#layouts.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0" }
%thead
%tr
%th.layout
Layout
%th.modify
Modify
- render_region :thead do |thead|
- thead.title_header do
%th.layout
Layout
- thead.modify_header do
%th.modify
Modify
%tbody
- @layouts.each do |layout|
%tr.node.level-1
%td.layout
= image('layout', :alt => 'layout-icon')
= link_to layout.name, layout_edit_url(:id => layout)
%td.remove
= link_to image('remove', :alt => 'Remove Layout'), layout_remove_url(:id => layout)
- render_region :tbody do |tbody|
- tbody.title_cell do
%td.layout
= image('layout', :alt => 'layout-icon')
= link_to layout.name, layout_edit_url(:id => layout)
- tbody.modify_cell do
%td.remove
= link_to image('remove', :alt => 'Remove Layout'), layout_remove_url(:id => layout)

%p
= link_to image('new-layout', :alt => "New Layout"), layout_new_url
- render_region :bottom do |bottom|
- bottom.new_button do
%p
= link_to image('new-layout', :alt => "New Layout"), layout_new_url
30 changes: 20 additions & 10 deletions app/views/admin/snippet/index.html.haml
@@ -1,20 +1,30 @@
%h1 Snippets

%p Snippets are generally small pieces of content which are included in other pages or layouts.
- render_region :top do |top|
- top.help_text do
%p Snippets are generally small pieces of content which are included in other pages or layouts.

%table#snippets.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0"}
%thead
%tr
%th.snippet Snippet
%th.modify Modify
- render_region :thead do |thead|
- thead.title_header do
%th.snippet Snippet
- thead.modify_header do
%th.modify Modify
%tbody
- @snippets.each do |snippet|
%tr.node.level-1
%td.snippet
= image('snippet', :alt => 'snippet-icon')
%span= link_to snippet.name, snippet_edit_url(:id => snippet)
%td.remove
= link_to image('remove', :alt => 'Remove Snippet'), snippet_remove_url(:id => snippet)
- render_region :tbody do |tbody|
- tbody.title_cell do
%td.snippet
= image('snippet', :alt => 'snippet-icon')
%span= link_to snippet.name, snippet_edit_url(:id => snippet)
- tbody.modify_cell do
%td.remove
= link_to image('remove', :alt => 'Remove Snippet'), snippet_remove_url(:id => snippet)

%p
= link_to image('new-snippet', :alt => 'New Snippet'), snippet_new_url
- render_region :bottom do |bottom|
- bottom.new_button do
%p
= link_to image('new-snippet', :alt => 'New Snippet'), snippet_new_url
40 changes: 26 additions & 14 deletions app/views/admin/user/index.html.haml
@@ -1,23 +1,35 @@
%h1 Users

= render_region :top

%table#users.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0"}
%thead
%tr
%th.user Name / Login
%th.roles Roles
%th.modify Modify
- render_region :thead do |thead|
- thead.title_header do
%th.user Name / Login
- thead.roles_header do
%th.roles Roles
- thead.modify_header do
%th.modify Modify
%tbody
- @users.each do |user|
%tr.node.level-1
%td.user
= link_to user.name, user_edit_url(:id => user)
%small.login= h user.login
%td.roles= roles(user)
%td.remove
- if user == current_user
= image('remove-disabled', :alt => 'Remove')
- else
= link_to(image('remove', :alt => 'Remove User'), user_remove_url(:id => user))
- render_region :tbody do |tbody|
- tbody.title_cell do
%td.user
= link_to user.name, user_edit_url(:id => user)
%small.login= h user.login
- tbody.roles_cell do
%td.roles= roles(user)
- tbody.modify_cell do
%td.remove
- if user == current_user
= image('remove-disabled', :alt => 'Remove')
- else
= link_to(image('remove', :alt => 'Remove User'), user_remove_url(:id => user))

%p
= link_to image('new-user', :alt => 'New User'), user_new_url, :title => "New User"
- render_region :bottom do |bottom|
- bottom.new_button do
%p
= link_to image('new-user', :alt => 'New User'), user_new_url, :title => "New User"
2 changes: 1 addition & 1 deletion lib/generators/extension/templates/tasks.rake
Expand Up @@ -15,10 +15,10 @@ namespace :radiant do
desc "Copies public assets of the <%= extension_name %> to the instance public/ directory."
task :update => :environment do
is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
puts "Copying assets from <%= class_name %>"
Dir[<%= class_name %>.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
path = file.sub(<%= class_name %>.root, '')
directory = File.dirname(path)
puts "Copying #{path}..."
mkdir_p RAILS_ROOT + directory
cp file, RAILS_ROOT + path
end
Expand Down
29 changes: 28 additions & 1 deletion lib/radiant/admin_ui.rb
Expand Up @@ -78,7 +78,7 @@ def clear
attr_accessor :tabs

# Region sets
attr_accessor :page, :snippet, :layout, :user
attr_accessor :page, :snippet, :layout, :user, :extension

def initialize
@tabs = TabSet.new
Expand All @@ -90,6 +90,7 @@ def load_default_regions
@snippet = load_default_snippet_regions
@layout = load_default_layout_regions
@user = load_default_user_regions
@extension = load_default_extension_regions
end

private
Expand Down Expand Up @@ -121,6 +122,11 @@ def load_default_user_regions
edit_roles edit_notes}
edit.form_bottom.concat %w{edit_timestamp edit_buttons}
end
user.index = RegionSet.new do |index|
index.thead.concat %w{title_header roles_header modify_header}
index.tbody.concat %w{title_cell roles_cell modify_cell}
index.bottom.concat %w{new_button}
end
end
end

Expand All @@ -131,6 +137,12 @@ def load_default_snippet_regions
edit.form.concat %w{edit_title edit_content edit_filter edit_timestamp}
edit.form_bottom.concat %w{edit_buttons}
end
snippet.index = RegionSet.new do |index|
index.top.concat %w{help_text}
index.thead.concat %w{title_header modify_header}
index.tbody.concat %w{title_cell modify_cell}
index.bottom.concat %w{new_button}
end
end
end

Expand All @@ -141,6 +153,21 @@ def load_default_layout_regions
edit.form.concat %w{edit_title edit_extended_metadata edit_content edit_timestamp}
edit.form_bottom.concat %w{edit_buttons}
end
layout.index = RegionSet.new do |index|
index.top.concat %w{help_text}
index.thead.concat %w{title_header modify_header}
index.tbody.concat %w{title_cell modify_cell}
index.bottom.concat %w{new_button}
end
end
end

def load_default_extension_regions
returning OpenStruct.new do |extension|
extension.index = RegionSet.new do |index|
index.thead.concat %w{title_header website_header version_header}
index.tbody.concat %w{title_cell website_cell version_cell}
end
end
end
end
Expand Down

0 comments on commit 4e123c9

Please sign in to comment.