anytime 0.1.4 → 0.1.5

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.
@@ -3,23 +3,22 @@ require 'action_controller/base'
3
3
  class AnytimeController < ActionController::Base
4
4
 
5
5
  def freeze
6
- date = params[:date]
6
+ if date = params[:date]
7
+ if defined?(current_user) and current_user
8
+ user = current_user
9
+ sign_out user
10
+ end
7
11
 
8
- if defined?(current_user) and current_user
9
- user = current_user
10
- sign_out user
11
- end
12
-
13
- if defined?(current_admin) and current_admin
14
- admin = current_admin
15
- sign_out admin
16
- end
12
+ if defined?(current_admin) and current_admin
13
+ admin = current_admin
14
+ sign_out admin
15
+ end
17
16
 
18
- Anytime.freeze_at(date[:year].to_i, date[:month].to_i, date[:day].to_i, date[:hour].to_i, date[:minute].to_i, date[:second].to_i)
19
-
20
- sign_in user if defined?(user)
21
- sign_in admin if defined?(admin)
17
+ Anytime.freeze_at(date[:year].to_i, date[:month].to_i, date[:day].to_i, date[:hour].to_i, date[:minute].to_i, date[:second].to_i)
22
18
 
19
+ sign_in user if defined?(user) and user
20
+ sign_in admin if defined?(admin) and admin
21
+ end
23
22
  redirect_to :back
24
23
  end
25
24
 
data/lib/config/routes.rb CHANGED
@@ -4,8 +4,8 @@ require "active_support/core_ext/hash/slice"
4
4
  module ActionDispatch::Routing
5
5
  class Mapper
6
6
  def routes_anytime_to(path_name)
7
- match path_name.to_s => 'anytime#freeze'
8
- match 'un' + path_name.to_s => 'anytime#unfreeze'
7
+ match path_name.to_s => 'anytime#freeze', :via => :post
8
+ match 'un' + path_name.to_s => 'anytime#unfreeze', :via => :post
9
9
  end
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anytime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-28 00:00:00.000000000 Z
12
+ date: 2013-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mocha