This commit is contained in:
Nicolas Bally 2014-10-20 23:32:40 +02:00
commit af54665111
1280 changed files with 293992 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

16
.gitignore vendored Normal file
View File

@ -0,0 +1,16 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp

4
Capfile Normal file
View File

@ -0,0 +1,4 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks

37
Gemfile Normal file
View File

@ -0,0 +1,37 @@
source 'https://rubygems.org'
gem 'rails', '4.1.4'
gem 'bcrypt', '~> 3.1.7'
gem 'sqlite3', group: :development
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'haml-rails'
gem 'unicorn'
gem "capistrano", '2.15.5', group: :development
gem "rvm-capistrano",'1.4.1', group: :development
gem 'net-ssh', '~>2.7.0'
gem "therubyracer"
gem 'carrierwave'
gem 'rmagick', :require => 'RMagick'
gem 'acts_as_tree'
gem 'formtastic', "2.3.0"
gem "twitter-bootstrap-rails"
gem 'formtastic-bootstrap'

190
Gemfile.lock Normal file
View File

@ -0,0 +1,190 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.4)
actionpack (= 4.1.4)
actionview (= 4.1.4)
mail (~> 2.5.4)
actionpack (4.1.4)
actionview (= 4.1.4)
activesupport (= 4.1.4)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
actionview (4.1.4)
activesupport (= 4.1.4)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.4)
activesupport (= 4.1.4)
builder (~> 3.1)
activerecord (4.1.4)
activemodel (= 4.1.4)
activesupport (= 4.1.4)
arel (~> 5.0.0)
activesupport (4.1.4)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
acts_as_tree (2.1.0)
activerecord (>= 3.0.0)
arel (5.0.1.20140414130214)
bcrypt (3.1.7)
builder (3.2.2)
capistrano (2.15.5)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
carrierwave (0.10.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.8.0)
erubis (2.7.0)
execjs (2.2.1)
formtastic (2.3.0)
actionpack (>= 3.0)
formtastic-bootstrap (3.0.0)
formtastic (>= 2.2)
haml (4.0.5)
tilt
haml-rails (0.5.3)
actionpack (>= 4.0.1)
activesupport (>= 4.0.1)
haml (>= 3.1, < 5.0)
railties (>= 4.0.1)
highline (1.6.21)
hike (1.2.3)
i18n (0.6.11)
jbuilder (2.1.3)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (3.1.2)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
kgio (2.9.2)
libv8 (3.16.14.7)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
minitest (5.4.2)
multi_json (1.10.1)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.7.0)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
polyglot (0.3.5)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.1.4)
actionmailer (= 4.1.4)
actionpack (= 4.1.4)
actionview (= 4.1.4)
activemodel (= 4.1.4)
activerecord (= 4.1.4)
activesupport (= 4.1.4)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.4)
sprockets-rails (~> 2.0)
railties (4.1.4)
actionpack (= 4.1.4)
activesupport (= 4.1.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
rake (10.3.2)
rdoc (4.1.2)
json (~> 1.4)
ref (1.0.5)
rmagick (2.13.3)
rvm-capistrano (1.4.1)
capistrano (>= 2.0.0)
sass (3.2.19)
sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
sass (~> 3.2.0)
sprockets (~> 2.8, <= 2.11.0)
sprockets-rails (~> 2.0)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
spring (1.1.3)
sprockets (2.11.0)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.1.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.9)
therubyracer (0.12.1)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (2.4.0)
coffee-rails
twitter-bootstrap-rails (3.2.0)
actionpack (~> 4.1)
execjs (~> 2.2)
rails (~> 4.1)
railties (~> 4.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.5.3)
execjs (>= 0.3.0)
json (>= 1.8.0)
unicorn (4.8.3)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
PLATFORMS
ruby
DEPENDENCIES
acts_as_tree
bcrypt (~> 3.1.7)
capistrano (= 2.15.5)
carrierwave
coffee-rails (~> 4.0.0)
formtastic (= 2.3.0)
formtastic-bootstrap
haml-rails
jbuilder (~> 2.0)
jquery-rails
net-ssh (~> 2.7.0)
rails (= 4.1.4)
rmagick
rvm-capistrano (= 1.4.1)
sass-rails (~> 4.0.3)
sdoc (~> 0.4.0)
spring
sqlite3
therubyracer
turbolinks
twitter-bootstrap-rails
uglifier (>= 1.3.0)
unicorn

28
README.rdoc Normal file
View File

@ -0,0 +1,28 @@
== README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.

6
Rakefile Normal file
View File

@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks

BIN
app/.DS_Store vendored Normal file

Binary file not shown.

BIN
app/assets/.DS_Store vendored Normal file

Binary file not shown.

BIN
app/assets/images/.DS_Store vendored Normal file

Binary file not shown.

0
app/assets/images/.keep Normal file
View File

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
app/assets/images/file_types/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
app/assets/images/fond.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
app/assets/images/vendor/select2-spinner.gif vendored Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
app/assets/images/vendor/select2.png vendored Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

BIN
app/assets/images/vendor/select2x2.png vendored Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

BIN
app/assets/javascripts/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,400 @@
#= require jquery
#= require jquery_ujs
# require turbolinks
#= require event_form
#= require bootstrap
#= require vendor/jquery-sortable
#= require vendor/jquery.event.drag.js
#= require vendor/bootstrap-slider
#= require vendor/jquery.ui.widget
#= require vendor/tmpl.min
#= require vendor/jquery.iframe-transport
#= require vendor/jquery.fileupload
#= require vendor/jquery.fileupload-ui
#= require vendor/jquery.fileupload-process
#= require vendor/select2.min
#= require manager
#= require image_files
#= require pane_hover
#= require redactor
#= require redactor_plugins/fontsize
#= require redactor_plugins/fontfamily
#= require redactor_plugins/fontcolor
#= require nested_fields
portlet_to_move = false
content_type_to_move =false
@open_collapse3 = ->
$("#collapse3 .panel").show()
$("#collapse3").show()
@reset_edit_pane = ->
$("#element_form").html()
$("#collapse3").hide()
@unselect_portlet = ->
$(".portlet.active").removeClass("active")
reset_edit_pane()
@cancel_move_portlet = ->
$(".move_message").show()
$(".cancel_message").hide()
$(".move").removeClass("move")
$(".portlet_placeholder").remove()
portlet_to_move = false
$(document).ready ->
$(document).on 'click', 'input.datepicker', ->
$(this).datetimepicker(
language: 'fr'
pickTime: false
).focus();
$(document).on 'click', 'input.datetimepicker', ->
$(this).datetimepicker(
use24hours: true
format: 'DD/MM/YYYY hh:mm'
minuteStepping:15
language: 'fr'
).focus();
$(document).on 'click', 'input.timepicker', ->
$(this).datetimepicker(
use24hours: true
format: 'DD/MM/YYYY hh:mm'
minuteStepping:15
pickDate: false
language: 'fr'
).focus();
$(document).on "click", ".portlet", (event) ->
if !$(this).hasClass("active") and portlet_to_move == false
$(".portlet.active").removeClass("active")
$(this).addClass("active")
$.ajax({url : $(this).data("edit-link"), type: "GET"});
$("#collapse3 .trash").attr("href", $(this).data("show-link"));
event.stopPropagation();
$(document).on "click", ".block_portlets", (event) ->
portlet_to_move = false
content_type_to_move = false
$("#element_form").html("")
$(".portlet.active").removeClass("active")
$(document).on "click", "#content_types .content_type", ->
cancel_move_portlet()
unselect_portlet()
reset_edit_pane()
type = $(this).data("type")
content_type_to_move = type
init_portlets_place_holder()
$(this).addClass("move")
false
$(document).on "click", ".portlet_handle", ->
if portlet_to_move == false
$(".move_message").hide()
$(".cancel_message").show()
id = $(this).data("portlet-id")
portlet_to_move = $("#portlet_"+id)
init_portlets_place_holder()
portlet_to_move.addClass("move")
false
else
cancel_move_portlet()
false
$(document).on "click", ".portlet_placeholder", ->
if portlet_to_move != false
$(this).after portlet_to_move
$(".move").removeClass("move")
$(".portlet_placeholder").remove()
update_block_portlet_order(portlet_to_move.closest(".block_portlets").data("block_id"))
cancel_move_portlet()
else
block_id = $(this).closest(".block_portlets").data("block_id")
$(this).replaceWith('<div id="new_portlet_form_inline" class="portlet"><div id="new_portlet_content_form"></div></div>');
$.ajax({
url:"/portlet/portlets/new.js",
type: "GET",
data: {
block_id : block_id,
position : $(this).attr("data_position"),
content_type : content_type_to_move
}
})
content_type_to_move = false
$(".portlet_placeholder").remove()
@init_portlets_place_holder = ->
placeholder = '<div class="portlet_placeholder"><i class="fa fa-angle-right place"></i></div>'
$(".block_portlets").each ->
$(this).find(".portlet_placeholder").remove()
$(this).prepend(placeholder)
$(this).find(".portlet").each ->
$(this).after(placeholder)
@flash_delay = ->
$("#flashs").find(".alert").each ->
if !$(this).hasClass("delay")
$(this).addClass("delay")
$(this).delay(3000).fadeOut();
@init_menu_items_list = ->
if $(".prevv_folder").length > 0
$(".prevv_folder").sortable({
group:"menu_items",
containerSelector :".receptable",
itemSelector:".menu_item_row",
handle: ".handle",
nested:false,
placeholder:"<div class='placeholder'></div>",
})
oldContainer = ""
$("#sortable_menu_item").sortable({
group:"menu_items",
containerSelector :".receptable",
itemSelector:".menu_item_row",
handle: ".handle",
nested:true,
placeholder:"<div class='placeholder'></div>",
afterMove: (placeholder, container) ->
if oldContainer != container and container.el.hasClass("prevv_folder")
if oldContainer
oldContainer.el.removeClass("active")
container.el.addClass("active")
oldContainer = container
onDrop: (item, Container, _super) ->
if Container
parent_id = Container.el.data("parent-id")
menu_id = Container.el.data("menu-id")
id = item.data("menu-item-id")
$.ajax({
url:"/admin/menu_items/"+id+".js",
type: "PUT",
data: {
reorder : true,
menu_item : {
parent_id : parent_id,
menu_id : menu_id
}
},
success : ->
_super(item)
item.remove()
})
else
_super(item)
sortable_data = {parent_id :$("#sortable_menu_item").data("parent-id"), menu_id :$("#sortable_menu_item").data("menu-id") , menu_items_ids : []}
$("#sortable_menu_item").find(".menu_item_row").each ->
sortable_data.menu_items_ids.push $(this).data("menu-item-id")
$.ajax({url : "/admin/menu_items/reorder", data : sortable_data, type: "POST"});
})
@update_block_portlet_order = (block_portlet_id) ->
return_order = []
block_portlet = $("#block_portlet_"+block_portlet_id)
block_data = {block_id : block_portlet.data('block_id'), block_portlet_ids : []}
block_portlet.children('.portlet').each ->
if $(this).data('portlet_id')
block_data.block_portlet_ids.push($(this).data('portlet_id'))
return_order.push(block_data);
$.ajax({url : "/portlet/portlets/reorder", data : {blocks:return_order}, type: "POST"})
jQuery ->
$(".inline-contenteditable").keypress (e) ->
if e.which == 13
false
else
$(this).html($(this).text())
return true
$(document).on 'click', ".portlet_title_content .inline-contenteditable", () ->
$.ajax
url : "/portlet/title_contents/"+$(this).data("title-id")+"/edit.js",
type: "GET",
$(document).on 'blur keyup paste', ".portlet_title_content .inline-contenteditable", () ->
$(this).html($(this).text())
$.ajax
url : "/portlet/title_contents/"+$(this).data("title-id"),
type: "PUT",
data :
title_content :
content : $(this).html()
$(".sortable").sortable({
containerSelector :".block",
itemSelector:".portlet",
handle: ".handle",
nested:true,
placeholder:"<div class='placeholder'></div>"
})
flash_delay();
item_catched = ""
adjustment = ""
$("#menu_item_inspector_container").sortable({
itemSelector:"#menu_item_informations",
pullPlaceholder :false,
placeholder : "",
handle: ".inspector_handle",
onDragStart: ($item, container, _super) ->
$item.css({
height: $item.height(),
width: $item.width()
})
$("body").addClass("dragging")
offset = $item.offset()
pointer = container.rootGroup.pointer
adjustment = {
left: pointer.left - offset.left,
top: pointer.top - offset.top
}
onCancel : ($item, container, _super) ->
$item.css(position)
$item.removeClass("dragged")
$("body").removeClass("dragging")
onDrag: ($item, position, _super) ->
$item.css({
left: position.left - adjustment.left,
top: position.top - adjustment.top - $(window).scrollTop()
})
})
$(document).on "scroll", () ->
if( $(this).scrollTop() <= 52 )
top = 52 - $(this).scrollTop()
else
top = 0
$("#toolbar-text, #menu_item_informations").css
top : top
$(document).on "click", "#menu_item_informations .save", ->
$(this).closest(".panel").find("form").submit()
return false
$(document).on "click", "#menu_item_informations h4", ->
$(this).next(".panel").toggle()
return false

13
app/assets/javascripts/bootstrap.js vendored Normal file
View File

@ -0,0 +1,13 @@
//= require bootstrap/affix
//= require bootstrap/alert
//= require bootstrap/button
//= require bootstrap/carousel
//= require bootstrap/dropdown
//= require bootstrap/tab
//= require bootstrap/transition
//= require bootstrap/scrollspy
//= require bootstrap/modal
//= require bootstrap/tooltip
//= require bootstrap/popover
//= require bootstrap/datetimepicker

View File

@ -0,0 +1,137 @@
/* ========================================================================
* Bootstrap: affix.js v3.1.1
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// AFFIX CLASS DEFINITION
// ======================
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$window = $(window)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element = $(element)
this.affixed =
this.unpin =
this.pinnedOffset = null
this.checkPosition()
}
Affix.RESET = 'affix affix-top affix-bottom'
Affix.DEFAULTS = {
offset: 0
}
Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$window.scrollTop()
var position = this.$element.offset()
return (this.pinnedOffset = position.top - scrollTop)
}
Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var scrollHeight = $(document).height()
var scrollTop = this.$window.scrollTop()
var position = this.$element.offset()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
if (this.affixed == 'top') position.top += scrollTop
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
if (this.affixed === affix) return
if (this.unpin) this.$element.css('top', '')
var affixType = 'affix' + (affix ? '-' + affix : '')
var e = $.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
this.affixed = affix
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger($.Event(affixType.replace('affix', 'affixed')))
if (affix == 'bottom') {
this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() })
}
}
// AFFIX PLUGIN DEFINITION
// =======================
var old = $.fn.affix
$.fn.affix = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.affix.Constructor = Affix
// AFFIX NO CONFLICT
// =================
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
// AFFIX DATA-API
// ==============
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()
data.offset = data.offset || {}
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
if (data.offsetTop) data.offset.top = data.offsetTop
$spy.affix(data)
})
})
}(jQuery);

View File

@ -0,0 +1,88 @@
/* ========================================================================
* Bootstrap: alert.js v3.1.1
* http://getbootstrap.com/javascript/#alerts
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// ALERT CLASS DEFINITION
// ======================
var dismiss = '[data-dismiss="alert"]'
var Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
Alert.prototype.close = function (e) {
var $this = $(this)
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = $(selector)
if (e) e.preventDefault()
if (!$parent.length) {
$parent = $this.hasClass('alert') ? $this : $this.parent()
}
$parent.trigger(e = $.Event('close.bs.alert'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
$parent.trigger('closed.bs.alert').remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent
.one($.support.transition.end, removeElement)
.emulateTransitionEnd(150) :
removeElement()
}
// ALERT PLUGIN DEFINITION
// =======================
var old = $.fn.alert
$.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.alert')
if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.fn.alert.Constructor = Alert
// ALERT NO CONFLICT
// =================
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
// ALERT DATA-API
// ==============
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
}(jQuery);

Some files were not shown because too many files have changed in this diff Show More