Merge branch 'master' into title-error-message

This commit is contained in:
rachel-dtr
2019-02-14 10:53:47 -05:00
committed by GitHub
108 changed files with 4803 additions and 2121 deletions

View File

@@ -4,6 +4,7 @@ import { conformToMask } from 'vue-text-mask'
import FormMixin from '../../mixins/form'
import textinput from '../text_input'
import optionsinput from '../options_input'
import uploadinput from '../upload_input'
export default {
name: 'funding',
@@ -13,6 +14,7 @@ export default {
components: {
textinput,
optionsinput,
uploadinput,
},
props: {
@@ -32,7 +34,6 @@ export default {
clin_02 = 0,
clin_03 = 0,
clin_04 = 0,
csp_estimate,
} = this.initialData
return {
@@ -40,7 +41,6 @@ export default {
clin_02,
clin_03,
clin_04,
showUpload: !csp_estimate || this.uploadErrors.length > 0,
}
},
@@ -63,9 +63,6 @@ export default {
},
methods: {
showUploadInput: function() {
this.showUpload = true
},
updateBudget: function() {
document.querySelector('#to-target').innerText = this.totalBudgetStr
},

View File

@@ -0,0 +1,27 @@
import textinput from './text_input'
import checkboxinput from './checkbox_input'
import FormMixin from '../mixins/form'
export default {
mixins: [FormMixin],
components: {
textinput,
checkboxinput,
},
props: {
initialData: {
type: Object,
default: () => ({}),
},
},
data() {
const { unlimited_level_of_warrant = false } = this.initialData
return {
unlimited_level_of_warrant,
}
},
}

View File

@@ -61,8 +61,14 @@ export default {
props: {
members: Array,
role_choices: Array,
status_choices: Array,
role_choices: {
type: Array,
default: () => [],
},
status_choices: {
type: Array,
default: () => [],
},
},
data: function() {
@@ -87,7 +93,7 @@ export default {
displayName: 'Environments',
attr: 'num_env',
sortFunc: numericSort,
class: 'table-cell--align-right',
class: 'table-cell--align-center',
},
{
displayName: 'Status',

View File

@@ -0,0 +1,30 @@
import ToggleMixin from '../mixins/toggle'
const cookieName = 'expandSidenav'
export default {
name: 'sidenav-toggler',
mixins: [ToggleMixin],
props: {
defaultVisible: {
type: Boolean,
default: function() {
if (document.cookie.match(cookieName)) {
return !!document.cookie.match(cookieName + ' *= *true')
} else {
return true
}
},
},
},
methods: {
toggle: function(e) {
e.preventDefault()
this.isVisible = !this.isVisible
document.cookie = cookieName + '=' + this.isVisible + '; path=/'
},
},
}

View File

@@ -84,6 +84,10 @@ export default {
}
},
onBlur: function(e) {
this._checkIfValid({ value: e.target.value, invalidate: true })
},
//
_checkIfValid: function({ value, invalidate = false }) {
// Validate the value

View File

@@ -1,32 +1,14 @@
import ToggleMixin from '../mixins/toggle'
export default {
name: 'toggler',
mixins: [ToggleMixin],
props: {
defaultVisible: {
type: Boolean,
default: () => false,
},
},
data: function() {
return {
isVisible: this.defaultVisible,
}
},
render: function(createElement) {
return createElement(this.$vnode.data.tag, [
this.$scopedSlots.default({
isVisible: this.isVisible,
toggle: this.toggle,
}),
])
},
methods: {
toggle: function(e) {
e.preventDefault()
this.isVisible = !this.isVisible
},
},
}

View File

@@ -0,0 +1,41 @@
import createNumberMask from 'text-mask-addons/dist/createNumberMask'
import { conformToMask } from 'vue-text-mask'
import FormMixin from '../mixins/form'
import textinput from './text_input'
import optionsinput from './options_input'
export default {
name: 'uploadinput',
mixins: [FormMixin],
components: {
textinput,
optionsinput,
},
props: {
initialData: {
type: String,
},
uploadErrors: {
type: Array,
default: () => [],
},
},
data: function() {
const pdf = this.initialData
return {
showUpload: !pdf || this.uploadErrors.length > 0,
}
},
methods: {
showUploadInput: function() {
this.showUpload = true
},
},
}

View File

@@ -6,6 +6,7 @@ import classes from '../styles/atat.scss'
import Vue from 'vue/dist/vue'
import VTooltip from 'v-tooltip'
import levelofwarrant from './components/levelofwarrant'
import optionsinput from './components/options_input'
import multicheckboxinput from './components/multi_checkbox_input'
import textinput from './components/text_input'
@@ -20,6 +21,7 @@ import NewApplication from './components/forms/new_application'
import EditEnvironmentRole from './components/forms/edit_environment_role'
import EditApplicationRoles from './components/forms/edit_application_roles'
import funding from './components/forms/funding'
import uploadinput from './components/upload_input'
import Modal from './mixins/modal'
import selector from './components/selector'
import BudgetChart from './components/charts/budget_chart'
@@ -32,6 +34,7 @@ import RequestsList from './components/requests_list'
import ConfirmationPopover from './components/confirmation_popover'
import { isNotInVerticalViewport } from './lib/viewport'
import DateSelector from './components/date_selector'
import SidenavToggler from './components/sidenav_toggler'
Vue.config.productionTip = false
@@ -43,6 +46,7 @@ const app = new Vue({
el: '#app-root',
components: {
toggler,
levelofwarrant,
optionsinput,
multicheckboxinput,
textinput,
@@ -64,8 +68,10 @@ const app = new Vue({
RequestsList,
ConfirmationPopover,
funding,
uploadinput,
DateSelector,
EditOfficerForm,
SidenavToggler,
},
mounted: function() {

View File

@@ -5,6 +5,10 @@ export const formatDollars = (value, cents = true) => {
currency: 'USD',
})
} else if (typeof value === 'string') {
if (value === '') {
return value
}
return parseFloat(value).toLocaleString('us-US', {
style: 'currency',
currency: 'USD',

23
js/mixins/toggle.js Normal file
View File

@@ -0,0 +1,23 @@
export default {
data: function() {
return {
isVisible: this.defaultVisible,
}
},
render: function(createElement) {
return createElement(this.$vnode.data.tag, [
this.$scopedSlots.default({
isVisible: this.isVisible,
toggle: this.toggle,
}),
])
},
methods: {
toggle: function(e) {
e.preventDefault()
this.isVisible = !this.isVisible
},
},
}