Skip to content
Browse files

Merge branch 'master' of https://github.com/SE-Team/project-x

  • Loading branch information...
2 parents 5057458 + ddddeb8 commit d430819c44f0541f4d342c23a1a68cb19ce32ac1 @jordanrossdunn jordanrossdunn committed Dec 12, 2012
View
58 lib/controllers/session/session_controller.rb
@@ -81,18 +81,6 @@ def self.token_pair(uuid)
end
end
- def self.calendar(uuid)
- calendar = nil
- if @@users_session_data[uuid][:calendar]
- calendar = @@users_session_data[uuid][:calendar]
- else
- client = get_client(uuid)
- calendar = client.discovered_api('calendar', 'v3')
- @@users_session_data[uuid][:calendar] = calendar
- end
- return calendar
- end
-
def self.plus(uuid)
plus = nil
if @@users_session_data[uuid][:plus]
@@ -117,32 +105,27 @@ def self.drive(uuid)
return drive
end
- private
-
- def self.get_or_create_user_hash(uuid)
- if @@users_session_data[uuid]
- return @@users_session_data[uuid]
- else
- @@users_session_data[uuid] = {}
- return @@users_session_data[uuid]
- end
+ def self.calendar(uuid)
+ calendar = nil
+ if @@users_session_data[uuid][:calendar]
+ calendar = @@users_session_data[uuid][:calendar]
+ else
+ client = get_client(uuid)
+ calendar = client.discovered_api('calendar', 'v3')
+ @@users_session_data[uuid][:calendar] = calendar
+ end
+ return calendar
end
+ private
+
def self.api_config
@settings ||= (begin
settings = YAML::load(File.open('lib/config/config.yml'))
settings
end)
end
- def self.get_in(hash, keys)
- cur_hash = hash
- keys.each do |kw|
- cur_hash = cur_hash[kw]
- end
- cur_hash
- end
-
def self.create_client(uuid, code="")
config_info = api_config
client = Google::APIClient.new
@@ -153,4 +136,21 @@ def self.create_client(uuid, code="")
client.authorization.code = code
return client
end
+
+ def self.get_or_create_user_hash(uuid)
+ if @@users_session_data[uuid]
+ return @@users_session_data[uuid]
+ else
+ @@users_session_data[uuid] = {}
+ return @@users_session_data[uuid]
+ end
+ end
+
+ def self.get_in(hash, keys)
+ cur_hash = hash
+ keys.each do |kw|
+ cur_hash = cur_hash[kw]
+ end
+ cur_hash
+ end
end
View
1 lib/controllers/user/sidebar.rb
@@ -2,6 +2,7 @@ module UserSidebarController
def user_sidebar_items(user)
[{href: "/user/#{user.user_name}/create-event", icon: "icon-flag", title: "Create Event"},
:divider,
+ {href: "/user/#{user.user_name}/stream", icon: "icon-home", title: "My Stream", badge: {value: "#{user.events.all.count}"}},
{href: "/user/#{user.user_name}/events", icon: "icon-home", title: "My Events", badge: {value: "#{user.events.all.count}"}},
{href: "/user/#{user.user_name}/messages", icon: "icon-envelope", title: "Messages", badge: {value: "#{user.r_messages.all(new_message: true).count}"}},
:divider,
View
1 lib/views/index.haml
@@ -26,6 +26,7 @@
.item
%img{:alt => "", :src => "images/index/login_665x440.png"}
.carousel-caption
+
%h4 Login with your Google account
%p Too many accounts and passwords? No problem! Just use our comfortable option of using your Google account to login. Ready to go!
%a.left.carousel-control{"data-slide" => "prev", :href => "#myCarousel"} ‹
View
9 lib/views/navbar.haml
@@ -13,7 +13,13 @@
%img.profile_pic.pull-left{:src => gravatar_for(current_user,30)}
%li.dropdown
%a{"data-toggle" => "dropdown", :href => "#"}
- Me
+ - if current_user.display_name.nil?
+ %span= "Me"
+ - else
+ - if current_user.display_name.length > 0
+ %span= current_user.display_name
+ - else
+ %span= "Me"
%i.icon-chevron-down
%ul.dropdown-menu
%li
@@ -58,6 +64,7 @@
%li
%a{:href => "/login"}
Login
+
:javascript
$('#search-input').keypress(function(e) {
if(e.which == 13) {
View
40 lib/views/user/dashboard.haml
@@ -51,7 +51,6 @@
url: "/api/sync/toggle_event",
data: {event_id: event_id}
}).done(function(response){
- console.log(response);
var div_id_name = '#google-btn-' + event_id;
if (response == "synched") {
$(div_id_name).addClass("synched-btn-decoration");
@@ -73,41 +72,4 @@
}
});
});
- });
-
- // $(function() {
- // var loop = true;
- // var $container = $('#isotope-container');
- // function doStuff() {
- // if (loop) {
- // var now = Date();
- // $.ajax({
- // type: "POST",
- // url: "/api/user/stream/update",
- // data: {user_id: "#{@user.id}",
- // user_salt: "#{@user.salt}",
- // time: now,
- // range: "0 10"}
- // }).done(function (response) {
- // if (response.length > 0) {
- // var html = $('<div>').html(response);
- // // add the new elements to the isotope container
- // $container.prepend(html).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' });
- // // add the click handlers for the new elements
- // $('.element').click(function(e) {
- // if ($(e.target).hasClass('event-load-btn')) {
- // } else {
- // $(this).toggleClass('large');
- // $container.isotope('reLayout');
- // }
- // });
- // }
- // if ($.browser.mozilla) {
- // $('.element > img').addClass("moz-tile-img");
- // }
- // });
- // setTimeout(doStuff, 10000);
- // }
- // };
- // doStuff();
- // });
+ });

0 comments on commit d430819

Please sign in to comment.
Something went wrong with that request. Please try again.