Skip to content

Commit 39baa83

Browse files
authored
Merge pull request #15 from cdscally/development
Development
2 parents dcb7870 + 57b3664 commit 39baa83

File tree

5 files changed

+55
-12
lines changed

5 files changed

+55
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.node_modules/

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
![Note App Logo](https://user-images.githubusercontent.com/6470014/27345241-dbfd1a88-55e0-11e7-8a01-e0c914008543.png)
2+
3+
A single page application build with JavaScript, HTML and CSS.
4+
No libraries or frameworks allowed!
5+
6+
## User Stories
7+
```
8+
As a programmer
9+
I can see a list of my notes, where each note is abbreviated to the first 20 characters
10+
So I can find the one I want
11+
```
12+
13+
```
14+
As a programmer
15+
I can create a new note
16+
So I can record something I need to remember
17+
```
18+
19+
```
20+
As a programmer
21+
I can see the full text of an individual note on its own page
22+
So I can see all the information in the note
23+
```
24+
25+
## Contributors
26+
27+
- [Charlotte Feather](https://github.com/charliefea)
28+
- [Colin Scally](https://github.com/cdscally)
29+
- [Mario Ribeiro](https://github.com/marioribeiro)
30+
- [Simon Ashbery](https://github.com/SiAshbery)
31+
- [Kavita Kalaichelvan](https://github.com/kkavita92)

SpecRunner.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
<head>
44
<meta charset="utf-8">
55
<title>Notes App SpecRunner</title>
6-
7-
<script src="./src/view.js"></script>
86
<script src="./src/NoteList.js"></script>
97
<script src="./src/Note.js"></script>
108
<script src="./spec/TestingFramework.js"></script>

css/template.css

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ header {
3939
background-color: #FFF;
4040
border-radius: 4px;
4141
box-sizing: border-box;
42-
padding: 15px;
4342
margin-bottom: 15px;
4443
}
4544
ul#notes-list li:hover {
4645
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
4746
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
48-
cursor: pointer;
49-
}
47+
}
48+
49+
ul#notes-list li p{
50+
padding: 15px;
51+
cursor: pointer;
52+
}
5053

5154
.create-new-note {
5255
width: 646px;
@@ -105,3 +108,7 @@ header {
105108
resize: none;
106109
margin-top: 15px;
107110
}
111+
112+
#note-content {
113+
word-wrap: break-word;
114+
}

src/view.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@ var pageList = new NoteList();
22

33
var submitNote = function() {
44
pageList.createNote(document.forms[0].elements[0].value);
5+
document.forms[0].elements[0].value = '';
56
writeList();
67
};
78

89
var writeList = function() {
910
var notesList = document.getElementById('notes-list');
1011
var li = document.createElement('li');
11-
var note = document.createElement('p');
12-
var long = pageList.notes[pageList.notes.length - 1].content;
13-
note.innerHTML = pageList.list()[pageList.list().length - 1];
14-
note.addEventListener('click', function() {
12+
var noteElement = document.createElement('p');
13+
var fullNote = pageList.notes[pageList.notes.length - 1].content;
14+
var abbreviatedNote = pageList.list()[pageList.list().length - 1];
15+
if (fullNote == abbreviatedNote) {
16+
noteElement.innerHTML = abbreviatedNote;
17+
} else {
18+
noteElement.innerHTML = abbreviatedNote + '...';
19+
}
20+
noteElement.addEventListener('click', function() {
1521
var noteContent = document.getElementById('note-content');
16-
noteContent.innerHTML = long;
22+
noteContent.innerHTML = fullNote;
1723
});
18-
li.appendChild(note);
24+
li.appendChild(noteElement);
1925
notesList.appendChild(li);
20-
};
26+
};

0 commit comments

Comments
 (0)