Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Store
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Moecube Store
Commits
bfbf8087
Commit
bfbf8087
authored
Nov 08, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
history fix
parent
75205994
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
24 deletions
+22
-24
assets/javascripts/decks.coffee
assets/javascripts/decks.coffee
+9
-8
assets/javascripts/decks.js
assets/javascripts/decks.js
+13
-16
No files found.
assets/javascripts/decks.coffee
View file @
bfbf8087
...
...
@@ -81,15 +81,13 @@ class Deck extends Spine.Controller
count
=
decoded
>>
27
&
0x3
{
card_id
:
card_id
,
side
:
side
,
count
:
count
}
@
refresh
card_usages
refresh
:
(
card_usages
,
modify_url
=
true
)
->
refresh
:
(
card_usages
)
->
cards_need_load
=
(
card_usage
.
card_id
for
card_usage
in
card_usages
when
!
Card
.
exists
(
card_usage
.
card_id
))
if
cards_need_load
.
length
Card
.
query
{
_id
:
{
$in
:
cards_need_load
}},
=>
CardUsage
.
refresh
card_usages
,
clear
:
true
history
.
pushState
(
CardUsage
.
toJSON
(),
@
deck_name
,
@
location
())
if
modify_url
else
CardUsage
.
refresh
card_usages
,
clear
:
true
history
.
pushState
(
CardUsage
.
toJSON
(),
@
deck_name
,
@
location
())
if
modify_url
else
CardUsage
.
refresh
card_usages
,
clear
:
true
render
:
=>
@
main
=
[]
...
...
@@ -137,6 +135,7 @@ class Deck extends Spine.Controller
last_item
=
{
card_id
:
card_id
,
side
:
side
,
count
:
1
}
card_usages
.
push
last_item
@
refresh
card_usages
@
set_history
()
).
disableSelection
();
if
$
(
'.operate_area'
).
hasClass
(
'text'
)
@
el
.
jscroll
({
W
:
"12px"
,
Btn
:
...
...
@@ -145,7 +144,8 @@ class Deck extends Spine.Controller
"/decks/?name=
#{
@
deck_name
}
&cards=
#{
@
encode
()
}
"
url
:
->
"http://my-card.in"
+
@
location
()
set_history
:
->
history
.
pushState
(
CardUsage
.
toJSON
(),
@
deck_name
,
@
location
())
tab_control
:
->
$
(
".bottom_area div"
).
click
->
...
...
@@ -173,7 +173,7 @@ class Deck extends Spine.Controller
if
count
<
3
#TODO: lflist
card_usage
.
count
++
card_usage
.
save
()
history
.
pushState
(
CardUsage
.
toJSON
(),
@
deck_name
,
@
location
()
)
@
set_history
(
)
minus
:
(
e
)
->
e
.
preventDefault
()
card_usage
=
$
(
e
.
target
).
tmplItem
().
data
...
...
@@ -182,7 +182,7 @@ class Deck extends Spine.Controller
card_usage
.
save
()
else
card_usage
.
destroy
()
history
.
pushState
(
CardUsage
.
toJSON
(),
@
deck_name
,
@
location
()
)
@
set_history
(
)
$
(
document
).
ready
->
$
(
'#name'
).
html
$
.
url
().
param
(
'name'
)
...
...
@@ -237,6 +237,7 @@ $(document).ready ->
result
.
push
{
card_id
:
last_id
,
side
:
side
,
count
:
count
}
if
last_id
$
(
'#deck_load'
).
attr
'disabled'
,
false
deck
.
refresh
result
deck
.
set_history
()
reader
.
readAsText
(
file
)
$
.
i18n
.
properties
...
...
assets/javascripts/decks.js
View file @
bfbf8087
...
...
@@ -201,12 +201,9 @@
return
this
.
refresh
(
card_usages
);
};
Deck
.
prototype
.
refresh
=
function
(
card_usages
,
modify_url
)
{
Deck
.
prototype
.
refresh
=
function
(
card_usages
)
{
var
card_usage
,
cards_need_load
,
_this
=
this
;
if
(
modify_url
==
null
)
{
modify_url
=
true
;
}
cards_need_load
=
(
function
()
{
var
_i
,
_len
,
_results
;
_results
=
[];
...
...
@@ -224,20 +221,14 @@
$in
:
cards_need_load
}
},
function
()
{
CardUsage
.
refresh
(
card_usages
,
{
return
CardUsage
.
refresh
(
card_usages
,
{
clear
:
true
});
if
(
modify_url
)
{
return
history
.
pushState
(
CardUsage
.
toJSON
(),
_this
.
deck_name
,
_this
.
location
());
}
});
}
else
{
CardUsage
.
refresh
(
card_usages
,
{
return
CardUsage
.
refresh
(
card_usages
,
{
clear
:
true
});
if
(
modify_url
)
{
return
history
.
pushState
(
CardUsage
.
toJSON
(),
this
.
deck_name
,
this
.
location
());
}
}
};
...
...
@@ -383,7 +374,8 @@
}
}
card_usages
.
push
(
last_item
);
return
_this
.
refresh
(
card_usages
);
_this
.
refresh
(
card_usages
);
return
_this
.
set_history
();
}
}).
disableSelection
();
if
(
$
(
'
.operate_area
'
).
hasClass
(
'
text
'
))
{
...
...
@@ -404,6 +396,10 @@
return
"
http://my-card.in
"
+
this
.
location
();
};
Deck
.
prototype
.
set_history
=
function
()
{
return
history
.
pushState
(
CardUsage
.
toJSON
(),
this
.
deck_name
,
this
.
location
());
};
Deck
.
prototype
.
tab_control
=
function
()
{
$
(
"
.bottom_area div
"
).
click
(
function
()
{
var
$dangqian
;
...
...
@@ -446,7 +442,7 @@
card_usage
.
count
++
;
card_usage
.
save
();
}
return
history
.
pushState
(
CardUsage
.
toJSON
(),
this
.
deck_name
,
this
.
location
()
);
return
this
.
set_history
(
);
};
Deck
.
prototype
.
minus
=
function
(
e
)
{
...
...
@@ -459,7 +455,7 @@
}
else
{
card_usage
.
destroy
();
}
return
history
.
pushState
(
CardUsage
.
toJSON
(),
this
.
deck_name
,
this
.
location
()
);
return
this
.
set_history
(
);
};
return
Deck
;
...
...
@@ -551,7 +547,8 @@
});
}
$
(
'
#deck_load
'
).
attr
(
'
disabled
'
,
false
);
return
deck
.
refresh
(
result
);
deck
.
refresh
(
result
);
return
deck
.
set_history
();
};
return
reader
.
readAsText
(
file
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment