Merge branch 'master' into moderation

This commit is contained in:
Andreas N 2014-12-27 02:12:32 +01:00
commit 92af469aa4
11 changed files with 60 additions and 17 deletions

View File

@ -0,0 +1 @@
($ document).ready -> ($ '[data-toggle="tooltip"]').tooltip()

View File

@ -66,3 +66,7 @@
background-color: #fff; background-color: #fff;
text-transform: uppercase; text-transform: uppercase;
} }
.profile--follow-btn {
margin-top: 5px;
}

View File

@ -33,6 +33,15 @@ class User < ActiveRecord::Base
# validates :website, format: { with: WEBSITE_REGEX } # 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) def login=(login)
@login = login @login = login
end end

View File

@ -14,7 +14,7 @@
= user_screen_name notification.target.user = user_screen_name notification.target.user
%p.notification--text %p.notification--text
answered 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 your question
= time_ago_in_words notification.target.created_at = time_ago_in_words notification.target.created_at
ago ago
@ -40,7 +40,7 @@
= user_screen_name notification.target.user = user_screen_name notification.target.user
%p.notification--text %p.notification--text
smiled at 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 your answer
= time_ago_in_words notification.target.created_at = time_ago_in_words notification.target.created_at
ago ago
@ -54,7 +54,7 @@
= user_screen_name notification.target.user = user_screen_name notification.target.user
%p.notification--text %p.notification--text
commented on 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 your answer
= time_ago_in_words notification.target.created_at = time_ago_in_words notification.target.created_at
ago ago

View File

@ -49,6 +49,6 @@
.row .row
.col-md-6.col-md-offset-6.col-sm-8.col-sm-offset-4.col-xs-6.col-xs-offset-6.text-right .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 = 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-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

View File

@ -12,7 +12,8 @@
%button.btn.btn-info.btn-sm{type: :button, name: 'ab-smile', data: { a_id: a.id, action: :smile }} %button.btn.btn-info.btn-sm{type: :button, name: 'ab-smile', data: { a_id: a.id, action: :smile }}
%i.fa.fa-smile-o %i.fa.fa-smile-o
%span{id: "ab-smile-count-#{a.id}"}= a.smile_count %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 }} - 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 %i.fa.fa-comments
%span{id: "ab-comment-count-#{a.id}"}= a.comment_count %span{id: "ab-comment-count-#{a.id}"}= a.comment_count
- if privileged? a.user - if privileged? a.user

View File

@ -1,11 +1,11 @@
- if user_signed_in? - if user_signed_in?
- type ||= :nil - type ||= :nil
- if user == current_user - 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 - else
- if current_user.following? user - 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 Unfollow
- else - 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 Follow

View File

@ -1,9 +1,9 @@
.profile--header .profile--header
.container.j2-page .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' = render 'user/profile_info'
.hidden-xs= render 'shared/links' .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.j2-lh.hidden-xs= @title
%h1.visible-xs= @title %h1.visible-xs= @title
#questions #questions

View File

@ -1,9 +1,9 @@
.profile--header .profile--header
.container.j2-page .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' = render 'user/profile_info'
.hidden-xs= render 'shared/links' .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' = render 'shared/questionbox'
#answers #answers
- @answers.each do |a| - @answers.each do |a|

View File

@ -1,9 +1,9 @@
.profile--header .profile--header
.container.j2-page .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' = render 'user/profile_info'
.hidden-xs= render 'shared/links' .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.j2-lh.hidden-xs= @title
%h1.visible-xs= @title %h1.visible-xs= @title
#users #users

View File

@ -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