aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets
diff options
context:
space:
mode:
authorTeddy Wing2015-01-24 10:41:07 -0500
committerTeddy Wing2015-01-24 10:41:07 -0500
commit154fb936beb820d5e8db616899a6a95bc8d1c080 (patch)
treec45eab082b4e1ef37320a6608f6850c9871e6c1c /app/assets
parent384167b6122e44971aac7f98a0131f8cad1ef47f (diff)
downloadNotes-angular-demo-154fb936beb820d5e8db616899a6a95bc8d1c080.tar.bz2
main view: Create & update work
Add hooks to create new notes and save existing notes from the interface.
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/services/notes.js27
-rw-r--r--app/assets/stylesheets/components/type.scss4
-rw-r--r--app/assets/stylesheets/layouts/_global.scss41
3 files changed, 69 insertions, 3 deletions
diff --git a/app/assets/javascripts/services/notes.js b/app/assets/javascripts/services/notes.js
index b1b4e90..bfa0b03 100644
--- a/app/assets/javascripts/services/notes.js
+++ b/app/assets/javascripts/services/notes.js
@@ -3,7 +3,13 @@ angular
.factory('NoteService', [
'$resource',
function($resource) {
- var Note = $resource('/notes/:id.json', { id: '@id' });
+ var Note = $resource('/notes/:id.json',
+ { id: '@id' },
+ {
+ save: {
+ method: 'PUT'
+ }
+ });
return {
notes: [],
@@ -14,15 +20,32 @@ angular
},
get_note: function(note) {
- this.current_note = Note.get({ id: note.id });
+ this.current_note = note;
},
save: function() {
+ console.log(this.current_note.body);
Note.save({
id: this.current_note.id,
title: this.current_note.title,
body: this.current_note.body
});
+ },
+
+ create: function () {
+ var _this = this;
+
+ if (this.new_note_title) {
+ Note.save({
+ title: this.new_note_title,
+ body: ''
+ }, function(response) {
+ _this.show_create = false;
+ delete _this.new_note_title;
+ _this.current_note = response;
+ _this.get_notes();
+ });
+ }
}
};
}
diff --git a/app/assets/stylesheets/components/type.scss b/app/assets/stylesheets/components/type.scss
index 7e8fc05..d4e4ecf 100644
--- a/app/assets/stylesheets/components/type.scss
+++ b/app/assets/stylesheets/components/type.scss
@@ -3,6 +3,10 @@
}
+.font-size-16 {
+ font-size: 16px;
+}
+
.font-size-28 {
font-size: 28px;
}
diff --git a/app/assets/stylesheets/layouts/_global.scss b/app/assets/stylesheets/layouts/_global.scss
index 02dbe0c..88973e3 100644
--- a/app/assets/stylesheets/layouts/_global.scss
+++ b/app/assets/stylesheets/layouts/_global.scss
@@ -4,6 +4,10 @@ body {
}
+.display-inline-block {
+ display: inline-block;
+}
+
.display-block {
display: block;
}
@@ -13,6 +17,10 @@ body {
}
+.margin-top--15 {
+ margin-top: -15px;
+}
+
.margin-top-70 {
margin-top: 70px;
}
@@ -41,6 +49,19 @@ body {
}
+.border-none {
+ border: none;
+}
+
+.outline-none {
+ outline: none;
+}
+
+
+.width-100\% {
+ width: 100%;
+}
+
.min-height-100\% {
min-height: 100%;
}
@@ -121,8 +142,11 @@ $sidebar-width: 250px;
.note-editor {
margin-left: $sidebar-width;
padding: 12px 15px;
- font: 18px/1.7 Georgia, Times, serif;
outline: none;
+
+ textarea {
+ font: 18px/1.7 Georgia, Times, serif;
+ }
}
@@ -134,6 +158,12 @@ $sidebar-width: 250px;
border-radius: 6px;
}
+button.button {
+ border: none;
+ font: 16px Avenir, Helvetica, sans-serif;
+ cursor: pointer;
+}
+
.button:hover {
background-color: #178E17;
color: #eee;
@@ -144,3 +174,12 @@ $sidebar-width: 250px;
-webkit-box-shadow:inset 0 2px 4px 0 #0D4F0D;
box-shadow:inset 0 2px 4px 0 #0D4F0D;
}
+
+
+input.form-field {
+ border: 2px solid rgb(213, 202, 202);
+ width: 260px;
+ height: 42px;
+ padding: 0 10px;
+ font-size: 16px;
+}