partystreusel 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/README.md +177 -0
- data/Rakefile +1 -0
- data/lib/partystreusel.rb +9 -0
- data/lib/partystreusel/version.rb +3 -0
- data/partystreusel.gemspec +21 -0
- data/vendor/assets/javascripts/carousel/models/photo.js.coffee +10 -0
- data/vendor/assets/javascripts/carousel/models/photos_collection.js.coffee +10 -0
- data/vendor/assets/javascripts/carousel/models/project.js.coffee +44 -0
- data/vendor/assets/javascripts/carousel/models/projects_collection.js.coffee +15 -0
- data/vendor/assets/javascripts/carousel/views/carousel.js.coffee +105 -0
- data/vendor/assets/javascripts/carousel/views/photo-details-view.js.coffee +10 -0
- data/vendor/assets/javascripts/carousel/views/photo_view.js.coffee +62 -0
- data/vendor/assets/javascripts/carousel/views/project_details_view.js.coffee +10 -0
- data/vendor/assets/javascripts/carousel/views/project_view.js.coffee +29 -0
- data/vendor/assets/javascripts/carousel/views/warning_view.js.coffee +14 -0
- data/vendor/assets/javascripts/sc.accordion.js.coffee +47 -0
- data/vendor/assets/javascripts/sc.carousel.js.coffee +3 -0
- data/vendor/assets/javascripts/sc.expandable_content.js.coffee +40 -0
- metadata +88 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
# Partystreusel
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
Add **partystreusel** to your Gemfile `gem 'partystreusel'` and bundle. Done.
|
5
|
+
|
6
|
+
## Available components:
|
7
|
+
* **Expandable Content:** enables a "read more" button to show or hide additional content.
|
8
|
+
* **Accordion:** Allows for multiple nested accordions.
|
9
|
+
* **Carousel:** Allows 2-dimensional scrolling in vertical and horizontal direction. The images are thereby divided into image-groups. The image-group to image-group scrolling is vertically, scrolling inside the image-group is horizontally.
|
10
|
+
|
11
|
+
## Usage in Rails:
|
12
|
+
Most components have a backbone.js dependency. Satisfy it by loading backbone.js and rails-underscore:
|
13
|
+
|
14
|
+
gem 'rails-backbone'
|
15
|
+
gem 'underscore-rails'
|
16
|
+
|
17
|
+
Then, require backbone.js and underscore.js in your manifest, usually application.js(.coffee):
|
18
|
+
|
19
|
+
#= require underscore
|
20
|
+
#= require backbone
|
21
|
+
|
22
|
+
## Expandable Content
|
23
|
+
|
24
|
+
Load it inside your manifest, usually application.js(.coffee):
|
25
|
+
|
26
|
+
#= require sc.expandable_content
|
27
|
+
|
28
|
+
#### Required Markup:
|
29
|
+
|
30
|
+
#jump_id.expandable
|
31
|
+
… your content …
|
32
|
+
%a.more{ :href => '#' } read more
|
33
|
+
.expandable-content.hidden
|
34
|
+
… read more content …
|
35
|
+
%a.less{ :href => '#jump_id' } read less
|
36
|
+
|
37
|
+
#### Required Styles:
|
38
|
+
|
39
|
+
.hidden
|
40
|
+
display: none
|
41
|
+
|
42
|
+
#### Use it:
|
43
|
+
|
44
|
+
$(".expandable").each ->
|
45
|
+
new SC.ExpandableContent(el: $(this))
|
46
|
+
|
47
|
+
## Accordion
|
48
|
+
|
49
|
+
Load it inside your manifest, usually application.js(.coffee):
|
50
|
+
|
51
|
+
#= require sc.accordion
|
52
|
+
|
53
|
+
#### Required Markup:
|
54
|
+
|
55
|
+
.accordion
|
56
|
+
.accordion-item
|
57
|
+
.title
|
58
|
+
The clickable header of the accordion item
|
59
|
+
.content
|
60
|
+
… The content which is toggled by clicking the header …
|
61
|
+
|
62
|
+
#### Required Styles:
|
63
|
+
|
64
|
+
.open .content
|
65
|
+
display: block
|
66
|
+
|
67
|
+
.content
|
68
|
+
display: none
|
69
|
+
|
70
|
+
#### Use it:
|
71
|
+
|
72
|
+
$(".accordion").each ->
|
73
|
+
new SC.Accordion(el: $(this))
|
74
|
+
|
75
|
+
## Carousel
|
76
|
+
|
77
|
+
The carousel component has dependencies to jQuery and jQuery-UI-Effects.
|
78
|
+
Load them together with the carousel inside your manifest, usually application.js(.coffee):
|
79
|
+
|
80
|
+
#= require jquery
|
81
|
+
#= require jquery-ui
|
82
|
+
#= require sc.carousel
|
83
|
+
|
84
|
+
#### Required Model (json):
|
85
|
+
|
86
|
+
The model needs a 'photos' attribute per image-group.<br />
|
87
|
+
Inside the 'photos' the images with their specific urls are defined.<br />
|
88
|
+
Here's an example of two image-groups. The first includes two images, the second three:
|
89
|
+
|
90
|
+
{
|
91
|
+
"photos": [
|
92
|
+
{
|
93
|
+
"image": {
|
94
|
+
"url": <imageUrl>
|
95
|
+
}
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"image": {
|
99
|
+
"url": <imageUrl>
|
100
|
+
}
|
101
|
+
}
|
102
|
+
]
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"photos": [
|
106
|
+
{
|
107
|
+
"image": {
|
108
|
+
"url": <imageUrl>
|
109
|
+
}
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"image": {
|
113
|
+
"url": <imageUrl>
|
114
|
+
}
|
115
|
+
},
|
116
|
+
{
|
117
|
+
"image": {
|
118
|
+
"url": <imageUrl>
|
119
|
+
}
|
120
|
+
}
|
121
|
+
]
|
122
|
+
}
|
123
|
+
|
124
|
+
#### Required Markup:
|
125
|
+
|
126
|
+
#projects-carousel-viewport
|
127
|
+
%script{:type=>'text/template', :id=>'project-details-template'}
|
128
|
+
… put HTML elements (e.g. a link with the title of the image-group and a paragraph with a short description of that image-group) here.
|
129
|
+
Those elements are then rendered into '.project-detail' div …
|
130
|
+
|
131
|
+
%script{:type=>'text/template', :id=>'photo-details-template'}
|
132
|
+
… put HTML elements (e.g. a link with the title of the image and a paragraph with a short description of that image) here.
|
133
|
+
Those elements are then rendered into '.photo-detail' div …
|
134
|
+
|
135
|
+
%script{:type=>'text/template', :id=>'project-template'}
|
136
|
+
… define here the HTML element into which the images defined in the model shall be rendered (e.g. %div or %a, whatever is needed).
|
137
|
+
The rendered elements are then put into '.stage' div …
|
138
|
+
|
139
|
+
.stage
|
140
|
+
|
141
|
+
%span.project-detail
|
142
|
+
|
143
|
+
%span.photo-detail
|
144
|
+
|
145
|
+
%a{ :href => "#", :class => "previous-project" }
|
146
|
+
%a{ :href => "#", :class => "next-project" }
|
147
|
+
%a{ :href => "#", :class => "previous" }
|
148
|
+
%a{ :href => "#", :class => "next" }
|
149
|
+
|
150
|
+
#### Required Styles:
|
151
|
+
|
152
|
+
#projects-carousel-viewport
|
153
|
+
position: relative
|
154
|
+
|
155
|
+
.stage
|
156
|
+
img
|
157
|
+
position: absolute
|
158
|
+
display: none
|
159
|
+
|
160
|
+
.previous-project
|
161
|
+
<addYourStyleHere>
|
162
|
+
|
163
|
+
.next-project
|
164
|
+
<addYourStyleHere>
|
165
|
+
|
166
|
+
.previous
|
167
|
+
<addYourStyleHere>
|
168
|
+
|
169
|
+
.next
|
170
|
+
<addYourStyleHere>
|
171
|
+
|
172
|
+
#### Use it:
|
173
|
+
|
174
|
+
$('#projects-carousel-viewport').each ->
|
175
|
+
projects = new SC.ProjectsCollection <yourModelJson>
|
176
|
+
app = new SC.Carousel projects: projects, el: this
|
177
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "partystreusel/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "partystreusel"
|
7
|
+
s.version = Partystreusel::VERSION
|
8
|
+
s.authors = ["Immanuel Häussermann", "Donat Baier", "Franca Rast", "Noëlle Rosenberg"]
|
9
|
+
s.email = ["haeussermann@gmail.com", "donat.baier@gmail.com", "franca.rast@screenconcept.ch", "noro660@hotmail.com"]
|
10
|
+
s.homepage = "http://www.screenconcept.ch"
|
11
|
+
s.summary = %q{A collection uf reusable javascript components by Screen Concept}
|
12
|
+
s.description = %q{Contains sliders, accordions, expandable contents and any other component we deem worthy of joining this collection of awesomeness.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "partystreusel"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
s.add_dependency "jquery-rails"
|
21
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
window.SC ||= {}
|
2
|
+
|
3
|
+
class SC.PhotosCollection extends Backbone.Collection
|
4
|
+
model:SC.Photo
|
5
|
+
|
6
|
+
successor_of:(member) ->
|
7
|
+
if this.last() == member then this.first() else this.at(this.indexOf(member) + 1)
|
8
|
+
|
9
|
+
predecessor_of:(member) ->
|
10
|
+
if this.first() == member then this.last() else this.at(this.indexOf(member) - 1)
|
@@ -0,0 +1,44 @@
|
|
1
|
+
window.SC ||={}
|
2
|
+
|
3
|
+
class SC.Project extends Backbone.Model
|
4
|
+
|
5
|
+
initialize: ->
|
6
|
+
@isRendered = false
|
7
|
+
@photos = new SC.PhotosCollection(this.get 'photos')
|
8
|
+
@currentPhoto = @photos.first()
|
9
|
+
|
10
|
+
switchToNextPhoto: ->
|
11
|
+
@currentPhoto.hide('slideLeft')
|
12
|
+
@currentPhoto = this.nextPhoto()
|
13
|
+
@currentPhoto.show('slideRight')
|
14
|
+
|
15
|
+
nextPhoto: ->
|
16
|
+
@photos.successor_of(@currentPhoto)
|
17
|
+
|
18
|
+
switchToPreviousPhoto: ->
|
19
|
+
@currentPhoto.hide('slideRight')
|
20
|
+
@currentPhoto = this.previousPhoto()
|
21
|
+
@currentPhoto.show('slideLeft')
|
22
|
+
|
23
|
+
previousPhoto: ->
|
24
|
+
@photos.predecessor_of(@currentPhoto)
|
25
|
+
|
26
|
+
activate: (effect) ->
|
27
|
+
@currentPhoto.show(effect)
|
28
|
+
this.trigger 'activated'
|
29
|
+
|
30
|
+
deactivate: (effect) ->
|
31
|
+
@currentPhoto.hide(effect)
|
32
|
+
|
33
|
+
showingFirstPhoto: ->
|
34
|
+
@currentPhoto == @photos.first()
|
35
|
+
|
36
|
+
showingLastPhoto: ->
|
37
|
+
@currentPhoto == @photos.last()
|
38
|
+
|
39
|
+
forwardPhotos: ->
|
40
|
+
@currentPhoto = @photos.last()
|
41
|
+
|
42
|
+
rewindPhotos: ->
|
43
|
+
@currentPhoto.hide('instant')
|
44
|
+
@currentPhoto = @photos.first()
|
@@ -0,0 +1,15 @@
|
|
1
|
+
window.SC ||= {}
|
2
|
+
|
3
|
+
class SC.ProjectsCollection extends Backbone.Collection
|
4
|
+
model:SC.Project
|
5
|
+
|
6
|
+
initialize: ->
|
7
|
+
# @url = '/projects'
|
8
|
+
|
9
|
+
successor_of:(member) ->
|
10
|
+
next = if this.last() == member then this.first() else this.at(this.indexOf(member) + 1)
|
11
|
+
next = this.first() unless next?
|
12
|
+
next
|
13
|
+
|
14
|
+
predecessor_of:(member) ->
|
15
|
+
if this.first() == member then this.last() else this.at(this.indexOf(member) - 1)
|
@@ -0,0 +1,105 @@
|
|
1
|
+
window.SC ||= {}
|
2
|
+
|
3
|
+
class SC.Carousel extends Backbone.View
|
4
|
+
|
5
|
+
events:{
|
6
|
+
'click .next':'switchToNext'
|
7
|
+
'click .previous':'switchToPrevious'
|
8
|
+
'click .next-project':'switchToNextProject'
|
9
|
+
'click .previous-project':'switchToPreviousProject'
|
10
|
+
}
|
11
|
+
|
12
|
+
initialize:->
|
13
|
+
@el = $('.stage')
|
14
|
+
@projects = @options['projects']
|
15
|
+
this.setDefaults()
|
16
|
+
# new SC.ProjectsCollection()
|
17
|
+
# @projects.url = '/projects'
|
18
|
+
# @projects.fetch()
|
19
|
+
@currentProject = @projects.first()
|
20
|
+
this.render(@currentProject)
|
21
|
+
@currentProject.activate('instant')
|
22
|
+
this.preloadProjects()
|
23
|
+
this.prepareFiltering()
|
24
|
+
@warning = new SC.WarningView({model:@projects})
|
25
|
+
|
26
|
+
prepareFiltering: =>
|
27
|
+
@model.bind 'change', this.reloadProjects if @model?
|
28
|
+
|
29
|
+
setDefaults: ->
|
30
|
+
@stickyProjects = !!@options['stickyProjects']
|
31
|
+
|
32
|
+
reloadProjects: =>
|
33
|
+
@projects.fetch({data: {filter: @model.toJSON()}, success:this.refresh})
|
34
|
+
|
35
|
+
refresh: =>
|
36
|
+
# TODO refactor handling of empty projects collection
|
37
|
+
@projects.trigger 'change'
|
38
|
+
if @projects.isEmpty()
|
39
|
+
@projects.add @currentProject
|
40
|
+
else
|
41
|
+
this.switchToNextProject()
|
42
|
+
|
43
|
+
preloadProjects: ->
|
44
|
+
this.render this.nextProject()
|
45
|
+
this.render this.previousProject()
|
46
|
+
|
47
|
+
render: (project) ->
|
48
|
+
unless project.isRendered
|
49
|
+
v = new SC.ProjectView({model:project})
|
50
|
+
@el.append v.render()
|
51
|
+
return this
|
52
|
+
|
53
|
+
switchToNext: ->
|
54
|
+
return this.switchToNextPhoto() if @stickyProjects == true
|
55
|
+
if @currentProject.showingLastPhoto()
|
56
|
+
this.switchToNextProject()
|
57
|
+
else
|
58
|
+
this.switchToNextPhoto()
|
59
|
+
false # Stop event
|
60
|
+
|
61
|
+
switchToPrevious: ->
|
62
|
+
return this.switchToPreviousPhoto() if @stickyProjects == true
|
63
|
+
if @currentProject.showingFirstPhoto()
|
64
|
+
this.switchToPreviousProject(true)
|
65
|
+
else
|
66
|
+
this.switchToPreviousPhoto()
|
67
|
+
false # Stop event
|
68
|
+
|
69
|
+
switchToNextPhoto:->
|
70
|
+
@currentProject.switchToNextPhoto()
|
71
|
+
false # Stop event
|
72
|
+
|
73
|
+
switchToPreviousPhoto:->
|
74
|
+
@currentProject.switchToPreviousPhoto()
|
75
|
+
false # Stop event
|
76
|
+
|
77
|
+
switchToNextProject:=>
|
78
|
+
next = this.nextProject()
|
79
|
+
this.rewindProjects() if next == @projects.first()
|
80
|
+
this.render next
|
81
|
+
@currentProject.deactivate('slideUp')
|
82
|
+
@currentProject = next
|
83
|
+
@currentProject.activate('slideDown')
|
84
|
+
this.preloadProjects()
|
85
|
+
false #stop event
|
86
|
+
|
87
|
+
nextProject:->
|
88
|
+
@projects.successor_of(@currentProject)
|
89
|
+
|
90
|
+
switchToPreviousProject: (forwardPhotos) ->
|
91
|
+
previous = this.previousProject()
|
92
|
+
this.render previous
|
93
|
+
@currentProject.deactivate('slideDown')
|
94
|
+
@currentProject = this.previousProject()
|
95
|
+
@currentProject.forwardPhotos() if forwardPhotos == true #true!, not the event object or something else
|
96
|
+
@currentProject.activate('slideUp')
|
97
|
+
this.preloadProjects()
|
98
|
+
false #stop event
|
99
|
+
|
100
|
+
previousProject:->
|
101
|
+
@projects.predecessor_of(@currentProject)
|
102
|
+
|
103
|
+
rewindProjects: ->
|
104
|
+
for project in @projects.models
|
105
|
+
project.rewindPhotos()
|
@@ -0,0 +1,62 @@
|
|
1
|
+
window.SC ||= {}
|
2
|
+
|
3
|
+
class SC.PhotoView extends Backbone.View
|
4
|
+
|
5
|
+
tagName:"img"
|
6
|
+
|
7
|
+
initialize:->
|
8
|
+
this.render()
|
9
|
+
@model.bind 'show:slideLeft', this.slideInLeft
|
10
|
+
@model.bind 'show:slideRight', this.slideInRight
|
11
|
+
@model.bind 'show:slideUp', this.slideInUp
|
12
|
+
@model.bind 'show:slideDown', this.slideInDown
|
13
|
+
@model.bind 'show:instant', this.show
|
14
|
+
@model.bind 'hide:slideLeft', this.slideOutLeft
|
15
|
+
@model.bind 'hide:slideRight', this.slideOutRight
|
16
|
+
@model.bind 'hide:slideUp', this.slideOutUp
|
17
|
+
@model.bind 'hide:slideDown', this.slideOutDown
|
18
|
+
@model.bind 'hide:instant', this.hide
|
19
|
+
@model.bind 'activated', this.renderDetails
|
20
|
+
|
21
|
+
render:->
|
22
|
+
$(@el).attr 'src', @model.get('image').url
|
23
|
+
|
24
|
+
renderDetails: =>
|
25
|
+
v = new SC.PhotoDetailsView({model:@model})
|
26
|
+
v.render()
|
27
|
+
|
28
|
+
slideOutLeft: =>
|
29
|
+
this.slideOut('left')
|
30
|
+
|
31
|
+
slideOutRight: =>
|
32
|
+
this.slideOut('right')
|
33
|
+
|
34
|
+
slideOutUp: =>
|
35
|
+
this.slideOut('up')
|
36
|
+
|
37
|
+
slideOutDown: =>
|
38
|
+
this.slideOut('down')
|
39
|
+
|
40
|
+
slideOut: (direction) ->
|
41
|
+
$(@el).hide('slide', {direction: direction}, 500)
|
42
|
+
|
43
|
+
slideInLeft: =>
|
44
|
+
this.slideIn('left')
|
45
|
+
|
46
|
+
slideInRight: =>
|
47
|
+
this.slideIn('right')
|
48
|
+
|
49
|
+
slideInUp: =>
|
50
|
+
this.slideIn('up')
|
51
|
+
|
52
|
+
slideInDown: =>
|
53
|
+
this.slideIn('down')
|
54
|
+
|
55
|
+
slideIn:(direction) ->
|
56
|
+
$(@el).show('slide', {direction: direction}, 500)
|
57
|
+
|
58
|
+
show: =>
|
59
|
+
$(@el).show()
|
60
|
+
|
61
|
+
hide: =>
|
62
|
+
$(@el).hide()
|
@@ -0,0 +1,29 @@
|
|
1
|
+
window.SC ||= {}
|
2
|
+
|
3
|
+
class SC.ProjectView extends Backbone.View
|
4
|
+
|
5
|
+
initialize:->
|
6
|
+
this.initEl()
|
7
|
+
this.initPhotoViews()
|
8
|
+
@model.bind 'activated', this.renderDetails
|
9
|
+
|
10
|
+
initEl: ->
|
11
|
+
template = _.template $("#project-template").html(), {project:@model}
|
12
|
+
@el = $(template)
|
13
|
+
|
14
|
+
initPhotoViews:->
|
15
|
+
@photoViews = []
|
16
|
+
for photo in @model.photos.models
|
17
|
+
@photoViews.push new SC.PhotoView({model:photo})
|
18
|
+
|
19
|
+
render:->
|
20
|
+
for photo in @photoViews
|
21
|
+
$(@el).append photo.el
|
22
|
+
@model.isRendered = true
|
23
|
+
@el
|
24
|
+
|
25
|
+
renderDetails: =>
|
26
|
+
v = new SC.ProjectDetailsView({model:@model})
|
27
|
+
v.render()
|
28
|
+
|
29
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Easy handling of accordion elements
|
2
|
+
# The structure should be as follows:
|
3
|
+
#
|
4
|
+
# <div class='accordion'>
|
5
|
+
# <div class='accordion-item'>
|
6
|
+
# <div class='title'>Title</div>
|
7
|
+
# <div class='content'> ... your content ... </div>
|
8
|
+
# </div>
|
9
|
+
#
|
10
|
+
# // repeat accordion-items ...
|
11
|
+
# </div>
|
12
|
+
#
|
13
|
+
|
14
|
+
window.SC ||= {}
|
15
|
+
|
16
|
+
class window.SC.Accordion extends Backbone.View
|
17
|
+
|
18
|
+
events:
|
19
|
+
"click .title" : "handleClick"
|
20
|
+
|
21
|
+
initialize: ->
|
22
|
+
@items = @$("> .accordion-item")
|
23
|
+
@open = null
|
24
|
+
@initiallyOpenItem()
|
25
|
+
|
26
|
+
initiallyOpenItem: ->
|
27
|
+
if window.location.hash
|
28
|
+
elem = $(window.location.hash)
|
29
|
+
@openItem(elem.parent()) if elem.hasClass("title")
|
30
|
+
|
31
|
+
openItem: (elem) ->
|
32
|
+
@closeItem(@open) if @open
|
33
|
+
@open = elem.addClass("open")
|
34
|
+
|
35
|
+
closeItem: (elem) ->
|
36
|
+
elem.removeClass("open")
|
37
|
+
@open = null
|
38
|
+
|
39
|
+
toggleItem: (elem) ->
|
40
|
+
if elem.hasClass("open")
|
41
|
+
@closeItem(elem)
|
42
|
+
else
|
43
|
+
@openItem(elem)
|
44
|
+
|
45
|
+
handleClick: (event) =>
|
46
|
+
item = $(event.currentTarget).parent()
|
47
|
+
@toggleItem(item)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Easy handling of content elements that are expandable/collapsable via a more/less links.
|
2
|
+
# The structure should be as follows:
|
3
|
+
#
|
4
|
+
# <div id='something' class='expandable'>
|
5
|
+
# some content
|
6
|
+
# <a href='' class='more'>more</a>
|
7
|
+
# <div class='expandable-content hidden'>
|
8
|
+
# some content
|
9
|
+
# <a href='#something' class='less'>less</a>
|
10
|
+
# </div>
|
11
|
+
# </div>
|
12
|
+
#
|
13
|
+
# NOTE: Ideally, the less href points to the id of the .expandable div, so that
|
14
|
+
# when collapsing the expandable container the browser jumps back up.
|
15
|
+
|
16
|
+
window.SC ||= {}
|
17
|
+
|
18
|
+
class SC.ExpandableContent extends Backbone.View
|
19
|
+
|
20
|
+
events:
|
21
|
+
"click .more" : "handleOpen"
|
22
|
+
"click .less" : "handleClose"
|
23
|
+
|
24
|
+
initialize: ->
|
25
|
+
@content = @$(".expandable-content")
|
26
|
+
@more = @$(".more")
|
27
|
+
|
28
|
+
handleOpen: (event) =>
|
29
|
+
@content.removeClass("hidden")
|
30
|
+
@more.addClass("hidden")
|
31
|
+
# allow anchoring, but prevent the event to bubble
|
32
|
+
# up and open the content again in IE
|
33
|
+
event.stopPropagation()
|
34
|
+
|
35
|
+
handleClose: (event) =>
|
36
|
+
@content.addClass("hidden")
|
37
|
+
@more.removeClass("hidden")
|
38
|
+
# allow anchoring, but prevent the event to bubble
|
39
|
+
# up and open the content again in IE
|
40
|
+
event.stopPropagation()
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: partystreusel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Immanuel Häussermann
|
9
|
+
- Donat Baier
|
10
|
+
- Franca Rast
|
11
|
+
- Noëlle Rosenberg
|
12
|
+
autorequire:
|
13
|
+
bindir: bin
|
14
|
+
cert_chain: []
|
15
|
+
date: 2012-12-18 00:00:00.000000000 Z
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: jquery-rails
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
description: Contains sliders, accordions, expandable contents and any other component
|
34
|
+
we deem worthy of joining this collection of awesomeness.
|
35
|
+
email:
|
36
|
+
- haeussermann@gmail.com
|
37
|
+
- donat.baier@gmail.com
|
38
|
+
- franca.rast@screenconcept.ch
|
39
|
+
- noro660@hotmail.com
|
40
|
+
executables: []
|
41
|
+
extensions: []
|
42
|
+
extra_rdoc_files: []
|
43
|
+
files:
|
44
|
+
- .gitignore
|
45
|
+
- Gemfile
|
46
|
+
- README.md
|
47
|
+
- Rakefile
|
48
|
+
- lib/partystreusel.rb
|
49
|
+
- lib/partystreusel/version.rb
|
50
|
+
- partystreusel.gemspec
|
51
|
+
- vendor/assets/javascripts/carousel/models/photo.js.coffee
|
52
|
+
- vendor/assets/javascripts/carousel/models/photos_collection.js.coffee
|
53
|
+
- vendor/assets/javascripts/carousel/models/project.js.coffee
|
54
|
+
- vendor/assets/javascripts/carousel/models/projects_collection.js.coffee
|
55
|
+
- vendor/assets/javascripts/carousel/views/carousel.js.coffee
|
56
|
+
- vendor/assets/javascripts/carousel/views/photo-details-view.js.coffee
|
57
|
+
- vendor/assets/javascripts/carousel/views/photo_view.js.coffee
|
58
|
+
- vendor/assets/javascripts/carousel/views/project_details_view.js.coffee
|
59
|
+
- vendor/assets/javascripts/carousel/views/project_view.js.coffee
|
60
|
+
- vendor/assets/javascripts/carousel/views/warning_view.js.coffee
|
61
|
+
- vendor/assets/javascripts/sc.accordion.js.coffee
|
62
|
+
- vendor/assets/javascripts/sc.carousel.js.coffee
|
63
|
+
- vendor/assets/javascripts/sc.expandable_content.js.coffee
|
64
|
+
homepage: http://www.screenconcept.ch
|
65
|
+
licenses: []
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project: partystreusel
|
84
|
+
rubygems_version: 1.8.24
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: A collection uf reusable javascript components by Screen Concept
|
88
|
+
test_files: []
|