This file contains 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
<% private_conversations_windows.each do |conversation| %> | |
<%= render partial: "private/conversations/conversation", | |
locals: { conversation: conversation, | |
user: current_user } %> | |
<% end %> |
This file contains 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
<%= bootstrap_form_for(@post) do |f| %> | |
<%= f.text_field :title, | |
maxlength: 100, | |
placeholder: 'Title', | |
class: 'form-control', | |
required: true, | |
minlength: 5, | |
maxlength: 100 %> | |
<%= f.hidden_field :branch, :value => @branch %> | |
<%= f.text_area :content, |
This file contains 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
FactoryGirl.define do | |
factory :user do | |
sequence(:name) { |n| "test#{n}" } | |
sequence(:email) { |n| "test#{n}@test.com" } | |
password '123456' | |
password_confirmation '123456' | |
end | |
end |
This file contains 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
require 'rails_helper' | |
RSpec.describe Post, type: :model do | |
context 'Associations' do | |
it 'belongs_to user' do | |
association = described_class.reflect_on_association(:user).macro | |
expect(association).to eq :belongs_to | |
end | |
it 'belongs_to category' do |
This file contains 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
... | |
if user_signed_in? | |
@message_has_been_sent = conversation_exist? | |
end | |
... |
This file contains 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
context '#update_pagination_partial_path' do | |
it "returns an update_pagination partial's path" do | |
posts = double('posts', :next_page => 2) | |
assign(:posts, posts) | |
expect(helper.update_pagination_partial_path).to( | |
eq 'posts/posts_pagination_page/update_pagination' | |
) | |
end | |
it "returns a remove_pagination partial's path" do |
This file contains 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', function() { | |
// when a contact request is accepted, mark it as accepted | |
$('body').on('click', '.accept-request a', function() { | |
var sender_user_name = $('nav #user-name').html(); | |
var receiver_user_name = $(this) | |
.parents('[data-user-name]') | |
.attr('data-user-name'); | |
var requests_menu_item = $('#contacts-requests ul'); | |
requests_menu_item = requests_menu_item |
This file contains 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 ContactsController < ApplicationController | |
def create | |
@contact = current_user.contacts.create(contact_id: params[:contact_id]) | |
respond_ok | |
end | |
def update | |
@contact = Contact.find_by_users(params[:id], current_user.id) | |
@contact.update(accepted: true) |
This file contains 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
<div class="contact-request-status" | |
data-user-name="<%= @recipient.name %>"> | |
<div class="contact-name"> | |
<%= @recipient.name %> sent you a contact request | |
</div> | |
<div class="request-response"> | |
<span class="accept-request"> | |
<%= link_to "Accept", | |
contact_path(id: @recipient.id), | |
remote: true, |
NewerOlder