-
Notifications
You must be signed in to change notification settings - Fork 1
Adding the Views
moellep edited this page Nov 5, 2014
·
1 revision
Views layout the application content. The My-Status application has three pages, so there will be three view methods defined.
- Add file
View/MyStatus.pm
package NewProject::View::MyStatus;
use strict;
use Bivio::Base 'View.Base';
use Bivio::UI::ViewLanguageAUTOLOAD;
sub my_status {
my($self) = @_;
return $self->internal_body(Join([
# The admin list link will only be displayed if the user has
# permissions to execute the MY_STATUS_ADMIN_LIST task.
# The link text comes from the xlink.MY_STATUS_ADMIN_LIST facade value
XLink('MY_STATUS_ADMIN_LIST', 'pull-right')->put(
control => 'MY_STATUS_ADMIN_LIST',
),
BR(),
# An HTML <div class="jumbotron">
DIV_jumbotron(
If(
['Model.MyStatus', 'status_code', '->eq_unknown'],
# no status code - show only the update link
P(XLink('MY_STATUS_UPDATE', 'btn btn-primary btn-lg')),
# else: show the code and comment
Join([
H1(String(['Model.MyStatus', 'status_code', '->get_short_desc'])),
P(String(['Model.MyStatus', 'status_comment'])),
P(Join([
XLink('MY_STATUS_UPDATE', 'btn btn-primary btn-lg'),
DIV(
Join([
'Last Updated: ',
DateTime(['Model.MyStatus', 'modified_date_time']),
]),
{
class => 'text-muted small',
},
),
])),
]),
),
),
]));
}
sub my_status_admin_list {
my($self) = @_;
return $self->internal_body(Join([
XLink('MY_STATUS', 'pull-right'),
BR(),
DIV(
vs_paged_list('MyStatusList', [
'MyStatus.modified_date_time',
['User.last_name', {
column_order_by => ['User.last_name_sort'],
}],
['User.first_name', {
column_order_by => ['User.first_name_sort'],
}],
'MyStatus.status_code',
'MyStatus.status_comment',
]),
{
class => 'col-md-10 col-md-offset-1',
}
),
]));
}
sub my_status_update {
my($self) = @_;
return $self->internal_body(
vs_simple_form('MyStatusForm', [
['MyStatusForm.MyStatus.status_code', {
wf_want_select => 1,
unknown_label => 'Select Status',
}],
'MyStatusForm.MyStatus.status_comment',
]),
);
}
1;- Agenda
- Getting Started
- My-Status Example Application
- Model
- View
- Task
- Application Support
- Testing
- Miscellaneous