sunrise-cms 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +6 -0
- data/README.md +1 -1
- data/app/assets/javascripts/sunrise/manage.js.coffee +13 -1
- data/app/controllers/sunrise/application_controller.rb +2 -0
- data/app/controllers/sunrise/dashboard_controller.rb +4 -3
- data/app/helpers/sunrise/dashboard_helper.rb +36 -0
- data/app/views/sunrise/dashboard/_activity.html.erb +16 -0
- data/app/views/sunrise/dashboard/index.html.erb +32 -32
- data/config/locales/sunrise/en.yml +10 -2
- data/config/locales/sunrise/ru.yml +10 -6
- data/config/locales/sunrise/uk.yml +10 -6
- data/db/migrate/20111216144915_create_structures.rb +4 -3
- data/lib/generators/sunrise/templates/config/nginx-config +1 -1
- data/lib/generators/sunrise/templates/config/seeds.rb +2 -3
- data/lib/generators/sunrise/templates/config/sunrise.rb +43 -10
- data/lib/generators/sunrise/templates/models/active_record/asset.rb +1 -1
- data/lib/generators/sunrise/templates/models/active_record/settings.rb +3 -0
- data/lib/generators/sunrise/templates/models/active_record/structure.rb +2 -1
- data/lib/generators/sunrise/templates/models/active_record/user.rb +2 -1
- data/lib/generators/sunrise/templates/models/mongoid/asset.rb +2 -1
- data/lib/generators/sunrise/templates/models/mongoid/settings.rb +3 -0
- data/lib/generators/sunrise/templates/models/mongoid/structure.rb +2 -2
- data/lib/generators/sunrise/templates/models/mongoid/user.rb +2 -2
- data/lib/generators/sunrise/templates/models/sunrise/sunrise_structure.rb +2 -2
- data/lib/sunrise/config.rb +2 -10
- data/lib/sunrise/models/ability.rb +1 -1
- data/lib/sunrise/models/structure.rb +6 -5
- data/lib/sunrise/utils.rb +3 -3
- data/lib/sunrise/version.rb +1 -1
- data/spec/controllers/sunrise/dashboard_controller_spec.rb +4 -2
- data/spec/controllers/sunrise/manager_controller_spec.rb +1 -1
- data/spec/dummy/app/helpers/application_helper.rb +10 -0
- data/spec/dummy/app/models/active_record/post.rb +4 -0
- data/spec/dummy/app/models/mongoid/post.rb +2 -2
- data/spec/dummy/app/views/public_activity/post/_create.html.erb +5 -0
- data/spec/dummy/app/views/public_activity/post/_destroy.html.erb +5 -0
- data/spec/dummy/app/views/public_activity/post/_update.html.erb +5 -0
- data/spec/dummy/config/routes.rb +1 -0
- data/spec/dummy/db/migrate/20130214090723_create_activities.rb +23 -0
- data/spec/dummy/log/development.log +1 -0
- data/spec/dummy/log/test.log +30059 -0
- data/spec/models/structure_spec.rb +1 -1
- data/spec/orm/active_record.rb +0 -3
- data/spec/orm/mongoid.rb +12 -1
- data/spec/requests/dashboard_spec.rb +5 -2
- data/spec/requests/manager/default/create_spec.rb +2 -2
- data/spec/requests/manager/default/edit_spec.rb +2 -2
- data/spec/requests/manager/default/new_spec.rb +1 -1
- data/spec/requests/manager/default/update_spec.rb +2 -2
- data/vendor/assets/images/gravatar-140.png +0 -0
- data/vendor/assets/images/sunrise/audit/{action.png → key.png} +0 -0
- data/vendor/assets/images/sunrise/audit/{user.png → owner.png} +0 -0
- data/vendor/assets/images/sunrise/audit/{auditable.png → trackable.png} +0 -0
- data/vendor/assets/images/sunrise/icons/commented.svg +8 -0
- data/vendor/assets/images/sunrise/icons/create.svg +3 -0
- data/vendor/assets/images/sunrise/icons/destroy.svg +7 -0
- data/vendor/assets/images/sunrise/icons/update.svg +10 -0
- metadata +39 -79
- data/app/views/sunrise/dashboard/_event.html.erb +0 -15
- data/lib/generators/sunrise/templates/models/mongoid/history_tracker.rb +0 -31
- data/spec/factories/audit_factory.rb +0 -24
- data/spec/tmp/app/models/defaults/ability.rb +0 -18
- data/spec/tmp/app/models/defaults/asset.rb +0 -7
- data/spec/tmp/app/models/defaults/attachment_file.rb +0 -5
- data/spec/tmp/app/models/defaults/avatar.rb +0 -7
- data/spec/tmp/app/models/defaults/picture.rb +0 -7
- data/spec/tmp/app/models/defaults/position_type.rb +0 -7
- data/spec/tmp/app/models/defaults/role_type.rb +0 -8
- data/spec/tmp/app/models/defaults/settings.rb +0 -3
- data/spec/tmp/app/models/defaults/structure.rb +0 -9
- data/spec/tmp/app/models/defaults/structure_type.rb +0 -9
- data/spec/tmp/app/models/defaults/user.rb +0 -13
- data/spec/tmp/app/models/sunrise/sunrise_navigation.rb +0 -14
- data/spec/tmp/app/models/sunrise/sunrise_page.rb +0 -10
- data/spec/tmp/app/models/sunrise/sunrise_structure.rb +0 -35
- data/spec/tmp/app/models/sunrise/sunrise_user.rb +0 -50
- data/spec/tmp/app/uploaders/attachment_file_uploader.rb +0 -5
- data/spec/tmp/app/uploaders/avatar_uploader.rb +0 -15
- data/spec/tmp/app/uploaders/picture_uploader.rb +0 -15
- data/spec/tmp/app/views/layouts/application.html.erb +0 -22
- data/spec/tmp/app/views/pages/show.html.erb +0 -2
- data/spec/tmp/app/views/shared/_notice.html.erb +0 -17
- data/spec/tmp/config/application.rb +0 -63
- data/spec/tmp/config/database.yml.sample +0 -34
- data/spec/tmp/config/initializers/sunrise.rb +0 -18
- data/spec/tmp/config/logrotate-config.sample +0 -9
- data/spec/tmp/config/nginx-config.sample +0 -99
- data/spec/tmp/config/routes.rb +0 -9
- data/spec/tmp/db/seeds.rb +0 -31
- data/spec/tmp/spec/controllers/pages_controller_spec.rb +0 -22
- data/spec/tmp/spec/controllers/welcome_controller_spec.rb +0 -18
- data/spec/tmp/spec/factories/structure_factory.rb +0 -22
- data/spec/tmp/spec/factories/user_factory.rb +0 -61
- data/spec/tmp/spec/spec_helper.rb +0 -37
- data/spec/tmp/spec/support/helpers/controller_macros.rb +0 -52
@@ -1,99 +0,0 @@
|
|
1
|
-
# dummy
|
2
|
-
#
|
3
|
-
upstream dummy_backend {
|
4
|
-
server unix:/var/www/dummy/tmp/sockets/unicorn.sock;
|
5
|
-
}
|
6
|
-
|
7
|
-
server {
|
8
|
-
listen 5.9.17.136:80;
|
9
|
-
server_name dummy.fodojo.com;
|
10
|
-
|
11
|
-
access_log off;
|
12
|
-
error_log off;
|
13
|
-
server_tokens off;
|
14
|
-
|
15
|
-
root /var/www/dummy/public;
|
16
|
-
|
17
|
-
if (-f $request_filename) {
|
18
|
-
break;
|
19
|
-
}
|
20
|
-
|
21
|
-
if (-f /cache$request_filename) {
|
22
|
-
rewrite (.*) /cache$1 break;
|
23
|
-
break;
|
24
|
-
}
|
25
|
-
|
26
|
-
if (-f /cache$request_filename.html) {
|
27
|
-
rewrite (.*) /cache$1.html break;
|
28
|
-
break;
|
29
|
-
}
|
30
|
-
|
31
|
-
if (-f $document_root/cache$request_uri.html) {
|
32
|
-
rewrite (.*) /cache$1.html break;
|
33
|
-
}
|
34
|
-
|
35
|
-
if (-f $document_root/cache$request_uri/index.html) {
|
36
|
-
rewrite (.*) /cache$1/index.html break;
|
37
|
-
}
|
38
|
-
|
39
|
-
# This directive prohibits direct access to the cache directory from outside
|
40
|
-
location ^~ /cache {
|
41
|
-
internal;
|
42
|
-
}
|
43
|
-
|
44
|
-
location ~ /\.[^\/]+ {
|
45
|
-
return 404;
|
46
|
-
}
|
47
|
-
|
48
|
-
location / {
|
49
|
-
proxy_redirect off;
|
50
|
-
proxy_set_header Host $host;
|
51
|
-
proxy_set_header X-Real-IP $remote_addr;
|
52
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
53
|
-
# proxy_set_header X-Forwarded-Proto https; # for SSL, add this
|
54
|
-
|
55
|
-
client_max_body_size 20m;
|
56
|
-
client_body_buffer_size 128k;
|
57
|
-
|
58
|
-
proxy_connect_timeout 90;
|
59
|
-
proxy_send_timeout 90;
|
60
|
-
proxy_read_timeout 90;
|
61
|
-
|
62
|
-
proxy_buffer_size 4k;
|
63
|
-
proxy_buffers 4 32k;
|
64
|
-
proxy_busy_buffers_size 64k;
|
65
|
-
proxy_temp_file_write_size 64k;
|
66
|
-
|
67
|
-
if (!-f $request_filename) {
|
68
|
-
proxy_pass http://dummy_backend;
|
69
|
-
break;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
location ~ ^/(assets|ckeditor_assets|images|javascripts|stylesheets)/ {
|
74
|
-
expires 1y;
|
75
|
-
add_header Cache-Control public;
|
76
|
-
|
77
|
-
# Some browsers still send conditional-GET requests if there's a
|
78
|
-
# Last-Modified header or an ETag header even if they haven't
|
79
|
-
# reached the expiry date sent in the Expires header.
|
80
|
-
add_header Last-Modified "";
|
81
|
-
add_header ETag "";
|
82
|
-
break;
|
83
|
-
}
|
84
|
-
|
85
|
-
# This rewrites all the requests to the maintenance.html page if it exists in the doc root.
|
86
|
-
if (-f $document_root/system/maintenance.html) {
|
87
|
-
return 503;
|
88
|
-
}
|
89
|
-
|
90
|
-
error_page 503 @503;
|
91
|
-
location @503 {
|
92
|
-
# Serve static assets if found.
|
93
|
-
if (-f $request_filename) {
|
94
|
-
break;
|
95
|
-
}
|
96
|
-
|
97
|
-
rewrite ^(.*)$ /system/maintenance.html break;
|
98
|
-
}
|
99
|
-
}
|
data/spec/tmp/config/routes.rb
DELETED
data/spec/tmp/db/seeds.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
def insert_user
|
4
|
-
User.truncate!
|
5
|
-
password = Rails.env.production? ? Devise.friendly_token : (1..9).to_a.join
|
6
|
-
|
7
|
-
admin = User.new do |u|
|
8
|
-
u.name = "Administrator"
|
9
|
-
u.email = 'dev@fodojo.com'
|
10
|
-
u.password = password
|
11
|
-
u.password_confirmation = password
|
12
|
-
u.login = 'admin' if u.respond_to?(:login)
|
13
|
-
u.role_type = RoleType.admin
|
14
|
-
end
|
15
|
-
|
16
|
-
admin.skip_confirmation!
|
17
|
-
admin.save!
|
18
|
-
|
19
|
-
puts "Admin: #{admin.email}, #{admin.password}"
|
20
|
-
end
|
21
|
-
|
22
|
-
def insert_structures
|
23
|
-
Structure.truncate!
|
24
|
-
|
25
|
-
main_page = Structure.create!({:title => "Главная страница", :slug => "main-page", :structure_type => StructureType.main, :parent => nil}, :as => :admin)
|
26
|
-
#Structure.create!({:title => "Трансляции", :slug => "broadcasts", :structure_type => StructureType.broadcasts, :parent => main_page}, :as => :admin)
|
27
|
-
#Structure.create!({:title => "Прямые репортажи", :slug => "posts", :structure_type => StructureType.posts, :parent => main_page}, :as => :admin)
|
28
|
-
end
|
29
|
-
|
30
|
-
insert_user
|
31
|
-
insert_structures
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe PagesController do
|
4
|
-
render_views
|
5
|
-
|
6
|
-
before(:all) do
|
7
|
-
@root = FactoryGirl.create(:structure_main)
|
8
|
-
end
|
9
|
-
|
10
|
-
context "page" do
|
11
|
-
before(:each) { @page = FactoryGirl.create(:structure_page, :parent => @root) }
|
12
|
-
|
13
|
-
it "should render show action" do
|
14
|
-
get :show, :id => @page.slug
|
15
|
-
|
16
|
-
assigns(:structure).should == @page
|
17
|
-
|
18
|
-
response.should be_success
|
19
|
-
response.should render_template('show')
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe WelcomeController do
|
4
|
-
render_views
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@root = FactoryGirl.create(:structure_main)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should render index action" do
|
11
|
-
get :index
|
12
|
-
|
13
|
-
assigns(:structure).should == @root
|
14
|
-
|
15
|
-
response.should be_success
|
16
|
-
response.should render_template('index')
|
17
|
-
end
|
18
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
FactoryGirl.define do
|
3
|
-
factory :structure_page, :class => Structure do
|
4
|
-
title 'Structure'
|
5
|
-
slug { FactoryGirl.generate(:slug) }
|
6
|
-
structure_type StructureType.page
|
7
|
-
position_type PositionType.menu
|
8
|
-
is_visible true
|
9
|
-
end
|
10
|
-
|
11
|
-
factory :structure_main, :class => Structure do
|
12
|
-
title "Main page"
|
13
|
-
slug "main-page"
|
14
|
-
structure_type StructureType.main
|
15
|
-
position_type PositionType.default
|
16
|
-
is_visible true
|
17
|
-
end
|
18
|
-
|
19
|
-
sequence :slug do |n|
|
20
|
-
"slug#{n}"
|
21
|
-
end
|
22
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
FactoryGirl.define do
|
3
|
-
factory :admin_user, :class => User do |user|
|
4
|
-
user.name 'Admin'
|
5
|
-
user.email { FactoryGirl.generate(:email) }
|
6
|
-
user.password 'password'
|
7
|
-
user.password_confirmation 'password'
|
8
|
-
|
9
|
-
user.after(:build) do |u|
|
10
|
-
u.roles.build(:role_type => RoleType.admin)
|
11
|
-
u.skip_confirmation!
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
factory :redactor_user, :class => User do |user|
|
16
|
-
user.name 'Redactor'
|
17
|
-
user.email { FactoryGirl.generate(:email) }
|
18
|
-
user.password 'password'
|
19
|
-
user.password_confirmation 'password'
|
20
|
-
|
21
|
-
user.after(:build) do |u|
|
22
|
-
u.roles.build(:role_type => RoleType.redactor)
|
23
|
-
u.skip_confirmation!
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
factory :moderator_user, :class => User do |user|
|
28
|
-
user.name 'Redactor'
|
29
|
-
user.email { FactoryGirl.generate(:email) }
|
30
|
-
user.password 'password'
|
31
|
-
user.password_confirmation 'password'
|
32
|
-
|
33
|
-
user.after(:build) do |u|
|
34
|
-
u.roles.build(:role_type => RoleType.moderator)
|
35
|
-
u.skip_confirmation!
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
factory :default_user, :class => User do |user|
|
40
|
-
user.name 'Test'
|
41
|
-
user.email { FactoryGirl.generate(:email) }
|
42
|
-
user.password 'password'
|
43
|
-
user.password_confirmation 'password'
|
44
|
-
|
45
|
-
user.after(:build) do |u|
|
46
|
-
u.roles.build(:role_type => RoleType.default)
|
47
|
-
u.skip_confirmation!
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
factory :user, :class => User do |user|
|
52
|
-
user.name 'Test'
|
53
|
-
user.email { FactoryGirl.generate(:email) }
|
54
|
-
user.password 'password'
|
55
|
-
user.password_confirmation 'password'
|
56
|
-
end
|
57
|
-
|
58
|
-
sequence :email do |n|
|
59
|
-
"testing#{n}@example.com"
|
60
|
-
end
|
61
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
require File.expand_path("../../config/environment", __FILE__)
|
4
|
-
require 'rspec/rails'
|
5
|
-
|
6
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
7
|
-
# in spec/support/ and its subdirectories.
|
8
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
# == Mock Framework
|
12
|
-
#
|
13
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
14
|
-
#
|
15
|
-
# config.mock_with :mocha
|
16
|
-
# config.mock_with :flexmock
|
17
|
-
# config.mock_with :rr
|
18
|
-
config.mock_with :rspec
|
19
|
-
|
20
|
-
config.include Devise::TestHelpers, :type => :controller
|
21
|
-
config.extend ControllerMacros, :type => :controller
|
22
|
-
|
23
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
-
# examples within a transaction, remove the following line or assign false
|
25
|
-
# instead of true.
|
26
|
-
config.use_transactional_fixtures = false
|
27
|
-
|
28
|
-
require 'database_cleaner'
|
29
|
-
config.before(:suite) do
|
30
|
-
DatabaseCleaner.strategy = :truncation
|
31
|
-
DatabaseCleaner.clean
|
32
|
-
end
|
33
|
-
|
34
|
-
config.after(:all) do
|
35
|
-
DatabaseCleaner.clean
|
36
|
-
end
|
37
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module ControllerMacros
|
3
|
-
def login_admin
|
4
|
-
before(:all) do
|
5
|
-
@admin = FactoryGirl.create(:admin_user)
|
6
|
-
end
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
sign_out :user
|
10
|
-
sign_in @admin
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def login_default
|
15
|
-
before(:all) do
|
16
|
-
@user = FactoryGirl.create(:default_user)
|
17
|
-
end
|
18
|
-
|
19
|
-
before(:each) do
|
20
|
-
sign_out :user
|
21
|
-
sign_in @user
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def login_redactor
|
26
|
-
before(:all) do
|
27
|
-
@user = FactoryGirl.create(:redactor_user)
|
28
|
-
end
|
29
|
-
|
30
|
-
before(:each) do
|
31
|
-
sign_out :user
|
32
|
-
sign_in @user
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def login_moderator
|
37
|
-
before(:all) do
|
38
|
-
@user = FactoryGirl.create(:moderator_user)
|
39
|
-
end
|
40
|
-
|
41
|
-
before(:each) do
|
42
|
-
sign_out :user
|
43
|
-
sign_in @user
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def user_logout
|
48
|
-
before(:each) do
|
49
|
-
sign_out :user
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|