openstax_utilities 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,3 @@
1
-
2
1
  ActionController::Base.define_singleton_method(:protect_beta) do |options={}|
3
2
  options[:username] ||= SecureRandom.hex
4
3
  options[:password] ||= SecureRandom.hex
@@ -7,7 +6,17 @@ ActionController::Base.define_singleton_method(:protect_beta) do |options={}|
7
6
 
8
7
  return if !(options[:enable_always] || Rails.env.production?)
9
8
 
10
- prepend_before_filter do
9
+ @@protect_beta_options = options
10
+ prepend_before_filter :protect_beta
11
+ end
12
+
13
+ ActionController::Base.define_singleton_method(:skip_protect_beta) do |options={}|
14
+ skip_before_filter :protect_beta, options
15
+ end
16
+
17
+ class ActionController::Base
18
+ def protect_beta
19
+ options = @@protect_beta_options
11
20
  authenticate_or_request_with_http_basic(options[:message]) do |username, password|
12
21
  username == options[:username] && password == options[:password]
13
22
  end
@@ -39,6 +48,20 @@ module OpenStax
39
48
  # Just here for documentation purposes, see code above
40
49
  end
41
50
 
51
+ # Called in a controller to skip the beta protection enabled elsewhere (e.g.
52
+ # in a parent controller). Takes options like skip_before_filter
53
+ #
54
+ # @example Usage to skip beta protection on index action
55
+ # class MyController < ApplicationController
56
+ # skip_protect_beta :except => [:index]
57
+ #
58
+ # @param :except Methods to not use this skip for
59
+ # @param :only The only methods to use this skipping
60
+ #
61
+ def self.skip_protect_beta(options={})
62
+ # Just here for documentation purposes, see code above
63
+ end
64
+
42
65
  end
43
66
  end
44
67
  end
@@ -1,6 +1,8 @@
1
1
  # Copyright 2011-2013 Rice University. Licensed under the Affero General Public
2
2
  # License version 3 or later. See the COPYRIGHT file for details.
3
3
 
4
+ require 'attribeautiful'
5
+
4
6
  module OpenStax::Utilities::Blocks
5
7
  class BlockBase
6
8
  include Attribeautiful
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Utilities
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_utilities
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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-06-18 00:00:00.000000000 Z
12
+ date: 2013-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.1'
30
+ - !ruby/object:Gem::Dependency
31
+ name: attribeautiful
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.0.7
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.0.7
30
46
  description: Utilities for OpenStax web sites
31
47
  email:
32
48
  - jps@kindlinglabs.com
@@ -36,7 +52,6 @@ extra_rdoc_files: []
36
52
  files:
37
53
  - app/assets/javascripts/openstax_utilities.js
38
54
  - app/assets/stylesheets/openstax_utilities.css
39
- - app/assets/stylesheets/section_block.css.scss
40
55
  - app/helpers/block_helper.rb
41
56
  - app/helpers/partial_helper.rb
42
57
  - app/views/osu/shared/_section.html.erb
@@ -101,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
116
  version: '0'
102
117
  segments:
103
118
  - 0
104
- hash: -4255439280706106682
119
+ hash: 3071181377175490331
105
120
  required_rubygems_version: !ruby/object:Gem::Requirement
106
121
  none: false
107
122
  requirements:
@@ -110,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
125
  version: '0'
111
126
  segments:
112
127
  - 0
113
- hash: -4255439280706106682
128
+ hash: 3071181377175490331
114
129
  requirements: []
115
130
  rubyforge_project:
116
131
  rubygems_version: 1.8.24
@@ -1,33 +0,0 @@
1
- // Copyright 2011-2013 Rice University. Licensed under the Affero General Public
2
- // License version 3 or later. See the COPYRIGHT file for details.
3
-
4
- @mixin section-block-base($heading_font_size:16px, $heading_color:black, $body_indent:0px, $body_top_margin:8px) {
5
- margin: 10px 0px;
6
-
7
- .section-block-heading {
8
-
9
- color: $heading_color;
10
- font-size: $heading_font_size;
11
-
12
- a {
13
- font-size: $heading_font_size;
14
- }
15
- }
16
-
17
- .section-block-body {
18
- margin: $body_top_margin 0px 0px;
19
- padding: 0px 0px 0px $body_indent;
20
- }
21
- }
22
-
23
- .section-block-section {
24
- @include section-block-base(16px);
25
- }
26
-
27
- .section-block-section.nesting-2 {
28
- @include section-block-base(14px);
29
-
30
- .section-block-heading {
31
- font-style: italic;
32
- }
33
- }