pulsate control to add new post if no posts present

This commit is contained in:
danielgrippi 2012-05-02 22:05:40 -07:00
parent bc81c6985a
commit 2d3edbf74f
7 changed files with 44 additions and 4 deletions

View file

@ -72,6 +72,9 @@ app.models.Stream = Backbone.Collection.extend({
var preloadJson = window.preLoadContent && JSON.parse(window.preLoadContent) var preloadJson = window.preLoadContent && JSON.parse(window.preLoadContent)
delete window.preLoadContent // always do this just to be safe in preventing dirty state across navigates delete window.preLoadContent // always do this just to be safe in preventing dirty state across navigates
if(preloadJson) { this.items.reset(preloadJson) } if(preloadJson) {
this.items.reset(preloadJson)
this.trigger("fetched")
}
} }
}); });

View file

@ -36,6 +36,11 @@ app.pages.Profile = app.views.Base.extend({
this.model = new app.models.Profile.findByGuid(options.personId) this.model = new app.models.Profile.findByGuid(options.personId)
this.stream = options && options.stream || new app.models.Stream() this.stream = options && options.stream || new app.models.Stream()
/* binds for getting started pulsation */
this.stream.bind("fetched", this.pulsateNewPostControl, this)
this.stream.items.bind("remove", this.pulsateNewPostControl, this)
this.stream.preloadOrFetch(); this.stream.preloadOrFetch();
this.canvasView = new app.views.Canvas({ model : this.stream }) this.canvasView = new app.views.Canvas({ model : this.stream })
@ -44,6 +49,14 @@ app.pages.Profile = app.views.Base.extend({
this.profileInfo = new app.views.ProfileInfo({ model : this.model.set({isOwnProfile : this.isOwnProfile()}) }) this.profileInfo = new app.views.ProfileInfo({ model : this.model.set({isOwnProfile : this.isOwnProfile()}) })
}, },
pulsateNewPostControl : function() {
this.$("#composer-button")[
this.stream.items.length == 0
? 'addClass'
: 'removeClass'
]("pulse")
},
toggleEdit : function(evt) { toggleEdit : function(evt) {
if(evt) { evt.preventDefault() } if(evt) { evt.preventDefault() }
this.editMode = !this.editMode this.editMode = !this.editMode

View file

@ -1,6 +1,10 @@
@import 'mixins'; @import 'mixins';
@import 'new_styles/new_mixins';
@import 'new_styles/variables'; @import 'new_styles/variables';
/* custom animations */
@import 'new_styles/animations';
/* mainly for the post viewer & composer */ /* mainly for the post viewer & composer */
@import 'new_styles/base'; @import 'new_styles/base';
@import 'new_styles/composer'; @import 'new_styles/composer';

View file

@ -0,0 +1,15 @@
@-webkit-keyframes opacity-pulse {
0% { @include opacity(0.3); }
65% { @include opacity(0.9); }
100% { @include opacity(0.3); }
}
@-moz-keyframes opacity-pulse {
0% { @include opacity(0.3); }
65% { @include opacity(0.9); }
100% { @include opacity(0.3); }
}
@-ms-keyframes opacity-pulse {
0% { @include opacity(0.3); }
65% { @include opacity(0.9); }
100% { @include opacity(0.3); }
}

View file

@ -1,5 +1,3 @@
@import "_new_mixins";
/* new link color */ /* new link color */
a { color : rgb(42,156,235) } a { color : rgb(42,156,235) }

View file

@ -1,3 +1,10 @@
/* getting started pulse animation */
#composer-button.pulse {
-webkit-animation: opacity-pulse 1s infinite;
-moz-animation: opacity-pulse 1s infinite;
-ms-animation: opacity-pulse 1s infinite;
}
/* functionality under edit mode */ /* functionality under edit mode */
.edit-mode { .edit-mode {
#edit-mode-toggle.control { #edit-mode-toggle.control {

View file

@ -46,7 +46,7 @@
<section id="profile-controls"> <section id="profile-controls">
{{#if isOwnProfile}} {{#if isOwnProfile}}
<a href="#composer" class="control small" rel="facebox"> <a href="#composer" id="composer-button" class="control small" rel="facebox">
<img src='{{imageUrl "buttons/pub@2x.png"}}' title="New Post" rel="tooltip"/> <img src='{{imageUrl "buttons/pub@2x.png"}}' title="New Post" rel="tooltip"/>
</a> </a>
<a href="#" id="edit-mode-toggle" class="control small"> <a href="#" id="edit-mode-toggle" class="control small">