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,8 +0,0 @@
|
|
1
|
-
class RoleType < Sunrise::Models::RoleType
|
2
|
-
define_enum do |builder|
|
3
|
-
builder.member :default, :object => new("default")
|
4
|
-
builder.member :redactor, :object => new("redactor")
|
5
|
-
builder.member :moderator, :object => new("moderator")
|
6
|
-
builder.member :admin, :object => new("admin")
|
7
|
-
end
|
8
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class StructureType < Sunrise::Models::StructureType
|
2
|
-
define_enum do |builder|
|
3
|
-
builder.member :page, :object => new("page")
|
4
|
-
builder.member :posts, :object => new("posts")
|
5
|
-
builder.member :main, :object => new("main")
|
6
|
-
builder.member :redirect, :object => new("redirect")
|
7
|
-
builder.member :group, :object => new("group")
|
8
|
-
end
|
9
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class User < ActiveRecord::Base
|
2
|
-
include Sunrise::Models::User
|
3
|
-
include ActiveModel::ForbiddenAttributesProtection
|
4
|
-
|
5
|
-
# Include default devise modules.
|
6
|
-
devise :database_authenticatable, :confirmable, :lockable, :timeoutable,
|
7
|
-
:recoverable, :rememberable, :trackable, :validatable,
|
8
|
-
:encryptable, :encryptor => :sha512
|
9
|
-
|
10
|
-
fileuploads :avatar
|
11
|
-
|
12
|
-
# audited :protect => false, :only => [:name, :email, :password]
|
13
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class SunriseNavigation < Sunrise::Config::Navigation
|
2
|
-
navigation :main do |m|
|
3
|
-
m.item :dashboard, root_path, :class => "icon1"
|
4
|
-
m.item :structures, index_path(:model_name => "structures"), :class => "icon2"
|
5
|
-
m.item :users, index_path(:model_name => "users"), :class => "icon3"
|
6
|
-
m.item :services, "#", :class => "icon4"
|
7
|
-
m.item :settings, edit_settings_path, :class => "icon4"
|
8
|
-
end
|
9
|
-
|
10
|
-
navigation :creates do |c|
|
11
|
-
c.item :structures, new_path(:model_name => "structures")
|
12
|
-
c.item :users, new_path(:model_name => "users")
|
13
|
-
end
|
14
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
class SunriseStructure < Sunrise::AbstractModel
|
3
|
-
self.resource_name = "Structure"
|
4
|
-
|
5
|
-
default_list_view :tree
|
6
|
-
available_list_view [:tree, :thumbs]
|
7
|
-
|
8
|
-
list :tree do
|
9
|
-
field :title
|
10
|
-
field :updated_at
|
11
|
-
field :id
|
12
|
-
end
|
13
|
-
|
14
|
-
show do
|
15
|
-
field :title
|
16
|
-
field :redirect_url
|
17
|
-
field :is_visible
|
18
|
-
end
|
19
|
-
|
20
|
-
edit do
|
21
|
-
field :title
|
22
|
-
field :redirect_url
|
23
|
-
field :slug
|
24
|
-
field :parent_id, :collection => lambda { Structure.nested_set_options() {|i| "#{'–' * i.depth} #{i.title}"} }, :if => lambda { |s| s.moveable? }
|
25
|
-
field :kind, :collection => lambda { StructureType.all }, :include_blank => false
|
26
|
-
field :position, :collection => lambda { PositionType.all }, :include_blank => false
|
27
|
-
field :is_visible
|
28
|
-
|
29
|
-
group :meta_tags, :holder => :sidebar do
|
30
|
-
field :tag_title
|
31
|
-
field :tag_keywords
|
32
|
-
field :tag_description
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
class SunriseUser < Sunrise::AbstractModel
|
2
|
-
self.resource_name = "User"
|
3
|
-
|
4
|
-
list :table do
|
5
|
-
field :email
|
6
|
-
field :updated_at
|
7
|
-
field :id
|
8
|
-
|
9
|
-
group :search do
|
10
|
-
field :email
|
11
|
-
field :name
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
list :thumbs do
|
16
|
-
scope { User.includes(:avatar) }
|
17
|
-
preview lambda { |user| user.avatar.try(:url, :thumb) }
|
18
|
-
|
19
|
-
field :email, :label => false
|
20
|
-
field :updated_at, :label => false
|
21
|
-
field :id
|
22
|
-
|
23
|
-
group :search do
|
24
|
-
field :email
|
25
|
-
field :name
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
edit do
|
30
|
-
permited_attributes lambda { |user|
|
31
|
-
user.admin? ? :all : [:name, :password, :password_confirmation, :avatar_attributes]
|
32
|
-
}
|
33
|
-
|
34
|
-
field :name
|
35
|
-
field :email
|
36
|
-
field :password
|
37
|
-
field :password_confirmation
|
38
|
-
field :role_type_id, :collection => lambda { RoleType.all }
|
39
|
-
|
40
|
-
group :bottom, :holder => :bottom do
|
41
|
-
field :avatar, :as => :uploader
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
list :export do
|
46
|
-
field :id
|
47
|
-
field :name
|
48
|
-
field :email
|
49
|
-
end
|
50
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class AvatarUploader < Sunrise::CarrierWave::BaseUploader
|
2
|
-
process :quality => 90
|
3
|
-
|
4
|
-
version :thumb do
|
5
|
-
process :resize_to_fill => [50, 50]
|
6
|
-
end
|
7
|
-
|
8
|
-
version :small do
|
9
|
-
process :resize_to_fill => [32, 32]
|
10
|
-
end
|
11
|
-
|
12
|
-
def extension_white_list
|
13
|
-
%w(jpg jpeg gif png)
|
14
|
-
end
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class PictureUploader < Sunrise::CarrierWave::BaseUploader
|
2
|
-
process :quality => 90
|
3
|
-
|
4
|
-
version :thumb do
|
5
|
-
process :resize_to_fill => [50, 50]
|
6
|
-
end
|
7
|
-
|
8
|
-
version :content do
|
9
|
-
process :resize_to_fit => [575, 500]
|
10
|
-
end
|
11
|
-
|
12
|
-
def extension_white_list
|
13
|
-
%w(jpg jpeg gif png)
|
14
|
-
end
|
15
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
3
|
-
<head>
|
4
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
-
<%= csrf_meta_tag %>
|
6
|
-
<%= raw(render_meta_tags(@structure)) %>
|
7
|
-
<title><%= render_page_title(@structure) %></title>
|
8
|
-
<%= stylesheet_link_tag "application" %>
|
9
|
-
<%= javascript_include_tag "application" %>
|
10
|
-
<%= yield(:head) %>
|
11
|
-
</head>
|
12
|
-
<body>
|
13
|
-
<%#= render :partial => "manage/shared/panel" if content_manager? %>
|
14
|
-
<%= render :partial => 'shared/notice' if flash %>
|
15
|
-
|
16
|
-
<div class='content'>
|
17
|
-
<%= yield %>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<%= yield(:footer) %>
|
21
|
-
</body>
|
22
|
-
</html>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<% unless flash.keys.empty? %>
|
2
|
-
<div class="message" style="display:none;z-index:5000;">
|
3
|
-
<div class="alert-container">
|
4
|
-
<div class="alert">
|
5
|
-
<% flash.each do |key, text| %>
|
6
|
-
<%= content_tag(:div, text, :class => "flash_#{key}") %>
|
7
|
-
<% end %>
|
8
|
-
<%= link_to_function(image_tag("cross_ico.png", :title=>t('label.close')), "$(this).parents('div.message').slideUp()", :class=>"close") %>
|
9
|
-
</div>
|
10
|
-
</div>
|
11
|
-
<script type='text/javascript' charset='UTF-8'>
|
12
|
-
$(document).ready(function(){
|
13
|
-
$('div.message').slideDown('slow');
|
14
|
-
})
|
15
|
-
</script>
|
16
|
-
</div>
|
17
|
-
<% end %>
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
|
5
|
-
unless defined?(SUNRISE_ORM)
|
6
|
-
SUNRISE_ORM = (ENV["SUNRISE_ORM"] || :active_record).to_sym
|
7
|
-
end
|
8
|
-
|
9
|
-
if defined?(Bundler)
|
10
|
-
# If you precompile assets before deploying to production, use this line
|
11
|
-
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
12
|
-
# If you want your assets lazily compiled in production, use this line
|
13
|
-
Bundler.require(SUNRISE_ORM)
|
14
|
-
end
|
15
|
-
|
16
|
-
require "sunrise-cms"
|
17
|
-
|
18
|
-
module Dummy
|
19
|
-
class Application < Rails::Application
|
20
|
-
# Settings in config/environments/* take precedence over those specified here.
|
21
|
-
# Application configuration should go into files in config/initializers
|
22
|
-
# -- all .rb files in that directory are automatically loaded.
|
23
|
-
|
24
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
25
|
-
config.autoload_paths += %W(
|
26
|
-
#{config.root}/../../lib/generators/sunrise/templates/models/#{SUNRISE_ORM}
|
27
|
-
#{config.root}/../../lib/generators/sunrise/templates/uploaders
|
28
|
-
#{config.root}/../../lib/generators/sunrise/templates/models/sunrise
|
29
|
-
#{config.root}/app/models/#{SUNRISE_ORM}
|
30
|
-
#{config.root}/app/models/sunrise)
|
31
|
-
|
32
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
33
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
34
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
35
|
-
|
36
|
-
# Activate observers that should always be running.
|
37
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
38
|
-
|
39
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
40
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
41
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
42
|
-
|
43
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
44
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
45
|
-
# config.i18n.default_locale = :de
|
46
|
-
|
47
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
48
|
-
config.encoding = "utf-8"
|
49
|
-
|
50
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
51
|
-
config.filter_parameters += [:password]
|
52
|
-
|
53
|
-
# Enable the asset pipeline
|
54
|
-
config.assets.enabled = true
|
55
|
-
|
56
|
-
# Version of your assets, change this if you want to expire all your assets
|
57
|
-
config.assets.version = '1.0'
|
58
|
-
|
59
|
-
# Disable the default whitelisting that occurs in later versions of Rails
|
60
|
-
config.active_record.whitelist_attributes = false
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# And be sure to use new-style password hashing:
|
2
|
-
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
|
3
|
-
development:
|
4
|
-
adapter: mysql2
|
5
|
-
encoding: utf8
|
6
|
-
reconnect: false
|
7
|
-
database: dummy
|
8
|
-
pool: 5
|
9
|
-
username: root
|
10
|
-
password:
|
11
|
-
socket: /var/run/mysqld/mysqld.sock
|
12
|
-
|
13
|
-
# Warning: The database defined as "test" will be erased and
|
14
|
-
# re-generated from your development database when you run "rake".
|
15
|
-
# Do not set this db to the same as development or production.
|
16
|
-
test:
|
17
|
-
adapter: mysql2
|
18
|
-
encoding: utf8
|
19
|
-
reconnect: false
|
20
|
-
database: dummy_test
|
21
|
-
pool: 5
|
22
|
-
username: root
|
23
|
-
password:
|
24
|
-
socket: /var/run/mysqld/mysqld.sock
|
25
|
-
|
26
|
-
production:
|
27
|
-
adapter: mysql2
|
28
|
-
encoding: utf8
|
29
|
-
reconnect: true
|
30
|
-
database: dummy
|
31
|
-
pool: 5
|
32
|
-
username: root
|
33
|
-
password:
|
34
|
-
socket: /var/run/mysqld/mysqld.sock
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# Use this hook to configure sunrise
|
2
|
-
if Object.const_defined?("Sunrise")
|
3
|
-
Sunrise.setup do |config|
|
4
|
-
# Flash keys
|
5
|
-
#config.flash_keys = [ :success, :failure ]
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
# Assuming HistoryTracker is your tracker class
|
10
|
-
# Mongoid::History.tracker_class_name = :history_tracker
|
11
|
-
|
12
|
-
# Assuming you're using devise/authlogic
|
13
|
-
# Mongoid::History.current_user_method = :current_user
|
14
|
-
|
15
|
-
#if Settings.table_exists?
|
16
|
-
# Settings.defaults[:some_setting] = "value"
|
17
|
-
# Settings.defaults[:some_setting2] = "value2"
|
18
|
-
#end
|