caboose-cms 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- M2NlNDg1ZjM4NTJkYTdiZmFmYmVjM2M3MWU2ZmQyZTE5NjQyMGNhMQ==
4
+ ZmU5NjQ5ZTQ3ZTVmZmY4MjAwMDMxMjlkYjljM2RkNmE2YzFhYTMxMQ==
5
5
  data.tar.gz: !binary |-
6
- ZDZhZjFmZWUwZDE2Mjc0NGU4ZDk3OTMzMDdhY2JjNTczYTg0ZDcyMw==
6
+ M2E0NmFiYTlmZGZjOTdlZTA4NDA0Nzk2MzVmNjQ5NzA4MmRiOGFmNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Nzk1MDVhOGU2NTI5YmZlNDI1NWI3MjY5ZTdjMjgxMTcwZWFmOWRlNjcyNTdh
10
- NmFiMTVlYzhjMDcyNWYzNzc5NWFkZGExM2I0MzUwYmUzZWY5YjQyMjdmNDMw
11
- ODNlMDgyYmNlYjk4NzJiNjI0MmNiZTA1ZjcwZmExZmE1ZWFiMTE=
9
+ ZDEwYTM2YmQ2NzJkYjc1OGE1NGUxMjFmNzhhNzQxNTlhMjE4YTk3MGQyNDI3
10
+ MWFlZjNiYjhjNWRiNWQ1Nzk5MjIxODJkYzY2MzUwZmNhMmZjNDliZWFhMzk4
11
+ OWNiYmQzM2JlZTYxOGE5YWFjZGE3NmRlNzdlNmFiZTU3ZDE1ZjE=
12
12
  data.tar.gz: !binary |-
13
- NDBiMTQwNmY3NzQ5OTU0NWI1YjlkMWFhY2FhYTE0MDVjNjE5M2YyMzg2YjIz
14
- ZWRmYzNmOTE3MWY2YTFhNDVlYTU5MWUzZTY2YzQ1ZDVhNDQwZjI2NDFhODI4
15
- ZDQxYTA2YjYzNmY5YTQwOTZhZWM4YmFmZmIwMmU0NmUxOTcwNzQ=
13
+ ZjBlYzBhNzFhMGMyZmRhMzZiMmM2ZWRjZTZjM2FiNzYzMTlhYzkzNGQ5YjU3
14
+ NWI5MmM5N2M0MGMyMzE3ZTkzYjQxNWEyZjI1OWFiMDYyMzUzODZkZWI4ZDNl
15
+ YTJkYTcxMzNmMDM5MWU4ZjZkYTQ0ZTZhZWM5YjJmMGIyMmY3YmI=
@@ -7,7 +7,7 @@ module Caboose
7
7
  logout_user
8
8
  elo = User.find(User::LOGGED_OUT_USER_ID)
9
9
  login_user(elo)
10
- redirect_to "/"
10
+ redirect_to params[:return_url] ? params[:return_url] : "/"
11
11
  end
12
12
  end
13
13
  end
@@ -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
- # Log out the current user
253
- cookies.delete(:caboose_user_id)
254
- reset_session
255
-
256
- # Login the new user
257
- login_user(user, false)
258
- redirect_to "/"
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
- <%= javascript_include_tag "caboose/application" %>
4
- <%= javascript_include_tag @site.name == 'application' ? 'application' : "#{@site.name}/js/application" %>
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| %><%= javascript_include_tag r %><% end %>
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
- <%= stylesheet_link_tag 'caboose/application' %>
14
- <%= stylesheet_link_tag @site.name == 'application' ? 'application' : "#{@site.name}/css/application" %>
15
- <% Caboose::stylesheets.each do |css| %><%= stylesheet_link_tag(css) %><% end %>
16
- <% @page.linked_resources_map[:css].each do |r| %><%= stylesheet_link_tag r %><% end %>
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 %>
@@ -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"
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.6.1'
2
+ VERSION = '0.6.2'
3
3
  end
@@ -9,18 +9,16 @@ namespace :caboose do
9
9
  end
10
10
  end
11
11
 
12
- desc "Migrate block images to media"
13
- task :migrate_block_images_to_media => :environment do
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.1
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-01 00:00:00.000000000 Z
11
+ date: 2015-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg