Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
31
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
BDE
nk20
Commits
0411646a
Commit
0411646a
authored
5 years ago
by
Pierre-antoine Comby
Browse files
Options
Downloads
Patches
Plain Diff
make the CI pass and nicer front
parent
20ea017e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!54
Meilleurs vues pour la gestion des boutons
Pipeline
#8022
passed with warnings with stages
in 4 minutes and 15 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/note/tables.py
+15
-14
15 additions, 14 deletions
apps/note/tables.py
apps/note/views.py
+2
-8
2 additions, 8 deletions
apps/note/views.py
templates/note/transactiontemplate_list.html
+8
-6
8 additions, 6 deletions
templates/note/transactiontemplate_list.html
with
25 additions
and
28 deletions
apps/note/tables.py
+
15
−
14
View file @
0411646a
...
@@ -56,11 +56,12 @@ class HistoryTable(tables.Table):
...
@@ -56,11 +56,12 @@ class HistoryTable(tables.Table):
def
render_valid
(
self
,
value
):
def
render_valid
(
self
,
value
):
return
"
✔
"
if
value
else
"
✖
"
return
"
✔
"
if
value
else
"
✖
"
# function delete_button(id) provided in template file
# function delete_button(id) provided in template file
delete_template
=
"""
DELETE_TEMPLATE
=
"""
<button id=
"
{{ record.pk }}
"
class=
"
btn btn-danger
"
onclick=
"
delete_button(this.id)
"
> {{ delete_trans }}</button>
<button id=
"
{{ record.pk }}
"
class=
"
btn btn-danger
"
onclick=
"
delete_button(this.id)
"
> {{ delete_trans }}</button>
"""
"""
class
AliasTable
(
tables
.
Table
):
class
AliasTable
(
tables
.
Table
):
class
Meta
:
class
Meta
:
attrs
=
{
attrs
=
{
...
@@ -75,7 +76,7 @@ class AliasTable(tables.Table):
...
@@ -75,7 +76,7 @@ class AliasTable(tables.Table):
name
=
tables
.
Column
(
attrs
=
{
'
td
'
:
{
'
class
'
:
'
text-center
'
}})
name
=
tables
.
Column
(
attrs
=
{
'
td
'
:
{
'
class
'
:
'
text-center
'
}})
# delete = tables.TemplateColumn(template_code=delete_template,
# delete = tables.TemplateColumn(template_code=delete_template,
# attrs={'td':{'class': 'col-sm-1'}})
# attrs={'td':{'class': 'col-sm-1'}})
delete
=
tables
.
LinkColumn
(
'
member:user_alias_delete
'
,
delete
=
tables
.
LinkColumn
(
'
member:user_alias_delete
'
,
args
=
[
A
(
'
pk
'
)],
args
=
[
A
(
'
pk
'
)],
attrs
=
{
attrs
=
{
...
@@ -97,16 +98,16 @@ class ButtonTable(tables.Table):
...
@@ -97,16 +98,16 @@ class ButtonTable(tables.Table):
model
=
TransactionTemplate
model
=
TransactionTemplate
edit
=
tables
.
LinkColumn
(
'
note:template_update
'
,
edit
=
tables
.
LinkColumn
(
'
note:template_update
'
,
args
=
[
A
(
'
pk
'
)],
args
=
[
A
(
'
pk
'
)],
attrs
=
{
attrs
=
{
'
td
'
:
{
'
class
'
:
'
col-sm-1
'
},
'
td
'
:
{
'
class
'
:
'
col-sm-1
'
},
'
a
'
:
{
'
class
'
:
'
btn btn-primary
'
}
},
'
a
'
:
{
'
class
'
:
'
btn btn-primary
'
}}
,
text
=
_
(
'
edit
'
)
,
text
=
_
(
'
edit
'
),
accessor
=
'
pk
'
)
accessor
=
'
pk
'
)
delete
=
tables
.
TemplateColumn
(
template_code
=
delete_template
,
delete
=
tables
.
TemplateColumn
(
template_code
=
DELETE_TEMPLATE
,
extra_context
=
{
"
delete_trans
"
:
_
(
'
delete
'
)},
extra_context
=
{
"
delete_trans
"
:
_
(
'
delete
'
)},
attrs
=
{
'
td
'
:{
'
class
'
:
'
col-sm-1
'
}})
attrs
=
{
'
td
'
:
{
'
class
'
:
'
col-sm-1
'
}})
def
render_amount
(
self
,
value
):
def
render_amount
(
self
,
value
):
return
pretty_money
(
value
)
return
pretty_money
(
value
)
This diff is collapsed.
Click to expand it.
apps/note/views.py
+
2
−
8
View file @
0411646a
...
@@ -111,6 +111,7 @@ class TransactionTemplateCreateView(LoginRequiredMixin, CreateView):
...
@@ -111,6 +111,7 @@ class TransactionTemplateCreateView(LoginRequiredMixin, CreateView):
form_class
=
TransactionTemplateForm
form_class
=
TransactionTemplateForm
success_url
=
reverse_lazy
(
'
note:template_list
'
)
success_url
=
reverse_lazy
(
'
note:template_list
'
)
class
TransactionTemplateListView
(
LoginRequiredMixin
,
SingleTableView
):
class
TransactionTemplateListView
(
LoginRequiredMixin
,
SingleTableView
):
"""
"""
List TransactionsTemplates
List TransactionsTemplates
...
@@ -118,14 +119,6 @@ class TransactionTemplateListView(LoginRequiredMixin, SingleTableView):
...
@@ -118,14 +119,6 @@ class TransactionTemplateListView(LoginRequiredMixin, SingleTableView):
model
=
TransactionTemplate
model
=
TransactionTemplate
table_class
=
ButtonTable
table_class
=
ButtonTable
def
get_queryset
(
self
):
name
=
self
.
request
.
GET
.
get
(
'
name
'
,
''
)
if
(
name
!=
''
):
object_list
=
self
.
model
.
objects
.
filter
(
name__icontains
=
name
)
else
:
object_list
=
self
.
model
.
objects
.
all
()
return
object_list
class
TransactionTemplateUpdateView
(
LoginRequiredMixin
,
UpdateView
):
class
TransactionTemplateUpdateView
(
LoginRequiredMixin
,
UpdateView
):
"""
"""
...
@@ -134,6 +127,7 @@ class TransactionTemplateUpdateView(LoginRequiredMixin, UpdateView):
...
@@ -134,6 +127,7 @@ class TransactionTemplateUpdateView(LoginRequiredMixin, UpdateView):
form_class
=
TransactionTemplateForm
form_class
=
TransactionTemplateForm
success_url
=
reverse_lazy
(
'
note:template_list
'
)
success_url
=
reverse_lazy
(
'
note:template_list
'
)
class
ConsoView
(
LoginRequiredMixin
,
SingleTableView
):
class
ConsoView
(
LoginRequiredMixin
,
SingleTableView
):
"""
"""
The Magic View that make people pay their beer and burgers.
The Magic View that make people pay their beer and burgers.
...
...
This diff is collapsed.
Click to expand it.
templates/note/transactiontemplate_list.html
+
8
−
6
View file @
0411646a
...
@@ -14,12 +14,14 @@
...
@@ -14,12 +14,14 @@
</div>
</div>
</div>
</div>
<div
class=
"row justify-content-center"
>
<div
class=
"row justify-content-center"
>
<div
class=
"col-md-10 card shadow"
>
<div
class=
"col-md-10"
>
<div
class=
"card-header text-center"
>
<div
class=
"card card-border shadow"
>
<h5>
{% trans "buttons listing "%}
</h5>
<div
class=
"card-header text-center"
>
</div>
<h5>
{% trans "buttons listing "%}
</h5>
<div
class=
"card"
id=
"buttons_table"
>
</div>
{% render_table table %}
<div
class=
"card-body px-0 py-0"
id=
"buttons_table"
>
{% render_table table %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
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