content_engine 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/content_engine.gemspec +3 -118
- metadata +6 -117
- data/Gemfile +0 -40
- data/README.md +0 -43
- data/app/controllers/content_engine/articles_controller.rb +0 -54
- data/app/controllers/content_engine/pages_controller.rb +0 -76
- data/app/controllers/content_engine_controller.rb +0 -14
- data/app/helpers/application_helper.rb +0 -2
- data/app/models/article.rb +0 -29
- data/app/models/content.rb +0 -64
- data/app/models/page.rb +0 -40
- data/app/models/site.rb +0 -26
- data/app/models/tag.rb +0 -53
- data/app/models/user.rb +0 -5
- data/app/views/content_engine/articles/_form.erb +0 -8
- data/app/views/content_engine/articles/edit.html.erb +0 -7
- data/app/views/content_engine/articles/index.html.erb +0 -10
- data/app/views/content_engine/articles/new.html.erb +0 -6
- data/app/views/content_engine/articles/show.html.erb +0 -9
- data/app/views/content_engine/pages/_form.erb +0 -8
- data/app/views/content_engine/pages/edit.html.erb +0 -7
- data/app/views/content_engine/pages/index.html.erb +0 -10
- data/app/views/content_engine/pages/new.html.erb +0 -6
- data/app/views/content_engine/pages/show.html.erb +0 -9
- data/app/views/layouts/application.html.erb +0 -16
- data/config/application.rb +0 -1
- data/config/locales/en.yml +0 -5
- data/config/routes.rb +0 -25
- data/db/migrate/20100225105011_create_contents.rb +0 -22
- data/db/migrate/20100225105903_create_users.rb +0 -8
- data/db/migrate/20100225110024_create_sites.rb +0 -15
- data/db/migrate/20100225110037_create_memberships.rb +0 -12
- data/db/migrate/20100225112236_acts_as_taggable_on.rb +0 -26
- data/db/schema.rb +0 -58
- data/lib/content_engine.rb +0 -24
- data/lib/tasks/content_engine.rake +0 -24
- data/spec/blueprint.rb +0 -41
- data/spec/models/article_spec.rb +0 -56
- data/spec/models/page_spec.rb +0 -158
- data/spec/models/site_spec.rb +0 -32
- data/spec/rails_app/.gitignore +0 -4
- data/spec/rails_app/Rakefile +0 -10
- data/spec/rails_app/app/controllers/admins_controller.rb +0 -6
- data/spec/rails_app/app/controllers/application_controller.rb +0 -6
- data/spec/rails_app/app/controllers/home_controller.rb +0 -4
- data/spec/rails_app/app/controllers/sessions_controller.rb +0 -6
- data/spec/rails_app/app/controllers/users_controller.rb +0 -12
- data/spec/rails_app/app/helpers/application_helper.rb +0 -3
- data/spec/rails_app/app/views/home/index.html.erb +0 -1
- data/spec/rails_app/app/views/layouts/application.html.erb +0 -19
- data/spec/rails_app/config.ru +0 -4
- data/spec/rails_app/config/application.rb +0 -30
- data/spec/rails_app/config/boot.rb +0 -9
- data/spec/rails_app/config/database.yml +0 -16
- data/spec/rails_app/config/environment.rb +0 -5
- data/spec/rails_app/config/environments/development.rb +0 -19
- data/spec/rails_app/config/environments/production.rb +0 -33
- data/spec/rails_app/config/environments/test.rb +0 -29
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails_app/config/initializers/cookie_verification_secret.rb +0 -7
- data/spec/rails_app/config/initializers/inflections.rb +0 -2
- data/spec/rails_app/config/initializers/session_store.rb +0 -15
- data/spec/rails_app/config/routes.rb +0 -21
- data/spec/rails_app/db/migrate/20100225105011_create_contents.rb +0 -22
- data/spec/rails_app/db/migrate/20100225105903_create_users.rb +0 -8
- data/spec/rails_app/db/migrate/20100225110024_create_sites.rb +0 -15
- data/spec/rails_app/db/migrate/20100225110037_create_memberships.rb +0 -12
- data/spec/rails_app/db/migrate/20100225112236_acts_as_taggable_on.rb +0 -26
- data/spec/rails_app/db/schema.rb +0 -59
- data/spec/rails_app/public/404.html +0 -26
- data/spec/rails_app/public/422.html +0 -26
- data/spec/rails_app/public/500.html +0 -26
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/public/images/rails.png +0 -0
- data/spec/rails_app/public/javascripts/application.js +0 -2
- data/spec/rails_app/public/javascripts/controls.js +0 -963
- data/spec/rails_app/public/javascripts/dragdrop.js +0 -973
- data/spec/rails_app/public/javascripts/effects.js +0 -1128
- data/spec/rails_app/public/javascripts/prototype.js +0 -4320
- data/spec/rails_app/public/javascripts/rails.js +0 -110
- data/spec/rails_app/public/robots.txt +0 -5
- data/spec/rails_app/public/stylesheets/.gitkeep +0 -0
- data/spec/rails_app/script/rails +0 -10
- data/spec/requests/user_manage_articles_spec.rb +0 -85
- data/spec/requests/user_manage_pages_spec.rb +0 -92
- data/spec/requests/webrat.log +0 -17
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -36
@@ -1,110 +0,0 @@
|
|
1
|
-
document.observe("dom:loaded", function() {
|
2
|
-
var authToken = $$('meta[name=csrf-token]').first().readAttribute('content'),
|
3
|
-
authParam = $$('meta[name=csrf-param]').first().readAttribute('content'),
|
4
|
-
formTemplate = '<form method="#{method}" action="#{action}">\
|
5
|
-
#{realmethod}<input name="#{param}" value="#{token}" type="hidden">\
|
6
|
-
</form>',
|
7
|
-
realmethodTemplate = '<input name="_method" value="#{method}" type="hidden">';
|
8
|
-
|
9
|
-
function handleRemote(element) {
|
10
|
-
var method, url, params;
|
11
|
-
|
12
|
-
if (element.tagName.toLowerCase() == 'form') {
|
13
|
-
method = element.readAttribute('method') || 'post';
|
14
|
-
url = element.readAttribute('action');
|
15
|
-
params = element.serialize(true);
|
16
|
-
} else {
|
17
|
-
method = element.readAttribute('data-method') || 'get';
|
18
|
-
// TODO: data-url support is going away, just use href
|
19
|
-
url = element.readAttribute('data-url') || element.readAttribute('href');
|
20
|
-
params = {};
|
21
|
-
}
|
22
|
-
|
23
|
-
var event = element.fire("ajax:before");
|
24
|
-
if (event.stopped) return false;
|
25
|
-
|
26
|
-
new Ajax.Request(url, {
|
27
|
-
method: method,
|
28
|
-
parameters: params,
|
29
|
-
asynchronous: true,
|
30
|
-
evalScripts: true,
|
31
|
-
|
32
|
-
onLoading: function(request) { element.fire("ajax:loading", {request: request}); },
|
33
|
-
onLoaded: function(request) { element.fire("ajax:loaded", {request: request}); },
|
34
|
-
onInteractive: function(request) { element.fire("ajax:interactive", {request: request}); },
|
35
|
-
onComplete: function(request) { element.fire("ajax:complete", {request: request}); },
|
36
|
-
onSuccess: function(request) { element.fire("ajax:success", {request: request}); },
|
37
|
-
onFailure: function(request) { element.fire("ajax:failure", {request: request}); }
|
38
|
-
});
|
39
|
-
|
40
|
-
element.fire("ajax:after");
|
41
|
-
}
|
42
|
-
|
43
|
-
$(document.body).observe("click", function(event) {
|
44
|
-
var message = event.element().readAttribute('data-confirm');
|
45
|
-
if (message && !confirm(message)) {
|
46
|
-
event.stop();
|
47
|
-
return false;
|
48
|
-
}
|
49
|
-
|
50
|
-
var element = event.findElement("a[data-remote=true]");
|
51
|
-
if (element) {
|
52
|
-
handleRemote(element);
|
53
|
-
event.stop();
|
54
|
-
}
|
55
|
-
|
56
|
-
var element = event.findElement("a[data-method]");
|
57
|
-
if (element && element.readAttribute('data-remote') != 'true') {
|
58
|
-
var method = element.readAttribute('data-method'),
|
59
|
-
piggyback = method.toLowerCase() != 'post',
|
60
|
-
formHTML = formTemplate.interpolate({
|
61
|
-
method: 'POST',
|
62
|
-
realmethod: piggyback ? realmethodTemplate.interpolate({ method: method }) : '',
|
63
|
-
action: element.readAttribute('href'),
|
64
|
-
token: authToken,
|
65
|
-
param: authParam
|
66
|
-
});
|
67
|
-
|
68
|
-
var form = new Element('div').update(formHTML).down().hide();
|
69
|
-
this.insert({ bottom: form });
|
70
|
-
|
71
|
-
form.submit();
|
72
|
-
event.stop();
|
73
|
-
}
|
74
|
-
});
|
75
|
-
|
76
|
-
// TODO: I don't think submit bubbles in IE
|
77
|
-
$(document.body).observe("submit", function(event) {
|
78
|
-
var message = event.element().readAttribute('data-confirm');
|
79
|
-
if (message && !confirm(message)) {
|
80
|
-
event.stop();
|
81
|
-
return false;
|
82
|
-
}
|
83
|
-
|
84
|
-
var inputs = event.element().select("input[type=submit][data-disable-with]");
|
85
|
-
inputs.each(function(input) {
|
86
|
-
input.disabled = true;
|
87
|
-
input.writeAttribute('data-original-value', input.value);
|
88
|
-
input.value = input.readAttribute('data-disable-with');
|
89
|
-
});
|
90
|
-
|
91
|
-
var element = event.findElement("form[data-remote=true]");
|
92
|
-
if (element) {
|
93
|
-
handleRemote(element);
|
94
|
-
event.stop();
|
95
|
-
}
|
96
|
-
});
|
97
|
-
|
98
|
-
$(document.body).observe("ajax:complete", function(event) {
|
99
|
-
var element = event.element();
|
100
|
-
|
101
|
-
if (element.tagName.toLowerCase() == 'form') {
|
102
|
-
var inputs = element.select("input[type=submit][disabled=true][data-disable-with]");
|
103
|
-
inputs.each(function(input) {
|
104
|
-
input.value = input.readAttribute('data-original-value');
|
105
|
-
input.writeAttribute('data-original-value', null);
|
106
|
-
input.disabled = false;
|
107
|
-
});
|
108
|
-
}
|
109
|
-
});
|
110
|
-
});
|
File without changes
|
data/spec/rails_app/script/rails
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
ENV_PATH = File.expand_path('../../config/environment', __FILE__)
|
5
|
-
BOOT_PATH = File.expand_path('../../config/boot', __FILE__)
|
6
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
7
|
-
ROOT_PATH = File.expand_path('../..', __FILE__)
|
8
|
-
|
9
|
-
require BOOT_PATH
|
10
|
-
require 'rails/commands'
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Manage articles" do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@site = Site.make do |s|
|
7
|
-
s.articles.make :title => 'news announcement'
|
8
|
-
end
|
9
|
-
|
10
|
-
@article = @site.articles.first
|
11
|
-
end
|
12
|
-
|
13
|
-
it "View all articles" do
|
14
|
-
# When
|
15
|
-
visit articles_path
|
16
|
-
|
17
|
-
# Then
|
18
|
-
should_see "All articles"
|
19
|
-
should_see "news announcement"
|
20
|
-
end
|
21
|
-
|
22
|
-
it "View a single article" do
|
23
|
-
# Given
|
24
|
-
visit articles_path
|
25
|
-
click_link @article.title
|
26
|
-
|
27
|
-
# Then
|
28
|
-
should_see @article.title
|
29
|
-
should_see @article.body_source
|
30
|
-
end
|
31
|
-
|
32
|
-
it "Create a new article" do
|
33
|
-
visit articles_path
|
34
|
-
click_link 'New article'
|
35
|
-
should_see 'New Article'
|
36
|
-
|
37
|
-
# When
|
38
|
-
fill_in "Title", :with => "My awesome about article"
|
39
|
-
fill_in "Body", :with => "Hello world"
|
40
|
-
click_button 'Create article'
|
41
|
-
|
42
|
-
# Then
|
43
|
-
should_see 'Article was successfully created'
|
44
|
-
end
|
45
|
-
|
46
|
-
it "Update a article" do
|
47
|
-
visit articles_path
|
48
|
-
click_link @article.title
|
49
|
-
click_link "Edit"
|
50
|
-
|
51
|
-
# When
|
52
|
-
fill_in "Title", :with => "My awesome about article update"
|
53
|
-
fill_in "Body", :with => "Hello world update"
|
54
|
-
click_button "Update article"
|
55
|
-
|
56
|
-
# Then
|
57
|
-
should_see 'Article was successfully update'
|
58
|
-
should_see 'Hello world update'
|
59
|
-
end
|
60
|
-
|
61
|
-
it "Publish a article" do
|
62
|
-
visit articles_path
|
63
|
-
click_link @article.title
|
64
|
-
click_link "Edit"
|
65
|
-
|
66
|
-
select 'publish', :from => 'Status'
|
67
|
-
click_button "Update article"
|
68
|
-
|
69
|
-
should_see "Article was successfully update"
|
70
|
-
should_see "Published at"
|
71
|
-
end
|
72
|
-
|
73
|
-
it "delete a article" do
|
74
|
-
article_title = @article.title.dup
|
75
|
-
|
76
|
-
visit articles_path
|
77
|
-
click_link article_title
|
78
|
-
click_link "Edit"
|
79
|
-
|
80
|
-
click_link "Destroy"
|
81
|
-
|
82
|
-
# Rails 3 delete link are js submission
|
83
|
-
# response.should_not contain(article_title)
|
84
|
-
end
|
85
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Manage pages" do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@site = Site.make do |s|
|
7
|
-
s.pages.make :title => 'homepage'
|
8
|
-
s.pages.make :title => 'about us'
|
9
|
-
end
|
10
|
-
|
11
|
-
@page = @site.pages.first
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
it "View all tasks items" do
|
16
|
-
# Given
|
17
|
-
|
18
|
-
visit pages_path
|
19
|
-
# When
|
20
|
-
|
21
|
-
|
22
|
-
# Then
|
23
|
-
should_see "All pages"
|
24
|
-
should_see "homepage"
|
25
|
-
should_see "about us"
|
26
|
-
end
|
27
|
-
|
28
|
-
it "View a single page" do
|
29
|
-
|
30
|
-
# Given
|
31
|
-
visit pages_path
|
32
|
-
click_link @page.title
|
33
|
-
|
34
|
-
# Then
|
35
|
-
should_see @page.title
|
36
|
-
should_see @page.body_source
|
37
|
-
end
|
38
|
-
|
39
|
-
it "Create a new page" do
|
40
|
-
visit pages_path
|
41
|
-
click_link 'New page'
|
42
|
-
should_see 'New page'
|
43
|
-
|
44
|
-
# When
|
45
|
-
fill_in "Title", :with => "My awesome about page"
|
46
|
-
fill_in "Body", :with => "Hello world"
|
47
|
-
click_button 'Create page'
|
48
|
-
|
49
|
-
# Then
|
50
|
-
should_see 'Page was successfully created'
|
51
|
-
end
|
52
|
-
|
53
|
-
it "Update a page" do
|
54
|
-
visit pages_path
|
55
|
-
click_link @page.title
|
56
|
-
click_link "Edit"
|
57
|
-
|
58
|
-
# When
|
59
|
-
fill_in "Title", :with => "My awesome about page update"
|
60
|
-
fill_in "Body", :with => "Hello world update"
|
61
|
-
click_button "Update page"
|
62
|
-
|
63
|
-
# Then
|
64
|
-
should_see 'Page was successfully update'
|
65
|
-
should_see 'Hello world update'
|
66
|
-
end
|
67
|
-
|
68
|
-
it "Publish a page" do
|
69
|
-
visit pages_path
|
70
|
-
click_link @page.title
|
71
|
-
click_link "Edit"
|
72
|
-
|
73
|
-
select 'publish', :from => 'Status'
|
74
|
-
click_button "Update page"
|
75
|
-
|
76
|
-
should_see "Page was successfully update"
|
77
|
-
should_see "Published at"
|
78
|
-
end
|
79
|
-
|
80
|
-
it "delete a page" do
|
81
|
-
page_title = @page.title.dup
|
82
|
-
|
83
|
-
visit pages_path
|
84
|
-
click_link page_title
|
85
|
-
click_link "Edit"
|
86
|
-
|
87
|
-
click_link "Destroy"
|
88
|
-
|
89
|
-
# Rails 3 delete link are js submission
|
90
|
-
# response.should_not contain(page_title)
|
91
|
-
end
|
92
|
-
end
|
data/spec/requests/webrat.log
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# Logfile created on Fri Feb 26 14:04:18 +1100 2010 by /
|
2
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
3
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
4
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
5
|
-
REQUESTING PAGE: GET /pages/1 with {} and HTTP headers {}
|
6
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
7
|
-
REQUESTING PAGE: GET /pages/1 with {} and HTTP headers {}
|
8
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
9
|
-
REQUESTING PAGE: GET /pages/1 with {} and HTTP headers {}
|
10
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
11
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
12
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
13
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
14
|
-
REQUESTING PAGE: GET /pages/1 with {} and HTTP headers {"HTTP_REFERER"=>"/pages"}
|
15
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
16
|
-
REQUESTING PAGE: GET /pages with {} and HTTP headers {}
|
17
|
-
REQUESTING PAGE: GET /pages/1 with {} and HTTP headers {"HTTP_REFERER"=>"/pages"}
|
data/spec/spec.opts
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
2
|
-
# from the project root directory.
|
3
|
-
ENV["RAILS_ENV"] ||= 'test'
|
4
|
-
|
5
|
-
require File.expand_path('../rails_app/config/application', __FILE__)
|
6
|
-
require File.expand_path('../rails_app/config/environment', __FILE__)
|
7
|
-
|
8
|
-
# Run migration
|
9
|
-
ActiveRecord::Migration.verbose = false
|
10
|
-
require File.expand_path('../../db/schema', __FILE__)
|
11
|
-
|
12
|
-
require 'rspec/rails'
|
13
|
-
# Requires supporting files with custom matchers and macros, etc,
|
14
|
-
# in ./support/ and its subdirectories.
|
15
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
16
|
-
|
17
|
-
# Load ContentEngine
|
18
|
-
require 'content_engine'
|
19
|
-
|
20
|
-
Rspec.configure do |config|
|
21
|
-
require File.dirname(__FILE__) + '/blueprint'
|
22
|
-
|
23
|
-
# Remove this line if you don't want Rspec's should and should_not
|
24
|
-
# methods or matchers
|
25
|
-
require 'rspec/expectations'
|
26
|
-
config.include Rspec::Matchers
|
27
|
-
|
28
|
-
# == Mock Framework
|
29
|
-
config.mock_with :rspec
|
30
|
-
|
31
|
-
include Webrat::Methods
|
32
|
-
|
33
|
-
def should_see (pattern)
|
34
|
-
response.should contain(pattern)
|
35
|
-
end
|
36
|
-
end
|