sunrise-cms 1.0.0.rc2 → 1.0.0.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/sunrise/jquery.pagination.js.coffee +8 -10
- data/app/controllers/sunrise/activities_controller.rb +20 -0
- data/app/controllers/sunrise/dashboard_controller.rb +0 -10
- data/app/helpers/sunrise/activities_helper.rb +36 -0
- data/app/helpers/sunrise/dashboard_helper.rb +0 -32
- data/app/views/sunrise/{dashboard → activities}/_activity.html.erb +0 -0
- data/app/views/sunrise/activities/_header.html.erb +12 -0
- data/app/views/sunrise/activities/index.html.erb +37 -0
- data/app/views/sunrise/dashboard/index.html.erb +1 -33
- data/config/locales/sunrise/en.yml +1 -0
- data/config/locales/sunrise/ru.yml +1 -0
- data/config/locales/sunrise/uk.yml +1 -0
- data/config/routes.rb +4 -2
- data/lib/generators/sunrise/templates/config/active_record/sunrise.rb +2 -2
- data/lib/generators/sunrise/templates/config/mongoid/sunrise.rb +2 -2
- data/lib/generators/sunrise/templates/models/sunrise/sunrise_navigation.rb +1 -1
- data/lib/sunrise/config.rb +3 -3
- data/lib/sunrise/version.rb +1 -1
- data/spec/controllers/sunrise/{dashboard_controller_spec.rb → activities_controller_spec.rb} +1 -1
- data/spec/requests/activities_spec.rb +41 -0
- data/spec/requests/dashboard_spec.rb +2 -8
- data/spec/support/helpers/controller_helper.rb +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f16976245e13fe93bc1c0de8d3f07e0925dea26e
|
4
|
+
data.tar.gz: b973a2726856b5732fef592accf355a1aaaf9b6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fd90d5b0a8d6139fc3f3a69ca1c6a65b72edc728755a4bdefb27383fbeb3327ef197632534a6b95536374da21b68fa5cd5d4b284219700cdab30386c7ebf41a
|
7
|
+
data.tar.gz: dd1b9a847686bc41a4e415b2fc92989a150c9be553036096aeeea70623819743fec770876d99e18f6ceb0fb0f7e815ef4df5c1cfeded121395079ca22f3c8f9c
|
@@ -1,15 +1,13 @@
|
|
1
1
|
$ = jQuery
|
2
2
|
|
3
|
-
$.fn.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
)
|
12
|
-
})
|
3
|
+
$.fn.pagination = (options = {}) ->
|
4
|
+
@each ->
|
5
|
+
$this = $(this)
|
6
|
+
data = $this.data("pagination")
|
7
|
+
if (!data)
|
8
|
+
$this.data("pagination", new Pagination(this, options))
|
9
|
+
if (typeof options is 'string')
|
10
|
+
data[options]()
|
13
11
|
|
14
12
|
class Pagination
|
15
13
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Sunrise
|
2
|
+
class ActivitiesController < Sunrise::ApplicationController
|
3
|
+
include Sunrise::Utils::SearchWrapper
|
4
|
+
|
5
|
+
authorize_resource :class => false
|
6
|
+
|
7
|
+
def index
|
8
|
+
per_page = Sunrise::Config.activities_per_page
|
9
|
+
cur_page = (params[:page] || 1).to_i
|
10
|
+
offset = (cur_page - 1) * per_page
|
11
|
+
|
12
|
+
@events = Sunrise.activities
|
13
|
+
@events = @events.limit(per_page).offset(offset)
|
14
|
+
|
15
|
+
respond_with(@events) do |format|
|
16
|
+
format.html { render :layout => params[:time].blank? }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -5,16 +5,6 @@ module Sunrise
|
|
5
5
|
authorize_resource :class => false
|
6
6
|
|
7
7
|
def index
|
8
|
-
per_page = Sunrise::Config.activities_per_page
|
9
|
-
cur_page = (params[:page] || 1).to_i
|
10
|
-
offset = (cur_page - 1) * per_page
|
11
|
-
|
12
|
-
@events = Sunrise.activities
|
13
|
-
@events = @events.limit(per_page).offset(offset)
|
14
|
-
|
15
|
-
respond_with(@events) do |format|
|
16
|
-
format.html { render :layout => params[:time].blank? }
|
17
|
-
end
|
18
8
|
end
|
19
9
|
end
|
20
10
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Sunrise
|
2
|
+
module ActivitiesHelper
|
3
|
+
|
4
|
+
# For generating time tags calculated using jquery.timeago
|
5
|
+
def timeago_tag(time, options = {})
|
6
|
+
options[:class] ||= "timeago"
|
7
|
+
content_tag(:abbr, time.to_s, options.merge(:title => time.getutc.iso8601)) if time
|
8
|
+
end
|
9
|
+
|
10
|
+
def activity_icon_tag(key, options = {})
|
11
|
+
icon = key.split('.').last
|
12
|
+
image = image_path("sunrise/icons/#{icon}.svg")
|
13
|
+
|
14
|
+
options = {
|
15
|
+
:class => "mega-icon",
|
16
|
+
:style => "background-image: url(#{image});"
|
17
|
+
}.merge(options)
|
18
|
+
|
19
|
+
content_tag(:div, nil, options)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Check if object still exists in the database and display a link to it,
|
23
|
+
# otherwise display a proper message about it.
|
24
|
+
# This is used in activities that can refer to
|
25
|
+
# objects which no longer exist, like removed posts.
|
26
|
+
def link_to_trackable(object, object_type)
|
27
|
+
model_name = object_type.downcase
|
28
|
+
|
29
|
+
if object
|
30
|
+
link_to(model_name, edit_path(:model_name => model_name.pluralize, :id => object.id))
|
31
|
+
else
|
32
|
+
"a #{model_name} which does not exist anymore"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,36 +1,4 @@
|
|
1
1
|
module Sunrise
|
2
2
|
module DashboardHelper
|
3
|
-
|
4
|
-
# For generating time tags calculated using jquery.timeago
|
5
|
-
def timeago_tag(time, options = {})
|
6
|
-
options[:class] ||= "timeago"
|
7
|
-
content_tag(:abbr, time.to_s, options.merge(:title => time.getutc.iso8601)) if time
|
8
|
-
end
|
9
|
-
|
10
|
-
def activity_icon_tag(key, options = {})
|
11
|
-
icon = key.split('.').last
|
12
|
-
image = image_path("sunrise/icons/#{icon}.svg")
|
13
|
-
|
14
|
-
options = {
|
15
|
-
:class => "mega-icon",
|
16
|
-
:style => "background-image: url(#{image});"
|
17
|
-
}.merge(options)
|
18
|
-
|
19
|
-
content_tag(:div, nil, options)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Check if object still exists in the database and display a link to it,
|
23
|
-
# otherwise display a proper message about it.
|
24
|
-
# This is used in activities that can refer to
|
25
|
-
# objects which no longer exist, like removed posts.
|
26
|
-
def link_to_trackable(object, object_type)
|
27
|
-
model_name = object_type.downcase
|
28
|
-
|
29
|
-
if object
|
30
|
-
link_to(model_name, edit_path(:model_name => model_name.pluralize, :id => object.id))
|
31
|
-
else
|
32
|
-
"a #{model_name} which does not exist anymore"
|
33
|
-
end
|
34
|
-
end
|
35
3
|
end
|
36
4
|
end
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="filter-line-wrapper">
|
2
|
+
<div class="filter-line-holder">
|
3
|
+
<div class="struct-name"><%= t('manage.menu.main.dashboard') %></div>
|
4
|
+
|
5
|
+
<div class="vline-block">
|
6
|
+
<%= form_for search_wrapper, :url => root_path, :html => {:method => :get, :novalidate => true} do |f| %>
|
7
|
+
<%= f.text_field :q %>
|
8
|
+
<%= f.submit t('manage.search'), :class => "button" %>
|
9
|
+
<% end %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</div>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<div class="wrapper without-panel">
|
2
|
+
<div class="dbTable">
|
3
|
+
<table id="events-table" cellpadding="0" cellspacing="0" border="0" width="100%">
|
4
|
+
<tbody>
|
5
|
+
<tr class="theader">
|
6
|
+
<% ["created_at", "owner", "key", "trackable"].each do |attr| %>
|
7
|
+
<th>
|
8
|
+
<%= image_tag("sunrise/audit/#{attr}.png") %>
|
9
|
+
<%= PublicActivity::Activity.human_attribute_name("activity.#{attr}") %>
|
10
|
+
</th>
|
11
|
+
<% end -%>
|
12
|
+
</tr>
|
13
|
+
<%= render :partial => 'activity', :collection => @events %>
|
14
|
+
</tbody>
|
15
|
+
</table>
|
16
|
+
|
17
|
+
<% if @events.count >= Sunrise::Config.activities_per_page -%>
|
18
|
+
<div class="centerBtnHolder">
|
19
|
+
<%= link_to t('manage.buttons.next_50'), "#", :class=>"button", :style=>"width:100px;", :id=>"events-next" %>
|
20
|
+
|
21
|
+
<script type="text/javascript">
|
22
|
+
$(document).ready(function(){
|
23
|
+
$("#events-table").pagination({
|
24
|
+
url: '/manage/dashboard',
|
25
|
+
binder: '#events-next',
|
26
|
+
event: 'click',
|
27
|
+
callback: function(data){
|
28
|
+
var rows = $(data).find("#events-table tr.event");
|
29
|
+
$('#events-table tbody').append(rows);
|
30
|
+
}
|
31
|
+
});
|
32
|
+
});
|
33
|
+
</script>
|
34
|
+
</div>
|
35
|
+
<% end -%>
|
36
|
+
</div>
|
37
|
+
</div>
|
@@ -1,37 +1,5 @@
|
|
1
1
|
<div class="wrapper without-panel">
|
2
2
|
<div class="dbTable">
|
3
|
-
|
4
|
-
<tbody>
|
5
|
-
<tr class="theader">
|
6
|
-
<% ["created_at", "owner", "key", "trackable"].each do |attr| %>
|
7
|
-
<th>
|
8
|
-
<%= image_tag("sunrise/audit/#{attr}.png") %>
|
9
|
-
<%= PublicActivity::Activity.human_attribute_name("activity.#{attr}") %>
|
10
|
-
</th>
|
11
|
-
<% end -%>
|
12
|
-
</tr>
|
13
|
-
<%= render :partial => 'activity', :collection => @events %>
|
14
|
-
</tbody>
|
15
|
-
</table>
|
16
|
-
|
17
|
-
<% if @events.count >= Sunrise::Config.activities_per_page -%>
|
18
|
-
<div class="centerBtnHolder">
|
19
|
-
<%= link_to t('manage.buttons.next_50'), "#", :class=>"button", :style=>"width:100px;", :id=>"events-next" %>
|
20
|
-
|
21
|
-
<script type="text/javascript">
|
22
|
-
$(document).ready(function(){
|
23
|
-
$("#events-table").pagination({
|
24
|
-
url: '/manage/dashboard',
|
25
|
-
binder: '#events-next',
|
26
|
-
event: 'click',
|
27
|
-
callback: function(data){
|
28
|
-
var rows = $(data).find("#events-table tr.event");
|
29
|
-
$('#events-table tbody').append(rows);
|
30
|
-
}
|
31
|
-
});
|
32
|
-
});
|
33
|
-
</script>
|
34
|
-
</div>
|
35
|
-
<% end -%>
|
3
|
+
|
36
4
|
</div>
|
37
5
|
</div>
|
data/config/routes.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
Sunrise::Engine.routes.draw do
|
2
|
-
root
|
2
|
+
root Sunrise::Config.root_route_options
|
3
3
|
|
4
|
-
get "/
|
4
|
+
get "/activities/p/:page", to: "activities#index", page: /\d+/
|
5
|
+
get "/dashboard", to: "dashboard#index", as: :dashboard
|
5
6
|
|
6
7
|
resource :settings, only: [:edit, :update]
|
8
|
+
resources :activities, only: [:index]
|
7
9
|
|
8
10
|
controller "manager" do
|
9
11
|
scope ":model_name" do
|
@@ -40,8 +40,8 @@ Sunrise.setup do |config|
|
|
40
40
|
# Lists the formats that should be treated as navigational (default: [:html, :json])
|
41
41
|
# config.navigational_formats = [:html, :json]
|
42
42
|
|
43
|
-
# Welcome
|
44
|
-
# config.
|
43
|
+
# Welcome root path options
|
44
|
+
# config.root_route_options = {to: "manager#index", model_name: "structures"}
|
45
45
|
end
|
46
46
|
|
47
47
|
PublicActivity::Config.set do
|
@@ -40,8 +40,8 @@ Sunrise.setup do |config|
|
|
40
40
|
# Lists the formats that should be treated as navigational (default: [:html, :json])
|
41
41
|
# config.navigational_formats = [:html, :json]
|
42
42
|
|
43
|
-
# Welcome
|
44
|
-
# config.
|
43
|
+
# Welcome root path options
|
44
|
+
# config.root_route_options = {to: "manager#index", model_name: "structures"}
|
45
45
|
end
|
46
46
|
|
47
47
|
PublicActivity::Config.set do
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class SunriseNavigation < Sunrise::Config::Navigation
|
2
2
|
navigation :main do
|
3
|
-
item :dashboard, root_path, class: "icon1"
|
4
3
|
item :structures, index_path(model_name: "structures"), class: "icon2"
|
5
4
|
item :users, index_path(model_name: "users"), class: "icon3"
|
6
5
|
item :settings, edit_settings_path, class: "icon4"
|
6
|
+
item :activities, activities_path, class: "icon1"
|
7
7
|
end
|
8
8
|
|
9
9
|
navigation :creates do
|
data/lib/sunrise/config.rb
CHANGED
@@ -51,9 +51,9 @@ module Sunrise
|
|
51
51
|
mattr_accessor :navigational_formats
|
52
52
|
@@navigational_formats = [:html, :json]
|
53
53
|
|
54
|
-
# Welcome
|
55
|
-
mattr_accessor :
|
56
|
-
@@
|
54
|
+
# Welcome root path options
|
55
|
+
mattr_accessor :root_route_options
|
56
|
+
@@root_route_options = {to: "manager#index", model_name: "structures"}
|
57
57
|
|
58
58
|
def self.scoped_views?
|
59
59
|
@@scoped_views === true
|
data/lib/sunrise/version.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Sunrise Manager Activities" do
|
4
|
+
subject { page }
|
5
|
+
before(:all) do
|
6
|
+
@admin = FactoryGirl.create(:admin_user, :email => "#{Time.now.to_i}@gmail.com")
|
7
|
+
|
8
|
+
@post = FactoryGirl.create(:post)
|
9
|
+
@user = FactoryGirl.create(:redactor_user)
|
10
|
+
@event = @post.create_activity :key => 'post.create', :owner => @user
|
11
|
+
end
|
12
|
+
|
13
|
+
context "admin" do
|
14
|
+
before(:each) { login_as @admin }
|
15
|
+
|
16
|
+
describe "GET /manage" do
|
17
|
+
before(:each) do
|
18
|
+
visit activities_path
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should show page title" do
|
22
|
+
should have_content "Activities"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should render records" do
|
26
|
+
dom_id = ["activity", @event.id].join('_')
|
27
|
+
should have_selector("#" + dom_id)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "anonymous user" do
|
33
|
+
before(:each) do
|
34
|
+
visit activities_path
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should redirect to login page" do
|
38
|
+
should have_content('Sign in')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -7,7 +7,6 @@ describe "Sunrise Manager Dashboard" do
|
|
7
7
|
|
8
8
|
@post = FactoryGirl.create(:post)
|
9
9
|
@user = FactoryGirl.create(:redactor_user)
|
10
|
-
@event = @post.create_activity :key => 'post.create', :owner => @user
|
11
10
|
end
|
12
11
|
|
13
12
|
context "admin" do
|
@@ -15,23 +14,18 @@ describe "Sunrise Manager Dashboard" do
|
|
15
14
|
|
16
15
|
describe "GET /manage" do
|
17
16
|
before(:each) do
|
18
|
-
visit
|
17
|
+
visit dashboard_path
|
19
18
|
end
|
20
19
|
|
21
20
|
it "should show page title" do
|
22
21
|
should have_content "Dashboard"
|
23
22
|
end
|
24
|
-
|
25
|
-
it "should render records" do
|
26
|
-
dom_id = ["activity", @event.id].join('_')
|
27
|
-
should have_selector("#" + dom_id)
|
28
|
-
end
|
29
23
|
end
|
30
24
|
end
|
31
25
|
|
32
26
|
describe "anonymous user" do
|
33
27
|
before(:each) do
|
34
|
-
visit
|
28
|
+
visit dashboard_path
|
35
29
|
end
|
36
30
|
|
37
31
|
it "should redirect to login page" do
|
@@ -22,6 +22,6 @@ module ControllerHelper
|
|
22
22
|
|
23
23
|
def process_action(action, parameters = nil, session = nil, flash = nil, method = "GET")
|
24
24
|
parameters ||= {}
|
25
|
-
process(action, parameters.merge!(:use_route => Sunrise::Engine.engine_name), session, flash
|
25
|
+
process(action, method, parameters.merge!(:use_route => Sunrise::Engine.engine_name), session, flash)
|
26
26
|
end
|
27
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunrise-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Galeta
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -434,10 +434,12 @@ files:
|
|
434
434
|
- app/assets/stylesheets/sunrise/customize.css
|
435
435
|
- app/assets/stylesheets/sunrise/main.css
|
436
436
|
- app/assets/stylesheets/sunrise/pagination.css
|
437
|
+
- app/controllers/sunrise/activities_controller.rb
|
437
438
|
- app/controllers/sunrise/application_controller.rb
|
438
439
|
- app/controllers/sunrise/dashboard_controller.rb
|
439
440
|
- app/controllers/sunrise/manager_controller.rb
|
440
441
|
- app/controllers/sunrise/settings_controller.rb
|
442
|
+
- app/helpers/sunrise/activities_helper.rb
|
441
443
|
- app/helpers/sunrise/application_helper.rb
|
442
444
|
- app/helpers/sunrise/dashboard_helper.rb
|
443
445
|
- app/helpers/sunrise/manager_helper.rb
|
@@ -451,7 +453,9 @@ files:
|
|
451
453
|
- app/views/kaminari/sunrise/_prev_page.html.erb
|
452
454
|
- app/views/layouts/sunrise/application.html.erb
|
453
455
|
- app/views/layouts/sunrise/devise.html.erb
|
454
|
-
- app/views/sunrise/
|
456
|
+
- app/views/sunrise/activities/_activity.html.erb
|
457
|
+
- app/views/sunrise/activities/_header.html.erb
|
458
|
+
- app/views/sunrise/activities/index.html.erb
|
455
459
|
- app/views/sunrise/dashboard/_header.html.erb
|
456
460
|
- app/views/sunrise/dashboard/index.html.erb
|
457
461
|
- app/views/sunrise/manager/_controls.html.erb
|
@@ -610,7 +614,7 @@ files:
|
|
610
614
|
- Rakefile
|
611
615
|
- README.md
|
612
616
|
- CHANGELOG.rdoc
|
613
|
-
- spec/controllers/sunrise/
|
617
|
+
- spec/controllers/sunrise/activities_controller_spec.rb
|
614
618
|
- spec/controllers/sunrise/manager_controller_spec.rb
|
615
619
|
- spec/controllers/sunrise/settings_controller_spec.rb
|
616
620
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -683,6 +687,7 @@ files:
|
|
683
687
|
- spec/orm/kaminari/active_record.rb
|
684
688
|
- spec/orm/kaminari/mongoid.rb
|
685
689
|
- spec/orm/mongoid.rb
|
690
|
+
- spec/requests/activities_spec.rb
|
686
691
|
- spec/requests/dashboard_spec.rb
|
687
692
|
- spec/requests/manager/default/create_spec.rb
|
688
693
|
- spec/requests/manager/default/destroy_spec.rb
|
@@ -727,7 +732,7 @@ signing_key:
|
|
727
732
|
specification_version: 4
|
728
733
|
summary: Rails CMS
|
729
734
|
test_files:
|
730
|
-
- spec/controllers/sunrise/
|
735
|
+
- spec/controllers/sunrise/activities_controller_spec.rb
|
731
736
|
- spec/controllers/sunrise/manager_controller_spec.rb
|
732
737
|
- spec/controllers/sunrise/settings_controller_spec.rb
|
733
738
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -800,6 +805,7 @@ test_files:
|
|
800
805
|
- spec/orm/kaminari/active_record.rb
|
801
806
|
- spec/orm/kaminari/mongoid.rb
|
802
807
|
- spec/orm/mongoid.rb
|
808
|
+
- spec/requests/activities_spec.rb
|
803
809
|
- spec/requests/dashboard_spec.rb
|
804
810
|
- spec/requests/manager/default/create_spec.rb
|
805
811
|
- spec/requests/manager/default/destroy_spec.rb
|