diff --git a/src/js/apps/programs/program/flow/flow_app.js b/src/js/apps/programs/program/flow/flow_app.js index 87e3f0973..fff2d28d9 100644 --- a/src/js/apps/programs/program/flow/flow_app.js +++ b/src/js/apps/programs/program/flow/flow_app.js @@ -4,7 +4,7 @@ import SubRouterApp from 'js/base/subrouterapp'; import ActionApp from 'js/apps/programs/program/action/action_app'; -import { LayoutView, ContextTrailView, HeaderView, ListView } from 'js/views/programs/program/flow/flow_views'; +import { LayoutView, ContextTrailView, HeaderView, AddActionView, ListView } from 'js/views/programs/program/flow/flow_views'; import { SidebarView } from 'js/views/programs/program/sidebar/sidebar-views'; export default SubRouterApp.extend({ @@ -43,6 +43,7 @@ export default SubRouterApp.extend({ })); this.showHeader(); + this.showAddAction(); this.showActionList(); this.showProgramSidebar(); }, @@ -63,12 +64,21 @@ export default SubRouterApp.extend({ this.listenTo(headerView, { 'edit': this.onEditFlow, + }); + + this.showChildView('header', headerView); + }, + + showAddAction() { + const addActionView = new AddActionView(); + + this.listenTo(addActionView, { 'click:addAction': () => { Radio.trigger('event-router', 'programFlow:action:new', this.flow.id); }, }); - this.showChildView('header', headerView); + this.showChildView('addAction', addActionView); }, showActionList() { diff --git a/src/js/i18n/en-US.yml b/src/js/i18n/en-US.yml index 2a9687a84..4e0c0f88d 100644 --- a/src/js/i18n/en-US.yml +++ b/src/js/i18n/en-US.yml @@ -678,10 +678,9 @@ careOptsFrontend: actionItemTemplate: newProgramFlowAction: New Flow Action flowViews: + addActionBtn: Action contextBackBtn: Back to List emptyView: No Actions - headerTemplate: - action: Action programViews: contextBackBtn: Back to List sidebar: diff --git a/src/js/views/programs/program/flow/flow_views.js b/src/js/views/programs/program/flow/flow_views.js index e7b84d3bf..1669785d5 100644 --- a/src/js/views/programs/program/flow/flow_views.js +++ b/src/js/views/programs/program/flow/flow_views.js @@ -51,12 +51,13 @@ const ContextTrailView = View.extend({ }); const HeaderView = View.extend({ + className: 'program-flow__header', modelEvents: { 'editing': 'onEditing', 'change': 'render', }, onEditing(isEditing) { - this.ui.flow.toggleClass('is-selected', isEditing); + this.$el.toggleClass('is-selected', isEditing); }, template: HeaderTemplate, regions: { @@ -64,11 +65,7 @@ const HeaderView = View.extend({ owner: '[data-owner-region]', }, triggers: { - 'click @ui.flow': 'edit', - 'click .js-add-action': 'click:addAction', - }, - ui: { - flow: '.js-flow', + 'click': 'edit', }, onRender() { this.showBehavior(); @@ -97,6 +94,17 @@ const HeaderView = View.extend({ }, }); +const AddActionView = View.extend({ + template: hbs` +
- {{#if details}} - {{ details }} - {{ else }} - - {{/if}} -
{{~ remove_whitespace ~}} - - -+ {{#if details}} + {{ details }} + {{ else }} + + {{/if}} +
{{~ remove_whitespace ~}} + +