Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

having an issue

  • Loading branch information...
commit 9301dc0b1d28108df8d3b5f82cfd1787fb555de8 2 parents 0868121 + 3b1a040
@jordanrossdunn jordanrossdunn authored
View
2  lib/model/base.rb
@@ -108,7 +108,7 @@ class Category
# def name=(n)
# @name = n
- # event.category_name = n
+ # event.category.name = n
# end
end
View
21 lib/model/data_generator.rb
@@ -344,16 +344,23 @@ def rand_events(max_events=25)
users.each do |user|
print "."
(1..(1 + rand(max_events))).each do |i|
- categories = ["work",
- "entertainment",
- "personal",
- "school",
- "outdoors",
- "etc"]
+ categories = ["outdoor",
+ "personal",
+ "music",
+ "tv",
+ "movies",
+ "entertainment",
+ "art",
+ "community",
+ "etc",
+ "school",
+ "sports",
+ "political",
+ "charity"]
rand_category = categories[rand(categories.size)]
title_seed = rand(titles.count)
description_seed = rand(descriptions.count)
- new_event = Event.create(title: titles[title_seed], body: descriptions[description_seed], user: user, img_url: "/images/banksy/thumb/#{(1 + rand(19))}.jpg")
+ new_event = Event.create(title: titles[title_seed], body: descriptions[description_seed], user: user, img_url: "/images/banksy/thumb/#{(1 + rand(19))}.jpg", start_date: DateTime.now, end_date: DateTime.now.next_day)
category = Category.create(event: new_event)
new_event.category.name = rand_category
new_event.save
View
21 lib/model/event.rb
@@ -9,9 +9,8 @@ class Event
property :location, String, default: ""
property :permission, String, default: "public"
property :event_date, DateTime, default: DateTime.now
- property :category_name, String, default: ""
- property :start_date, DateTime
- property :end_date, DateTime
+ property :start_date, DateTime, default: DateTime.now
+ property :end_date, DateTime, default: DateTime.now
property :updated_at, DateTime
property :created_at, DateTime, default: DateTime.now # A DateTime, for any date you might like.
property :body, Text # A text block, for longer string data.
@@ -60,7 +59,7 @@ def toggle_google_calendar_event(user_uuid)
else
result = client.execute(:api_method => service.events.insert,
:parameters => {'calendarId' => SessionController.user(user_uuid).email},
- :body => JSON.dump(generate_google_event_json("Test Location", self.body, self.title)),
+ :body => JSON.dump(generate_google_event_json),
:headers => {'Content-Type' => 'application/json'})
success = update google_calendar_id: result.data.id
return_msg = "synched"
@@ -69,16 +68,14 @@ def toggle_google_calendar_event(user_uuid)
return success ? return_msg : "failed"
end
- def generate_google_event_json(location, description, title)
- start_date = "2012-11-5"
- end_date = "2012-11-8"
+ def generate_google_event_json
{
- "start" => { "date" => start_date },
- "end" => { "date" => end_date },
- "location" => location,
+ "start" => { "date" => event.start_date.strftime("%Y-%m-%d") },
+ "end" => { "date" => event.end_date.strftime("%Y-%m-%d") },
+ "location" => self.location,
"transparency" => "transparent",
- "description" => body,
- "summary" => title,
+ "description" => self.body,
+ "summary" => self.title,
"status" => "confirmed"
}
end
View
2  lib/model/user.rb
@@ -21,6 +21,8 @@ class Link #from http://datamapper.org/docs/associations.html
property :img_url, String
property :email, String
property :password, String
+ property :display_name, String
+ property :location, String
property :salt, String
property :session_id, String
property :hashed_password, String
View
13 lib/public/css/site-styles.css
@@ -151,7 +151,7 @@ color:#FFF
}
.element img {
-width:110px;
+height:110px;
}
.element.large .symbol {
@@ -159,7 +159,8 @@ font-size:4.5em
}
.element.large img {
-width:350px;
+height:350px;
+min-width: 350px;
}
.element.large h1 {
@@ -378,6 +379,10 @@ margin-top:5px
margin-top:15px
}
+.mid_mb {
+margin-bottom:15px !important;
+}
+
.twitter-photo {
width:50px;
height:50px
@@ -414,7 +419,7 @@ padding-top:7px
.center_block {
margin: 0 auto;
- display:block;
+ display:block !important;
}
.center {
@@ -707,4 +712,4 @@ bottom:14px;
#start_time table {
background-color: red;
-}
+}
View
9 lib/routes/api/api.rb
@@ -77,7 +77,7 @@
response_str = ""
user.events.each do |event|
element = render_pane({title: event.title,
- classes: event.category_name,
+ classes: event.category.name,
id: event.id,
category: event.category.name,
tumbler: event.tumbler,
@@ -101,7 +101,7 @@
events = user.stream_events(100)
events.each do |event|
element = render_pane({title: event.title,
- classes: event.category_name,
+ classes: event.category.name,
id: event.id,
category: event.category.name,
tumbler: event.tumbler,
@@ -134,11 +134,12 @@
events = events[(range_vals[0].to_i..range_vals[1].to_i)]
events.each do |event|
element = render_pane({title: event.title,
- classes: event.category_name,
+ classes: event.category.name,
id: event.id,
category: event.category.name,
tumbler: event.tumbler,
- event_time: event.event_date,
+ start_date: event.start_date,
+ end_date: event.end_date,
img_url: event.img_url,
user_name: event.user.user_name,
event: event})
View
28 lib/routes/user/user.rb
@@ -37,10 +37,26 @@
## Events ####################################################
##############################################################
+def categories
+ ["outdoor",
+ "personal",
+ "music",
+ "tv",
+ "movies",
+ "entertainment",
+ "art",
+ "community",
+ "etc",
+ "school",
+ "sports",
+ "political",
+ "charity"]
+end
+
get '/user/:user_name/stream' do
@user = current_user
unless @user.nil?
- @categories = @user.account_setting.categories.split('&')
+ @categories = categories
@sidebar = user_sidebar(@user)
@breadcrumbs = bread_crumbs_partial request.path_info.split('/')
haml :'user/dashboard', locals: {categories: @categories}, layout: :'layout/user'
@@ -52,7 +68,7 @@
get '/user/:user_name/events' do
@user = current_user
unless @user.nil?
- @categories = @user.account_setting.categories.split('&')
+ @categories = categories
@sidebar = user_sidebar(@user)
@breadcrumbs = bread_crumbs_partial request.path_info.split('/')
haml :'user/events', locals: {categories: @categories}, layout: :'layout/user'
@@ -246,5 +262,11 @@
end
##############################################################
-
+post '/user/:username/account' do
+ @user = current_user
+ @user.display_name = params[:display_name]
+ @user.location = params[:location]
+ @user.save!
+ redirect '/'
+end
View
4 lib/views/event/event.haml
@@ -60,9 +60,9 @@
#event_map{:style => "width:400px;height:300px;"}
.row#follow-tray
-if current_user.following?(event.user) || current_user == event.user
- %p.btn.btn-primary.following-btn= "Following #{event.user.user_name}"
+ %p.btn.btn-primary.following-btn= "Following #{event.user.display_name ? event.user.display_name : event.user.user_name}"
-else
- %a.btn.btn-warning.follow-btn{id: "followed-user-#{event.user.user_name}-#{event.user.id}"}= "Follow #{event.user.user_name}"
+ %a.btn.btn-warning.follow-btn{id: "followed-user-#{event.user.user_name}-#{event.user.id}"}= "Follow #{event.user.display_name ? event.user.display_name : event.user.user_name}"
.row
%h4= "comments"
%hr
View
4 lib/views/looking_glass/tile.haml
@@ -22,8 +22,8 @@
.row
%h1.window-pane= map[:title]
.row
- -#%h3.name= map[:category]
- %p.event-date= map[:start_date].strftime("%m/%d/%Y")
+ %h3.name= map[:category]
+ %p.event-date= map[:event].start_date.strftime("%m/%d/%Y")
-#%p.user_name= map[:user_name]
-#.row
-#%p.comment-count= "#{map[:tumbler].comments.count}"
View
22 lib/views/user/account.haml
@@ -6,16 +6,22 @@
// %p= 'email: ' << user.email.to_s
.content.span9
- %h2.center= user.user_name.to_s
- %img.center_block{:src => gravatar_for(user,200)}
- %form.form-horizontal
+ -#%h2.center= user.user_name.to_s
+ %img.center_block.mid_mb{:src => gravatar_for(user,200)}
+ %form.form-horizontal{:action => "", :method => "post"}
.control-group
- %label.control-label{:for => "inputEmail"}
+ %label.control-label{:for => "inputEmail"}
Email:
.controls
- %input#inputEmail{:value => "#{user.email.to_s}", :placeholder => "Email", :type => "email"}
+ %input#inputEmail{:name => "email", :value => "#{user.email}", :type => "text"}
.control-group
- %label.control-label{:for => "inputUrl"}
- Image URL:
+ %label.control-label{:for => "inputDisplayName"}
+ Display Name
.controls
- %input#inputUrl{:value => "#{user.img_url.to_s}", :placeholder => "Image URL", :type => "url"}
+ %input#inputDisplayName{:name => "display_name", :placeholder => "#{user.display_name ? user.display_name : 'Display Name'}", :type => "text"}
+ .control-group
+ %label.control-label{:for => "location"}
+ Location
+ .controls
+ %input#location{:name => "location", :placeholder => "Location", :type => "text"}
+ %input.center_block{:type => "submit", :class => "btn", :name => "Update"}/
Please sign in to comment.
Something went wrong with that request. Please try again.