Skip to content

Commit

Permalink
major refactor and upgrade for Radiant 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew vonderLuft committed Apr 22, 2011
1 parent aa5e459 commit 221588b
Show file tree
Hide file tree
Showing 31 changed files with 516 additions and 225 deletions.
11 changes: 11 additions & 0 deletions HELP.textile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
The *Sitemap Search* extension, as its name implies, enables you to search your sitemap; pages, snippets and layouts

h2. Usage

The Search tab is located under 'Content' to the right of 'Pages'

The Search box is located in the lower bar of the index page for Pages, Snippets, Layouts.
If you have the the BannerRotator extension and/or the Templates extension installed, it will be on those index pages also.
And of course it is also on the Search Results page.

Enter your search string, and click the button. Results are sortable by attribute.
15 changes: 0 additions & 15 deletions README

This file was deleted.

51 changes: 51 additions & 0 deletions README.textile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
h2. Sitemap Search

Created by Sean Cribbs in Fall 2007.
Revised and generalized by Sean Cribbs and Andrew vonderLuft in August 2008.
Extended and refactored by Andrew vonderLuft since then.

Provides a simple content search of pages, snippets, and layouts.
Contains rudimentary support for scoping searches within a given site when using the multi_site extension.

h2. Revision History

* 4/2011 - UI upgrade for Radiant >= 1.0.0; added Layouts; added templates to search from "Templates extension":https://github.com/avonderluft/radiant-templates-extension
* 2/2010 - add banners to search, from "BannerRotator extension":https://github.com/avonderluft/radiant-banner_rotator-extension
* 2/2009 - upgraded for compatibility with Radiant 0.7
* 12/2008 - initial commit

h2. Requirements

* current version requires Radiant >= 1.0.0
* tag 0.7.2 available for earlier versions

page_list_view extension must be installed

From your RADIANT_ROOT:

<pre>
$ script/extension install page_list_view
</pre>

h2. Installation

From your RADIANT_ROOT:

<pre>
$ script/extension install sitemap_search
</pre>

Restart your radiant app, and you should be good to go.

h2. Usage

See the Help doc.

h2. To do

* Include page fields, e.g. 'keywords' and 'description'

h2. Acknowledgments

Thanks to Digital Pulp for funding the initial development of this extension as part of the Redken.com project.
Further support for generalization and release was provided by Con-way.
15 changes: 15 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "radiant-sitemap_search-extension"
gem.summary = %Q{Sitemap Search Extension for Radiant CMS}
gem.description = %Q{Adds search feature for pages, snippets, layouts, et al.}
gem.email = "[email protected]"
gem.homepage = "https://github.com/avonderluft/radiant-sitemap_search-extension"
gem.authors = ['Andrew vonderLuft','Sean Cribbs']
gem.add_dependency 'radiant', ">=1.0.0"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
rescue LoadError
puts "Jeweler (or a dependency) not available. This is only required if you plan to package banner_rotator as a gem."
end
# I think this is the one that should be moved to the extension Rakefile template

# In rails 1.2, plugins aren't available in the path until they're loaded.
Expand Down
13 changes: 13 additions & 0 deletions app/controllers/admin/search_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Admin::SearchController < ApplicationController
def index
if params[:q]
@pages = Page.search(params[:q])
if current_user.designer? || current_user.admin?
@snippets = Snippet.search(params[:q])
@layouts = Layout.search(params[:q])
@templates = Template.search(params[:q]) if defined?(TemplatesExtension)
@banners = Banner.search(params[:q]) if defined?(BannerRotatorExtension)
end
end
end
end
7 changes: 0 additions & 7 deletions app/controllers/searches_controller.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module SearchesHelper
module Admin::SearchHelper
include Admin::ListViewHelper

def link_text(object)
Expand All @@ -15,12 +15,9 @@ def link_text(object)

def link_url(object)
case object
when Page
page_edit_path(:id => object)
when Snippet
snippet_edit_path(:id => object)
when Banner
edit_admin_banner_path(:id => object)
when Page; edit_admin_page_path(:id => object)
when Snippet; edit_admin_snippet_path(:id => object)
when Banner; edit_admin_banner_path(:id => object)
end
end

Expand Down
21 changes: 0 additions & 21 deletions app/views/admin/_sitemap_search.html.haml

This file was deleted.

28 changes: 28 additions & 0 deletions app/views/admin/pages/index.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
- @page_title = t('pages') + ' - ' + default_page_title

.outset
= render_region :top
%table.index#pages{:summary=>t('page_hierarchy')}
%thead
%tr
- render_region :sitemap_head do |sitemap_head|
- sitemap_head.title_column_header do
%th.name= t('page')
- sitemap_head.status_column_header do
%th.status= t('status')
- sitemap_head.actions_column_header do
%th.actions= t('modify')
%tbody
- if @homepage
= render_node @homepage
- else
%tr
%td.empty{:colspan => admin.page.index.node.length}= t('no_pages')
= render_region :bottom

#actions
%ul
- unless @homepage
%li= link_to image('plus') + " " + t("new_homepage"), new_admin_page_path, :class => 'action_button'
- else
= render :partial => 'admin/search/search_action'
27 changes: 27 additions & 0 deletions app/views/admin/pages/page_list_view.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- include_javascript 'admin/tablekit'
- include_javascript 'admin/ruledtable'
- @page_title = t('pages') + ' - ' + default_page_title

.outset
= render_region :top
%table.index.sortable{:summary=>"Sortable list of pages"}
%thead
%tr
- list_display_attributes.each do |att|
%th{:class => attribute_header_class(att), :id => attribute_header_id(att) }
%a
%span.w1= att.humanize
%tbody
- if @pages.any?
= render :partial => 'page', :collection => @pages
- else
%tr
%td.empty{:colspan => list_display_attributes.length}= t('no_pages')
#actions
= pagination_for(@pages)
%ul
- unless @pages.any?
%li= link_to image('plus') + " " + t("new_homepage"), new_admin_page_path, :class => 'action_button'
= render :partial => 'admin/search/search_action'

= render :partial => 'page_list_view_styles'
11 changes: 11 additions & 0 deletions app/views/admin/search/_banner.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
%tr[banner]
%td.preview
%a{:href => edit_admin_banner_url(banner)}
%img.snapshot{:src => banner.background_image, :alt => "#{banner.name} #{t('banner_rotator.banner')}", :title => "#{t('banner_rotator.edit')} #{banner.name} #{t('banner_rotator.banner')}"}
%td.name= link_to banner.name, edit_admin_banner_url(banner)
%td.status
= banner.description if banner.description
%td.status{:style=>"font-size:75%"}
= banner.link_url if banner.link_url
%td.status
= banner.updated_at.strftime("%m/%d/%Y at %I:%M %p") if banner.updated_at
5 changes: 5 additions & 0 deletions app/views/admin/search/_banner_index_bottom.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#actions
= pagination_for(@banners)
%ul
%li= link_to image('plus') + " " + t('banner_rotator.new_banner'), new_admin_banner_url
= render :partial => 'admin/search/search_action'
8 changes: 8 additions & 0 deletions app/views/admin/search/_layout.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%tr[layout]
%td.name
= image('layout', :alt => '')
= link_to layout.name, edit_admin_layout_url(layout)
%td.status
= layout.updated_by.name if layout.updated_by
%td.status
= layout.updated_at.strftime("%m/%d/%Y at %I:%M %p") if layout.updated_at
5 changes: 5 additions & 0 deletions app/views/admin/search/_layout_index_bottom.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#actions
= pagination_for(@layouts)
%ul
%li= link_to image('plus') + " " + t('new_layout'), new_admin_layout_url, :class => 'action_button'
= render :partial => 'admin/search/search_action'
15 changes: 15 additions & 0 deletions app/views/admin/search/_results_nav.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.nav
= link_to t('pages') + " (#{@pages.size})", '#pages'
- if designer?
&bull;
= link_to t('snippets') + " (#{@snippets.size})", '#snippets'
&bull;
= link_to t('layouts') + " (#{@layouts.size})", '#layouts'
- if defined?(TemplatesExtension)
&bull;
= link_to t('templates') + " (#{@templates.size})", '#templates'
- if defined?(BannerRotatorExtension)
&bull;
= link_to t('banner_rotator.banners') + " (#{@banners.size})", '#banners'
&bull;
= link_to 'Top', '#top'
7 changes: 7 additions & 0 deletions app/views/admin/search/_search_action.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
%li
#site_search.action_button
- form_for :site_search, :url => search_path, :html => { :class => 'button_form', :multipart => true } do |f|
%span
= f.label :site_search, image('search')
= text_field_tag :q, params[:q], :title => t('sitemap_search.search_content'), :cols => "20"
= f.submit t('sitemap_search.search_content')
8 changes: 8 additions & 0 deletions app/views/admin/search/_snippet.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%tr[snippet]
%td.name
= image('snippet', :alt => '')
= link_to snippet.name, edit_admin_snippet_url(snippet)
%td.status
= snippet.updated_by.name if snippet.updated_by
%td.status
= snippet.updated_at.strftime("%m/%d/%Y at %I:%M %p") if snippet.updated_at
5 changes: 5 additions & 0 deletions app/views/admin/search/_snippet_index_bottom.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#actions
= pagination_for(@snippets)
%ul
%li= link_to image('plus') + " " + t('new_snippet'), new_admin_snippet_url, :class => 'action_button'
= render :partial => 'admin/search/search_action'
8 changes: 8 additions & 0 deletions app/views/admin/search/_template.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%tr[template]
%td.name
= image('template', :alt => '')
= link_to template.name, edit_admin_template_url(template)
%td.status
= template.page_class_name if template.page_class_name
%td.status
= template.updated_at.strftime("%m/%d/%Y at %I:%M %p") if template.updated_at
4 changes: 4 additions & 0 deletions app/views/admin/search/_template_index_bottom.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#actions
%ul
%li= link_to image('plus') + " " + t('new_template'), new_admin_template_url
= render :partial => 'admin/search/search_action'
Loading

0 comments on commit 221588b

Please sign in to comment.