radiant-people-extension 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README +3 -0
- data/Rakefile +141 -0
- data/VERSION +1 -0
- data/app/controllers/admin/people_controller.rb +41 -0
- data/app/helpers/admin/people_helper.rb +2 -0
- data/app/models/person.rb +16 -0
- data/app/views/admin/people/_form.html.haml +15 -0
- data/app/views/admin/people/_person.html.haml +9 -0
- data/app/views/admin/people/edit.html.haml +12 -0
- data/app/views/admin/people/index.html.haml +46 -0
- data/app/views/admin/people/new.html.haml +13 -0
- data/cucumber.yml +1 -0
- data/db/migrate/20090905004948_create_people.rb +17 -0
- data/features/support/env.rb +16 -0
- data/features/support/paths.rb +14 -0
- data/lib/tasks/people_extension_tasks.rake +28 -0
- data/people_extension.rb +48 -0
- data/radiant-people-extension.gemspec +75 -0
- data/spec/controllers/admin/people_controller_spec.rb +14 -0
- data/spec/helpers/admin/people_helper_spec.rb +11 -0
- data/spec/models/person_spec.rb +24 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +36 -0
- metadata +110 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg
|
data/README
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |gem|
|
4
|
+
gem.name = "radiant-people-extension"
|
5
|
+
gem.summary = %Q{Manage People in Radiant CMS}
|
6
|
+
gem.description = %Q{A generic and extendable way to manage people in Radiant CMS}
|
7
|
+
gem.email = "jim@saturnflyer.com"
|
8
|
+
gem.homepage = "http://github.com/saturnflyer/radiant-people-extension"
|
9
|
+
gem.authors = ["Jim Gay"]
|
10
|
+
gem.add_dependency 'will_paginate'
|
11
|
+
gem.add_dependency 'searchlogic'
|
12
|
+
gem.add_dependency 'merger'
|
13
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
+
end
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler (or a dependency) not available. This is only required if you plan to package gemmy as a gem."
|
17
|
+
end
|
18
|
+
|
19
|
+
# I think this is the one that should be moved to the extension Rakefile template
|
20
|
+
|
21
|
+
# In rails 1.2, plugins aren't available in the path until they're loaded.
|
22
|
+
# Check to see if the rspec plugin is installed first and require
|
23
|
+
# it if it is. If not, use the gem version.
|
24
|
+
|
25
|
+
# Determine where the RSpec plugin is by loading the boot
|
26
|
+
unless defined? RADIANT_ROOT
|
27
|
+
ENV["RAILS_ENV"] = "test"
|
28
|
+
case
|
29
|
+
when ENV["RADIANT_ENV_FILE"]
|
30
|
+
require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot"
|
31
|
+
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
|
32
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
|
33
|
+
else
|
34
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
require 'rake'
|
39
|
+
require 'rake/rdoctask'
|
40
|
+
require 'rake/testtask'
|
41
|
+
|
42
|
+
rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
|
43
|
+
$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
|
44
|
+
require 'spec/rake/spectask'
|
45
|
+
require 'cucumber'
|
46
|
+
require 'cucumber/rake/task'
|
47
|
+
|
48
|
+
# Cleanup the RADIANT_ROOT constant so specs will load the environment
|
49
|
+
Object.send(:remove_const, :RADIANT_ROOT)
|
50
|
+
|
51
|
+
extension_root = File.expand_path(File.dirname(__FILE__))
|
52
|
+
|
53
|
+
task :default => :spec
|
54
|
+
task :stats => "spec:statsetup"
|
55
|
+
|
56
|
+
desc "Run all specs in spec directory"
|
57
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
58
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
59
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
60
|
+
end
|
61
|
+
|
62
|
+
task :features => 'spec:integration'
|
63
|
+
|
64
|
+
namespace :spec do
|
65
|
+
desc "Run all specs in spec directory with RCov"
|
66
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
67
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
68
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
69
|
+
t.rcov = true
|
70
|
+
t.rcov_opts = ['--exclude', 'spec', '--rails']
|
71
|
+
end
|
72
|
+
|
73
|
+
desc "Print Specdoc for all specs"
|
74
|
+
Spec::Rake::SpecTask.new(:doc) do |t|
|
75
|
+
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
76
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
77
|
+
end
|
78
|
+
|
79
|
+
[:models, :controllers, :views, :helpers].each do |sub|
|
80
|
+
desc "Run the specs under spec/#{sub}"
|
81
|
+
Spec::Rake::SpecTask.new(sub) do |t|
|
82
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
83
|
+
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
desc "Run the Cucumber features"
|
88
|
+
Cucumber::Rake::Task.new(:integration) do |t|
|
89
|
+
t.fork = true
|
90
|
+
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
|
91
|
+
# t.feature_pattern = "#{extension_root}/features/**/*.feature"
|
92
|
+
t.profile = "default"
|
93
|
+
end
|
94
|
+
|
95
|
+
# Setup specs for stats
|
96
|
+
task :statsetup do
|
97
|
+
require 'code_statistics'
|
98
|
+
::STATS_DIRECTORIES << %w(Model\ specs spec/models)
|
99
|
+
::STATS_DIRECTORIES << %w(View\ specs spec/views)
|
100
|
+
::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers)
|
101
|
+
::STATS_DIRECTORIES << %w(Helper\ specs spec/views)
|
102
|
+
::CodeStatistics::TEST_TYPES << "Model specs"
|
103
|
+
::CodeStatistics::TEST_TYPES << "View specs"
|
104
|
+
::CodeStatistics::TEST_TYPES << "Controller specs"
|
105
|
+
::CodeStatistics::TEST_TYPES << "Helper specs"
|
106
|
+
::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
|
107
|
+
end
|
108
|
+
|
109
|
+
namespace :db do
|
110
|
+
namespace :fixtures do
|
111
|
+
desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
|
112
|
+
task :load => :environment do
|
113
|
+
require 'active_record/fixtures'
|
114
|
+
ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
|
115
|
+
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
|
116
|
+
Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
desc 'Generate documentation for the people extension.'
|
124
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
125
|
+
rdoc.rdoc_dir = 'rdoc'
|
126
|
+
rdoc.title = 'PeopleExtension'
|
127
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
128
|
+
rdoc.rdoc_files.include('README')
|
129
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
130
|
+
end
|
131
|
+
|
132
|
+
# For extensions that are in transition
|
133
|
+
desc 'Test the people extension.'
|
134
|
+
Rake::TestTask.new(:test) do |t|
|
135
|
+
t.libs << 'lib'
|
136
|
+
t.pattern = 'test/**/*_test.rb'
|
137
|
+
t.verbose = true
|
138
|
+
end
|
139
|
+
|
140
|
+
# Load any custom rakefiles for extension
|
141
|
+
Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class Admin::PeopleController < Admin::ResourceController
|
2
|
+
before_filter :load_stylesheets
|
3
|
+
before_filter :add_styles
|
4
|
+
|
5
|
+
def index
|
6
|
+
if params[:person] #search
|
7
|
+
@people = Person.search(params[:person]).paginate(:page => params[:page], :per_page => 50)
|
8
|
+
else
|
9
|
+
@people = Person.all.paginate(:page => params[:page], :per_page => 50)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def merge
|
14
|
+
people_ids = params[:merge][:person].collect{|p| p[0].to_i }.to_a
|
15
|
+
@people = Person.find_all_by_id(people_ids, :order => :id)
|
16
|
+
@person = @people.first
|
17
|
+
@person.merge!(@people)
|
18
|
+
flash[:notice] = "The people you selected have been merged into #{@person.full_name}."
|
19
|
+
redirect_to edit_admin_person_path(@person)
|
20
|
+
end
|
21
|
+
|
22
|
+
def announce_saved
|
23
|
+
flash[:notice] = "#{@person.full_name} saved below."
|
24
|
+
end
|
25
|
+
|
26
|
+
def load_stylesheets
|
27
|
+
# include_stylesheet 'admin/people'
|
28
|
+
end
|
29
|
+
def add_styles
|
30
|
+
@content_for_page_css ||= ''
|
31
|
+
@content_for_page_css << %{
|
32
|
+
.search { background: #eae3c5; border: 1px solid #fff; padding: 10px}
|
33
|
+
.label_head { float: left; padding: 0; margin: 0 10px 0 0; }
|
34
|
+
.form-area { overflow: hidden;}
|
35
|
+
.form-area td { vertical-align: top;}
|
36
|
+
h2 { color: #b7b092; margin: 1em 0 0; border-bottom: 2px solid #eae3c5; }
|
37
|
+
.personExtras { clear: both;}
|
38
|
+
.recordPart { float: left;}
|
39
|
+
.recordPart label, .recordPart input { display: block; }}
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Person < ActiveRecord::Base
|
2
|
+
include Merger
|
3
|
+
validates_presence_of :first_name
|
4
|
+
validates_presence_of :last_name
|
5
|
+
|
6
|
+
default_scope :order => 'last_name, first_name, middle_name DESC'
|
7
|
+
|
8
|
+
def full_name(*options)
|
9
|
+
options = options.extract_options!
|
10
|
+
if options[:last_name_first]
|
11
|
+
"#{last_name}, #{first_name} #{middle_name}".squeeze(' ').strip
|
12
|
+
else
|
13
|
+
"#{first_name} #{middle_name} #{last_name}".squeeze(' ').strip
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
.recordPart
|
2
|
+
= f.label :first_name
|
3
|
+
= f.text_field :first_name
|
4
|
+
= f.error_message_on :first_name
|
5
|
+
.recordPart
|
6
|
+
= f.label :middle_name
|
7
|
+
= f.text_field :middle_name
|
8
|
+
= f.error_message_on :middle_name
|
9
|
+
.recordPart
|
10
|
+
= f.label :last_name
|
11
|
+
= f.text_field :last_name
|
12
|
+
= f.error_message_on :last_name
|
13
|
+
.recordPart
|
14
|
+
= f.label :gender
|
15
|
+
= f.select :gender, [['male','male'],['female','female']], :include_blank => true
|
@@ -0,0 +1,9 @@
|
|
1
|
+
%tr
|
2
|
+
- render_region :person do |p|
|
3
|
+
- p.name_column do
|
4
|
+
%td
|
5
|
+
- if params[:person]
|
6
|
+
= check_box_tag "merge[person][#{person.id}]", 1, true
|
7
|
+
= link_to(person.full_name(:last_name_first => true), edit_admin_person_path(person))
|
8
|
+
- p.gender_column do
|
9
|
+
%td= person.gender
|
@@ -0,0 +1,12 @@
|
|
1
|
+
%h1= @person.full_name
|
2
|
+
- form_for ['admin',@person], :method => :put do |f|
|
3
|
+
.form-area
|
4
|
+
- @person_form = f
|
5
|
+
- render_region :person_info do |person_info|
|
6
|
+
= render 'form', :f => f
|
7
|
+
%p.buttons
|
8
|
+
- render_region :buttons do |buttons|
|
9
|
+
= save_model_button(@person)
|
10
|
+
= save_model_and_continue_editing_button(@person)
|
11
|
+
or
|
12
|
+
= link_to 'Cancel', admin_people_path
|
@@ -0,0 +1,46 @@
|
|
1
|
+
.outset
|
2
|
+
- render_region :top do |top|
|
3
|
+
- top.search do
|
4
|
+
.search
|
5
|
+
%h2.label_head Filter
|
6
|
+
- form_tag admin_people_path, :method => :get do
|
7
|
+
= label :person, :last_name
|
8
|
+
= text_field :person, :last_name
|
9
|
+
= label :person, :first_name
|
10
|
+
= text_field :person, :first_name
|
11
|
+
= submit_tag 'Search'
|
12
|
+
= link_to 'Clear results...', admin_people_path
|
13
|
+
- if params[:person]
|
14
|
+
- form_for :merge, :url => merge_admin_people_path() do |f|
|
15
|
+
%table.index
|
16
|
+
%thead
|
17
|
+
%tr
|
18
|
+
- render_region :people_head do |people_head|
|
19
|
+
- people_head.name_column_head do
|
20
|
+
%th Name
|
21
|
+
- people_head.gender_column_head do
|
22
|
+
%th Gender
|
23
|
+
%tbody
|
24
|
+
- unless @people.blank?
|
25
|
+
- @people.each do |person|
|
26
|
+
= render_person(person)
|
27
|
+
%p= submit_tag 'Merge'
|
28
|
+
|
29
|
+
- else
|
30
|
+
%table.index
|
31
|
+
%thead
|
32
|
+
%tr
|
33
|
+
- render_region :people_head do |people_head|
|
34
|
+
- people_head.name_column_head do
|
35
|
+
%th Name
|
36
|
+
- people_head.gender_column_head do
|
37
|
+
%th Gender
|
38
|
+
%tbody
|
39
|
+
- unless @people.blank?
|
40
|
+
- @people.each do |person|
|
41
|
+
- @current_person = person # for additions
|
42
|
+
= render 'person', :person => person
|
43
|
+
%p= will_paginate @people
|
44
|
+
#actions
|
45
|
+
%ul
|
46
|
+
%li= link_to "Add Person", new_admin_person_path
|
@@ -0,0 +1,13 @@
|
|
1
|
+
- include_stylesheet 'admin/people'
|
2
|
+
%h1 New Person
|
3
|
+
- form_for ['admin',@person] do |f|
|
4
|
+
.form-area
|
5
|
+
- @person_form = f
|
6
|
+
- render_region :person_info do |person_info|
|
7
|
+
= render 'form', :f => f
|
8
|
+
%p.buttons
|
9
|
+
- render_region :buttons do |buttons|
|
10
|
+
= save_model_button(@person)
|
11
|
+
= save_model_and_continue_editing_button(@person)
|
12
|
+
or
|
13
|
+
= link_to 'Cancel', admin_people_path
|
data/cucumber.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
default: --format progress features --tags ~@proposed,~@in_progress
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreatePeople < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :people do |t|
|
4
|
+
t.string :prefix
|
5
|
+
t.string :first_name
|
6
|
+
t.string :middle_name
|
7
|
+
t.string :last_name
|
8
|
+
t.string :gender
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table :people
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Sets up the Rails environment for Cucumber
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
# Extension root
|
4
|
+
extension_env = File.expand_path(File.dirname(__FILE__) + '/../../../../../config/environment')
|
5
|
+
require extension_env+'.rb'
|
6
|
+
|
7
|
+
Dir.glob(File.join(RADIANT_ROOT, "features", "**", "*.rb")).each {|step| require step}
|
8
|
+
|
9
|
+
Cucumber::Rails::World.class_eval do
|
10
|
+
include Dataset
|
11
|
+
datasets_directory "#{RADIANT_ROOT}/spec/datasets"
|
12
|
+
Dataset::Resolver.default = Dataset::DirectoryResolver.new("#{RADIANT_ROOT}/spec/datasets", File.dirname(__FILE__) + '/../../spec/datasets', File.dirname(__FILE__) + '/../datasets')
|
13
|
+
self.datasets_database_dump_path = "#{Rails.root}/tmp/dataset"
|
14
|
+
|
15
|
+
# dataset :people
|
16
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
namespace :radiant do
|
2
|
+
namespace :extensions do
|
3
|
+
namespace :people do
|
4
|
+
|
5
|
+
desc "Runs the migration of the People extension"
|
6
|
+
task :migrate => :environment do
|
7
|
+
require 'radiant/extension_migrator'
|
8
|
+
if ENV["VERSION"]
|
9
|
+
PeopleExtension.migrator.migrate(ENV["VERSION"].to_i)
|
10
|
+
else
|
11
|
+
PeopleExtension.migrator.migrate
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Copies public assets of the People to the instance public/ directory."
|
16
|
+
task :update => :environment do
|
17
|
+
is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
|
18
|
+
puts "Copying assets from PeopleExtension"
|
19
|
+
Dir[PeopleExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
|
20
|
+
path = file.sub(PeopleExtension.root, '')
|
21
|
+
directory = File.dirname(path)
|
22
|
+
mkdir_p RAILS_ROOT + directory, :verbose => false
|
23
|
+
cp file, RAILS_ROOT + path, :verbose => false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/people_extension.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
class PeopleExtension < Radiant::Extension
|
3
|
+
version "#{File.read(File.expand_path(File.dirname(__FILE__)) + '/VERSION')}"
|
4
|
+
description "Manage people."
|
5
|
+
url "http://saturnflyer.com/"
|
6
|
+
|
7
|
+
extension_config do |config|
|
8
|
+
config.gem 'will_paginate'
|
9
|
+
config.gem 'searchlogic'
|
10
|
+
config.gem 'merger'
|
11
|
+
end
|
12
|
+
|
13
|
+
define_routes do |map|
|
14
|
+
map.merge_admin_people '/admin/people/merge.:format', :controller => 'admin/people', :action => 'merge', :conditions => {:method => :post}
|
15
|
+
map.namespace :admin do |admin|
|
16
|
+
admin.resources :people, :member => { :remove => :get }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def activate
|
21
|
+
Radiant::AdminUI.class_eval do
|
22
|
+
attr_accessor :people
|
23
|
+
end
|
24
|
+
admin.people = load_default_people_regions
|
25
|
+
tab "People" do
|
26
|
+
add_item 'All People', "/admin/people"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def deactivate
|
31
|
+
end
|
32
|
+
|
33
|
+
def load_default_people_regions
|
34
|
+
returning OpenStruct.new do |people|
|
35
|
+
people.index = Radiant::AdminUI::RegionSet.new do |index|
|
36
|
+
index.top.concat %w{search}
|
37
|
+
index.people_head.concat %w{name_column_head gender_column_head}
|
38
|
+
index.person.concat %w{name_column gender_column}
|
39
|
+
end
|
40
|
+
people.new = Radiant::AdminUI::RegionSet.new do |new|
|
41
|
+
new.person_info.concat %w{}
|
42
|
+
new.buttons.concat %w{}
|
43
|
+
end
|
44
|
+
people.edit = people.new.clone
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{radiant-people-extension}
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jim Gay"]
|
12
|
+
s.date = %q{2010-01-19}
|
13
|
+
s.description = %q{A generic and extendable way to manage people in Radiant CMS}
|
14
|
+
s.email = %q{jim@saturnflyer.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"README",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"app/controllers/admin/people_controller.rb",
|
24
|
+
"app/helpers/admin/people_helper.rb",
|
25
|
+
"app/models/person.rb",
|
26
|
+
"app/views/admin/people/_form.html.haml",
|
27
|
+
"app/views/admin/people/_person.html.haml",
|
28
|
+
"app/views/admin/people/edit.html.haml",
|
29
|
+
"app/views/admin/people/index.html.haml",
|
30
|
+
"app/views/admin/people/new.html.haml",
|
31
|
+
"cucumber.yml",
|
32
|
+
"db/migrate/20090905004948_create_people.rb",
|
33
|
+
"features/support/env.rb",
|
34
|
+
"features/support/paths.rb",
|
35
|
+
"lib/tasks/people_extension_tasks.rake",
|
36
|
+
"people_extension.rb",
|
37
|
+
"radiant-people-extension.gemspec",
|
38
|
+
"spec/controllers/admin/people_controller_spec.rb",
|
39
|
+
"spec/helpers/admin/people_helper_spec.rb",
|
40
|
+
"spec/models/person_spec.rb",
|
41
|
+
"spec/spec.opts",
|
42
|
+
"spec/spec_helper.rb"
|
43
|
+
]
|
44
|
+
s.homepage = %q{http://github.com/saturnflyer/radiant-people-extension}
|
45
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
46
|
+
s.require_paths = ["lib"]
|
47
|
+
s.rubygems_version = %q{1.3.5}
|
48
|
+
s.summary = %q{Manage People in Radiant CMS}
|
49
|
+
s.test_files = [
|
50
|
+
"spec/controllers/admin/people_controller_spec.rb",
|
51
|
+
"spec/helpers/admin/people_helper_spec.rb",
|
52
|
+
"spec/models/person_spec.rb",
|
53
|
+
"spec/spec_helper.rb"
|
54
|
+
]
|
55
|
+
|
56
|
+
if s.respond_to? :specification_version then
|
57
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
58
|
+
s.specification_version = 3
|
59
|
+
|
60
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
61
|
+
s.add_runtime_dependency(%q<will_paginate>, [">= 0"])
|
62
|
+
s.add_runtime_dependency(%q<searchlogic>, [">= 0"])
|
63
|
+
s.add_runtime_dependency(%q<merger>, [">= 0"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<will_paginate>, [">= 0"])
|
66
|
+
s.add_dependency(%q<searchlogic>, [">= 0"])
|
67
|
+
s.add_dependency(%q<merger>, [">= 0"])
|
68
|
+
end
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<will_paginate>, [">= 0"])
|
71
|
+
s.add_dependency(%q<searchlogic>, [">= 0"])
|
72
|
+
s.add_dependency(%q<merger>, [">= 0"])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe Admin::PeopleController do
|
4
|
+
|
5
|
+
describe 'routing' do
|
6
|
+
it "should map the consolidate path" do
|
7
|
+
route_for(:controller => "admin/people", :action => "consolidate").should == "/admin/people/consolidate"
|
8
|
+
end
|
9
|
+
it "should map the path to the action" do
|
10
|
+
params_from(:get, "/admin/people/consolidate").should == {:controller => "admin/people", :action => "consolidate"}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe Admin::PeopleHelper do
|
4
|
+
|
5
|
+
#Delete this example and add some real ones or delete this file
|
6
|
+
it "should include the Admin::PeopleHelper" do
|
7
|
+
included_modules = self.metaclass.send :included_modules
|
8
|
+
included_modules.should include(Admin::PeopleHelper)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe Person do
|
4
|
+
before(:each) do
|
5
|
+
@person = Person.new(:first_name => 'Jim', :last_name => 'Gay', :middle_name => 'M')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "full_name" do
|
9
|
+
it "should return the concatenated first, middle, and last names" do
|
10
|
+
@person.full_name.should == 'Jim M Gay'
|
11
|
+
end
|
12
|
+
it "should return the concatenated names stripped of extra whitespace" do
|
13
|
+
@person.first_name = ' Jim'
|
14
|
+
@person.last_name = 'Gay '
|
15
|
+
@person.middle_name = ''
|
16
|
+
@person.full_name.should == 'Jim Gay'
|
17
|
+
end
|
18
|
+
context 'with :last_name_first' do
|
19
|
+
it "should return the concatenated last, first, and middle names" do
|
20
|
+
@person.full_name(:last_name_first => true).should == 'Gay, Jim M'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
unless defined? RADIANT_ROOT
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
case
|
4
|
+
when ENV["RADIANT_ENV_FILE"]
|
5
|
+
require ENV["RADIANT_ENV_FILE"]
|
6
|
+
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
|
7
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
|
8
|
+
else
|
9
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
require "#{RADIANT_ROOT}/spec/spec_helper"
|
13
|
+
|
14
|
+
Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
|
15
|
+
|
16
|
+
if File.directory?(File.dirname(__FILE__) + "/matchers")
|
17
|
+
Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
|
18
|
+
end
|
19
|
+
|
20
|
+
Spec::Runner.configure do |config|
|
21
|
+
# config.use_transactional_fixtures = true
|
22
|
+
# config.use_instantiated_fixtures = false
|
23
|
+
# config.fixture_path = RAILS_ROOT + '/spec/fixtures'
|
24
|
+
|
25
|
+
# You can declare fixtures for each behaviour like this:
|
26
|
+
# describe "...." do
|
27
|
+
# fixtures :table_a, :table_b
|
28
|
+
#
|
29
|
+
# Alternatively, if you prefer to declare them only once, you can
|
30
|
+
# do so here, like so ...
|
31
|
+
#
|
32
|
+
# config.global_fixtures = :table_a, :table_b
|
33
|
+
#
|
34
|
+
# If you declare global fixtures, be aware that they will be declared
|
35
|
+
# for all of your examples, even those that don't use them.
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: radiant-people-extension
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jim Gay
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-19 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: will_paginate
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: searchlogic
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: merger
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
description: A generic and extendable way to manage people in Radiant CMS
|
46
|
+
email: jim@saturnflyer.com
|
47
|
+
executables: []
|
48
|
+
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files:
|
52
|
+
- README
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- README
|
56
|
+
- Rakefile
|
57
|
+
- VERSION
|
58
|
+
- app/controllers/admin/people_controller.rb
|
59
|
+
- app/helpers/admin/people_helper.rb
|
60
|
+
- app/models/person.rb
|
61
|
+
- app/views/admin/people/_form.html.haml
|
62
|
+
- app/views/admin/people/_person.html.haml
|
63
|
+
- app/views/admin/people/edit.html.haml
|
64
|
+
- app/views/admin/people/index.html.haml
|
65
|
+
- app/views/admin/people/new.html.haml
|
66
|
+
- cucumber.yml
|
67
|
+
- db/migrate/20090905004948_create_people.rb
|
68
|
+
- features/support/env.rb
|
69
|
+
- features/support/paths.rb
|
70
|
+
- lib/tasks/people_extension_tasks.rake
|
71
|
+
- people_extension.rb
|
72
|
+
- radiant-people-extension.gemspec
|
73
|
+
- spec/controllers/admin/people_controller_spec.rb
|
74
|
+
- spec/helpers/admin/people_helper_spec.rb
|
75
|
+
- spec/models/person_spec.rb
|
76
|
+
- spec/spec.opts
|
77
|
+
- spec/spec_helper.rb
|
78
|
+
has_rdoc: true
|
79
|
+
homepage: http://github.com/saturnflyer/radiant-people-extension
|
80
|
+
licenses: []
|
81
|
+
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options:
|
84
|
+
- --charset=UTF-8
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
version:
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: "0"
|
98
|
+
version:
|
99
|
+
requirements: []
|
100
|
+
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 1.3.5
|
103
|
+
signing_key:
|
104
|
+
specification_version: 3
|
105
|
+
summary: Manage People in Radiant CMS
|
106
|
+
test_files:
|
107
|
+
- spec/controllers/admin/people_controller_spec.rb
|
108
|
+
- spec/helpers/admin/people_helper_spec.rb
|
109
|
+
- spec/models/person_spec.rb
|
110
|
+
- spec/spec_helper.rb
|