Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
i8ln for the admin module
Browse files Browse the repository at this point in the history
Merging PR #354 thanks to @dswanson and @baileye
Closes #345
  • Loading branch information
jkleinsc committed Mar 21, 2016
1 parent 013266d commit af00f1d
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 43 deletions.
7 changes: 4 additions & 3 deletions app/admin/address/route.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';
import Ember from 'ember';
import { translationMacro as t } from 'ember-i18n';
export default AbstractEditRoute.extend({
hideNewButton: true,
newTitle: 'Address Options',
editTitle: 'Address Options',
newTitle: t('admin.address.new_title'),
editTitle: t('admin.address.edit_title'),
model: function() {
return new Ember.RSVP.Promise(function(resolve) {
this.get('store').find('option', 'address_options').then(function(addressOptions) {
Expand All @@ -13,7 +14,7 @@ export default AbstractEditRoute.extend({
var newConfig = store.push(store.normalize('option', {
id: 'address_options',
value: {
address1Label: 'Address',
address1Label: this.get('i18n').t('admin.address.address_label'),
address1Include: true
}
}));
Expand Down
15 changes: 11 additions & 4 deletions app/admin/loaddb/controller.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import Ember from 'ember';
import { translationMacro as t } from 'ember-i18n';
import ModalHelper from 'hospitalrun/mixins/modal-helper';
import ProgressDialog from 'hospitalrun/mixins/progress-dialog';
export default Ember.Controller.extend(ModalHelper, ProgressDialog, {
database: Ember.inject.service(),
fileSystem: Ember.inject.service('filesystem'),
progressMessage: 'Please wait while your database is loaded.',
progressTitle: 'Loading Database',
progressMessage: t('admin.loaddb.progress_message'),
progressTitle: t('admin.loaddb.progress_title'),
syncResults: null,

actions: {
loadFile: function() {
var fileSystem = this.get('fileSystem'),
fileToImport = this.get('importFile');
if (!fileToImport || !fileToImport.type) {
this.displayAlert('Select File To Load', 'Please select file to load.');
this.displayAlert(
this.get('i18n').t('admin.loaddb.display_alert_title'),
this.get('i18n').t('admin.loaddb.display_alert_message')
);
} else {
this.showProgressModal();
this.set('syncResults');
Expand All @@ -25,7 +29,10 @@ export default Ember.Controller.extend(ModalHelper, ProgressDialog, {
this.closeProgressModal();
this.set('syncResults', results);
}).catch((err) => {
this.displayAlert('Error Loading', `The database could not be imported. The error was:${JSON.stringify(err)}`);
this.displayAlert(
this.get('i18n').t('admin.loaddb.error_display_alert_title'),
this.get('i18n').t('admin.loaddb.error_display_alert_message', { error: JSON.stringify(err) })
);
});
});
}
Expand Down
3 changes: 2 additions & 1 deletion app/admin/loaddb/route.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';
import Ember from 'ember';
import { translationMacro as t } from 'ember-i18n';
import UserSession from 'hospitalrun/mixins/user-session';
export default AbstractEditRoute.extend(UserSession, {
hideNewButton: true,
editTitle: 'Load DB',
editTitle: t('admin.loaddb.edit_title'),

beforeModel: function() {
if (!this.currentUserCan('load_db')) {
Expand Down
50 changes: 40 additions & 10 deletions app/admin/lookup/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,37 +251,58 @@ export default Ember.Controller.extend(BillingCategories, LabPricingTypes,
switch (lookupType) {
case 'inventory_types': {
if (value === 'Medication') {
this.displayAlert('Cannot Delete Medication', 'The Medication inventory type cannot be deleted because it is needed for the Medication module.');
this.displayAlert(
this.get('i18n').t('admin.lookup.delete_value_inventory_type_medication_title'),
this.get('i18n').t('admin.lookup.delete_value_inventory_type_medication_message')
);
return false;
}
break;
}
case 'lab_pricing_types': {
if (value === 'Lab Procedure') {
this.displayAlert('Cannot Delete Lab Pricing Type', 'The Lab Procedure pricing type cannot be deleted because it is needed for the Labs module.');
this.displayAlert(
this.get('i18n').t('admin.lookup.delete_value_lab_pricing_type_procedure_title'),
this.get('i18n').t('admin.lookup.delete_value_lab_pricing_type_procedure_message')
);
return false;
}
break;
}
case 'imaging_pricing_types': {
if (value === 'Imaging Procedure') {
this.displayAlert('Cannot Delete Imaging Pricing Type', 'The Imaging Procedure pricing type cannot be deleted because it is needed for the Imaging module.');
this.displayAlert(
this.get('i18n').t('admin.lookup.delete_value_imaging_pricing_type_procedure_title'),
this.get('i18n').t('admin.lookup.delete_value_imaging_pricing_type_procedure_message')
);
return false;
}
break;
}
case 'visit_types': {
if (value === 'Admission') {
this.displayAlert('Cannot Delete Admmission Visit Type', 'The Admission Visit type cannot be deleted because it is needed for the Visits module.');
this.displayAlert(
this.get('i18n').t('admin.lookup.delete_value_visit_type_admission_title'),
this.get('i18n').t('admin.lookup.delete_value_visit_type_admission_message')
);
return false;
} else if (value === 'Imaging') {
this.displayAlert('Cannot Delete Imaging Visit Type', 'The Imaging Visit type cannot be deleted because it is needed for the Imaging module.');
this.displayAlert(
this.get('i18n').t('admin.lookup.delete_value_visit_type_imaging_title'),
this.get('i18n').t('admin.lookup.delete_value_visit_type_imaging_message')
);
return false;
} else if (value === 'Lab') {
this.displayAlert('Cannot Delete Lab Visit Type', 'The Lab Visit type cannot be deleted because it is needed for the Lab module.');
this.displayAlert(
this.get('i18n').t('admin.lookup.delete_value_visit_type_lab_title'),
this.get('i18n').t('admin.lookup.delete_value_visit_type_lab_message')
);
return false;
} else if (value === 'Pharmacy') {
this.displayAlert('Cannot Delete Pharmacy Visit Type', 'The Lab Visit type cannot be deleted because it is needed for the Medication module.');
this.displayAlert(
this.get('i18n').t('admin.lookup.delete_value_visit_type_pharmacy_title'),
this.get('i18n').t('admin.lookup.delete_value_visit_type_pharmacy_message')
);
return false;
}
}
Expand Down Expand Up @@ -321,7 +342,10 @@ export default Ember.Controller.extend(BillingCategories, LabPricingTypes,
fileToImport = this.get('importFile'),
lookupTypeList = this.get('lookupTypeList');
if (!fileToImport || !fileToImport.type) {
this.displayAlert('Select File To Import', 'Please select file to import.');
this.displayAlert(
this.get('i18n').t('admin.lookup.alert_import_list_title'),
this.get('i18n').t('admin.lookup.alert_import_list_message')
);
} else {
fileSystem.fileToDataURL(fileToImport).then(function(fileDataUrl) {
var dataUrlParts = fileDataUrl.split(',');
Expand All @@ -335,7 +359,10 @@ export default Ember.Controller.extend(BillingCategories, LabPricingTypes,
importFile: true
});
lookupTypeList.save().then(function() {
this.displayAlert('List Imported', 'The lookup list has been imported.', 'refreshLookupLists');
this.displayAlert(
this.get('i18n').t('admin.lookup.alert_import_list_save_title'),
this.get('i18n').t('admin.lookup.alert_import_list_save_message'),
'refreshLookupLists');
this.set('importFile');
this.set('model.importFileName');
}.bind(this));
Expand All @@ -346,7 +373,10 @@ export default Ember.Controller.extend(BillingCategories, LabPricingTypes,
var lookupTypeList = this.get('lookupTypeList');
lookupTypeList.set('userCanAdd', this.get('model.userCanAdd'));
lookupTypeList.save().then(function() {
this.displayAlert('List Saved', 'The lookup list has been saved');
this.displayAlert(
this.get('i18n').t('admin.lookup.alert_import_list_update_title'),
this.get('i18n').t('admin.lookup.alert_import_list_update_message')
);
}.bind(this));
},
updateValue: function(valueObject) {
Expand Down
18 changes: 0 additions & 18 deletions app/admin/lookup/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,8 @@ export default Ember.Controller.extend(IsUpdateDisabled, {
editController: Ember.inject.controller('admin/lookup'),
showUpdateButton: true,

title: function() {
var isNew = this.get('model.isNew');
if (isNew) {
return 'Add Value';
} else {
return 'Edit Value';
}
}.property('model.isNew'),

updateButtonAction: 'update',

updateButtonText: function() {
var isNew = this.get('model.isNew');
if (isNew) {
return 'Add';
} else {
return 'Update';
}
}.property('model.isNew'),

actions: {
cancel: function() {
this.send('closeModal');
Expand Down
6 changes: 3 additions & 3 deletions app/admin/lookup/edit/template.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{#modal-dialog
isUpdateDisabled=isUpdateDisabled
title=title
title=(t (if model.isNew 'admin.lookup.edit.template.add_title' 'admin.lookup.edit.template.edit_title'))
updateButtonAction=updateButtonAction
updateButtonText=updateButtonText}}
updateButtonText=(t (if model.isNew 'admin.lookup.edit.template.update_button_text_add' 'admin.lookup.edit.template.update_button_text_update'))}}
{{#em-form model=model submitButton=false action="update" }}
{{em-input label="Value" property="value" class="lookup-type-value"}}
{{em-input label=(t 'admin.lookup.edit.template.label_title') property="value" class="lookup-type-value"}}
{{/em-form}}
{{/modal-dialog}}
3 changes: 2 additions & 1 deletion app/admin/lookup/route.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import AbstractIndexRoute from 'hospitalrun/routes/abstract-index-route';
import { translationMacro as t } from 'ember-i18n';
export default AbstractIndexRoute.extend({
hideNewButton: true,
pageTitle: 'Lookup Lists',
pageTitle: t('admin.lookup.page_title'),
model: function() {
return this.store.findAll('lookup');
},
Expand Down
2 changes: 1 addition & 1 deletion app/admin/lookup/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<td class="lookup-type-value">{{lookupTypeValue}}</td>
<td>
<button class="btn btn-default neutral" {{action 'editValue' lookupTypeValue bubbles=false }}>{{t 'labels.edit'}}</button>
<button class="btn btn-default warning" {{action 'deleteValue' lookupTypeValue bubbles=false }}><span class="octicon octicon-x"></span>Delete</button>
<button class="btn btn-default warning" {{action 'deleteValue' lookupTypeValue bubbles=false }}><span class="octicon octicon-x"></span>{{t 'labels.delete'}}</button>
</td>
</tr>
{{/each}}
Expand Down
2 changes: 1 addition & 1 deletion app/admin/query/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default Ember.Controller.extend(EditPanelProps, {
hideCancelButton: true,
showUpdateButton: true,
updateButtonAction: 'query',
updateButtonText: 'Query',
updateButtonText: 'Query', // admin function not requiring i8ln

objectTypeList: [
'appointment',
Expand Down
2 changes: 2 additions & 0 deletions app/admin/query/template.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{! disable specific rules for this template }}
<!-- template-lint bare-strings=false -->
{{#edit-panel editPanelProps=editPanelProps}}
<div class="panel panel-primary">
<div class="panel-body">
Expand Down
45 changes: 44 additions & 1 deletion app/locales/en/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,52 @@ export default {
},
messages: {
address_saved: 'The address options have been saved'
}
},

new_title: 'Address Options',
edit_title: 'Address Options',
address_label: 'Address'
},
loaddb: {
progress_message: 'Please wait while your database is loaded.',
progress_title: 'Loading Database',
display_alert_title: 'Select File To Load',
display_alert_message: 'Please select file to load.',
error_display_alert_title: 'Error Loading',
error_display_alert_message: `The database could not be imported. The error was: {{error}}`,
edit_title: 'Load DB'
},
lookup: {
delete_value_inventory_type_medication_title: 'Cannot Delete Medication',
delete_value_inventory_type_medication_message: 'The Medication inventory type cannot be deleted because it is needed for the Medication module.',
delete_value_lab_pricing_type_procedure_title: 'Cannot Delete Lab Pricing Type',
delete_value_lab_pricing_type_procedure_message: 'The Lab Procedure pricing type cannot be deleted because it is needed for the Labs module.',
delete_value_imaging_pricing_type_procedure_title: 'Cannot Delete Imaging Pricing Type',
delete_value_imaging_pricing_type_procedure_message: 'The Imaging Procedure pricing type cannot be deleted because it is needed for the Imaging module.',
delete_value_visit_type_admission_title: 'Cannot Delete Admission Visit Type',
delete_value_visit_type_admission_message: 'The Admission Visit type cannot be deleted because it is needed for the Visits module.',
delete_value_visit_type_imaging_title: 'Cannot Delete Imaging Visit Type',
delete_value_visit_type_imaging_message: 'The Imaging Visit type cannot be deleted because it is needed for the Imaging module.',
delete_value_visit_type_lab_title: 'Cannot Delete Lab Visit Type',
delete_value_visit_type_lab_message: 'The Lab Visit type cannot be deleted because it is needed for the Lab module.',
delete_value_visit_type_pharmacy_title: 'Cannot Delete Pharmacy Visit Type',
delete_value_visit_type_pharmacy_message: 'The Lab Visit type cannot be deleted because it is needed for the Medication module.',
alert_import_list_title: 'Select File To Import',
alert_import_list_message: 'Please select file to import.',
alert_import_list_save_title: 'List Imported',
alert_import_list_save_message: 'The lookup list has been imported.',
alert_import_list_update_title: 'List Saved',
alert_import_list_update_message: 'The lookup list has been saved.',
page_title: 'Lookup Lists',
edit: {
template: {
add_title: 'Add Value',
edit_title: 'Edit Value',
update_button_text_add: 'Add',
update_button_text_update: 'Update',
label_title: 'Value'
}
},
anesthesia_types: 'Anesthesia Types',
anesthesiologists: 'Anesthesiologists',
billing_categories: 'Billing Categories',
Expand Down
19 changes: 19 additions & 0 deletions build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2.4.2
BuildingBuilding.Building..Building...BuildingBuilding.Building..Building...BuildingBuilding.Building..Building...Processing _base.scss
Processing _bootstrap-theme.scss
Processing _bootstrap.scss
Processing _index.scss
Processing _layout.scss
Processing _loading_notice.scss
Processing _sign_in_screen.scss
Processing _temp_misc.scss
Processing _typography.scss
Processing _variables_mixins.scss
Processing app.scss
Processing components/_form_styles.scss
Processing components/_panel.scss
Processing components/_patient_summary.scss
Processing components/_sidebar_nav.scss
Processing components/_tab_content.scss
Processing components/_tab_nav.scss
BuildingBuilding.Building..Building...BuildingBuilding.Building..Building...BuildingBuilding.Building..Building...Built project successfully. Stored in "dist/".

0 comments on commit af00f1d

Please sign in to comment.