caboose-cms 0.6.1 → 0.6.2
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 +8 -8
- data/app/controllers/caboose/logout_controller.rb +1 -1
- data/app/controllers/caboose/users_controller.rb +35 -7
- data/app/helpers/caboose/application_helper.rb +14 -0
- data/app/views/layouts/caboose/application.html.erb +7 -7
- data/config/routes.rb +1 -0
- data/lib/caboose/version.rb +1 -1
- data/lib/tasks/caboose.rake +5 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmU5NjQ5ZTQ3ZTVmZmY4MjAwMDMxMjlkYjljM2RkNmE2YzFhYTMxMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2E0NmFiYTlmZGZjOTdlZTA4NDA0Nzk2MzVmNjQ5NzA4MmRiOGFmNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDEwYTM2YmQ2NzJkYjc1OGE1NGUxMjFmNzhhNzQxNTlhMjE4YTk3MGQyNDI3
|
10
|
+
MWFlZjNiYjhjNWRiNWQ1Nzk5MjIxODJkYzY2MzUwZmNhMmZjNDliZWFhMzk4
|
11
|
+
OWNiYmQzM2JlZTYxOGE5YWFjZGE3NmRlNzdlNmFiZTU3ZDE1ZjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjBlYzBhNzFhMGMyZmRhMzZiMmM2ZWRjZTZjM2FiNzYzMTlhYzkzNGQ5YjU3
|
14
|
+
NWI5MmM5N2M0MGMyMzE3ZTkzYjQxNWEyZjI1OWFiMDYyMzUzODZkZWI4ZDNl
|
15
|
+
YTJkYTcxMzNmMDM5MWU4ZjZkYTQ0ZTZhZWM5YjJmMGIyMmY3YmI=
|
@@ -248,14 +248,42 @@ module Caboose
|
|
248
248
|
def admin_su
|
249
249
|
return if !user_is_allowed('users', 'sudo')
|
250
250
|
user = User.find(params[:id])
|
251
|
+
|
252
|
+
# See if we're on the default domain
|
253
|
+
d = Caboose::Domain.where(:domain => request.host_with_port).first
|
254
|
+
|
255
|
+
if d.primary == true
|
256
|
+
logout_user
|
257
|
+
login_user(user, false) # Login the new user
|
258
|
+
redirect_to "/"
|
259
|
+
end
|
260
|
+
|
261
|
+
# Set a random token for the user
|
262
|
+
user.token = (0...20).map { ('a'..'z').to_a[rand(26)] }.join
|
263
|
+
user.save
|
264
|
+
redirect_to "http://#{d.site.primary_domain.domain}/admin/users/#{params[:id]}/su/#{user.token}"
|
265
|
+
end
|
266
|
+
|
267
|
+
# GET /admin/users/:id/su/:token
|
268
|
+
def admin_su_token
|
269
|
+
return if params[:token].nil?
|
270
|
+
user = User.find(params[:id])
|
251
271
|
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
272
|
+
token = params[:token]
|
273
|
+
if user.token == params[:token]
|
274
|
+
if logged_in? || logged_in_user.id == User::LOGGED_OUT_USER_ID
|
275
|
+
Caboose.log(logged_in_user.id)
|
276
|
+
redirect_to "/logout?return_url=/admin/users/#{params[:id]}/su/#{user.token}"
|
277
|
+
return
|
278
|
+
end
|
279
|
+
|
280
|
+
user.token = nil
|
281
|
+
user.save
|
282
|
+
login_user(user)
|
283
|
+
redirect_to '/'
|
284
|
+
else
|
285
|
+
render :json => false
|
286
|
+
end
|
259
287
|
end
|
260
288
|
|
261
289
|
end
|
@@ -26,6 +26,20 @@ tinyMCE.init({
|
|
26
26
|
def parent_categories
|
27
27
|
Caboose::Category.find(1).children.where(:status => 'Active')
|
28
28
|
end
|
29
|
+
|
30
|
+
def gzip_javascript_include_tag(asset)
|
31
|
+
tag = javascript_include_tag asset
|
32
|
+
tag = tag.gsub(/\.js/i, ".js.gz") if Rails.env.production? && request.accept_encoding =~ /gzip/i
|
33
|
+
#tag = tag.gsub(/\.js/i, ".js.gz") if request.accept_encoding =~ /gzip/i
|
34
|
+
tag.html_safe
|
35
|
+
end
|
36
|
+
|
37
|
+
def gzip_stylesheet_link_tag(asset)
|
38
|
+
tag = stylesheet_link_tag asset
|
39
|
+
tag = tag.gsub(/\.css/i, ".css.gz") if Rails.env.production? && request.accept_encoding =~ /gzip/i
|
40
|
+
#tag = tag.gsub(/\.css/i, ".css.gz") if request.accept_encoding =~ /gzip/i
|
41
|
+
tag.html_safe
|
42
|
+
end
|
29
43
|
|
30
44
|
end
|
31
45
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
<% if @page && @page.title != 'Access Denied' %>
|
2
2
|
<% content_for :js do %>
|
3
|
-
<%=
|
4
|
-
<%=
|
3
|
+
<%= gzip_javascript_include_tag "caboose/application" %>
|
4
|
+
<%= gzip_javascript_include_tag @site.name == 'application' ? 'application' : "#{@site.name}/js/application" %>
|
5
5
|
<script>window.loggedIn = <%= logged_in?.to_json %></script>
|
6
6
|
<% Caboose::javascripts.each do |js| %><%= javascript_include_tag(js) %><% end %>
|
7
|
-
<% @page.linked_resources_map[:js].each do |r| %><%=
|
7
|
+
<% @page.linked_resources_map[:js].each do |r| %><%= gzip_javascript_include_tag r %><% end %>
|
8
8
|
<% if @site.date_js_updated %><script type='text/javascript' src="<%= raw @site.custom_js_url %>"></script><% end %>
|
9
9
|
<% if @page.custom_js && @page.custom_js.strip.length > 0 %><script type='text/javascript'><%= raw @page.custom_js %></script><% end %>
|
10
10
|
<%= yield :caboose_js %>
|
11
11
|
<% end %>
|
12
12
|
<% content_for :css do %>
|
13
|
-
<%=
|
14
|
-
<%=
|
15
|
-
<% Caboose::stylesheets.each do |css| %><%=
|
16
|
-
<% @page.linked_resources_map[:css].each do |r| %><%=
|
13
|
+
<%= gzip_stylesheet_link_tag 'caboose/application' %>
|
14
|
+
<%= gzip_stylesheet_link_tag @site.name == 'application' ? 'application' : "#{@site.name}/css/application" %>
|
15
|
+
<% Caboose::stylesheets.each do |css| %><%= gzip_stylesheet_link_tag(css) %><% end %>
|
16
|
+
<% @page.linked_resources_map[:css].each do |r| %><%= gzip_stylesheet_link_tag r %><% end %>
|
17
17
|
<% if @site.date_css_updated %><link rel='stylesheet' type='text/css' url="<%= raw @site.custom_css_url %>" /><% end %>
|
18
18
|
<% if @page.custom_css && @page.custom_css.strip.length > 0 %><style><%= raw @page.custom_css %></style><% end %>
|
19
19
|
<%= yield :caboose_css %>
|
data/config/routes.rb
CHANGED
@@ -168,6 +168,7 @@ Caboose::Engine.routes.draw do
|
|
168
168
|
get "/admin/users/new" => "users#new"
|
169
169
|
get "/admin/users/import" => "users#import_form"
|
170
170
|
post "/admin/users/import" => "users#import"
|
171
|
+
get "/admin/users/:id/su/:token" => "users#admin_su_token"
|
171
172
|
get "/admin/users/:id/su" => "users#admin_su"
|
172
173
|
get "/admin/users/:id/edit-password" => "users#edit_password"
|
173
174
|
get "/admin/users/:id" => "users#edit"
|
data/lib/caboose/version.rb
CHANGED
data/lib/tasks/caboose.rake
CHANGED
@@ -9,18 +9,16 @@ namespace :caboose do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
desc "Migrate block images to media"
|
13
|
-
task :
|
12
|
+
desc "Migrate block images and files to media"
|
13
|
+
task :migrate_block_assets_to_media => :environment do
|
14
14
|
Caboose::Block.where("image_file_name is not null and media_id is null").reorder(:id).all.each do |b|
|
15
15
|
b.delay.migrate_media
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
desc "Migrate block files to media"
|
20
|
-
task :migrate_block_files_to_media => :environment do
|
16
|
+
end
|
21
17
|
Caboose::Block.where("file_file_name is not null and media_id is null").reorder(:id).all.each do |b|
|
22
18
|
b.delay.migrate_media
|
23
19
|
end
|
20
|
+
Caboose::BlockType.where(:id => 19).update_all('name' => 'image2')
|
21
|
+
Caboose::Block.where(:block_type_id => 19).update_all('name' => 'image2')
|
24
22
|
end
|
25
23
|
|
26
24
|
desc "Update expired caches and cache pages that aren't cached"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|