-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue #158 #215
Fix issue #158 #215
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.warn-persistence { | ||
display: none; | ||
background: #FBE3E4; | ||
color: #BA1F11; | ||
text-align: center; | ||
color:#9F6000; | ||
padding:5px; | ||
} | ||
|
||
.not-logged-in .warn-persistence { | ||
display: block; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ListIt.lvent.once('setup:views', function(L, barr) { | ||
'use strict'; | ||
L.addPage('help', new L.views.HelpPage({platform: "chrome"})); | ||
L.addPage('help', new L.views.HelpPage()); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
ListIt.lvent.once('setup:views', function(L, barr) { | ||
'use strict'; | ||
L.addPage('options', new L.views.HelpPage({platform: "firefox"})); | ||
|
||
L.addPage('options', new L.views.HelpPage()); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* Generated Template */ | ||
|
||
ListIt.templates['warn-persistence'] = function(obj){ | ||
var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'')}; | ||
with(obj||{}){ | ||
__p+='<div class="warn-persistence">\n Please <a href="#/options">log in</a> to sync your notes. If not, notes will be cleared if cookies are cleared.\n</div>\n\n'; | ||
} | ||
return __p; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,29 @@ | ||
ListIt.lvent.once('setup:views', function(L, barr) { | ||
'use strict'; | ||
|
||
var OldMainPage = L.views.MainPage; | ||
L.views.MainPage = L.views.MainPage.extend({ | ||
initialize: function() { | ||
OldMainPage.prototype.initialize.call(this); | ||
this.listenTo(L.server, 'change:registered', function(){ | ||
this.togglePopUpAlert(); | ||
}); | ||
}, | ||
|
||
render: function() { | ||
OldMainPage.prototype.render.call(this); | ||
this.$el.prepend(L.templates['warn-persistence']()); | ||
if(!L.server.get('registered')){ | ||
this.$el.addClass('not-logged-in'); | ||
} | ||
return this; | ||
}, | ||
|
||
togglePopUpAlert: function() { | ||
this.$el.toggleClass('not-logged-in', !L.server.get('registered')) | ||
} | ||
}); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly. However, the login state might change so you need to listen on changes to the |
||
L.addPage('main', new L.views.MainPage()); | ||
L.addPage('options', new L.views.OptionsPage()); | ||
L.addPage('help', new L.views.HelpPage()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="warn-persistence"> | ||
Please <a href="#/options">log in</a> to sync your notes. If not, notes will be cleared if cookies are cleared. | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wasn't clear about this. Because pretty much every platform has its own platform specific help, there is no reason to duplicate the code like this.
Instead, just check to see if any platform specific help exists by checking for the existence of
L.templates['help']
and render it if it does. As this is common functionality, you can put it in the shared base-class.Basically, while the help-text is platform specific, the code that renders it can be platform agnostic.