Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
5c113100
Commit
5c113100
authored
8 years ago
by
Jeremy Kersten
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] website_forum: make moderation queue async
Don't refresh page between each validation.
parent
59c60e38
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addons/website_forum/static/src/js/website_forum.js
+19
-0
19 additions, 0 deletions
addons/website_forum/static/src/js/website_forum.js
addons/website_forum/views/website_forum.xml
+6
-6
6 additions, 6 deletions
addons/website_forum/views/website_forum.xml
with
25 additions
and
6 deletions
addons/website_forum/static/src/js/website_forum.js
+
19
−
0
View file @
5c113100
...
@@ -138,6 +138,25 @@ if(!$('.website_forum').length) {
...
@@ -138,6 +138,25 @@ if(!$('.website_forum').length) {
});
});
});
});
$
(
'
.o_js_validation_queue a
'
).
on
(
'
click
'
,
function
(
ev
)
{
ev
.
preventDefault
();
var
$link
=
$
(
ev
.
currentTarget
);
var
self
=
$
(
this
);
$
(
this
).
parents
(
'
.post_to_validate
'
).
hide
();
$
.
get
(
$link
.
attr
(
'
href
'
))
.
fail
(
function
()
{
self
.
parents
(
'
.o_js_validation_queue > div
'
).
addClass
(
'
panel-danger
'
).
css
(
'
background-color
'
,
'
#FAA
'
);
self
.
parents
(
'
.post_to_validate
'
).
show
();
})
.
done
(
function
()
{
var
left
=
$
(
'
.o_js_validation_queue:visible
'
).
length
;
var
type
=
$
(
'
h2.page-header li.active a
'
).
data
(
'
type
'
);
$
(
'
#count_post
'
).
text
(
left
);
$
(
'
#moderation_tools a[href*="/
'
+
type
+
'
_"]
'
).
find
(
'
strong
'
).
text
(
left
);
});
});
$
(
'
.accept_answer
'
).
not
(
'
.karma_required
'
).
on
(
'
click
'
,
function
(
ev
)
{
$
(
'
.accept_answer
'
).
not
(
'
.karma_required
'
).
on
(
'
click
'
,
function
(
ev
)
{
ev
.
preventDefault
();
ev
.
preventDefault
();
var
$link
=
$
(
ev
.
currentTarget
);
var
$link
=
$
(
ev
.
currentTarget
);
...
...
This diff is collapsed.
Click to expand it.
addons/website_forum/views/website_forum.xml
+
6
−
6
View file @
5c113100
...
@@ -1165,7 +1165,7 @@
...
@@ -1165,7 +1165,7 @@
<t
t-call=
"website_forum.header"
>
<t
t-call=
"website_forum.header"
>
<h2
class=
"page-header mt0"
>
<h2
class=
"page-header mt0"
>
<t
t-set=
"count_posts"
t-value=
"len(posts_ids)"
/>
<t
t-set=
"count_posts"
t-value=
"len(posts_ids)"
/>
<
t
t-esc=
"count_posts"
/>
<
span
id=
'count_post'
t-esc=
"count_posts"
/>
<span
class=
"dropdown"
>
<span
class=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
<t
t-if=
"queue_type == 'validation'"
>
Pending
</t>
<t
t-if=
"queue_type == 'validation'"
>
Pending
</t>
...
@@ -1175,13 +1175,13 @@
...
@@ -1175,13 +1175,13 @@
</a>
</a>
<ul
class=
"dropdown-menu"
>
<ul
class=
"dropdown-menu"
>
<li
t-att-class=
"queue_type == 'validation' and 'active' or None "
>
<li
t-att-class=
"queue_type == 'validation' and 'active' or None "
>
<a
t-attf-href=
"/forum/#{slug(forum)}/validation_queue"
>
Pending
</a>
<a
data-type=
'validation'
t-attf-href=
"/forum/#{slug(forum)}/validation_queue"
>
Pending
</a>
</li>
</li>
<li
t-att-class=
"queue_type == 'flagged' and 'active' or None "
>
<li
t-att-class=
"queue_type == 'flagged' and 'active' or None "
>
<a
t-attf-href=
"/forum/#{slug(forum)}/flagged_queue"
>
Flagged
</a>
<a
data-type=
'flagged'
t-attf-href=
"/forum/#{slug(forum)}/flagged_queue"
>
Flagged
</a>
</li>
</li>
<li
t-if=
"uid"
t-att-class=
"queue_type == 'offensive' and 'active' or None "
>
<li
t-if=
"uid"
t-att-class=
"queue_type == 'offensive' and 'active' or None "
>
<a
t-attf-href=
"/forum/#{slug(forum)}/offensive_posts"
>
Offensive
</a>
<a
data-type=
'offensive'
t-attf-href=
"/forum/#{slug(forum)}/offensive_posts"
>
Offensive
</a>
</li>
</li>
</ul>
</ul>
</span>
</span>
...
@@ -1191,8 +1191,8 @@
...
@@ -1191,8 +1191,8 @@
<t
t-if=
"queue_type == 'flagged'"
>
The flagged queue is empty.
</t>
<t
t-if=
"queue_type == 'flagged'"
>
The flagged queue is empty.
</t>
<t
t-if=
"queue_type == 'offensive'"
>
The offensive queue is empty.
</t>
<t
t-if=
"queue_type == 'offensive'"
>
The offensive queue is empty.
</t>
</div>
</div>
<div
t-foreach=
"posts_ids"
t-as=
"question"
class=
"mb16 row"
style=
"padding-bottom:16px;border-bottom:1px solid #e7e7e7;"
>
<div
t-foreach=
"posts_ids"
t-as=
"question"
class=
"mb16 row
post_to_validate
"
style=
"padding-bottom:16px;border-bottom:1px solid #e7e7e7;"
>
<div
class=
"col-sm-2"
>
<div
class=
"col-sm-2
o_js_validation_queue
"
>
<div
class=
"panel panel-default text-center"
style=
"background-color:#eee;margin:0;padding:5px 12px 5px 12px;"
>
<div
class=
"panel panel-default text-center"
style=
"background-color:#eee;margin:0;padding:5px 12px 5px 12px;"
>
<a
t-attf-href=
"/forum/#{slug(forum)}/post/#{slug(question)}/validate"
style=
"padding-right:8px;"
><i
class=
"fa fa-check fa-2x"
/></a>
<a
t-attf-href=
"/forum/#{slug(forum)}/post/#{slug(question)}/validate"
style=
"padding-right:8px;"
><i
class=
"fa fa-check fa-2x"
/></a>
<a
t-if=
"queue_type == 'validation'"
t-attf-href=
"/forum/#{slug(forum)}/post/#{slug(question)}/refuse"
><i
class=
"fa fa-times fa-2x"
/></a>
<a
t-if=
"queue_type == 'validation'"
t-attf-href=
"/forum/#{slug(forum)}/post/#{slug(question)}/refuse"
><i
class=
"fa fa-times fa-2x"
/></a>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment