sunrise-cms 1.0.0.rc2 → 1.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3067042b43db55a77e22577281d9b57726e266e8
4
- data.tar.gz: 1889f74f4f96d8d860cb736c571e132595f4dae0
3
+ metadata.gz: f16976245e13fe93bc1c0de8d3f07e0925dea26e
4
+ data.tar.gz: b973a2726856b5732fef592accf355a1aaaf9b6e
5
5
  SHA512:
6
- metadata.gz: 3bd0e0f72630c74fcb6ce100be8e9da6d793e8c5f7a61970d79469f011cf5206ced9f517477b6e79ac2a7e524cf0a60612c2786d558953678b5d23bbaf2d59a1
7
- data.tar.gz: 1ae32d7c1832b1237ca18d68e326e5ae73bb37b8519540c62548a5813a6b55a28581605b5328900a12153ed9173ec677129ff3d5f596b15b13158f880391d9b1
6
+ metadata.gz: 4fd90d5b0a8d6139fc3f3a69ca1c6a65b72edc728755a4bdefb27383fbeb3327ef197632534a6b95536374da21b68fa5cd5d4b284219700cdab30386c7ebf41a
7
+ data.tar.gz: dd1b9a847686bc41a4e415b2fc92989a150c9be553036096aeeea70623819743fec770876d99e18f6ceb0fb0f7e815ef4df5c1cfeded121395079ca22f3c8f9c
@@ -1,15 +1,13 @@
1
1
  $ = jQuery
2
2
 
3
- $.fn.extend({
4
- pagination: (options) ->
5
- # Do no harm and return as soon as possible for unsupported browsers, namely IE6 and IE7
6
- return this if $.browser.msie and ($.browser.version is "6.0" or $.browser.version is "7.0")
7
- $(this).each((input_field) ->
8
- el = $(this).data('pagination')
9
- el ?= new Pagination(this, options)
10
- return el
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
@@ -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
- <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 -%>
3
+
36
4
  </div>
37
5
  </div>
@@ -126,6 +126,7 @@ en:
126
126
  users: "Users"
127
127
  settings: "Settings"
128
128
  services: "Services"
129
+ activities: "Activities"
129
130
  creates:
130
131
  structures: "Structure"
131
132
  users: "User"
@@ -126,6 +126,7 @@ ru:
126
126
  users: "Пользователи"
127
127
  settings: "Настройки"
128
128
  services: "Сервисные модули"
129
+ activities: "Активность"
129
130
  creates:
130
131
  structures: "Раздел"
131
132
  users: "Пользователя"
@@ -126,6 +126,7 @@ uk:
126
126
  users: "Користувачі"
127
127
  settings: "Налаштування"
128
128
  services: "Сервісні модулі"
129
+ activities: "Активність"
129
130
  creates:
130
131
  structures: "Розділ"
131
132
  users: "Користувача"
data/config/routes.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  Sunrise::Engine.routes.draw do
2
- root to: Sunrise::Config.root_controller
2
+ root Sunrise::Config.root_route_options
3
3
 
4
- get "/dashboard/p/:page", to: "dashboard#index", page: /\d+/
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 (root) controller path
44
- # config.root_controller = "dashboard#index"
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 (root) controller path
44
- # config.root_controller = "dashboard#index"
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
@@ -51,9 +51,9 @@ module Sunrise
51
51
  mattr_accessor :navigational_formats
52
52
  @@navigational_formats = [:html, :json]
53
53
 
54
- # Welcome (root) controller path
55
- mattr_accessor :root_controller
56
- @@root_controller = "dashboard#index"
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
@@ -1,3 +1,3 @@
1
1
  module Sunrise
2
- VERSION = "1.0.0.rc2".freeze
2
+ VERSION = "1.0.0.rc3".freeze
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Sunrise::DashboardController do
3
+ describe Sunrise::ActivitiesController do
4
4
  render_views
5
5
 
6
6
  before(:all) do
@@ -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 root_path
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 root_path
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, method)
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.rc2
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-04-30 00:00:00.000000000 Z
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/dashboard/_activity.html.erb
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/dashboard_controller_spec.rb
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/dashboard_controller_spec.rb
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