tb_core 1.2.4 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/javascripts/admin/core/application.js +1 -2
- data/app/assets/javascripts/admin/core/editor.js +23 -67
- data/app/assets/libs/jquery-ui/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-icons_228ef1_256x240.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-icons_ef8c08_256x240.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-icons_ffd27a_256x240.png +0 -0
- data/app/assets/libs/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/libs/jquery-ui/jquery-ui.css.scss +552 -0
- data/app/assets/libs/jquery-ui/jquery-ui.js +5468 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_flat_55_ffffff_40x100.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-icons_0073ea_256x240.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-icons_666666_256x240.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-icons_ff0084_256x240.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/jquery-ui-1.9.1.custom.css +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/jquery-ui-1.9.1.custom.min.css +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/js/jquery-ui-1.9.1.custom.js +0 -0
- data/app/assets/libs/{jquery-ui → jquery-ui-old}/js/jquery-ui-1.9.1.custom.min.js +0 -0
- data/app/assets/stylesheets/admin/core/application.css.scss +6 -2
- data/app/controllers/admin/application_controller.rb +1 -6
- data/app/controllers/spud/application_controller.rb +27 -9
- data/app/views/layouts/admin/error_page.html.erb +12 -0
- data/app/views/layouts/error_page.html.erb +6 -0
- data/lib/generators/spud/module_generator.rb +14 -0
- data/lib/generators/spud/templates/admin_controller.rb.erb +6 -3
- data/lib/generators/spud/templates/controller.rb.erb +2 -2
- data/lib/generators/spud/templates/views/admin/index.html.erb +7 -1
- data/lib/spud_core/belongs_to_app.rb +1 -1
- data/lib/spud_core/catch_all_route.rb +3 -0
- data/lib/spud_core/configuration.rb +1 -2
- data/lib/spud_core/engine.rb +9 -2
- data/lib/spud_core/errors.rb +29 -0
- data/lib/spud_core/version.rb +1 -1
- data/spec/controllers/admin/application_controller_spec.rb +2 -1
- data/spec/controllers/admin/users_controller_spec.rb +11 -7
- data/spec/controllers/sitemap_controllers_spec.rb +0 -6
- data/spec/controllers/spud/application_controller_spec.rb +1 -1
- metadata +45 -42
- data/app/assets/libs/tinymce/plugins/tableDropdown/editor_plugin.js +0 -140
- data/app/views/layouts/not_found.html.erb +0 -6
- data/lib/spud_core/exceptions.rb +0 -15
data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png
RENAMED
File without changes
|
data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png
RENAMED
File without changes
|
data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_flat_55_ffffff_40x100.png
RENAMED
File without changes
|
data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_flat_75_ffffff_40x100.png
RENAMED
File without changes
|
data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-bg_glass_65_ffffff_1x400.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-icons_0073ea_256x240.png
RENAMED
File without changes
|
data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-icons_454545_256x240.png
RENAMED
File without changes
|
data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-icons_666666_256x240.png
RENAMED
File without changes
|
data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-icons_ff0084_256x240.png
RENAMED
File without changes
|
data/app/assets/libs/{jquery-ui → jquery-ui-old}/css/flick/images/ui-icons_ffffff_256x240.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,7 +1,6 @@
|
|
1
1
|
//= require bootstrap/css/bootstrap
|
2
2
|
//= require datepicker/css/datepicker
|
3
|
-
//= require jquery-ui
|
4
|
-
//= require codemirror
|
3
|
+
//= require jquery-ui//jquery-ui
|
5
4
|
//= require_self
|
6
5
|
//= require admin/core/login
|
7
6
|
//= require admin/core/users
|
@@ -180,6 +179,11 @@ div.admin_application:hover {
|
|
180
179
|
position:relative;
|
181
180
|
padding-right:20px;
|
182
181
|
}
|
182
|
+
.data_controls{
|
183
|
+
.form-search{
|
184
|
+
display: inline-block;
|
185
|
+
}
|
186
|
+
}
|
183
187
|
#details {
|
184
188
|
padding:0 10px;
|
185
189
|
clear:both;
|
@@ -7,10 +7,6 @@ class Admin::ApplicationController < Spud::ApplicationController
|
|
7
7
|
respond_to :html, :json, :xml, :js
|
8
8
|
unloadable
|
9
9
|
|
10
|
-
rescue_from Spud::AccessDeniedError do |exception|
|
11
|
-
redirect_to admin_root_path, :flash => {:error => exception.message}
|
12
|
-
end
|
13
|
-
|
14
10
|
def current_admin_site
|
15
11
|
if(session[:admin_site] == nil)
|
16
12
|
return 0
|
@@ -28,8 +24,7 @@ private
|
|
28
24
|
redirect_to admin_login_path
|
29
25
|
return false
|
30
26
|
elsif !current_user.has_admin_rights?
|
31
|
-
|
32
|
-
redirect_to root_path
|
27
|
+
raise Spud::AccessDeniedError.new(:item => 'module', :template => '/layouts/admin/error_page')
|
33
28
|
return false
|
34
29
|
else
|
35
30
|
return true
|
@@ -12,8 +12,9 @@ class Spud::ApplicationController < ActionController::Base
|
|
12
12
|
include Spud::ApplicationHelper
|
13
13
|
before_action :set_mailer_default_url
|
14
14
|
|
15
|
-
rescue_from Spud::
|
16
|
-
|
15
|
+
rescue_from Spud::RequestError, :with => :handle_request_error
|
16
|
+
rescue_from ActionController::UnknownFormat, :with => :handle_unknown_format_error
|
17
|
+
|
17
18
|
def not_found
|
18
19
|
raise Spud::NotFoundError
|
19
20
|
end
|
@@ -52,6 +53,14 @@ private
|
|
52
53
|
return true
|
53
54
|
end
|
54
55
|
|
56
|
+
def require_admin_user
|
57
|
+
if current_user.blank? || !current_user.has_admin_rights?
|
58
|
+
store_location()
|
59
|
+
raise Spud::AccessDeniedError.new()
|
60
|
+
return false
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
55
64
|
def store_location
|
56
65
|
if request.format.html? && !request.xhr?
|
57
66
|
session[:return_to] = request.url
|
@@ -89,17 +98,26 @@ private
|
|
89
98
|
end
|
90
99
|
end
|
91
100
|
|
92
|
-
def
|
93
|
-
|
94
|
-
@exception.request_url = request.original_url
|
101
|
+
def handle_request_error(error)
|
102
|
+
error.request_url = request.original_url
|
95
103
|
respond_to do |format|
|
96
|
-
format.json{ render :json => {:errors =>
|
97
|
-
format.xml{ render :xml => {:errors =>
|
104
|
+
format.json{ render :json => {:errors => error.message}, :status => error.code }
|
105
|
+
format.xml{ render :xml => {:errors => error.message}, :status => error.code }
|
98
106
|
format.all{
|
99
|
-
|
100
|
-
render :template => template, :layout => nil, :formats => [:html], :status =>
|
107
|
+
@error = error
|
108
|
+
render :template => error.template, :layout => nil, :formats => [:html], :status => error.code, :content_type => 'text/html'
|
101
109
|
}
|
102
110
|
end
|
103
111
|
end
|
104
112
|
|
113
|
+
def handle_unknown_format_error(error)
|
114
|
+
error = Spud::NotFoundError.new()
|
115
|
+
handle_request_error(error)
|
116
|
+
end
|
117
|
+
|
118
|
+
def handle_routing_error(error)
|
119
|
+
error = Spud::NotFoundError.new()
|
120
|
+
handle_request_error(error)
|
121
|
+
end
|
122
|
+
|
105
123
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= content_for :content do %>
|
2
|
+
<div class="detail_wrapper">
|
3
|
+
<h2>
|
4
|
+
<%= @error.code %>: <%= @error.title %>!
|
5
|
+
</h2>
|
6
|
+
<div id="details">
|
7
|
+
<p><%= @error.message %></p>
|
8
|
+
<p>Requested URL: <%= @error.request_url %></p>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
<%= render :template => 'layouts/admin/application' %>
|
@@ -24,6 +24,10 @@ class Spud::ModuleGenerator < ::Rails::Generators::Base
|
|
24
24
|
environment("Spud::Core.config.admin_applications += [{:name => '#{module_name_formatted.humanize.titlecase}', :thumbnail => \"admin/module_icon.png\", :url => \"/admin/#{module_name_formatted}\"}]")
|
25
25
|
create_routes
|
26
26
|
invoke "model", [module_name_formatted.singularize] + attributes
|
27
|
+
|
28
|
+
if self.behavior == :invoke
|
29
|
+
create_model_scopes()
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
33
|
private
|
@@ -62,4 +66,14 @@ EOF
|
|
62
66
|
attributes.collect{ |att| att.split(':')[0] }
|
63
67
|
end
|
64
68
|
|
69
|
+
def create_model_scopes
|
70
|
+
sort_field = ask("What field would you like to sort by?", :default => 'created_at')
|
71
|
+
search_field = ask("What field would you like to search by?", :default => attributes.first.split(':').first)
|
72
|
+
inject_into_file "app/models/#{module_name.singularize.underscore}.rb", after: "ActiveRecord::Base\n" do <<-RUBY
|
73
|
+
scope :ordered, ->{ order('#{sort_field} desc') }
|
74
|
+
scope :search, ->(term){ where('#{search_field} LIKE ?', "%\#{term}%") }
|
75
|
+
RUBY
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
65
79
|
end
|
@@ -5,12 +5,15 @@ class Admin::<%= module_name_formatted.camelize%>Controller < Admin::Application
|
|
5
5
|
add_breadcrumb "<%= module_name_formatted.humanize.titlecase %>", :admin_<%= module_name_formatted %>_path
|
6
6
|
|
7
7
|
def index
|
8
|
-
@<%= module_name_formatted %> = <%= module_name_formatted.singularize.camelize %>.paginate(:page => params[:page])
|
8
|
+
@<%= module_name_formatted %> = <%= module_name_formatted.singularize.camelize %>.ordered.paginate(:page => params[:page])
|
9
|
+
if params[:search]
|
10
|
+
@<%= module_name_formatted %> = @<%= module_name_formatted %>.search(params[:search])
|
11
|
+
end
|
9
12
|
respond_with @<%= module_name_formatted %>
|
10
13
|
end
|
11
14
|
|
12
15
|
def show
|
13
|
-
respond_with @<%= module_name_formatted %>
|
16
|
+
respond_with @<%= module_name_formatted.singularize %>
|
14
17
|
end
|
15
18
|
|
16
19
|
def new
|
@@ -43,7 +46,7 @@ class Admin::<%= module_name_formatted.camelize%>Controller < Admin::Application
|
|
43
46
|
private
|
44
47
|
|
45
48
|
def load_<%= module_name_formatted.singularize %>
|
46
|
-
@<%= module_name_formatted.singularize %> = <%= module_name_formatted.singularize.camelize %>.
|
49
|
+
@<%= module_name_formatted.singularize %> = <%= module_name_formatted.singularize.camelize %>.find_by(:id => params[:id])
|
47
50
|
if @<%= module_name_formatted.singularize %>.blank?
|
48
51
|
flash[:error] = "Could not find the requested <%= module_name_formatted.singularize.camelize %>"
|
49
52
|
redirect_to admin_<%= module_name_formatted %>_path
|
@@ -4,7 +4,7 @@ class <%=module_name_formatted.camelize%>Controller < ApplicationController
|
|
4
4
|
before_action :load_<%=module_name_formatted.singularize%>, :only => [:show]
|
5
5
|
|
6
6
|
def index
|
7
|
-
@<%=module_name_formatted%> = <%=module_name_formatted.singularize.camelize%>.paginate(:page => params[:page])
|
7
|
+
@<%=module_name_formatted%> = <%=module_name_formatted.singularize.camelize%>.ordered.paginate(:page => params[:page])
|
8
8
|
respond_with @<%=module_name_formatted%>
|
9
9
|
end
|
10
10
|
|
@@ -15,7 +15,7 @@ class <%=module_name_formatted.camelize%>Controller < ApplicationController
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def load_<%=module_name_formatted.singularize%>
|
18
|
-
@<%=module_name_formatted.singularize%> = <%=module_name_formatted.singularize.camelize%>.
|
18
|
+
@<%=module_name_formatted.singularize%> = <%=module_name_formatted.singularize.camelize%>.find_by(:id => params[:id])
|
19
19
|
if @<%=module_name_formatted.singularize%>.blank?
|
20
20
|
raise Spud::NotFoundError.new(:item => '<%= module_name_formatted.singularize %>')
|
21
21
|
return false
|
@@ -1,4 +1,10 @@
|
|
1
1
|
<%% content_for :data_controls do %>
|
2
|
+
<%%= form_tag admin_<%= module_name_formatted %>_path, :method => :get, :class => 'form-search' do %>
|
3
|
+
<%%= text_field_tag 'search', params[:search], :placeholder => 'Search', :class => 'input-medium search-query' %>
|
4
|
+
<%% end %>
|
5
|
+
<%% if params[:search] %>
|
6
|
+
<%%= link_to 'Clear', admin_<%= module_name_formatted %>_path, :class => 'btn' %>
|
7
|
+
<%% end %>
|
2
8
|
<%%= link_to "New <%=module_name_formatted.singularize.humanize.titlecase%>", new_admin_<%=module_name_formatted.singularize%>_path, :class => "btn btn-primary", :title => "New <%=module_name_formatted.singularize.humanize.titlecase%>" %>
|
3
9
|
<%% end %>
|
4
10
|
|
@@ -16,7 +22,7 @@
|
|
16
22
|
<%-attribute_names.each do |attribute|-%>
|
17
23
|
<td><%%= <%=module_name_formatted.singularize%>.<%=attribute%> %></td>
|
18
24
|
<%-end-%>
|
19
|
-
<td align="right" width="150">
|
25
|
+
<td align="right" width="150" class="no-wrap">
|
20
26
|
<%%= link_to 'Details', admin_<%=module_name_formatted.singularize%>_path(<%=module_name_formatted.singularize%>), :class => 'btn btn-mini' %>
|
21
27
|
<%%= link_to 'Edit', edit_admin_<%=module_name_formatted.singularize%>_path(<%=module_name_formatted.singularize%>), :class => 'btn btn-mini' %>
|
22
28
|
<%%= link_to 'Delete', admin_<%=module_name_formatted.singularize%>_path(<%=module_name_formatted.singularize%>), :method => :delete, :data => {:confirm => 'Are you sure you want to delete this <%=module_name_formatted.singularize.humanize%>?'}, :class => 'btn btn-danger btn-mini' %>
|
@@ -21,7 +21,7 @@ module Spud::BelongsToApp
|
|
21
21
|
@page_name = self.class.page_title
|
22
22
|
|
23
23
|
if !current_user.can_view_app?(self.class.page_application)
|
24
|
-
raise Spud::AccessDeniedError.new(
|
24
|
+
raise Spud::AccessDeniedError.new(:item => 'module', :template => '/layouts/admin/error_page')
|
25
25
|
end
|
26
26
|
|
27
27
|
if controller.action_name == 'new' || controller.action_name == 'create'
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Spud
|
2
2
|
module Core
|
3
3
|
include ActiveSupport::Configurable
|
4
|
-
config_accessor :site_name,:admin_applications,:sitemap_urls,:multisite_mode_enabled,:multisite_config,:from_address,:site_id,:short_name, :javascripts,:stylesheets, :admin_javascripts, :admin_stylesheets, :permissions, :
|
4
|
+
config_accessor :site_name,:admin_applications,:sitemap_urls,:multisite_mode_enabled,:multisite_config,:from_address,:site_id,:short_name, :javascripts,:stylesheets, :admin_javascripts, :admin_stylesheets, :permissions, :production_alert_domain
|
5
5
|
self.admin_applications = []
|
6
6
|
self.site_name = "Company Name"
|
7
7
|
self.site_id = 0
|
@@ -15,7 +15,6 @@ module Spud
|
|
15
15
|
self.permissions = []
|
16
16
|
self.admin_javascripts = ['admin/core/application', 'admin/application']
|
17
17
|
self.admin_stylesheets = ['admin/core/application', 'admin/application']
|
18
|
-
self.not_found_template = 'layouts/not_found'
|
19
18
|
self.production_alert_domain = nil
|
20
19
|
|
21
20
|
def self.site_config_for_host(host)
|
data/lib/spud_core/engine.rb
CHANGED
@@ -2,14 +2,13 @@ require 'jquery-rails'
|
|
2
2
|
require 'authlogic'
|
3
3
|
require 'breadcrumbs_on_rails'
|
4
4
|
require 'will_paginate'
|
5
|
-
require 'codemirror-rails'
|
6
5
|
require 'tinymce-rails'
|
7
6
|
|
8
7
|
module Spud
|
9
8
|
module Core
|
10
9
|
class Engine < ::Rails::Engine
|
11
10
|
require "#{root}/lib/spud_core/belongs_to_app"
|
12
|
-
require "#{root}/lib/spud_core/
|
11
|
+
require "#{root}/lib/spud_core/errors"
|
13
12
|
require "#{root}/lib/spud_core/searchable"
|
14
13
|
require "#{root}/lib/responds_to_parent"
|
15
14
|
|
@@ -52,6 +51,14 @@ module Spud
|
|
52
51
|
Spud::Core.permissions.push(SpudPermission.new(tag, name, apps))
|
53
52
|
end
|
54
53
|
end
|
54
|
+
|
55
|
+
initializer 'tb_core.catch_all_route' do |config|
|
56
|
+
# Handle 404 errors if Spud::Cms is not installed
|
57
|
+
if !defined?(Spud::Cms)
|
58
|
+
config.routes_reloader.paths << File.expand_path('../catch_all_route.rb', __FILE__)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
55
62
|
end
|
56
63
|
end
|
57
64
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Spud::RequestError < StandardError
|
2
|
+
attr_accessor :request_url, :item, :template
|
3
|
+
attr_reader :code, :title
|
4
|
+
|
5
|
+
def initialize(message)
|
6
|
+
@template ||= 'layouts/error_page'
|
7
|
+
super(message)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Spud::AccessDeniedError < Spud::RequestError
|
12
|
+
def initialize(opts={})
|
13
|
+
@item = opts[:item] || 'page'
|
14
|
+
@template = opts[:template]
|
15
|
+
@code = 403
|
16
|
+
@title = "Access Denied"
|
17
|
+
super("You are not authorized to view the requested #{item.downcase}.")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class Spud::NotFoundError < Spud::RequestError
|
22
|
+
def initialize(opts={})
|
23
|
+
@item = opts[:item] || 'page'
|
24
|
+
@template = opts[:template]
|
25
|
+
@code = 404
|
26
|
+
@title = "Not Found"
|
27
|
+
super("The #{item.downcase} you were looking for could not be found.")
|
28
|
+
end
|
29
|
+
end
|
data/lib/spud_core/version.rb
CHANGED
@@ -27,7 +27,8 @@ describe Admin::UsersController do
|
|
27
27
|
SpudUserSession.create(FactoryGirl.build(:spud_user, :super_admin => false))
|
28
28
|
get :index
|
29
29
|
|
30
|
-
response.should
|
30
|
+
response.code.should eq("403")
|
31
|
+
response.should render_template('layouts/admin/error_page')
|
31
32
|
end
|
32
33
|
|
33
34
|
it "should allow access to users with the correct permissions" do
|
@@ -41,33 +42,36 @@ describe Admin::UsersController do
|
|
41
42
|
response.should be_success
|
42
43
|
end
|
43
44
|
|
44
|
-
it "should not allow access to users without a role, and redirect to
|
45
|
+
it "should not allow access to users without a role, and redirect to render error page if the user has no permissions" do
|
45
46
|
u = FactoryGirl.create(:spud_user, :super_admin => false)
|
46
47
|
u.role = nil
|
47
48
|
SpudUserSession.create(u)
|
48
49
|
get :index
|
49
50
|
|
50
|
-
response.should
|
51
|
+
response.code.should eq("403")
|
52
|
+
response.should render_template('layouts/admin/error_page')
|
51
53
|
end
|
52
54
|
|
53
|
-
it "should not allow access to users with a role that contains no permissions, and
|
55
|
+
it "should not allow access to users with a role that contains no permissions, and render error page if the users has no other admin modules" do
|
54
56
|
u = FactoryGirl.create(:spud_user, :super_admin => false)
|
55
57
|
u.role = @role
|
56
58
|
@role.spud_role_permissions = []
|
57
59
|
SpudUserSession.create(u)
|
58
60
|
get :index
|
59
61
|
|
60
|
-
response.should
|
62
|
+
response.code.should eq("403")
|
63
|
+
response.should render_template('layouts/admin/error_page')
|
61
64
|
end
|
62
65
|
|
63
|
-
it "should not allow access to users without permission and
|
66
|
+
it "should not allow access to users without permission and render error page if the users has other admin modules" do
|
64
67
|
u = FactoryGirl.create(:spud_user, :super_admin => false)
|
65
68
|
@role.permission_tags = ['admin.test.full_access']
|
66
69
|
u.role = @role
|
67
70
|
SpudUserSession.create(u)
|
68
71
|
get :index
|
69
72
|
|
70
|
-
response.should
|
73
|
+
response.code.should eq("403")
|
74
|
+
response.should render_template('layouts/admin/error_page')
|
71
75
|
end
|
72
76
|
end
|
73
77
|
|
@@ -11,11 +11,5 @@ describe SitemapsController do
|
|
11
11
|
|
12
12
|
assigns(:sitemap_urls).should == Spud::Core.sitemap_urls
|
13
13
|
end
|
14
|
-
|
15
|
-
it "should only respond to an XML format" do
|
16
|
-
expect {
|
17
|
-
get :show
|
18
|
-
}.to raise_exception(ActionController::UnknownFormat)
|
19
|
-
end
|
20
14
|
end
|
21
15
|
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Woods
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: codemirror-rails
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: sass-rails
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,16 +126,16 @@ dependencies:
|
|
140
126
|
name: tinymce-rails
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
|
-
- -
|
129
|
+
- - "~>"
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
131
|
+
version: 4.1.3
|
146
132
|
type: :runtime
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
|
-
- -
|
136
|
+
- - "~>"
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
138
|
+
version: 4.1.3
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: mysql2
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -326,24 +312,39 @@ files:
|
|
326
312
|
- app/assets/libs/datepicker/css/datepicker.css
|
327
313
|
- app/assets/libs/datepicker/js/bootstrap-datepicker.js
|
328
314
|
- app/assets/libs/datepicker/less/datepicker.less
|
329
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png
|
330
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png
|
331
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-bg_flat_55_ffffff_40x100.png
|
332
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-bg_flat_75_ffffff_40x100.png
|
333
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-bg_glass_65_ffffff_1x400.png
|
334
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png
|
335
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png
|
336
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png
|
337
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-icons_0073ea_256x240.png
|
338
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-icons_454545_256x240.png
|
339
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-icons_666666_256x240.png
|
340
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-icons_ff0084_256x240.png
|
341
|
-
- app/assets/libs/jquery-ui/css/flick/images/ui-icons_ffffff_256x240.png
|
342
|
-
- app/assets/libs/jquery-ui/css/flick/jquery-ui-1.9.1.custom.css
|
343
|
-
- app/assets/libs/jquery-ui/css/flick/jquery-ui-1.9.1.custom.min.css
|
344
|
-
- app/assets/libs/jquery-ui/js/jquery-ui-1.9.1.custom.js
|
345
|
-
- app/assets/libs/jquery-ui/js/jquery-ui-1.9.1.custom.min.js
|
346
|
-
- app/assets/libs/
|
315
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png
|
316
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png
|
317
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-bg_flat_55_ffffff_40x100.png
|
318
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-bg_flat_75_ffffff_40x100.png
|
319
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-bg_glass_65_ffffff_1x400.png
|
320
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png
|
321
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png
|
322
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png
|
323
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-icons_0073ea_256x240.png
|
324
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-icons_454545_256x240.png
|
325
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-icons_666666_256x240.png
|
326
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-icons_ff0084_256x240.png
|
327
|
+
- app/assets/libs/jquery-ui-old/css/flick/images/ui-icons_ffffff_256x240.png
|
328
|
+
- app/assets/libs/jquery-ui-old/css/flick/jquery-ui-1.9.1.custom.css
|
329
|
+
- app/assets/libs/jquery-ui-old/css/flick/jquery-ui-1.9.1.custom.min.css
|
330
|
+
- app/assets/libs/jquery-ui-old/js/jquery-ui-1.9.1.custom.js
|
331
|
+
- app/assets/libs/jquery-ui-old/js/jquery-ui-1.9.1.custom.min.js
|
332
|
+
- app/assets/libs/jquery-ui/images/ui-bg_diagonals-thick_18_b81900_40x40.png
|
333
|
+
- app/assets/libs/jquery-ui/images/ui-bg_diagonals-thick_20_666666_40x40.png
|
334
|
+
- app/assets/libs/jquery-ui/images/ui-bg_flat_10_000000_40x100.png
|
335
|
+
- app/assets/libs/jquery-ui/images/ui-bg_glass_100_f6f6f6_1x400.png
|
336
|
+
- app/assets/libs/jquery-ui/images/ui-bg_glass_100_fdf5ce_1x400.png
|
337
|
+
- app/assets/libs/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png
|
338
|
+
- app/assets/libs/jquery-ui/images/ui-bg_gloss-wave_35_f6a828_500x100.png
|
339
|
+
- app/assets/libs/jquery-ui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
|
340
|
+
- app/assets/libs/jquery-ui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
|
341
|
+
- app/assets/libs/jquery-ui/images/ui-icons_222222_256x240.png
|
342
|
+
- app/assets/libs/jquery-ui/images/ui-icons_228ef1_256x240.png
|
343
|
+
- app/assets/libs/jquery-ui/images/ui-icons_ef8c08_256x240.png
|
344
|
+
- app/assets/libs/jquery-ui/images/ui-icons_ffd27a_256x240.png
|
345
|
+
- app/assets/libs/jquery-ui/images/ui-icons_ffffff_256x240.png
|
346
|
+
- app/assets/libs/jquery-ui/jquery-ui.css.scss
|
347
|
+
- app/assets/libs/jquery-ui/jquery-ui.js
|
347
348
|
- app/assets/stylesheets/admin/application.css
|
348
349
|
- app/assets/stylesheets/admin/core/application.css.scss
|
349
350
|
- app/assets/stylesheets/admin/core/login.css.scss
|
@@ -398,8 +399,9 @@ files:
|
|
398
399
|
- app/views/core_mailer/forgot_password_notification.text.erb
|
399
400
|
- app/views/layouts/admin/application.html.erb
|
400
401
|
- app/views/layouts/admin/detail.html.erb
|
402
|
+
- app/views/layouts/admin/error_page.html.erb
|
401
403
|
- app/views/layouts/admin/login.html.erb
|
402
|
-
- app/views/layouts/
|
404
|
+
- app/views/layouts/error_page.html.erb
|
403
405
|
- app/views/layouts/spud/admin/detail.html.erb
|
404
406
|
- app/views/password_resets/index.html.erb
|
405
407
|
- app/views/password_resets/show.html.erb
|
@@ -436,9 +438,10 @@ files:
|
|
436
438
|
- lib/generators/spud/templates/views/layouts/application.html.erb
|
437
439
|
- lib/responds_to_parent.rb
|
438
440
|
- lib/spud_core/belongs_to_app.rb
|
441
|
+
- lib/spud_core/catch_all_route.rb
|
439
442
|
- lib/spud_core/configuration.rb
|
440
443
|
- lib/spud_core/engine.rb
|
441
|
-
- lib/spud_core/
|
444
|
+
- lib/spud_core/errors.rb
|
442
445
|
- lib/spud_core/searchable.rb
|
443
446
|
- lib/spud_core/test_files.rb
|
444
447
|
- lib/spud_core/version.rb
|