Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
some work on creating notes, added type, show button, typed views
Browse files Browse the repository at this point in the history
  • Loading branch information
EBTC committed Jul 6, 2015
1 parent 790e282 commit 3eba666
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
18 changes: 18 additions & 0 deletions client/app/modules/note/directives/note-directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,28 @@ export function NoteCreateDirective() {
newNote: '&'
},
controller: function (Note, Shout, $scope, gettextCatalog) {
this.type = 'note';
this.noteTypes = [{
icon: 'chat',
title: 'Note',
value: 'note'
},{
icon: 'email',
title: 'Email',
value: 'email'
},{
icon: 'call',
title: 'Phone',
value: 'phone'
},
];

this.create = () => {
Note.upsert(
{
title: this.title,
content: this.content,
type: this.type,
notableId: $scope.notableId,
notableType: $scope.notableType
}).$promise
Expand All @@ -52,6 +69,7 @@ export function NoteCreateDirective() {
this.clear = () => {
this.title = '';
this.content = '';
this.note_type = '';
};
},
controllerAs: 'ctrl',
Expand Down
9 changes: 9 additions & 0 deletions client/app/modules/note/templates/note-create-directive.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<md-card>
<md-card-content>
<h3 translate>Create new Note</h3>
<md-radio-group ng-model="ctrl.type" class="radio-buttons-hz">
<md-radio-button ng-repeat="type in ctrl.noteTypes"
ng-value="type.value"
aria-label="{{type.title}}">
<md-tooltip>{{type.title}}</md-tooltip>
<ng-md-icon icon="{{type.icon}}" style="fill:#61697E"></ng-md-icon>
</md-radio-button>
</md-radio-group>

<md-input-container>
<label translate>Title (optional)</label>
<input ng-model="ctrl.title" type="text"/>
Expand Down
14 changes: 12 additions & 2 deletions client/app/modules/person/views/person.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,23 @@ <h3 translate>Address</h3>
<mh-note-create
notable-type="Person"
notable-id="{{personCtrl.person.id}}"
new-note="personCtrl.newNote(note)"></mh-note-create>
new-note="personCtrl.newNote(note)"
ng-show="addNote"></mh-note-create>

<md-card class="md-2-line" ng-show="!addNote">
<md-card-content flex layout="row">
<div class="md-actions" layout="row" layout-align="end center">
<md-button ng-click="addNote = true" class="md-raised"><translate>New Note</translate></md-button>
</div>
</md-card-content>
</md-card>

<md-card class="md-2-line" ng-repeat="note in personCtrl.notes">
<md-card-content flex layout="row">
<div flex class="md-list-item-text">
<h4>{{note.title}}</h4>
<ng-md-icon size="16" icon="event_note"></ng-md-icon>
<ng-md-icon size="18" icon="{{note.type}}" ng-if="note.type"></ng-md-icon>
<ng-md-icon size="18" icon="chat" ng-if="!note.type"></ng-md-icon>
<small><i><span am-time-ago="note.created"></span>
<translate>from</translate> <a ui-sref="person.view({ id: note.ownerId })">{{note.ownerId}}</a></i></small>
<p>{{note.content}}</p>
Expand Down
6 changes: 6 additions & 0 deletions client/app/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ gm-map {
position:relative !important;
}
}

.radio-buttons-hz {
md-radio-button {
display: inline !important;
}
}

0 comments on commit 3eba666

Please sign in to comment.