Adding a First Things First callout for new users.

This commit is contained in:
Samuel Clay 2010-04-25 15:43:09 -04:00
parent 0a664b44a8
commit 5a1ee75314
8 changed files with 114 additions and 34 deletions

View file

@ -36,33 +36,33 @@ class LoginForm(forms.Form):
class SignupForm(forms.Form):
username = forms.RegexField(regex=r'^\w+$',
max_length=30,
widget=forms.TextInput(),
label=_(u'username'),
error_messages={'required': 'Please enter a username.'})
signup_username = forms.RegexField(regex=r'^\w+$',
max_length=30,
widget=forms.TextInput(),
label=_(u'username'),
error_messages={'required': 'Please enter a username.'})
email = forms.EmailField(widget=forms.TextInput(attrs=dict(maxlength=75)),
label=_(u'email address'),
error_messages={'required': 'Please enter your email.'})
password = forms.CharField(widget=forms.PasswordInput(render_value=False),
label=_(u'password'),
error_messages={'required': 'Please enter a password.'})
signup_password = forms.CharField(widget=forms.PasswordInput(render_value=False),
label=_(u'password'),
error_messages={'required': 'Please enter a password.'})
def clean_username(self):
def clean_signup_username(self):
try:
user = User.objects.get(username__iexact=self.cleaned_data['username'])
user = User.objects.get(username__iexact=self.cleaned_data['signup_username'])
except User.DoesNotExist:
return self.cleaned_data['username']
return self.cleaned_data['signup_username']
raise forms.ValidationError(_(u'This username is already taken. Please choose another.'))
return self.cleaned_data['username']
return self.cleaned_data['signup_username']
def save(self, profile_callback=None):
new_user = User(username=self.cleaned_data['username'],
new_user = User(username=self.cleaned_data['signup_username'],
email=self.cleaned_data['email'])
new_user.set_password(self.cleaned_data['password'])
new_user.set_password(self.cleaned_data['signup_password'])
new_user.is_active = True
new_user.save()
new_user = authenticate(username=self.cleaned_data['username'], password=self.cleaned_data['password'])
new_user = authenticate(username=self.cleaned_data['signup_username'], password=self.cleaned_data['signup_password'])
return new_user

View file

@ -38,11 +38,16 @@ a img {
/* = Splash page = */
/* =============== */
.NB-splash-heading {
display: none;
}
.NB-account {
position: absolute;
right: 50px;
top: 40px;
width: 186px;
z-index: 1;
}
.NB-account .NB-login {
@ -130,6 +135,45 @@ a img {
padding: 0;
}
/* ============ */
/* = Callouts = */
/* ============ */
.NB-callout {
position: absolute;
-moz-box-shadow: 2px 2px 5px #909090;
-webkit-box-shadow: 2px 2px 5px #909090;
box-shadow: 2px 2px 5px #909090;
border: 1px solid #707070;
background: #E2FFCC url('../img/reader/callout_background.png') repeat-x 0 0;
display: none;
z-index: 10;
}
.NB-callout .NB-callout-text {
font-size: 14px;
font-weight: bold;
}
.NB-callout .NB-callout-container {
position: relative;
padding: 4px 12px;
}
.NB-callout .NB-callout-container .NB-callout-arrow {
width: 32px;
height: 14px;
background: transparent url('../img/reader/callout_arrow.png') no-repeat 0 0;
position: absolute;
bottom: -14px;
left: 4px;
}
.NB-callout-ftux {
left: 2px;
bottom: 51px;
}
/* ================ */
/* = Content Pane = */
/* ================ */
@ -1115,6 +1159,7 @@ form.opml_import_form input {
text-shadow: 1px 1px 0 #F0F0F0;
list-style: none;
white-space: nowrap;
z-index: 0;
}
#NB-splash .NB-splash-links .NB-splash-link {

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

View file

@ -341,24 +341,29 @@
var self = this;
if ($('#feed_list').length) {
$('.NB-callout-ftux .NB-callout-text').text('Loading feeds...');
this.model.load_feeds($.rescope(this.make_feeds, this));
}
},
make_feeds: function() {
if (!this.model.feeds.length) {
this.load_feed_browser();
}
var $feed_list = this.$feed_list.empty();
var folders = this.model.folders;
var feeds = this.model.feeds;
NEWSBLUR.log(['Making feeds', {'folders': folders, 'feeds': feeds}]);
// NEWSBLUR.log(['Making feeds', {'folders': folders, 'feeds': feeds}]);
$('#story_taskbar').css({'display': 'block'});
// NEWSBLUR.log(['Subscriptions', {'folders':folders}]);
var $folder = this.make_feeds_folder(folders);
$feed_list.append($folder);
$('.unread_count', $feed_list).corner('4px');
if (!$folder.length) {
this.load_feed_browser();
this.setup_ftux_add_feed_callout();
} else {
$('.NB-callout-ftux').fadeOut(500);
}
},
make_feeds_folder: function(items) {
@ -1799,6 +1804,25 @@
save_profile: function(key, value) {
NEWSBLUR.Globals[key] = value;
},
// ========
// = FTUX =
// ========
setup_ftux_add_feed_callout: function() {
$('.NB-callout-ftux .NB-callout-text').text('First things first...');
$('.NB-callout-ftux').corner('5px');
$('.NB-callout-ftux').css({
'opacity': 0,
'display': 'block'
}).animate({
'opacity': 1,
'bottom': 36
}, {
'duration': 750,
'easing': 'easeInOutQuint'
});
}
};

View file

@ -22,19 +22,22 @@ NEWSBLUR.ReaderManageFeed.prototype = {
for (var f in this.feeds) {
feeds_list.push(f);
}
this.feed_id = feeds_list[Math.round(Math.random() * 1000 % (feeds_list.length-1))]
this.feed_id = feeds_list[Math.round(Math.random() * 1000 % (feeds_list.length-1))];
if (!this.feed_id) this.feed_id = f;
}
this.feed = this.model.get_feed(this.feed_id);
this.make_modal();
this.initialize_feed(this.feed_id);
this.handle_cancel();
this.open_modal();
this.load_feed_classifier();
if (this.feed_id) {
this.make_modal();
this.initialize_feed(this.feed_id);
this.handle_cancel();
this.open_modal();
this.load_feed_classifier();
this.$manage.bind('click', $.rescope(this.handle_click, this));
this.$manage.bind('change', $.rescope(this.handle_change, this));
this.$manage.bind('keyup', $.rescope(this.handle_keyup, this));
this.$manage.bind('click', $.rescope(this.handle_click, this));
this.$manage.bind('change', $.rescope(this.handle_change, this));
this.$manage.bind('keyup', $.rescope(this.handle_keyup, this));
}
},
initialize_feed: function(feed_id) {

View file

@ -2,10 +2,18 @@
{% block content %}
<h1 class="NB-splash-heading">NewsBlur</h1>
<h2 class="NB-splash-heading">- A feed reader with intelligence.</h2>
<div class="left-pane">
<ul class="left-center" id="feed_list"></ul>
<div class="NB-taskbar left-south">
<div class="NB-callout-ftux NB-callout">
<div class="NB-callout-container">
<div class="NB-callout-text"></div>
<div class="NB-callout-arrow"></div>
</div>
</div>
<ul class="taskbar_nav taskbar_nav_feeds">
<li class="task_button task_button_menu NB-task-add">
<li class="task_button task_button_menu NB-task-manage">
@ -114,12 +122,12 @@
<form method="post" action="{% url signup %}">
<div>
{{ signup_form.username.label_tag }}
{{ signup_form.username }}
{{ signup_form.signup_username.label_tag }}
{{ signup_form.signup_username }}
</div>
<div>
{{ signup_form.password.label_tag }}
{{ signup_form.password }}
{{ signup_form.signup_password.label_tag }}
{{ signup_form.signup_password }}
</div>
<div>
{{ signup_form.email.label_tag }}