cms-fortress 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rvmrc +1 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +161 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +38 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-affix.js +117 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-alert.js +99 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-button.js +105 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-carousel.js +207 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-collapse.js +167 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-dropdown.js +165 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-modal.js +247 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-popover.js +114 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-scrollspy.js +162 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-tab.js +144 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-tooltip.js +361 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-transition.js +60 -0
- data/app/assets/javascripts/cms/fortress/bootstrap-typeahead.js +335 -0
- data/app/assets/javascripts/cms/fortress/bootstrap.js +2276 -0
- data/app/assets/javascripts/cms/fortress/cms_fortress.js +14 -0
- data/app/assets/javascripts/html5shiv.js +8 -0
- data/app/assets/stylesheets/cms/fortress/admin_overrides.css +11 -0
- data/app/assets/stylesheets/cms/fortress/bootstrap-responsive.css +1109 -0
- data/app/assets/stylesheets/cms/fortress/bootstrap.css +6158 -0
- data/app/assets/stylesheets/cms/fortress/session.css +39 -0
- data/app/controllers/cms/fortress/admin_controller.rb +17 -0
- data/app/controllers/cms/fortress/roles_controller.rb +84 -0
- data/app/controllers/cms/fortress/users_controller.rb +89 -0
- data/app/helpers/cms/fortress/application_helper.rb +27 -0
- data/app/helpers/cms/fortress/roles_helper.rb +2 -0
- data/app/models/cms/fortress.rb +5 -0
- data/app/models/cms/fortress/role.rb +17 -0
- data/app/models/cms/fortress/role_detail.rb +6 -0
- data/app/models/cms/fortress/user.rb +14 -0
- data/app/models/cms_ability.rb +32 -0
- data/app/views/cms/fortress/admin/design.html.haml +1 -0
- data/app/views/cms/fortress/admin/roles.html.haml +1 -0
- data/app/views/cms/fortress/admin/settings.html.haml +1 -0
- data/app/views/cms/fortress/admin/users.html.haml +1 -0
- data/app/views/cms/fortress/roles/_form.html.haml +19 -0
- data/app/views/cms/fortress/roles/edit.html.haml +5 -0
- data/app/views/cms/fortress/roles/index.html.haml +20 -0
- data/app/views/cms/fortress/roles/new.html.haml +5 -0
- data/app/views/cms/fortress/roles/show.html.haml +12 -0
- data/app/views/cms/fortress/shared/_admin_topnav.html.haml +19 -0
- data/app/views/cms/fortress/shared/_navbar.html.erb +14 -0
- data/app/views/cms/fortress/users/_form.html.haml +27 -0
- data/app/views/cms/fortress/users/edit.html.haml +5 -0
- data/app/views/cms/fortress/users/index.html.haml +20 -0
- data/app/views/cms/fortress/users/new.html.haml +5 -0
- data/app/views/cms_users/sessions/new.html.erb +19 -0
- data/app/views/layouts/cms/fortress/default.html.erb +96 -0
- data/app/views/layouts/cms/fortress/session.html.erb +31 -0
- data/app/views/layouts/cms_admin/_body.html.haml +22 -0
- data/app/views/layouts/cms_admin/_head.html.haml +14 -0
- data/app/views/layouts/cms_admin/_left.html.haml +18 -0
- data/cms-fortress.gemspec +148 -0
- data/config/initializers/devise.rb +243 -0
- data/config/locales/en.yml +25 -0
- data/config/roles.yml +10 -0
- data/config/routes.rb +34 -0
- data/db/migrate/01_devise_create_cms_fortress_users.rb +56 -0
- data/db/migrate/02_create_cms_fortress_role_details.rb +15 -0
- data/db/migrate/03_create_cms_fortress_roles.rb +33 -0
- data/lib/cms-fortress.rb +9 -0
- data/lib/cms/fortress/application_controller_methods.rb +14 -0
- data/lib/cms/fortress/auth.rb +11 -0
- data/lib/cms/fortress/comfortable_mexican_sofa.rb +8 -0
- data/lib/cms/fortress/devise.rb +3 -0
- data/lib/cms/fortress/rails/engine.rb +19 -0
- data/lib/generators/cms/fortress/USAGE +8 -0
- data/lib/generators/cms/fortress/fortress_generator.rb +17 -0
- data/lib/generators/cms/fortress/templates/README +23 -0
- data/lib/generators/comfy/cms/cms_generator.rb +55 -0
- data/test/fixtures/cms/fortress/role_details.yml +17 -0
- data/test/fixtures/cms/fortress/roles.yml +9 -0
- data/test/functional/cms/fortress/roles_controller_test.rb +49 -0
- data/test/functional/cms/fortress/users_controller_test.rb +49 -0
- data/test/helper.rb +18 -0
- data/test/test_cms-fortress.rb +7 -0
- data/test/unit/cms/fortress/role_detail_test.rb +7 -0
- data/test/unit/cms/fortress/role_test.rb +7 -0
- data/test/unit/cms/fortress/role_user_test.rb +7 -0
- data/test/unit/helpers/cms/fortress/roles_helper_test.rb +4 -0
- data/test/unit/helpers/cms/fortress/users_helper_test.rb +4 -0
- metadata +226 -0
data/.document
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use --create 1.9.3@cms-fortress
|
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
gem 'rails'
|
4
|
+
gem 'comfortable_mexican_sofa', '1.8.1'
|
5
|
+
gem 'devise', '>= 1.5.4'
|
6
|
+
gem 'cancan', '>=1.6.9'
|
7
|
+
|
8
|
+
# Add dependencies to develop your gem here.
|
9
|
+
# Include everything needed to run rake, tests, features, etc.
|
10
|
+
group :development do
|
11
|
+
gem "rdoc"
|
12
|
+
gem "bundler"
|
13
|
+
gem "jeweler"
|
14
|
+
gem "simplecov"
|
15
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (3.2.13)
|
5
|
+
actionpack (= 3.2.13)
|
6
|
+
mail (~> 2.5.3)
|
7
|
+
actionpack (3.2.13)
|
8
|
+
activemodel (= 3.2.13)
|
9
|
+
activesupport (= 3.2.13)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
journey (~> 1.0.4)
|
13
|
+
rack (~> 1.4.5)
|
14
|
+
rack-cache (~> 1.2)
|
15
|
+
rack-test (~> 0.6.1)
|
16
|
+
sprockets (~> 2.2.1)
|
17
|
+
active_link_to (1.0.0)
|
18
|
+
activemodel (3.2.13)
|
19
|
+
activesupport (= 3.2.13)
|
20
|
+
builder (~> 3.0.0)
|
21
|
+
activerecord (3.2.13)
|
22
|
+
activemodel (= 3.2.13)
|
23
|
+
activesupport (= 3.2.13)
|
24
|
+
arel (~> 3.0.2)
|
25
|
+
tzinfo (~> 0.3.29)
|
26
|
+
activeresource (3.2.13)
|
27
|
+
activemodel (= 3.2.13)
|
28
|
+
activesupport (= 3.2.13)
|
29
|
+
activesupport (3.2.13)
|
30
|
+
i18n (= 0.6.1)
|
31
|
+
multi_json (~> 1.0)
|
32
|
+
arel (3.0.2)
|
33
|
+
bcrypt-ruby (3.0.1)
|
34
|
+
builder (3.0.4)
|
35
|
+
cancan (1.6.9)
|
36
|
+
climate_control (0.0.3)
|
37
|
+
activesupport (>= 3.0)
|
38
|
+
cocaine (0.5.1)
|
39
|
+
climate_control (>= 0.0.3, < 1.0)
|
40
|
+
coffee-rails (3.2.2)
|
41
|
+
coffee-script (>= 2.2.0)
|
42
|
+
railties (~> 3.2.0)
|
43
|
+
coffee-script (2.2.0)
|
44
|
+
coffee-script-source
|
45
|
+
execjs
|
46
|
+
coffee-script-source (1.6.2)
|
47
|
+
comfortable_mexican_sofa (1.8.1)
|
48
|
+
active_link_to (>= 1.0.0)
|
49
|
+
coffee-rails (>= 3.1.0)
|
50
|
+
formatted_form (>= 2.1.0)
|
51
|
+
haml-rails (>= 0.3.0)
|
52
|
+
jquery-rails (>= 2.2.0)
|
53
|
+
paperclip (>= 3.4.0)
|
54
|
+
rails (>= 3.1.0)
|
55
|
+
redcarpet (>= 2.2.0)
|
56
|
+
sass-rails (>= 3.1.0)
|
57
|
+
devise (2.2.3)
|
58
|
+
bcrypt-ruby (~> 3.0)
|
59
|
+
orm_adapter (~> 0.1)
|
60
|
+
railties (~> 3.1)
|
61
|
+
warden (~> 1.2.1)
|
62
|
+
erubis (2.7.0)
|
63
|
+
execjs (1.4.0)
|
64
|
+
multi_json (~> 1.0)
|
65
|
+
formatted_form (2.1.1)
|
66
|
+
rails (>= 3.1.0)
|
67
|
+
git (1.2.5)
|
68
|
+
haml (4.0.2)
|
69
|
+
tilt
|
70
|
+
haml-rails (0.4)
|
71
|
+
actionpack (>= 3.1, < 4.1)
|
72
|
+
activesupport (>= 3.1, < 4.1)
|
73
|
+
haml (>= 3.1, < 4.1)
|
74
|
+
railties (>= 3.1, < 4.1)
|
75
|
+
hike (1.2.2)
|
76
|
+
i18n (0.6.1)
|
77
|
+
jeweler (1.8.4)
|
78
|
+
bundler (~> 1.0)
|
79
|
+
git (>= 1.2.5)
|
80
|
+
rake
|
81
|
+
rdoc
|
82
|
+
journey (1.0.4)
|
83
|
+
jquery-rails (2.2.1)
|
84
|
+
railties (>= 3.0, < 5.0)
|
85
|
+
thor (>= 0.14, < 2.0)
|
86
|
+
json (1.7.7)
|
87
|
+
mail (2.5.3)
|
88
|
+
i18n (>= 0.4.0)
|
89
|
+
mime-types (~> 1.16)
|
90
|
+
treetop (~> 1.4.8)
|
91
|
+
mime-types (1.23)
|
92
|
+
multi_json (1.7.2)
|
93
|
+
orm_adapter (0.4.0)
|
94
|
+
paperclip (3.4.1)
|
95
|
+
activemodel (>= 3.0.0)
|
96
|
+
activerecord (>= 3.0.0)
|
97
|
+
activesupport (>= 3.0.0)
|
98
|
+
cocaine (~> 0.5.0)
|
99
|
+
mime-types
|
100
|
+
polyglot (0.3.3)
|
101
|
+
rack (1.4.5)
|
102
|
+
rack-cache (1.2)
|
103
|
+
rack (>= 0.4)
|
104
|
+
rack-ssl (1.3.3)
|
105
|
+
rack
|
106
|
+
rack-test (0.6.2)
|
107
|
+
rack (>= 1.0)
|
108
|
+
rails (3.2.13)
|
109
|
+
actionmailer (= 3.2.13)
|
110
|
+
actionpack (= 3.2.13)
|
111
|
+
activerecord (= 3.2.13)
|
112
|
+
activeresource (= 3.2.13)
|
113
|
+
activesupport (= 3.2.13)
|
114
|
+
bundler (~> 1.0)
|
115
|
+
railties (= 3.2.13)
|
116
|
+
railties (3.2.13)
|
117
|
+
actionpack (= 3.2.13)
|
118
|
+
activesupport (= 3.2.13)
|
119
|
+
rack-ssl (~> 1.3.2)
|
120
|
+
rake (>= 0.8.7)
|
121
|
+
rdoc (~> 3.4)
|
122
|
+
thor (>= 0.14.6, < 2.0)
|
123
|
+
rake (10.0.4)
|
124
|
+
rdoc (3.12.2)
|
125
|
+
json (~> 1.4)
|
126
|
+
redcarpet (2.2.2)
|
127
|
+
sass (3.2.8)
|
128
|
+
sass-rails (3.2.6)
|
129
|
+
railties (~> 3.2.0)
|
130
|
+
sass (>= 3.1.10)
|
131
|
+
tilt (~> 1.3)
|
132
|
+
simplecov (0.7.1)
|
133
|
+
multi_json (~> 1.0)
|
134
|
+
simplecov-html (~> 0.7.1)
|
135
|
+
simplecov-html (0.7.1)
|
136
|
+
sprockets (2.2.2)
|
137
|
+
hike (~> 1.2)
|
138
|
+
multi_json (~> 1.0)
|
139
|
+
rack (~> 1.0)
|
140
|
+
tilt (~> 1.1, != 1.3.0)
|
141
|
+
thor (0.18.1)
|
142
|
+
tilt (1.3.7)
|
143
|
+
treetop (1.4.12)
|
144
|
+
polyglot
|
145
|
+
polyglot (>= 0.3.1)
|
146
|
+
tzinfo (0.3.37)
|
147
|
+
warden (1.2.1)
|
148
|
+
rack (>= 1.0)
|
149
|
+
|
150
|
+
PLATFORMS
|
151
|
+
ruby
|
152
|
+
|
153
|
+
DEPENDENCIES
|
154
|
+
bundler
|
155
|
+
cancan (>= 1.6.9)
|
156
|
+
comfortable_mexican_sofa (= 1.8.1)
|
157
|
+
devise (>= 1.5.4)
|
158
|
+
jeweler
|
159
|
+
rails
|
160
|
+
rdoc
|
161
|
+
simplecov
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Melvin Sembrano
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
= cms-fortress
|
2
|
+
|
3
|
+
An extension for the awesome Comfortable Mexican Sofa (https://github.com/comfy/comfortable-mexican-sofa) CMS Engine
|
4
|
+
|
5
|
+
* Added Role Management for proper workflow
|
6
|
+
* Added Devise for User and Session Management
|
7
|
+
* todo..
|
8
|
+
|
9
|
+
Installation
|
10
|
+
------------
|
11
|
+
|
12
|
+
Add gem defintion to your Gemfile:
|
13
|
+
|
14
|
+
gem 'cms-fortress'
|
15
|
+
|
16
|
+
Then from the Rails project's root run:
|
17
|
+
|
18
|
+
bundle install
|
19
|
+
rails generate cms:fortress
|
20
|
+
rake db:migrate
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
== Contributing to cms-fortress
|
25
|
+
|
26
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
27
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
28
|
+
* Fork the project.
|
29
|
+
* Start a feature/bugfix branch.
|
30
|
+
* Commit and push until you are happy with your contribution.
|
31
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
32
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
33
|
+
|
34
|
+
== Copyright
|
35
|
+
|
36
|
+
Copyright (c) 2013 Melvin Sembrano. See LICENSE.txt for
|
37
|
+
further details.
|
38
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "cms-fortress"
|
18
|
+
gem.homepage = "http://github.com/melvinsembrano/cms-fortress"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Comfortable Mexican Sofa (CMS) - User and role management extension}
|
21
|
+
gem.description = %Q{Comfortable Mexican Sofa (CMS) - User and role management extension}
|
22
|
+
gem.email = "melvinsembrano@gmail.com"
|
23
|
+
gem.authors = ["Melvin Sembrano"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
gem.files.include 'lib/**/*.rb'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
=begin
|
37
|
+
require 'rcov/rcovtask'
|
38
|
+
Rcov::RcovTask.new do |test|
|
39
|
+
test.libs << 'test'
|
40
|
+
test.pattern = 'test/**/test_*.rb'
|
41
|
+
test.verbose = true
|
42
|
+
test.rcov_opts << '--exclude "gems/*"'
|
43
|
+
end
|
44
|
+
=end
|
45
|
+
|
46
|
+
task :default => :test
|
47
|
+
|
48
|
+
require 'rdoc/task'
|
49
|
+
Rake::RDocTask.new do |rdoc|
|
50
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
51
|
+
|
52
|
+
rdoc.rdoc_dir = 'rdoc'
|
53
|
+
rdoc.title = "cms-fortress #{version}"
|
54
|
+
rdoc.rdoc_files.include('README*')
|
55
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.0
|
@@ -0,0 +1,117 @@
|
|
1
|
+
/* ==========================================================
|
2
|
+
* bootstrap-affix.js v2.3.1
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#affix
|
4
|
+
* ==========================================================
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* ========================================================== */
|
19
|
+
|
20
|
+
|
21
|
+
!function ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* AFFIX CLASS DEFINITION
|
27
|
+
* ====================== */
|
28
|
+
|
29
|
+
var Affix = function (element, options) {
|
30
|
+
this.options = $.extend({}, $.fn.affix.defaults, options)
|
31
|
+
this.$window = $(window)
|
32
|
+
.on('scroll.affix.data-api', $.proxy(this.checkPosition, this))
|
33
|
+
.on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this))
|
34
|
+
this.$element = $(element)
|
35
|
+
this.checkPosition()
|
36
|
+
}
|
37
|
+
|
38
|
+
Affix.prototype.checkPosition = function () {
|
39
|
+
if (!this.$element.is(':visible')) return
|
40
|
+
|
41
|
+
var scrollHeight = $(document).height()
|
42
|
+
, scrollTop = this.$window.scrollTop()
|
43
|
+
, position = this.$element.offset()
|
44
|
+
, offset = this.options.offset
|
45
|
+
, offsetBottom = offset.bottom
|
46
|
+
, offsetTop = offset.top
|
47
|
+
, reset = 'affix affix-top affix-bottom'
|
48
|
+
, affix
|
49
|
+
|
50
|
+
if (typeof offset != 'object') offsetBottom = offsetTop = offset
|
51
|
+
if (typeof offsetTop == 'function') offsetTop = offset.top()
|
52
|
+
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
|
53
|
+
|
54
|
+
affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?
|
55
|
+
false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ?
|
56
|
+
'bottom' : offsetTop != null && scrollTop <= offsetTop ?
|
57
|
+
'top' : false
|
58
|
+
|
59
|
+
if (this.affixed === affix) return
|
60
|
+
|
61
|
+
this.affixed = affix
|
62
|
+
this.unpin = affix == 'bottom' ? position.top - scrollTop : null
|
63
|
+
|
64
|
+
this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : ''))
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
/* AFFIX PLUGIN DEFINITION
|
69
|
+
* ======================= */
|
70
|
+
|
71
|
+
var old = $.fn.affix
|
72
|
+
|
73
|
+
$.fn.affix = function (option) {
|
74
|
+
return this.each(function () {
|
75
|
+
var $this = $(this)
|
76
|
+
, data = $this.data('affix')
|
77
|
+
, options = typeof option == 'object' && option
|
78
|
+
if (!data) $this.data('affix', (data = new Affix(this, options)))
|
79
|
+
if (typeof option == 'string') data[option]()
|
80
|
+
})
|
81
|
+
}
|
82
|
+
|
83
|
+
$.fn.affix.Constructor = Affix
|
84
|
+
|
85
|
+
$.fn.affix.defaults = {
|
86
|
+
offset: 0
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
/* AFFIX NO CONFLICT
|
91
|
+
* ================= */
|
92
|
+
|
93
|
+
$.fn.affix.noConflict = function () {
|
94
|
+
$.fn.affix = old
|
95
|
+
return this
|
96
|
+
}
|
97
|
+
|
98
|
+
|
99
|
+
/* AFFIX DATA-API
|
100
|
+
* ============== */
|
101
|
+
|
102
|
+
$(window).on('load', function () {
|
103
|
+
$('[data-spy="affix"]').each(function () {
|
104
|
+
var $spy = $(this)
|
105
|
+
, data = $spy.data()
|
106
|
+
|
107
|
+
data.offset = data.offset || {}
|
108
|
+
|
109
|
+
data.offsetBottom && (data.offset.bottom = data.offsetBottom)
|
110
|
+
data.offsetTop && (data.offset.top = data.offsetTop)
|
111
|
+
|
112
|
+
$spy.affix(data)
|
113
|
+
})
|
114
|
+
})
|
115
|
+
|
116
|
+
|
117
|
+
}(window.jQuery);
|
@@ -0,0 +1,99 @@
|
|
1
|
+
/* ==========================================================
|
2
|
+
* bootstrap-alert.js v2.3.1
|
3
|
+
* http://twitter.github.com/bootstrap/javascript.html#alerts
|
4
|
+
* ==========================================================
|
5
|
+
* Copyright 2012 Twitter, Inc.
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
* ========================================================== */
|
19
|
+
|
20
|
+
|
21
|
+
!function ($) {
|
22
|
+
|
23
|
+
"use strict"; // jshint ;_;
|
24
|
+
|
25
|
+
|
26
|
+
/* ALERT CLASS DEFINITION
|
27
|
+
* ====================== */
|
28
|
+
|
29
|
+
var dismiss = '[data-dismiss="alert"]'
|
30
|
+
, Alert = function (el) {
|
31
|
+
$(el).on('click', dismiss, this.close)
|
32
|
+
}
|
33
|
+
|
34
|
+
Alert.prototype.close = function (e) {
|
35
|
+
var $this = $(this)
|
36
|
+
, selector = $this.attr('data-target')
|
37
|
+
, $parent
|
38
|
+
|
39
|
+
if (!selector) {
|
40
|
+
selector = $this.attr('href')
|
41
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
42
|
+
}
|
43
|
+
|
44
|
+
$parent = $(selector)
|
45
|
+
|
46
|
+
e && e.preventDefault()
|
47
|
+
|
48
|
+
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
|
49
|
+
|
50
|
+
$parent.trigger(e = $.Event('close'))
|
51
|
+
|
52
|
+
if (e.isDefaultPrevented()) return
|
53
|
+
|
54
|
+
$parent.removeClass('in')
|
55
|
+
|
56
|
+
function removeElement() {
|
57
|
+
$parent
|
58
|
+
.trigger('closed')
|
59
|
+
.remove()
|
60
|
+
}
|
61
|
+
|
62
|
+
$.support.transition && $parent.hasClass('fade') ?
|
63
|
+
$parent.on($.support.transition.end, removeElement) :
|
64
|
+
removeElement()
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
/* ALERT PLUGIN DEFINITION
|
69
|
+
* ======================= */
|
70
|
+
|
71
|
+
var old = $.fn.alert
|
72
|
+
|
73
|
+
$.fn.alert = function (option) {
|
74
|
+
return this.each(function () {
|
75
|
+
var $this = $(this)
|
76
|
+
, data = $this.data('alert')
|
77
|
+
if (!data) $this.data('alert', (data = new Alert(this)))
|
78
|
+
if (typeof option == 'string') data[option].call($this)
|
79
|
+
})
|
80
|
+
}
|
81
|
+
|
82
|
+
$.fn.alert.Constructor = Alert
|
83
|
+
|
84
|
+
|
85
|
+
/* ALERT NO CONFLICT
|
86
|
+
* ================= */
|
87
|
+
|
88
|
+
$.fn.alert.noConflict = function () {
|
89
|
+
$.fn.alert = old
|
90
|
+
return this
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
/* ALERT DATA-API
|
95
|
+
* ============== */
|
96
|
+
|
97
|
+
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
|
98
|
+
|
99
|
+
}(window.jQuery);
|