forked from OpenNeo/impress
navigate tips
This commit is contained in:
parent
f00a8f5d3b
commit
cc786c4241
3 changed files with 34 additions and 1 deletions
|
@ -1362,9 +1362,29 @@ View.PrankColorMessage = function(wardrobe) {
|
||||||
|
|
||||||
View.Tips = function() {
|
View.Tips = function() {
|
||||||
var wrapper = $('#tips');
|
var wrapper = $('#tips');
|
||||||
|
|
||||||
var tips = wrapper.find('li');
|
var tips = wrapper.find('li');
|
||||||
var index = Math.floor(Math.random() * tips.length);
|
var index = Math.floor(Math.random() * tips.length);
|
||||||
tips.eq(index).show();
|
tips.eq(index).show();
|
||||||
|
|
||||||
|
for (var i = 0; i < tips.length; i++) {
|
||||||
|
var prev = i == 0 ? tips.eq(tips.length - 1) : tips.eq(i - 1);
|
||||||
|
var curr = tips.eq(i);
|
||||||
|
var next = i < tips.length - 1 ? tips.eq(i + 1) : tips.eq(0);
|
||||||
|
(function(prev, curr, next) {
|
||||||
|
curr.find('a.prev').click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
curr.hide();
|
||||||
|
prev.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
curr.find('a.next').click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
curr.hide();
|
||||||
|
next.show();
|
||||||
|
});
|
||||||
|
})(prev, curr, next);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var userbar_sessions_link = $('#userbar a:last');
|
var userbar_sessions_link = $('#userbar a:last');
|
||||||
|
|
|
@ -275,6 +275,14 @@ body.outfits-edit
|
||||||
padding-left: image-width("tip.png") + 12px
|
padding-left: image-width("tip.png") + 12px
|
||||||
width: 400px
|
width: 400px
|
||||||
|
|
||||||
|
footer
|
||||||
|
color: $soft-text-color
|
||||||
|
font-size: 85%
|
||||||
|
text-align: right
|
||||||
|
|
||||||
|
a, span
|
||||||
|
margin-left: .5em
|
||||||
|
|
||||||
#preview-search-advanced
|
#preview-search-advanced
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
|
|
|
@ -109,10 +109,15 @@
|
||||||
%ul#preview-search-results
|
%ul#preview-search-results
|
||||||
#tips
|
#tips
|
||||||
%ul
|
%ul
|
||||||
- WardrobeTip.by_index.each do |tip|
|
- tips = WardrobeTip.by_index.all
|
||||||
|
- tips.each_with_index do |tip, index|
|
||||||
%li
|
%li
|
||||||
%h3 Did you know?
|
%h3 Did you know?
|
||||||
%div= md tip.body
|
%div= md tip.body
|
||||||
|
%footer
|
||||||
|
%a.prev{href: 'javascript:void(0)'} ← Prev
|
||||||
|
%span Tip #{index + 1} of #{tips.size}
|
||||||
|
%a.next{href: 'javascript:void(0)'} Next →
|
||||||
%form#preview-search-advanced
|
%form#preview-search-advanced
|
||||||
%header
|
%header
|
||||||
%h2= t '.search.advanced.header'
|
%h2= t '.search.advanced.header'
|
||||||
|
|
Loading…
Reference in a new issue