Merge branch 'master' into moderation
This commit is contained in:
commit
92af469aa4
|
@ -0,0 +1 @@
|
|||
($ document).ready -> ($ '[data-toggle="tooltip"]').tooltip()
|
|
@ -65,4 +65,8 @@
|
|||
border-bottom: 2px solid $brand-danger;
|
||||
background-color: #fff;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.profile--follow-btn {
|
||||
margin-top: 5px;
|
||||
}
|
|
@ -33,6 +33,15 @@ class User < ActiveRecord::Base
|
|||
|
||||
# validates :website, format: { with: WEBSITE_REGEX }
|
||||
|
||||
before_save do
|
||||
self.display_name = 'WRYYYYYYYY' if display_name == 'Dio Brando'
|
||||
self.website = if website.match %r{\Ahttps?://}
|
||||
website
|
||||
else
|
||||
"http://#{website}"
|
||||
end unless website.blank?
|
||||
end
|
||||
|
||||
def login=(login)
|
||||
@login = login
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
= user_screen_name notification.target.user
|
||||
%p.notification--text
|
||||
answered
|
||||
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.id)}
|
||||
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.id), title: "#{notification.target.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
|
||||
your question
|
||||
= time_ago_in_words notification.target.created_at
|
||||
ago
|
||||
|
@ -40,7 +40,7 @@
|
|||
= user_screen_name notification.target.user
|
||||
%p.notification--text
|
||||
smiled at
|
||||
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)}
|
||||
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), title: "#{notification.target.answer.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
|
||||
your answer
|
||||
= time_ago_in_words notification.target.created_at
|
||||
ago
|
||||
|
@ -54,7 +54,7 @@
|
|||
= user_screen_name notification.target.user
|
||||
%p.notification--text
|
||||
commented on
|
||||
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)}
|
||||
%a{href: show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), title: "#{notification.target.answer.content[0..40]}...", data: { toggle: :tooltip, placement: :top }}
|
||||
your answer
|
||||
= time_ago_in_words notification.target.created_at
|
||||
ago
|
||||
|
|
|
@ -49,6 +49,6 @@
|
|||
.row
|
||||
.col-md-6.col-md-offset-6.col-sm-8.col-sm-offset-4.col-xs-6.col-xs-offset-6.text-right
|
||||
= render 'shared/answerbox_buttons', a: a
|
||||
.panel-footer{id: "ab-comments-section-#{a.id}", style: 'display: none'}
|
||||
.panel-footer{id: "ab-comments-section-#{a.id}", style: @display_all.nil? ? 'display: none' : nil }
|
||||
%div{id: "ab-smiles-#{a.id}"}= render 'shared/smiles', a: a
|
||||
%div{id: "ab-comments-#{a.id}"}= render 'shared/comments', a: a
|
||||
%div{id: "ab-comments-#{a.id}"}= render 'shared/comments', a: a
|
|
@ -12,9 +12,10 @@
|
|||
%button.btn.btn-info.btn-sm{type: :button, name: 'ab-smile', data: { a_id: a.id, action: :smile }}
|
||||
%i.fa.fa-smile-o
|
||||
%span{id: "ab-smile-count-#{a.id}"}= a.smile_count
|
||||
%button.btn.btn-primary.btn-sm{type: :button, name: 'ab-comments', data: { a_id: a.id, state: :hidden }}
|
||||
%i.fa.fa-comments
|
||||
%span{id: "ab-comment-count-#{a.id}"}= a.comment_count
|
||||
- unless @display_all
|
||||
%button.btn.btn-primary.btn-sm{type: :button, name: 'ab-comments', data: { a_id: a.id, state: :hidden }}
|
||||
%i.fa.fa-comments
|
||||
%span{id: "ab-comment-count-#{a.id}"}= a.comment_count
|
||||
- if privileged? a.user
|
||||
%button.btn.btn-danger.btn-sm{name: 'ab-destroy', data: { a_id: a.id }}
|
||||
%i.fa.fa-trash-o
|
|
@ -1,11 +1,11 @@
|
|||
- if user_signed_in?
|
||||
- type ||= :nil
|
||||
- if user == current_user
|
||||
%a.btn.btn-default.btn-block{href: edit_user_profile_path} Edit profile
|
||||
%a.btn.btn-default.btn-block.profile--follow-btn{href: edit_user_profile_path} Edit profile
|
||||
- else
|
||||
- if current_user.following? user
|
||||
%button#editprofile.btn.btn-default.btn-block{type: :button, name: 'user-action', data: { action: :unfollow, type: type, target: user.screen_name }}
|
||||
%button#editprofile.btn.btn-default.btn-block.profile--follow-btn{type: :button, name: 'user-action', data: { action: :unfollow, type: type, target: user.screen_name }}
|
||||
Unfollow
|
||||
- else
|
||||
%button#editprofile.btn.btn-primary.btn-block{type: :button, name: 'user-action', data: { action: :follow, type: type, target: user.screen_name }}
|
||||
%button#editprofile.btn.btn-primary.btn-block.profile--follow-btn{type: :button, name: 'user-action', data: { action: :follow, type: type, target: user.screen_name }}
|
||||
Follow
|
|
@ -1,9 +1,9 @@
|
|||
.profile--header
|
||||
.container.j2-page
|
||||
.col-md-3.col-xs-12.col-sm-3
|
||||
.col-md-4.col-xs-12.col-sm-4
|
||||
= render 'user/profile_info'
|
||||
.hidden-xs= render 'shared/links'
|
||||
.col-md-9.col-xs-12.col-sm-9
|
||||
.col-md-8.col-xs-12.col-sm-8
|
||||
%h1.j2-lh.hidden-xs= @title
|
||||
%h1.visible-xs= @title
|
||||
#questions
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
.profile--header
|
||||
.container.j2-page
|
||||
.col-md-3.col-xs-12.col-sm-3
|
||||
.col-md-4.col-xs-12.col-sm-4
|
||||
= render 'user/profile_info'
|
||||
.hidden-xs= render 'shared/links'
|
||||
.col-md-9.col-xs-12.col-sm-9
|
||||
.col-md-8.col-xs-12.col-sm-8
|
||||
= render 'shared/questionbox'
|
||||
#answers
|
||||
- @answers.each do |a|
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
.profile--header
|
||||
.container.j2-page
|
||||
.col-md-3.col-xs-12.col-sm-3
|
||||
.col-md-4.col-xs-12.col-sm-4
|
||||
= render 'user/profile_info'
|
||||
.hidden-xs= render 'shared/links'
|
||||
.col-md-9.col-xs-12.col-sm-9
|
||||
.col-md-8.col-xs-12.col-sm-8
|
||||
%h1.j2-lh.hidden-xs= @title
|
||||
%h1.visible-xs= @title
|
||||
#users
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
include Warden::Test::Helpers
|
||||
Warden.test_mode!
|
||||
|
||||
feature "User profile page", :devise do
|
||||
|
||||
after :each do
|
||||
Warden.test_reset!
|
||||
end
|
||||
|
||||
scenario "user gets followed", js: true do
|
||||
me = FactoryGirl.create(:user)
|
||||
other = FactoryGirl.create(:user)
|
||||
|
||||
login_as me, scope: :user
|
||||
visit show_user_profile_path(other.screen_name)
|
||||
page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_1.png"), full: true
|
||||
|
||||
click_button "Follow"
|
||||
wait_for_ajax
|
||||
page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_2.png"), full: true
|
||||
|
||||
expect(page).to have_text("FOLLOWING")
|
||||
|
||||
click_link 'Followers'
|
||||
page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_3.png"), full: true
|
||||
expect(page).to have_text(me.screen_name)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue