This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def empty_trash | |
| @trashed_conversations = current_user.mailbox.trash | |
| @trashed_conversations.each do |convo| | |
| convo.destroy | |
| end | |
| redirect_to :back, notice: "Your conversations have been deleted." | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.chatrooms = App.cable.subscriptions.create "ChatroomsChannel", | |
| connected: -> | |
| # Called when the subscription is ready for use on the server | |
| disconnected: -> | |
| # Called when the subscription has been terminated by the server | |
| received: (data) -> | |
| active_chatroom = $("[data-behavior='messages'][data-chatroom-id='#{data.chatroom_id}']") | |
| if active_chatroom.length > 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).on "turbolinks:load", -> | |
| $('#new_message').on "keypress", (e)-> | |
| if e && e.keyCode == 13 | |
| e.preventDefault() | |
| $(this).submit() | |
| $("#new_message").on "submit", (e) -> | |
| e.preventDefault() | |
| chatroom_id = $("[data-behavior='messages']").data("chatroom-id") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.pick-a-date').datepicker({ | |
| dateFormat: "mm/dd/yy", | |
| }); | |
| $('#event_start_date_time').timepicker(); | |
| $('#event_end_date_time').timepicker(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $( "#datepicker" ).datepicker({ | |
| onSelect: function(date) { | |
| var data = {'event[user_id]': '<%= user.id %>', 'event[start_date]': date}; | |
| $.ajax({ | |
| data: data, | |
| type: 'get', | |
| url: '/events/get-day', | |
| success: function(data){ | |
| // Parse data to see if it returns an event object or if it's empty. | |
| var parsed_data = $.parseHTML(data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController | |
| def facebook | |
| @user = User.from_omniauth(request.env["omniauth.auth"]) | |
| if @user.persisted? | |
| sign_in_and_redirect @user, notice: "You have successfully connected Facebook." | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function closeIFrame() { | |
| $('#chat-window-iframe').hide(); | |
| }; | |
| $(document).on('click', '.close-chat', function(e) { | |
| parent.closeIFrame(); | |
| e.preventDefault(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > var past_date = moment("02/08/2017", "MM/DD/YYYY"); | |
| > undefined | |
| > var todays_date = moment(); | |
| > undefined | |
| > past_date | |
| > q {_isAMomentObject: true, _i: "02/08/2017", _f: "MM/DD/YYYY", _isUTC: false, _pf: Object…} | |
| > todays_date | |
| > q {_isAMomentObject: true, _isUTC: false, _pf: Object, _locale: B, _d: Wed Feb 15 2017 15:54:00 GMT-0800 (PST)} | |
| > past_date < todays_date | |
| > true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function go_events(){ | |
| var data = {'event[user_id]': '<%= @user.id %>'}; | |
| $.ajax({ | |
| data: data, | |
| type: 'post', | |
| url: '/events/get', | |
| success: function(data){ | |
| console.log('GO EVENTS DATA', data); | |
| var eventDates = {}; | |
| $.each( data, function(i, itemx) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ArgumentError in EventsController#save_event | |
| invalid date | |
| Extracted source (around line #8): | |
| @event = Event.new(event_params) | |
| @event.start_date = params[:event][:start_date_date].to_datetime | |
| @event.end_date = params[:event][:end_date_date].to_datetime | |
| if params['redirect_to'] | |
| redirect = params['redirect_to'] |