Skip to content

sphinx search return 100 ids #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
c91b214
sphinx search return 100 ids
Blaze34 Apr 9, 2014
cb69239
fix error for nil type
Blaze34 Apr 9, 2014
dcdb91f
dry navigation
Blaze34 Apr 9, 2014
196d9eb
edit fun
Blaze34 Apr 10, 2014
f9ccb41
fix in_sandbox& method
Blaze34 Apr 10, 2014
6b5f8eb
refactoring destroy rule
Blaze34 Apr 10, 2014
96eb2a7
fun edit/delete buttons
Blaze34 Apr 10, 2014
ac4c0d5
refresh cloud tags
Blaze34 Apr 11, 2014
0b7d9a3
fix fun destroy rule
Blaze34 Apr 11, 2014
ef20687
notification model
Blaze34 Apr 14, 2014
ce7d009
create notification on fun create
Blaze34 Apr 14, 2014
8119f04
fix fancybox popup bug
Blaze34 Apr 14, 2014
391aa54
extend vote model
Blaze34 Apr 14, 2014
4cc34f1
add field to notification
Blaze34 Apr 14, 2014
67b7cff
change autoload from lib
Blaze34 Apr 14, 2014
bfbd7eb
notification list
Blaze34 Apr 15, 2014
89811a3
show only my notifications
Blaze34 Apr 15, 2014
197e580
photo frame customization
Blaze34 Apr 15, 2014
204d1b3
comments without design
Blaze34 Apr 16, 2014
1c86d3c
answer to comment
Blaze34 Apr 16, 2014
c4bbc03
comment rights
Blaze34 Apr 16, 2014
f3fc8a6
cache commentable comments count
Blaze34 Apr 16, 2014
a0c56e2
remove vk comments
Blaze34 Apr 16, 2014
ee2c933
comments design
Blaze34 Apr 17, 2014
8b1101b
fix scss style
Blaze34 Apr 17, 2014
b0893d4
user cannot destroy own comment
Blaze34 Apr 17, 2014
ee734a8
comment remove btn
Blaze34 Apr 17, 2014
e4f6afd
comments design (end)
Blaze34 Apr 17, 2014
1d7d405
comments for not signed user
Blaze34 Apr 17, 2014
e47d78d
like box for reposted fun
Blaze34 Apr 17, 2014
4da0b96
fix comment unvote
Blaze34 Apr 17, 2014
df90cec
comments scroll to showed form
Blaze34 Apr 17, 2014
e4b23a3
comment depth
Blaze34 Apr 18, 2014
85ad35e
time ago script
Blaze34 Apr 18, 2014
012fc5e
time ago helper
Blaze34 Apr 18, 2014
496bfc7
time ago auto initialize
Blaze34 Apr 18, 2014
bf40cea
time ago in comments
Blaze34 Apr 18, 2014
def4620
time ago on show fun page
Blaze34 Apr 18, 2014
938364a
replace time_ago_in_words by js
Blaze34 Apr 18, 2014
c38d1eb
remove notification on fun create
Blaze34 Apr 22, 2014
e4215c1
notification on comment create
Blaze34 Apr 22, 2014
0e8a09d
gem meta_request only for development
Blaze34 Apr 22, 2014
f607b33
update gem meta_request and dependencies
Blaze34 Apr 22, 2014
98a123e
change user votes cache
Blaze34 Apr 22, 2014
58ce28c
get cached user votes for comments
Blaze34 Apr 22, 2014
f84e212
count liked funs on user page
Blaze34 Apr 22, 2014
114ed3d
user can vote at comments
Blaze34 Apr 22, 2014
f67957e
notification belongs to fun
Blaze34 Apr 22, 2014
fc0ee0e
save notifications with fun
Blaze34 Apr 22, 2014
d5a81c6
remove unneeded arrow
Blaze34 Apr 22, 2014
79e439e
set comment parent before create
Blaze34 Apr 22, 2014
a2b3e7d
duplicate notification if comment have a parent
Blaze34 Apr 22, 2014
f461a3e
fix show user url
Blaze34 Apr 22, 2014
24eb84f
notification group
Blaze34 Apr 24, 2014
d0be9b4
notification list
Blaze34 Apr 24, 2014
b052c65
notification list
Blaze34 Apr 25, 2014
bee2df8
notification list (small photos)
Blaze34 Apr 25, 2014
16fd0f8
notification list (fix)
Blaze34 Apr 25, 2014
dc7722c
fix condition in fun_image_path
Blaze34 Apr 28, 2014
ea5d61b
notification fun preview
Blaze34 Apr 28, 2014
654baa5
notification endless
Blaze34 Apr 28, 2014
33a59a3
notification link in dropdown
Blaze34 Apr 28, 2014
4266710
notification index title i18n
Blaze34 Apr 28, 2014
6270255
fix scripts
Blaze34 Apr 28, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ gem 'thin'
# Show error in better format
gem 'better_errors'
gem 'binding_of_caller'
gem 'meta_request'

# use this gem only for testing VK widgets
gem 'localtunnel'
Expand Down Expand Up @@ -91,6 +90,10 @@ gem 'bourbon'

gem 'sass-rails', '~> 3.2.3'

group :development do
gem 'meta_request'
end

group :assets do
# Toolkit from Twitter designed to kickstart development of webapps and sites
# gem "bootstrap-sass"
Expand All @@ -112,6 +115,10 @@ gem 'jquery-fileupload-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'

gem 'acts_as_commentable_with_threading'

gem 'momentjs-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

Expand Down
24 changes: 17 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ GEM
multi_json (~> 1.0)
acts-as-taggable-on (2.4.1)
rails (>= 3, < 5)
acts_as_commentable_with_threading (1.2.0)
activerecord (>= 3.0)
activesupport (>= 3.0)
awesome_nested_set (>= 2.0)
acts_as_votable (0.5.0)
rails (>= 3.0.0)
arel (3.0.2)
awesome_nested_set (2.1.6)
activerecord (>= 3.0.0)
bcrypt-ruby (3.0.1)
better_errors (0.9.0)
coderay (>= 1.0.0)
Expand Down Expand Up @@ -92,7 +98,7 @@ GEM
chardet (>= 0.9.0)
hoe (>= 1.2.0)
httpauth (0.2.0)
i18n (0.6.4)
i18n (0.6.9)
innertube (1.1.0)
joiner (0.2.0)
activerecord (>= 3.1.0, < 4.1.0)
Expand All @@ -106,7 +112,7 @@ GEM
jquery-ui-rails (4.0.3)
jquery-rails
railties (>= 3.1.0)
json (1.8.0)
json (1.8.1)
jwt (0.1.8)
multi_json (>= 1.5)
kaminari (0.14.1)
Expand All @@ -131,13 +137,15 @@ GEM
thin (~> 1.5.0)
meta-tags (1.5.0)
actionpack
meta_request (0.2.7)
meta_request (0.3.0)
callsite
rack-contrib
railties
middleware (0.1.0)
mime-types (1.23)
multi_json (1.7.7)
momentjs-rails (2.5.1)
railties (>= 3.1)
multi_json (1.9.2)
multipart-post (1.2.0)
mysql2 (0.3.15)
net-ssh (2.6.7)
Expand Down Expand Up @@ -179,7 +187,7 @@ GEM
rack (>= 0.9.1)
rack-protection (1.5.0)
rack
rack-ssl (1.3.3)
rack-ssl (1.3.4)
rack
rack-test (0.6.2)
rack (>= 1.0)
Expand All @@ -198,7 +206,7 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.1.0)
rake (10.3.1)
rdoc (3.12.2)
json (~> 1.4)
riddle (1.5.10)
Expand Down Expand Up @@ -242,7 +250,7 @@ GEM
joiner (>= 0.2.0)
middleware (>= 0.1.0)
riddle (>= 1.5.10)
thor (0.18.1)
thor (0.19.1)
tilt (1.4.1)
treetop (1.4.14)
polyglot
Expand All @@ -261,6 +269,7 @@ PLATFORMS

DEPENDENCIES
acts-as-taggable-on
acts_as_commentable_with_threading
acts_as_votable (~> 0.5.0)
better_errors
binding_of_caller
Expand All @@ -283,6 +292,7 @@ DEPENDENCIES
mailcatcher
meta-tags
meta_request
momentjs-rails
mysql2 (>= 0.3.13)
omniauth
omniauth-facebook
Expand Down
Binary file removed app/assets/images/btn-fun-delete.png
Binary file not shown.
Binary file added app/assets/images/btn-fun-icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 40 additions & 3 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
//= require source/bootstrap-tab
//= require rails.validations
//= require hogan.js
//= require moment
//= require moment/ru
//= require_tree .

$(function(){
Expand Down Expand Up @@ -116,13 +118,23 @@ $(function(){
$.fancybox.close()
});

var showAuthRequire = function(){
show_notice('<a href="/users/sign_in" class="sign_pop_up">Авторизируйтесь</a> или <a href="/users/sign_up" class="sign_pop_up">зарегистрируйтесь</a>, чтобы можно было выполнять это действие.', 'error');
};

$(document).on('click', 'a[data-auth]', function(e){
e.preventDefault();
show_notice('<a href="/users/sign_in" class="sign_pop_up">Авторизируйтесь</a> или <a href="/users/sign_up" class="sign_pop_up">зарегистрируйтесь</a>, чтобы можно было выполнять это действие.', 'error');
showAuthRequire();
});



$.rails.allowAction = function(element){
if ( ! element.attr('data-confirm')) return true
if ( element.data('auth')){
showAuthRequire();
return false;
}
if ( ! element.attr('data-confirm')) return true;

show_notice(element.data('confirm'), 'confirm', {
buttons: [
Expand All @@ -140,8 +152,33 @@ $(function(){
]
});
return false
}
};

// Initialize fancybox for add box

$('.fancybox_ajax').not('[data-auth]').fancybox({
type: 'ajax',
padding : 0,
helpers: {
overlay: {
locked: false
}
}
});

$.fn.findAndFormatDateTime = function(){
$(this).find('.date-time-format').datetimeformat({
onComplete: function(element, object){
element.tooltipster({
theme: 'tooltips_theme',
offsetY: -5,
content: object.moment.format('YYYY-MM-DD HH:mm')
});
}
});
};

$(document).findAndFormatDateTime();
});

function show_notice(text, type, options) {
Expand Down
93 changes: 93 additions & 0 deletions app/assets/javascripts/comments.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/


jQuery ->
$list = $ '.comment-list'

scrollToElement = ($target) ->
$window = $(window)
wb = $window.scrollTop() + $window.height()
tb = $target.offset().top + $target.outerHeight()

if tb + 10 > wb

$('html, body').animate(
scrollTop: tb - $window.height() + 10
500
);

changeTotal = (diff) ->
$list.find('.total_comments').each ->
$this = $(this)
$this.text(Math.max(0, parseInt($this.text()) + diff))

checkVotingScore = ($voting) ->
if parseInt($voting.find('.vote_result').text()) < 0
$voting.addClass 'red'
else
$voting.removeClass 'red'

$list.find('.voting').each ->
checkVotingScore $(this)

$form = $list.find('.form_wrapper')
.on 'ajax:beforeSend', ->
return false unless $.trim($(this).find('textarea').val()).length
.on 'ajax:beforeSend', ->
$(this).find('textarea').attr('disabled', 'disabled')
.on 'ajax:success', (e, response) ->
$(this).find('textarea').val('')
$(response).hide().insertBefore($form).show('slow').findAndFormatDateTime();
changeTotal 1
.on 'ajax:complete', ->
$(this).find('textarea').removeAttr('disabled');

$list
.on 'ajax:beforeSend', '.btn-close-sm', ->
$(this).closest('.comment').fadeTo 'fast', 0.5
.on 'ajax:success', '.btn-close-sm', ->
$(this).closest('.comment').hide 'fast', ->
changeTotal -1 - $(this).find('.comment').length
$(this).remove()
.on 'ajax:error', '.btn-close-sm', ->
$(this).closest('.comment').fadeTo 'fast', 1

.on 'click', '.comment_for', (e) ->
e.preventDefault()
$this = $(this)
return true unless $form.length
$this.addClass('hidden')

$into = $this.siblings('.info_list').last()
$into = $this.closest('.info_list') unless $into.length

return true unless $into.length

$form.addClass('hidden').find('input[name*=parent_id]').val($this.data('id') || '')
$into.append $form
$list.find('.comment_for.hidden').not($this).removeClass('hidden')

$form.removeClass 'hidden'
scrollToElement $form

.on 'ajax:before', '.voting', ->
$this = $(this)
return false if $this.data('sending')
$this.data('sending', true)

.on 'ajax:success', '.voting', (e, response) ->
$this = $(this)
$this.find('.vote_result').text(parseInt(response.score) || 0)
$this.find('.btn-action').removeClass('orange').data('method', false)

checkVotingScore $this

if response.vote
$this.find('.btn-action').first().addClass('orange').data('method', 'delete')
else if response.vote == false
$this.find('.btn-action').last().addClass('orange').data('method', 'delete')

.on 'ajax:complete', '.voting', ->
$(this).data('sending', false)
100 changes: 100 additions & 0 deletions app/assets/javascripts/date-time-format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
!function ($, moment) {

"use strict"; // jshint ;_

var settings = {
datetime: false,
refreshMillis: 20000,
todayFormat: '[сегодня в] HH:mm',
yesterdayFormat: '[вчера в] HH:mm',
thisYearFormat: 'D MMM в HH:mm',
defaultFormat: 'D MMM YYYY в HH:mm',
innerSelector: false,
onComplete: false
};

var DateTimeFormat = function (element, options) {
options = typeof options == 'object' ? options : {};

this.$element = $(element);
this.options = $.extend({}, settings, typeof options == 'object' ? options : {});
this.dateTimeStr = this.options.datetime || this.$element.data('iso8601');

if ( ! (this.dateTimeStr && moment(this.dateTimeStr).isValid())) return;

this.moment = moment(this.dateTimeStr);

this.init();
};

DateTimeFormat.prototype = {

init: function() {
this.setText().startInterval();
if ($.isFunction(this.options.onComplete))
this.options.onComplete(this.$element, this)
},

setText: function(){
if (this.options.innerSelector){
this.$element.find(this.options.innerSelector).text(this.getMomentStr())
}else{
this.$element.text(this.getMomentStr())
}
return this;
},

startInterval: function() {
if (this.options.refreshMillis > 0){
if (this.isLessThenHour()){
if(!this.intervalId){
this.intervalId = setInterval($.proxy(this.refreshText, this), this.options.refreshMillis);
}
}
}
return this
},

refreshText: function(){
this.setText();

if (this.intervalId && ! this.isLessThenHour()){
clearInterval(this.intervalId);
}
},

getMomentStr: function () {
if (this.isLessThenHour()) return this.moment.fromNow();
if (this.isToday()) return this.moment.format(this.options.todayFormat);
if (this.isYesterday()) return this.moment.format(this.options.yesterdayFormat);
if (this.isThisYear()) return this.moment.format(this.options.thisYearFormat);

return this.moment.format(this.options.defaultFormat);
},
isLessThenHour: function () {
return this.moment.isAfter(moment().subtract(1, 'hour'))
},
isToday: function () {
return this.moment.isSame(moment(), 'day')
},
isYesterday: function () {
return this.moment.isSame(moment().subtract(1, 'day'), 'day');
},
isThisYear: function () {
return this.moment.isSame(moment(), 'year')
}
};

/* DateTimeFormat PLUGIN DEFINITION
* =========================== */

$.fn.datetimeformat = function (options) {
return this.each(function () {
var $this = $(this), data = $this.data('datetimeformat');
if (!data) $this.data('datetimeformat', (new DateTimeFormat(this, options)))
if (typeof options == 'string') data[options]()
})
};

$.fn.datetimeformat.Constructor = DateTimeFormat;
}(window.jQuery, moment);
1 change: 1 addition & 0 deletions app/assets/javascripts/funs/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ $(function(){
wall.html(data.responseText);
wall.initButtonTooltips();
wall.initTooltips();
wall.findAndFormatDateTime();
$(window).data('endelessscroll').resetFiring();

if (postData.view == 'box'){
Expand Down
Loading