life-story 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +56 -0
  3. data/Gemfile +21 -0
  4. data/Gemfile.lock +136 -0
  5. data/LICENSE +21 -0
  6. data/README.md +40 -0
  7. data/Rakefile +8 -0
  8. data/app/controllers/application_controller.rb +31 -0
  9. data/app/controllers/story_controller.rb +101 -0
  10. data/app/controllers/user_controller.rb +59 -0
  11. data/app/models/.gitkeep +0 -0
  12. data/app/models/category.rb +4 -0
  13. data/app/models/concerns/slugifiable.rb +13 -0
  14. data/app/models/story.rb +8 -0
  15. data/app/models/user.rb +12 -0
  16. data/app/models/user_story.rb +4 -0
  17. data/app/views/layout.erb +42 -0
  18. data/app/views/stories/edit.erb +51 -0
  19. data/app/views/stories/new.erb +47 -0
  20. data/app/views/stories/show.erb +46 -0
  21. data/app/views/stories/show_by_category.erb +27 -0
  22. data/app/views/stories/show_by_date.erb +27 -0
  23. data/app/views/stories/show_by_users.erb +29 -0
  24. data/app/views/users/signup.erb +36 -0
  25. data/app/views/welcome.erb +51 -0
  26. data/config.ru +10 -0
  27. data/config/environment.rb +12 -0
  28. data/db/development.sqlite +0 -0
  29. data/db/migrate/20200118192302_create_users.rb +9 -0
  30. data/db/migrate/20200118192313_create_categories.rb +7 -0
  31. data/db/migrate/20200118192321_create_stories.rb +10 -0
  32. data/db/migrate/20200118201120_create_user_stories.rb +8 -0
  33. data/db/schema.rb +38 -0
  34. data/db/seeds.rb +39 -0
  35. data/development.sqlite +0 -0
  36. data/lib/.gitkeep +0 -0
  37. data/life-story.gemspec +46 -0
  38. data/public/favicon.ico +0 -0
  39. data/public/images/.gitkeep +0 -0
  40. data/public/images/life-story.png +0 -0
  41. data/public/javascripts/.gitkeep +0 -0
  42. data/public/stylesheets/main.css +246 -0
  43. metadata +204 -0
Binary file
@@ -0,0 +1,9 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |u|
4
+ u.string :username
5
+ u.string :email
6
+ u.string :password_digest
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ class CreateCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :categories do |c|
4
+ c.string :name
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ class CreateStories < ActiveRecord::Migration
2
+ def change
3
+ create_table :stories do |s|
4
+ s.text :summary
5
+ s.date :date
6
+ s.text :description
7
+ s.integer :category_id
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ class CreateUserStories < ActiveRecord::Migration
2
+ def change
3
+ create_table :user_stories do |ue|
4
+ ue.integer :user_id
5
+ ue.integer :story_id
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,38 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20200118201120) do
15
+
16
+ create_table "categories", force: :cascade do |t|
17
+ t.string "name"
18
+ end
19
+
20
+ create_table "stories", force: :cascade do |t|
21
+ t.text "summary"
22
+ t.date "date"
23
+ t.text "description"
24
+ t.integer "category_id"
25
+ end
26
+
27
+ create_table "user_stories", force: :cascade do |t|
28
+ t.integer "user_id"
29
+ t.integer "story_id"
30
+ end
31
+
32
+ create_table "users", force: :cascade do |t|
33
+ t.string "username"
34
+ t.string "email"
35
+ t.string "password_digest"
36
+ end
37
+
38
+ end
@@ -0,0 +1,39 @@
1
+ user_list = [
2
+ ["sophieqgu", "sophieqgu@gmail.com", "000000"],
3
+ ["burtiecutie", "burtieonthego@gmail.com", "111111"]
4
+ ]
5
+
6
+ user_list.each do |username, email, password|
7
+ User.create(username: username, email: email, password: password)
8
+ end
9
+
10
+ category_list = [
11
+ "Love",
12
+ "Friendship",
13
+ "Family",
14
+ "Health",
15
+ "Birth",
16
+ "Death",
17
+ "Work",
18
+ "Studies",
19
+ "Passions"
20
+ ]
21
+
22
+ category_list.each do |name|
23
+ Category.create(name: name)
24
+ end
25
+
26
+ story_list = [
27
+ ["completed the Sinatra Project", "2020-1-20", "I am exhausted but it's totally worth it!", 8]
28
+ ]
29
+
30
+ story_list.each do |summary, date, description, category_id|
31
+ Story.create(summary: summary, date: date, description: description, category_id: category_id)
32
+ end
33
+
34
+ story = Story.find(1)
35
+ sophieqgu = User.find_by(username: "sophieqgu")
36
+ burtiecutie = User.find_by(username: "burtiecutie")
37
+ story.users << sophieqgu
38
+ story.users << burtiecutie
39
+ story.save
File without changes
File without changes
@@ -0,0 +1,46 @@
1
+ lib = File.expand_path("../life-story", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "life-story"
7
+ spec.version = "0.1.0"
8
+ spec.authors = ["'Sophie Gu'"]
9
+ spec.email = ["'sophieqgu@gmail.com'"]
10
+
11
+ spec.summary = %q{A Sinatra app recording your important memories.}
12
+ spec.description = %q{This Sinatra app allows you to write stories recorded that are meaningful in various aspects of life. Record things that matter to you at that moment. Read later to reflect on what is really important in life. Browse by date, category and users to see what others have been through. Visualize your life and those that are connected to you in a single app.}
13
+ spec.homepage = "https://github.com/sophieqgu/life-story"
14
+ spec.license = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata["allowed_push_host"] = "https://www.rubygems.org"
20
+
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["source_code_uri"] = "https://github.com/sophieqgu/life-story"
23
+ spec.metadata["changelog_uri"] = "https://github.com/sophieqgu/life-story"
24
+ else
25
+ raise "RubyGems 2.0 or newer is required to protect against " \
26
+ "public gem pushes."
27
+ end
28
+
29
+ # Specify which files should be added to the gem when it is released.
30
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
31
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
32
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
+ end
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ["life-story"]
37
+
38
+ spec.add_development_dependency "bundler", "~> 2.0"
39
+ spec.add_development_dependency "rake", "~> 10.0"
40
+ spec.add_development_dependency "pry"
41
+ spec.add_development_dependency "sinatra"
42
+ spec.add_development_dependency "activerecord", "~> 4.2"
43
+ spec.add_development_dependency "sinatra-activerecord"
44
+ spec.add_dependency "sqlite3", "~> 1.3.6"
45
+ spec.add_dependency "sinatra-flash"
46
+ end
Binary file
File without changes
File without changes
@@ -0,0 +1,246 @@
1
+ @media screen {
2
+ /* --- Reset Styles --- */
3
+ * {
4
+ list-style: none;
5
+ margin: 0;
6
+ padding: 0;
7
+ }
8
+
9
+ html, body {
10
+ height: 100%;
11
+ width: 100%;
12
+ }
13
+
14
+ /* --- Welcome Page Styles --- */
15
+ body {
16
+ background-color: lightblue;
17
+ color: #333;
18
+ font-family: Sans-Serif;
19
+ line-height: 18px;
20
+ }
21
+
22
+ .wrapper {
23
+ background: #fff;
24
+ margin: 200px auto;
25
+ max-width: 1260px;
26
+ padding: 2.25%; /* 18px / 800px */
27
+ width: 85%;
28
+ }
29
+
30
+ h1 {
31
+ font-size: 36px;
32
+ line-height: 54px;
33
+ }
34
+
35
+ h2 {
36
+ border-bottom: 2px solid #ccc;
37
+ font-size: 24px;
38
+ line-height: 36px;
39
+ }
40
+
41
+ h3 {
42
+ font-size: 18px;
43
+ line-height: 36px;
44
+ margin-bottom: 18px;
45
+ }
46
+
47
+ p {
48
+ margin-bottom: 18px;
49
+ font-size: 16px;
50
+ }
51
+
52
+ a {
53
+ font-family: courier;
54
+ font-size: 14px;
55
+ text-decoration: none;
56
+ }
57
+
58
+ ul {
59
+ list-style-type: none;
60
+ margin: 0;
61
+ padding: 0;
62
+ width: 200px;
63
+ background-color: transparent;
64
+
65
+ }
66
+
67
+ li a {
68
+ display: block;
69
+ width: 100%;
70
+ color: #333;
71
+ padding: 16px 16px 2px;
72
+ text-decoration: none;
73
+ border-bottom: 2px solid #333;
74
+ font-family: Sans-Serif;
75
+ font-size: 16px;
76
+ }
77
+
78
+ /* Change the link color on hover */
79
+ li a:hover {
80
+ background-color: lightblue;
81
+ color: white;
82
+ }
83
+
84
+ .main {
85
+ overflow: hidden;
86
+ }
87
+
88
+ .content {
89
+ margin: 18px 0 18px;
90
+ float: left;
91
+ width: 60%; /* 480px / 800px */
92
+ }
93
+
94
+ .sidebar {
95
+ background: #eee;
96
+ float: right;
97
+ padding: 36px; /* 5px / 240px */
98
+ width: 30%; /* 240px / 800px */
99
+ font-size: 14px;
100
+ }
101
+
102
+ .sidebar ul {
103
+ font-size: 14px;
104
+ }
105
+
106
+ .branding {
107
+ clear: both;
108
+ }
109
+
110
+ footer.branding {
111
+ border-top: 2px solid #ccc;
112
+ margin-top: 20px;
113
+ padding-top: 20px;
114
+ }
115
+
116
+ form {
117
+ display: inline-block;
118
+ text-align: right;
119
+ width: 80%;
120
+ margin: 20px;
121
+ }
122
+
123
+ .sidebar form {
124
+ width: 100%;
125
+ margin: -18px -50px;
126
+ }
127
+
128
+
129
+ form::before ::after {
130
+ clear: both;
131
+ }
132
+
133
+ label {
134
+ display: inline-block;
135
+ width: 40%;
136
+ font-size: 16px;
137
+ margin-bottom: 14px;
138
+ }
139
+
140
+ input {
141
+ display: inline-block;
142
+ height: 20px;
143
+ font-size: 14px;
144
+ margin-bottom: 14px;
145
+ width: 40%;
146
+ }
147
+
148
+ input:focus {
149
+ background-color: lightblue;
150
+ }
151
+
152
+ textarea {
153
+ margin: auto;
154
+ padding-top: 18px;
155
+ }
156
+
157
+ button {
158
+ background-color: transparent;
159
+ display: inline-block;
160
+ margin: auto;
161
+ border: 1px solid #bbb;
162
+ color: #333;
163
+ padding: 6px 32px;
164
+ text-align: center;
165
+ border-radius: 2px;
166
+ font-size: 14px;
167
+ cursor: pointer;
168
+ }
169
+
170
+ button:hover {
171
+ background-color: lightblue;
172
+ border: 1px solid lightblue;
173
+ color: white;
174
+ }
175
+
176
+ select:not([multiple]) {
177
+ -webkit-appearance: none;
178
+ -moz-appearance: none;
179
+ }
180
+
181
+ #stories {
182
+ background-color: #eee;
183
+ line-height: 50px;
184
+ font-size: 16px;
185
+ cursor: pointer;
186
+ }
187
+
188
+ #new {
189
+ width: 100%;
190
+ }
191
+
192
+ #new input, select, textarea {
193
+ background-color: #eee;
194
+ border-radius: 0;
195
+ border: none;
196
+ border-left: 6px solid lightblue;
197
+ font-size: 14px;
198
+ font-family: courier;
199
+ height: 50px;
200
+ padding-left: 18px;
201
+ margin-bottom: 12px;
202
+ }
203
+
204
+
205
+ mark {
206
+ background-color: lightblue;
207
+ font-weight: bold;
208
+ }
209
+
210
+ .flash {
211
+ background-color: #eee;
212
+ color: hotpink;
213
+ font-weight: bold;
214
+ }
215
+ }
216
+
217
+ @media screen and (max-width: 600px) {
218
+ .wrapper {
219
+ -moz-box-shadow: none;
220
+ -webkit-box-shadow: none;
221
+ box-shadow: none;
222
+ width: auto;
223
+ }
224
+
225
+ .content, .sidebar {
226
+ float: none;
227
+ width: 100%;
228
+ }
229
+
230
+ .sidebar {
231
+ background: transparent;
232
+ border: none;
233
+ border-top: 2px solid #ccc;
234
+ padding: 0;
235
+ }
236
+
237
+ h1 {
238
+ font-size: 24px;
239
+ line-height: 36px;
240
+ }
241
+
242
+ h2 {
243
+ font-size: 18px;
244
+ line-height: 24px;
245
+ }
246
+ }
metadata ADDED
@@ -0,0 +1,204 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: life-story
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - "'Sophie Gu'"
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-01-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sinatra
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activerecord
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '4.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '4.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sinatra-activerecord
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.3.6
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.3.6
111
+ - !ruby/object:Gem::Dependency
112
+ name: sinatra-flash
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: This Sinatra app allows you to write stories recorded that are meaningful
126
+ in various aspects of life. Record things that matter to you at that moment. Read
127
+ later to reflect on what is really important in life. Browse by date, category and
128
+ users to see what others have been through. Visualize your life and those that are
129
+ connected to you in a single app.
130
+ email:
131
+ - "'sophieqgu@gmail.com'"
132
+ executables: []
133
+ extensions: []
134
+ extra_rdoc_files: []
135
+ files:
136
+ - ".gitignore"
137
+ - Gemfile
138
+ - Gemfile.lock
139
+ - LICENSE
140
+ - README.md
141
+ - Rakefile
142
+ - app/controllers/application_controller.rb
143
+ - app/controllers/story_controller.rb
144
+ - app/controllers/user_controller.rb
145
+ - app/models/.gitkeep
146
+ - app/models/category.rb
147
+ - app/models/concerns/slugifiable.rb
148
+ - app/models/story.rb
149
+ - app/models/user.rb
150
+ - app/models/user_story.rb
151
+ - app/views/layout.erb
152
+ - app/views/stories/edit.erb
153
+ - app/views/stories/new.erb
154
+ - app/views/stories/show.erb
155
+ - app/views/stories/show_by_category.erb
156
+ - app/views/stories/show_by_date.erb
157
+ - app/views/stories/show_by_users.erb
158
+ - app/views/users/signup.erb
159
+ - app/views/welcome.erb
160
+ - config.ru
161
+ - config/environment.rb
162
+ - db/development.sqlite
163
+ - db/migrate/20200118192302_create_users.rb
164
+ - db/migrate/20200118192313_create_categories.rb
165
+ - db/migrate/20200118192321_create_stories.rb
166
+ - db/migrate/20200118201120_create_user_stories.rb
167
+ - db/schema.rb
168
+ - db/seeds.rb
169
+ - development.sqlite
170
+ - lib/.gitkeep
171
+ - life-story.gemspec
172
+ - public/favicon.ico
173
+ - public/images/.gitkeep
174
+ - public/images/life-story.png
175
+ - public/javascripts/.gitkeep
176
+ - public/stylesheets/main.css
177
+ homepage: https://github.com/sophieqgu/life-story
178
+ licenses:
179
+ - MIT
180
+ metadata:
181
+ allowed_push_host: https://www.rubygems.org
182
+ homepage_uri: https://github.com/sophieqgu/life-story
183
+ source_code_uri: https://github.com/sophieqgu/life-story
184
+ changelog_uri: https://github.com/sophieqgu/life-story
185
+ post_install_message:
186
+ rdoc_options: []
187
+ require_paths:
188
+ - life-story
189
+ required_ruby_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ required_rubygems_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ requirements: []
200
+ rubygems_version: 3.0.3
201
+ signing_key:
202
+ specification_version: 4
203
+ summary: A Sinatra app recording your important memories.
204
+ test_files: []