atreides 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/stylesheets/atreides/admin_base.css.erb +0 -69
- data/app/models/atreides/content_part.rb +0 -1
- data/app/models/atreides/post.rb +2 -2
- data/app/models/atreides/user.rb +1 -1
- data/app/views/admin/common/_archive_sidebar.html.haml +0 -1
- data/app/views/atreides/admin/_content_nav.html.haml +0 -1
- data/app/views/atreides/posts/show.html.haml +1 -16
- data/config/locales/en.yml +0 -30
- data/config/routes.rb +0 -4
- data/lib/atreides.rb +0 -1
- data/lib/atreides/version.rb +1 -1
- data/lib/generators/atreides/atreides_generator.rb +1 -2
- data/lib/generators/templates/create_pages.rb +0 -2
- data/lib/generators/templates/create_posts.rb +0 -2
- data/lib/generators/templates/create_products.rb +0 -2
- data/lib/generators/templates/settings.yml +0 -4
- metadata +21 -64
- data/app/assets/javascripts/atreides/comments.coffee +0 -50
- data/app/controllers/admin/atreides/comments_controller.rb +0 -47
- data/app/controllers/atreides/comments_controller.rb +0 -43
- data/app/helpers/admin/atreides/comments_helper.rb +0 -8
- data/app/models/atreides/comment.rb +0 -93
- data/app/views/admin/atreides/comments/_line.html.haml +0 -60
- data/app/views/admin/atreides/comments/_sidebar.html.haml +0 -52
- data/app/views/admin/atreides/comments/create.js.haml +0 -1
- data/app/views/admin/atreides/comments/index.html.haml +0 -34
- data/lib/generators/templates/create_comments.rb +0 -19
- data/lib/generators/templates/disqussion.rb +0 -30
@@ -835,79 +835,10 @@ td.items_field a {
|
|
835
835
|
line-height:30px;
|
836
836
|
}
|
837
837
|
|
838
|
-
/*
|
839
|
-
* Comments
|
840
|
-
*
|
841
|
-
*/
|
842
|
-
|
843
|
-
#comments_list {
|
844
|
-
border-top:1px solid #ccc;
|
845
|
-
}
|
846
|
-
|
847
|
-
#comments_list .comment {
|
848
|
-
clear:left;
|
849
|
-
border-bottom:1px solid #eee;
|
850
|
-
padding: 1em 0;
|
851
|
-
}
|
852
|
-
|
853
|
-
#comments_list .comment:hover {
|
854
|
-
background:#f5f5f5;
|
855
|
-
}
|
856
|
-
|
857
|
-
#comments_list .comment-avatar {
|
858
|
-
float:left;
|
859
|
-
}
|
860
|
-
|
861
|
-
#comments_list .comment-name {
|
862
|
-
font-weight:bold;
|
863
|
-
}
|
864
|
-
|
865
|
-
#comments_list .comment-avatar img {
|
866
|
-
margin-right:0.5em;
|
867
|
-
margin-bottom:0.5em;
|
868
|
-
}
|
869
|
-
|
870
|
-
#comments_list .comment-excerpt p {
|
871
|
-
margin-bottom:0.5em;
|
872
|
-
}
|
873
|
-
|
874
|
-
.comment-time {
|
875
|
-
clear:left;
|
876
|
-
}
|
877
|
-
|
878
|
-
.comment-actions-left ul {
|
879
|
-
margin:0;
|
880
|
-
padding:0;
|
881
|
-
list-style:none;
|
882
|
-
}
|
883
|
-
|
884
|
-
.comment-actions-left li {
|
885
|
-
float:left;
|
886
|
-
margin-right:0.5em;
|
887
|
-
}
|
888
|
-
|
889
|
-
fieldset#comment_buttons {
|
890
|
-
border:none;
|
891
|
-
width:100%;
|
892
|
-
margin-top:1em;
|
893
|
-
}
|
894
|
-
|
895
|
-
#comment_buttons ol {
|
896
|
-
list-style:none;
|
897
|
-
margin:0;
|
898
|
-
padding:0;
|
899
|
-
}
|
900
|
-
|
901
838
|
#sidebar #filter-list ul {
|
902
839
|
padding:0;
|
903
840
|
}
|
904
841
|
|
905
|
-
.comments-panel-wrapper li.machine_tag {
|
906
|
-
float:none;
|
907
|
-
width:100%;
|
908
|
-
margin-bottom:0.5em;
|
909
|
-
}
|
910
|
-
|
911
842
|
/*
|
912
843
|
* Features
|
913
844
|
*
|
data/app/models/atreides/post.rb
CHANGED
@@ -62,9 +62,9 @@ class Atreides::Post < Atreides::Base
|
|
62
62
|
scope :popular_photos, lambda {
|
63
63
|
now = Time.zone.now
|
64
64
|
joins("INNER JOIN photos ON photos.photoable_type = 'Atreides::Post' AND photos.photoable_id = posts.id").
|
65
|
-
select("posts.*,
|
65
|
+
select("posts.*, likes_count").
|
66
66
|
where("posts.state = 'published' AND posts.published_at < ? AND posts.published_at < ?", now-1.week, now).
|
67
|
-
order("
|
67
|
+
order("likes_count desc, published_at desc").
|
68
68
|
group("posts.id").
|
69
69
|
limit(6)
|
70
70
|
}
|
data/app/models/atreides/user.rb
CHANGED
@@ -5,19 +5,4 @@
|
|
5
5
|
|
6
6
|
#page_nav
|
7
7
|
= link_to tt(".arrow_previous"), previous_post_path(resource), :class => "left" if resource.previous
|
8
|
-
= link_to tt(".arrow_next"), next_post_path(resource), :class => "right" if resource.next
|
9
|
-
|
10
|
-
.clear
|
11
|
-
|
12
|
-
#disqus_thread
|
13
|
-
:javascript
|
14
|
-
var disqus_shortname = 'testatreides';
|
15
|
-
var disqus_developer = 1;
|
16
|
-
(function() {
|
17
|
-
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
18
|
-
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
|
19
|
-
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
20
|
-
})();
|
21
|
-
%noscript Please enable JavaScript to view the #{link_to 'http://disqus.com/?ref_noscript', 'comments powered by Disqus.' }
|
22
|
-
= link_to 'http://disqus.com', :class => 'dsq-brlink' do
|
23
|
-
blog comments powered by <span class="logo-disqus">Disqus</span>
|
8
|
+
= link_to tt(".arrow_next"), next_post_path(resource), :class => "right" if resource.next
|
data/config/locales/en.yml
CHANGED
@@ -69,36 +69,6 @@ en:
|
|
69
69
|
reset: reset
|
70
70
|
|
71
71
|
atreides:
|
72
|
-
comments:
|
73
|
-
index:
|
74
|
-
comments: comments
|
75
|
-
approve: approve
|
76
|
-
'mark as spam': mark as spam
|
77
|
-
delete: delete
|
78
|
-
line:
|
79
|
-
'mark spam': mark as spam
|
80
|
-
'show comments only from this thread': show comments only from this thread
|
81
|
-
'this comment is': this comment is
|
82
|
-
'add commenter to': "add commenter to %{list}"
|
83
|
-
'all comments from': "all comments from"
|
84
|
-
'this thread': this thread
|
85
|
-
see_also: See other comments from
|
86
|
-
approved: approved
|
87
|
-
approve: approve
|
88
|
-
context: context
|
89
|
-
delete: delete
|
90
|
-
reply: reply
|
91
|
-
edit: edit
|
92
|
-
find: find
|
93
|
-
sidebar:
|
94
|
-
filter: filter
|
95
|
-
approved: approved
|
96
|
-
unapproved: unapproved
|
97
|
-
flagged: flagged
|
98
|
-
spam: spam
|
99
|
-
deleted: deleted
|
100
|
-
submit: submit
|
101
|
-
|
102
72
|
features:
|
103
73
|
index:
|
104
74
|
drafted: Drafted
|
data/config/routes.rb
CHANGED
@@ -50,10 +50,6 @@ Rails.application.routes.draw do
|
|
50
50
|
end
|
51
51
|
resource :photos, :controller => "atreides/photos"
|
52
52
|
end
|
53
|
-
resources :comments, :controller => "atreides/comments" do
|
54
|
-
put :update_many, :on => :collection
|
55
|
-
delete :delete_many, :on => :collection
|
56
|
-
end
|
57
53
|
resources :videos, :only => [:index, :destroy], :controller => "atreides/videos" do
|
58
54
|
post :reorder, :on => :collection
|
59
55
|
end
|
data/lib/atreides.rb
CHANGED
data/lib/atreides/version.rb
CHANGED
@@ -28,7 +28,7 @@ module Atreides
|
|
28
28
|
generate('devise:install')
|
29
29
|
|
30
30
|
%w(create_videos create_photos create_orders create_posts
|
31
|
-
create_pages create_likes
|
31
|
+
create_pages create_likes create_messages
|
32
32
|
create_features create_products create_line_items create_links
|
33
33
|
create_votes create_tweets create_sessions create_sites
|
34
34
|
create_content_parts add_userid_to_resources devise_create_users
|
@@ -47,7 +47,6 @@ module Atreides
|
|
47
47
|
copy_file 'settings.yml', 'config/settings.yml'
|
48
48
|
copy_file 'oembed.yml', 'config/oembed.yml'
|
49
49
|
copy_file 'delayed_job.rb', 'config/initializers/delayed_job.rb'
|
50
|
-
copy_file 'disqussion.rb', 'config/initializers/disqussion.rb'
|
51
50
|
copy_file 'Procfile', 'Procfile'
|
52
51
|
gsub_file 'config/application.rb', 'config.active_record.whitelist_attributes = true', 'config.active_record.whitelist_attributes = false'
|
53
52
|
remove_file 'public/index.html'
|
@@ -9,7 +9,6 @@ class CreatePages < ActiveRecord::Migration
|
|
9
9
|
t.timestamps
|
10
10
|
|
11
11
|
t.integer :likes_count, :default => 0
|
12
|
-
t.integer :comments_count, :default => 0
|
13
12
|
t.integer :votes_count, :default => 0
|
14
13
|
|
15
14
|
t.integer :parent_id
|
@@ -19,7 +18,6 @@ class CreatePages < ActiveRecord::Migration
|
|
19
18
|
end
|
20
19
|
add_index :pages, :slug
|
21
20
|
add_index :pages, :likes_count
|
22
|
-
add_index :pages, :comments_count
|
23
21
|
add_index :pages, :votes_count
|
24
22
|
add_index :pages, :parent_id
|
25
23
|
add_index :pages, :post_id
|
@@ -10,7 +10,6 @@ class CreatePosts < ActiveRecord::Migration
|
|
10
10
|
t.timestamps
|
11
11
|
t.integer :tumblr_id, :limit => 8 # BigInt because new tumblr ids are longer
|
12
12
|
t.integer :likes_count, :default => 0
|
13
|
-
t.integer :comments_count, :default => 0
|
14
13
|
t.integer :votes_count, :default => 0
|
15
14
|
t.integer :twitter_id
|
16
15
|
t.integer :facebook_id
|
@@ -25,7 +24,6 @@ class CreatePosts < ActiveRecord::Migration
|
|
25
24
|
end
|
26
25
|
add_index :posts, :slug
|
27
26
|
add_index :posts, :likes_count
|
28
|
-
add_index :posts, :comments_count
|
29
27
|
add_index :posts, :votes_count
|
30
28
|
add_index :posts, :twitter_id
|
31
29
|
add_index :posts, :linkable_id
|
@@ -8,12 +8,10 @@ class CreateProducts < ActiveRecord::Migration
|
|
8
8
|
t.string :price_currency
|
9
9
|
t.string :state
|
10
10
|
t.datetime :published_at
|
11
|
-
t.integer :comments_count, :default => 0
|
12
11
|
t.integer :likes_count, :default => 0
|
13
12
|
t.integer :votes_count, :default => 0
|
14
13
|
t.timestamps
|
15
14
|
end
|
16
|
-
add_index :products, :comments_count
|
17
15
|
add_index :products, :likes_count
|
18
16
|
add_index :products, :votes_count
|
19
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atreides
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -16,35 +16,19 @@ dependencies:
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: '0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: acts-as-taggable-on
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 2.3.3
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 2.3.3
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: acts_as_commentable
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
49
33
|
none: false
|
50
34
|
requirements:
|
@@ -205,22 +189,6 @@ dependencies:
|
|
205
189
|
version: '0'
|
206
190
|
- !ruby/object:Gem::Dependency
|
207
191
|
name: devise
|
208
|
-
requirement: !ruby/object:Gem::Requirement
|
209
|
-
none: false
|
210
|
-
requirements:
|
211
|
-
- - ~>
|
212
|
-
- !ruby/object:Gem::Version
|
213
|
-
version: 2.1.2
|
214
|
-
type: :runtime
|
215
|
-
prerelease: false
|
216
|
-
version_requirements: !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
|
-
requirements:
|
219
|
-
- - ~>
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
version: 2.1.2
|
222
|
-
- !ruby/object:Gem::Dependency
|
223
|
-
name: disqussion
|
224
192
|
requirement: !ruby/object:Gem::Requirement
|
225
193
|
none: false
|
226
194
|
requirements:
|
@@ -320,17 +288,17 @@ dependencies:
|
|
320
288
|
requirement: !ruby/object:Gem::Requirement
|
321
289
|
none: false
|
322
290
|
requirements:
|
323
|
-
- -
|
291
|
+
- - ! '>='
|
324
292
|
- !ruby/object:Gem::Version
|
325
|
-
version:
|
293
|
+
version: '0'
|
326
294
|
type: :runtime
|
327
295
|
prerelease: false
|
328
296
|
version_requirements: !ruby/object:Gem::Requirement
|
329
297
|
none: false
|
330
298
|
requirements:
|
331
|
-
- -
|
299
|
+
- - ! '>='
|
332
300
|
- !ruby/object:Gem::Version
|
333
|
-
version:
|
301
|
+
version: '0'
|
334
302
|
- !ruby/object:Gem::Dependency
|
335
303
|
name: grackle
|
336
304
|
requirement: !ruby/object:Gem::Requirement
|
@@ -512,17 +480,17 @@ dependencies:
|
|
512
480
|
requirement: !ruby/object:Gem::Requirement
|
513
481
|
none: false
|
514
482
|
requirements:
|
515
|
-
- -
|
483
|
+
- - '='
|
516
484
|
- !ruby/object:Gem::Version
|
517
|
-
version:
|
485
|
+
version: 3.1.4
|
518
486
|
type: :runtime
|
519
487
|
prerelease: false
|
520
488
|
version_requirements: !ruby/object:Gem::Requirement
|
521
489
|
none: false
|
522
490
|
requirements:
|
523
|
-
- -
|
491
|
+
- - '='
|
524
492
|
- !ruby/object:Gem::Version
|
525
|
-
version:
|
493
|
+
version: 3.1.4
|
526
494
|
- !ruby/object:Gem::Dependency
|
527
495
|
name: rails
|
528
496
|
requirement: !ruby/object:Gem::Requirement
|
@@ -640,33 +608,33 @@ dependencies:
|
|
640
608
|
requirement: !ruby/object:Gem::Requirement
|
641
609
|
none: false
|
642
610
|
requirements:
|
643
|
-
- -
|
611
|
+
- - ! '>='
|
644
612
|
- !ruby/object:Gem::Version
|
645
|
-
version:
|
613
|
+
version: '0'
|
646
614
|
type: :runtime
|
647
615
|
prerelease: false
|
648
616
|
version_requirements: !ruby/object:Gem::Requirement
|
649
617
|
none: false
|
650
618
|
requirements:
|
651
|
-
- -
|
619
|
+
- - ! '>='
|
652
620
|
- !ruby/object:Gem::Version
|
653
|
-
version:
|
621
|
+
version: '0'
|
654
622
|
- !ruby/object:Gem::Dependency
|
655
623
|
name: twitter
|
656
624
|
requirement: !ruby/object:Gem::Requirement
|
657
625
|
none: false
|
658
626
|
requirements:
|
659
|
-
- -
|
627
|
+
- - ! '>='
|
660
628
|
- !ruby/object:Gem::Version
|
661
|
-
version:
|
629
|
+
version: '0'
|
662
630
|
type: :runtime
|
663
631
|
prerelease: false
|
664
632
|
version_requirements: !ruby/object:Gem::Requirement
|
665
633
|
none: false
|
666
634
|
requirements:
|
667
|
-
- -
|
635
|
+
- - ! '>='
|
668
636
|
- !ruby/object:Gem::Version
|
669
|
-
version:
|
637
|
+
version: '0'
|
670
638
|
- !ruby/object:Gem::Dependency
|
671
639
|
name: uglifier
|
672
640
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1222,7 +1190,6 @@ files:
|
|
1222
1190
|
- lib/generators/atreides/USAGE
|
1223
1191
|
- lib/generators/templates/add_role_to_users.rb
|
1224
1192
|
- lib/generators/templates/add_userid_to_resources.rb
|
1225
|
-
- lib/generators/templates/create_comments.rb
|
1226
1193
|
- lib/generators/templates/create_content_parts.rb
|
1227
1194
|
- lib/generators/templates/create_features.rb
|
1228
1195
|
- lib/generators/templates/create_likes.rb
|
@@ -1243,7 +1210,6 @@ files:
|
|
1243
1210
|
- lib/generators/templates/create_votes.rb
|
1244
1211
|
- lib/generators/templates/delayed_job.rb
|
1245
1212
|
- lib/generators/templates/devise_create_users.rb
|
1246
|
-
- lib/generators/templates/disqussion.rb
|
1247
1213
|
- lib/generators/templates/em-net-http_override.rb
|
1248
1214
|
- lib/generators/templates/initializer.rb
|
1249
1215
|
- lib/generators/templates/new_relic.rb
|
@@ -1261,7 +1227,6 @@ files:
|
|
1261
1227
|
- app/assets/javascripts/atreides/admin_base.js.erb
|
1262
1228
|
- app/assets/javascripts/atreides/admin_edit.js
|
1263
1229
|
- app/assets/javascripts/atreides/application.js
|
1264
|
-
- app/assets/javascripts/atreides/comments.coffee
|
1265
1230
|
- app/assets/javascripts/atreides/public.js
|
1266
1231
|
- app/assets/javascripts/atreides/public_base.js.erb
|
1267
1232
|
- app/assets/javascripts/atreides/terryblr.js
|
@@ -1274,7 +1239,6 @@ files:
|
|
1274
1239
|
- app/assets/stylesheets/atreides/public.css
|
1275
1240
|
- app/assets/stylesheets/atreides/public_base.css
|
1276
1241
|
- app/assets/stylesheets/atreides/swfupload.css.erb
|
1277
|
-
- app/controllers/admin/atreides/comments_controller.rb
|
1278
1242
|
- app/controllers/admin/atreides/content_parts_controller.rb
|
1279
1243
|
- app/controllers/admin/atreides/dropbox_controller.rb
|
1280
1244
|
- app/controllers/admin/atreides/facebook_controller.rb
|
@@ -1295,13 +1259,11 @@ files:
|
|
1295
1259
|
- app/controllers/atreides/admin_controller.rb
|
1296
1260
|
- app/controllers/atreides/admin_home_controller.rb
|
1297
1261
|
- app/controllers/atreides/application_controller.rb
|
1298
|
-
- app/controllers/atreides/comments_controller.rb
|
1299
1262
|
- app/controllers/atreides/home_controller.rb
|
1300
1263
|
- app/controllers/atreides/likes_controller.rb
|
1301
1264
|
- app/controllers/atreides/pages_controller.rb
|
1302
1265
|
- app/controllers/atreides/posts_controller.rb
|
1303
1266
|
- app/controllers/atreides/public_controller.rb
|
1304
|
-
- app/helpers/admin/atreides/comments_helper.rb
|
1305
1267
|
- app/helpers/admin/atreides/dropbox_helper.rb
|
1306
1268
|
- app/helpers/admin/atreides/features_helper.rb
|
1307
1269
|
- app/helpers/admin/atreides/github_helper.rb
|
@@ -1325,7 +1287,6 @@ files:
|
|
1325
1287
|
- app/inputs/price_input.rb
|
1326
1288
|
- app/inputs/underline_input.rb
|
1327
1289
|
- app/models/atreides/ability.rb
|
1328
|
-
- app/models/atreides/comment.rb
|
1329
1290
|
- app/models/atreides/content_part.rb
|
1330
1291
|
- app/models/atreides/facebook_user.rb
|
1331
1292
|
- app/models/atreides/feature.rb
|
@@ -1352,10 +1313,6 @@ files:
|
|
1352
1313
|
- app/models/tumblr_post_publisher_job.rb
|
1353
1314
|
- app/models/tw_post_publisher_job.rb
|
1354
1315
|
- app/views/admin/_edit_head_content.html.haml
|
1355
|
-
- app/views/admin/atreides/comments/_line.html.haml
|
1356
|
-
- app/views/admin/atreides/comments/_sidebar.html.haml
|
1357
|
-
- app/views/admin/atreides/comments/create.js.haml
|
1358
|
-
- app/views/admin/atreides/comments/index.html.haml
|
1359
1316
|
- app/views/admin/atreides/content_parts/_form.html.haml
|
1360
1317
|
- app/views/admin/atreides/content_parts/_photos.html.haml
|
1361
1318
|
- app/views/admin/atreides/content_parts/_text.html.haml
|
@@ -1,50 +0,0 @@
|
|
1
|
-
$('#filter-list').change () ->
|
2
|
-
console.log 'go..'
|
3
|
-
self = $(this)
|
4
|
-
setTimeout () ->
|
5
|
-
self.submit()
|
6
|
-
, 30
|
7
|
-
|
8
|
-
# set up comment expand/collapse links.
|
9
|
-
$('.comment').each (index, comment) ->
|
10
|
-
# Don't create a new event for comments that have already been loaded.
|
11
|
-
return true if comment._loaded
|
12
|
-
comment._loaded = true;
|
13
|
-
|
14
|
-
$(this).click (event) ->
|
15
|
-
comment = $(this)
|
16
|
-
|
17
|
-
# Allow any user interact-able object (links, inputs, etc.) to function normally.
|
18
|
-
if ($(event.target).is('a,:input') || $(event.target).closest('a,:input').length > 0)
|
19
|
-
return true
|
20
|
-
|
21
|
-
if (comment.hasClass('expanded'))
|
22
|
-
comment.removeClass('expanded')
|
23
|
-
else
|
24
|
-
comment.addClass('expanded').removeClass('unread')
|
25
|
-
return false
|
26
|
-
|
27
|
-
if $('#expandall').hasClass('collapseall')
|
28
|
-
for post in posts
|
29
|
-
$('#comment-' + post.id).find('.comment-excerpt-block').click()
|
30
|
-
|
31
|
-
# $('.comment').live 'click', () ->
|
32
|
-
# $(this).toggleClass "expanded"
|
33
|
-
|
34
|
-
$('.actions form input[type=button]').click () ->
|
35
|
-
unless _.isEmpty getSelectedCommentId()
|
36
|
-
els = createInputCommentIds()
|
37
|
-
$(this).parent('form').append(els).submit()
|
38
|
-
else
|
39
|
-
console.log "Please select at least one comment."
|
40
|
-
return false
|
41
|
-
|
42
|
-
createInputCommentIds = () ->
|
43
|
-
els = ''
|
44
|
-
_.each getSelectedCommentId(), (cid) ->
|
45
|
-
els += "<input type='hidden' name='comment_ids[]' value='" + cid + "'>"
|
46
|
-
return els
|
47
|
-
|
48
|
-
getSelectedCommentId = () ->
|
49
|
-
_.map $('.comment-select input[type=checkbox]:checked'), (el) ->
|
50
|
-
$(el).attr("id").split("-")[1]
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'disqussion'
|
2
|
-
class Admin::Atreides::CommentsController < Atreides::AdminController
|
3
|
-
|
4
|
-
def index
|
5
|
-
super
|
6
|
-
end
|
7
|
-
|
8
|
-
def update_many
|
9
|
-
posts = Disqussion::Posts.new
|
10
|
-
case params[:comment_action]
|
11
|
-
when 'approve'
|
12
|
-
posts.approve params[:comment_ids] if params[:comment_ids]
|
13
|
-
when 'mark-spam'
|
14
|
-
posts.spam params[:comment_ids] if params[:comment_ids]
|
15
|
-
end if params[:comment_action]
|
16
|
-
redirect_to admin_comments_path
|
17
|
-
end
|
18
|
-
|
19
|
-
def delete_many
|
20
|
-
Disqussion::Posts.new.remove params[:comment_ids] if params[:comment_ids]
|
21
|
-
redirect_to admin_comments_path
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
# Query options are passed this way:
|
27
|
-
# from:username
|
28
|
-
# email:joe@bar.com
|
29
|
-
# ip:127.0.0.1
|
30
|
-
# thread:29372
|
31
|
-
def extract_options
|
32
|
-
@options ||= begin
|
33
|
-
opts = {}
|
34
|
-
opts[:query] = params[:query] if params.has_key?(:query) && %w(from email ip thread).include?(params[:query].split(':').first)
|
35
|
-
opts[:include] = params[:filter] if params.has_key?(:filter)
|
36
|
-
opts[:cursor] = params[:cursor] if params.has_key?(:cursor)
|
37
|
-
opts[:limit] = params[:limit] if params.has_key?(:limit)
|
38
|
-
opts
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def collection
|
43
|
-
@collection ||= Disqussion::Forums.new.listPosts(Settings.disqus.forum, extract_options)
|
44
|
-
end
|
45
|
-
|
46
|
-
include Atreides::Extendable
|
47
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
class Atreides::CommentsController < Atreides::PublicController
|
2
|
-
helper "Atreides::Posts"
|
3
|
-
before_filter :require_user, :only => [:create, :update]
|
4
|
-
|
5
|
-
def index
|
6
|
-
super do |wants|
|
7
|
-
wants.html { head :not_found }
|
8
|
-
wants.json { render :json => collection.to_json }
|
9
|
-
wants.xml { render :xml => collection.to_xml }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def create
|
14
|
-
build_resource.request = request
|
15
|
-
super do |success, failure|
|
16
|
-
success.html { head :ok, :location => post_path(parent) }
|
17
|
-
success.js
|
18
|
-
failure.wants.html { head :error, :message => resource.errors.full_messages.to_sentence }
|
19
|
-
failure.wants.js
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def resource
|
26
|
-
@comment ||= parent.comments.find params[:id]
|
27
|
-
end
|
28
|
-
|
29
|
-
def build_resource
|
30
|
-
@comment ||= Comment.new params[:comment].update(:user => current_user, :commentable => parent)
|
31
|
-
end
|
32
|
-
|
33
|
-
def collection
|
34
|
-
@comments ||= parent.comments.approved.paginate :page => params[:page]
|
35
|
-
end
|
36
|
-
|
37
|
-
def parent
|
38
|
-
@parent ||= Atreides::Post.find_by_slug!(params[:post_id]) ||
|
39
|
-
Atreides::Post.find(params[:post_id])
|
40
|
-
end
|
41
|
-
|
42
|
-
include Atreides::Extendable
|
43
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
class Atreides::Comment < Atreides::Base
|
2
|
-
|
3
|
-
acts_as_commentable
|
4
|
-
|
5
|
-
#
|
6
|
-
# Constants
|
7
|
-
#
|
8
|
-
|
9
|
-
#
|
10
|
-
# Associatons
|
11
|
-
#
|
12
|
-
belongs_to :commentable, :polymorphic => true, :counter_cache => true
|
13
|
-
belongs_to :user
|
14
|
-
|
15
|
-
#
|
16
|
-
# Validations
|
17
|
-
#
|
18
|
-
validates_presence_of :comment
|
19
|
-
validate :spam_filter, :on => :create
|
20
|
-
|
21
|
-
def spam_filter
|
22
|
-
errors.add(:base, "Unfortunately this comment is considered spam by Akismet. It will show up once it has been approved by the administrator.") if spam?
|
23
|
-
end
|
24
|
-
|
25
|
-
#
|
26
|
-
# Scopes
|
27
|
-
#
|
28
|
-
default_scope order('created_at ASC')
|
29
|
-
scope :moderated, where("moderated_at is not null")
|
30
|
-
scope :approved, where("moderated_at is null")
|
31
|
-
|
32
|
-
#
|
33
|
-
# Callbacks
|
34
|
-
#
|
35
|
-
|
36
|
-
#
|
37
|
-
# Class Methods
|
38
|
-
#
|
39
|
-
class << self
|
40
|
-
def base_class
|
41
|
-
self
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
#
|
46
|
-
# Instance Methods
|
47
|
-
#
|
48
|
-
def moderated?
|
49
|
-
moderated_at?
|
50
|
-
end
|
51
|
-
|
52
|
-
def moderate!
|
53
|
-
update_attributes!(:moderated_at => Time.zone.now)
|
54
|
-
end
|
55
|
-
|
56
|
-
def request=(request)
|
57
|
-
@user_ip = request.remote_ip
|
58
|
-
@user_agent = request.env['HTTP_USER_AGENT']
|
59
|
-
@referrer = request.env['HTTP_REFERER']
|
60
|
-
@has_request = true
|
61
|
-
end
|
62
|
-
|
63
|
-
def spam?
|
64
|
-
result = @has_request ? Akismetor.spam?(akismet_attributes) : false
|
65
|
-
moderate! if result
|
66
|
-
result
|
67
|
-
end
|
68
|
-
|
69
|
-
def akismet_attributes
|
70
|
-
{
|
71
|
-
:key => 'abc123',
|
72
|
-
:blog => "http://#{Settings.domain}",
|
73
|
-
:user_ip => @user_ip,
|
74
|
-
:user_agent => @user_agent,
|
75
|
-
:comment_author => user.full_name,
|
76
|
-
:comment_author_email => user.email,
|
77
|
-
# :comment_author_url => site_url,
|
78
|
-
:comment_content => comment
|
79
|
-
}
|
80
|
-
end
|
81
|
-
|
82
|
-
def mark_as_spam!
|
83
|
-
moderate!
|
84
|
-
Akismetor.submit_spam(akismet_attributes)
|
85
|
-
end
|
86
|
-
|
87
|
-
def mark_as_ham!
|
88
|
-
update_attribute(:moderated_at, nil)
|
89
|
-
Akismetor.submit_ham(akismet_attributes)
|
90
|
-
end
|
91
|
-
|
92
|
-
include Atreides::Extendable
|
93
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
.comment.span-17{:id => "comment-#{comment.id}", :class => "#{'approved' if comment.isApproved}"}
|
2
|
-
%label.span-1.comment-select.approved{:for => "check-#{comment.id}"}
|
3
|
-
= check_box_tag "", nil, false, :id => "check-#{comment.id}"
|
4
|
-
= hidden_field_tag "", comment.id
|
5
|
-
/ Excerpt block. This is shown by default and hidden when the parent is given the class "expanded"
|
6
|
-
.comment-excerpt-block.span-16.last
|
7
|
-
.comment-avatar
|
8
|
-
= image_tag comment.author.avatar.cache, :class => "comment-avatar", :size => "32x32"
|
9
|
-
.comment-excerpt
|
10
|
-
%p
|
11
|
-
%span.comment-name
|
12
|
-
= comment.author.name
|
13
|
-
%span
|
14
|
-
= "(#{comment.author.email}):" unless comment.author.email.blank?
|
15
|
-
%span.comment-body= comment.raw_message
|
16
|
-
.comment-time
|
17
|
-
Posted
|
18
|
-
= distance_of_time_in_words seconds_from_now(Time.parse(comment.createdAt))
|
19
|
-
ago.
|
20
|
-
.clear
|
21
|
-
/ End excerpt block
|
22
|
-
/ hidden by default, shown by javascript when expanded.
|
23
|
-
.comment-header{:style => "display:none"}
|
24
|
-
.comment-user
|
25
|
-
%a{:href => "#", :rel => "userlist"}
|
26
|
-
= image_tag comment.author.avatar.cache, :class => "comment-avatar", :size => "32x32"
|
27
|
-
.comment-name
|
28
|
-
= link_to comment.author.name, comment.author.url, :class => "profile-launcher", "data-profile-username" => comment.author.username, :target => "_blank"
|
29
|
-
%span
|
30
|
-
!= "(#{mail_to(comment.author.email)})" unless comment.author.email.blank?
|
31
|
-
/ %small
|
32
|
-
/ = link_to "#{comment.ipAddress}.", "?query=ip:#{comment.ipAddress}"
|
33
|
-
/ = link_to comment.author.url, comment.author.url, :target => "_blank"
|
34
|
-
.comment-time
|
35
|
-
Posted
|
36
|
-
= distance_of_time_in_words seconds_from_now(Time.parse(comment.createdAt))
|
37
|
-
ago.
|
38
|
-
.clear
|
39
|
-
/ hidden by default, shown by javascript when expanded.
|
40
|
-
.comment-body{:style => "display:none"}
|
41
|
-
.content
|
42
|
-
.content-wrapper
|
43
|
-
%p= comment.raw_message
|
44
|
-
.media
|
45
|
-
/ hidden by default, shown by javascript when expanded.
|
46
|
-
.comment-footer.clear
|
47
|
-
.comment-actions-left.span-12.prepend-1
|
48
|
-
= ttc(".see_also")
|
49
|
-
\:
|
50
|
-
= link_to comment.author.email, "?query=email:#{comment.author.email}"
|
51
|
-
= link_to comment.ipAddress, "?query=ip:#{comment.ipAddress}"
|
52
|
-
= link_to tt(".this thread"), "?query=thread:#{comment.thread}"
|
53
|
-
|
54
|
-
.comment-actions-left.span-4.last
|
55
|
-
= ttc ".this comment is"
|
56
|
-
%span.txt-approved= comment.isApproved ? tt('.approved') : tt('.not yet approved')
|
57
|
-
%a.add-userlist.blacklist{:href => "#", :style => "display: none; "}
|
58
|
-
= ttc ".add commenter to", :list => content_tag(:strong, "Blacklist")
|
59
|
-
%a.add-userlist.whitelist{:href => "#", :style => "display: none; "}
|
60
|
-
= ttc ".add commenter to", :list => content_tag(:strong, "Whitelist")
|
@@ -1,52 +0,0 @@
|
|
1
|
-
- content_for :sidebar do
|
2
|
-
#filters.comments-panel-wrapper
|
3
|
-
%ul.summary
|
4
|
-
%li.new-content
|
5
|
-
= link_to "Disqus.com", "http://#{Settings.disqus.forum}.disqus.com/admin/moderate/"
|
6
|
-
|
7
|
-
%li.divider
|
8
|
-
%li
|
9
|
-
%h3= ttt '.filter'
|
10
|
-
= form_tag '', :method => :get, :id => "filter-list", :class => 'formtastic' do
|
11
|
-
%ul
|
12
|
-
%li.machine_tag
|
13
|
-
%label#filter-approved{:for => "show_approved"}
|
14
|
-
/ Filter's default to "approved"
|
15
|
-
- if !params.has_key?(:filter) || params.has_key?(:filter) && params[:filter].include?("approved")
|
16
|
-
%input#show_approved{:checked => "checked", :type => "checkbox", :name => "filter[]", :value => "approved"}/
|
17
|
-
- else
|
18
|
-
%input#show_approved{:type => "checkbox", :name => "filter[]", :value => "approved"}/
|
19
|
-
= ttt ".approved"
|
20
|
-
|
21
|
-
%li.machine_tag
|
22
|
-
%label#filter-unapproved{:for => "show_unapproved"}
|
23
|
-
- if params.has_key?(:filter) && params[:filter].include?("unapproved")
|
24
|
-
%input#show_unapproved{:checked => "checked", :type => "checkbox", :name => "filter[]", :value => "unapproved"}/
|
25
|
-
- else
|
26
|
-
%input#show_unapproved{:type => "checkbox", :name => "filter[]", :value => "unapproved"}/
|
27
|
-
= ttt ".unapproved"
|
28
|
-
%li.machine_tag
|
29
|
-
%label#filter-flagged{:for => "show_flagged"}
|
30
|
-
- if params.has_key?(:filter) && params[:filter].include?("flagged")
|
31
|
-
%input#show_flagged{:checked => "checked", :type => "checkbox", :name => "filter[]", :value => "flagged"}/
|
32
|
-
- else
|
33
|
-
%input#show_flagged{:type => "checkbox", :name => "filter[]", :value => "flagged"}/
|
34
|
-
= ttt ".flagged"
|
35
|
-
%li.machine_tag
|
36
|
-
%label#filter-spam.hidden{:for => "show_spam"}
|
37
|
-
- if params.has_key?(:filter) && params[:filter].include?("spam")
|
38
|
-
%input#show_spam{:checked => "checked", :type => "checkbox", :type => "checkbox", :name => "filter[]", :value => "spam"}/
|
39
|
-
- else
|
40
|
-
%input#show_spam{:type => "checkbox", :type => "checkbox", :name => "filter[]", :value => "spam"}/
|
41
|
-
= ttt ".spam"
|
42
|
-
%li.machine_tag
|
43
|
-
%label#filter-deleted.hidden{:for => "show_deleted"}
|
44
|
-
- if params.has_key?(:filter) && params[:filter].include?("deleted")
|
45
|
-
%input#show_spam{:checked => "checked", :type => "checkbox", :type => "checkbox", :name => "filter[]", :value => "deleted"}/
|
46
|
-
- else
|
47
|
-
%input#show_spam{:type => "checkbox", :type => "checkbox", :name => "filter[]", :value => "deleted"}/
|
48
|
-
= ttt ".deleted"
|
49
|
-
%li.machine_tag
|
50
|
-
%label#filter-button.hidden{:for => "submit_button", :style => "display:none"}
|
51
|
-
%input#submit_button{:type => "submit"}
|
52
|
-
= ttt ".submit"
|
@@ -1 +0,0 @@
|
|
1
|
-
$("##{parent_object.dom_id('comments')}").html("#{escape_javascript(comment_item(resource))}")
|
@@ -1,34 +0,0 @@
|
|
1
|
-
= render :partial => 'sidebar'
|
2
|
-
|
3
|
-
%h2 #{ttt :'.comments'}
|
4
|
-
|
5
|
-
.clear
|
6
|
-
|
7
|
-
#comments_list
|
8
|
-
- @collection.response.each do |comment|
|
9
|
-
= render :partial => 'line', :locals => { :comment => comment}
|
10
|
-
|
11
|
-
.clear
|
12
|
-
|
13
|
-
%fieldset#comment_buttons.buttons.actions
|
14
|
-
%ol
|
15
|
-
%li.commit
|
16
|
-
= form_tag '/admin/comments/update_many', :method => :put do
|
17
|
-
= hidden_field_tag "comment_action", "approve"
|
18
|
-
%input#approve-selected.create{:type => "button", :value => ttc(".approve")}
|
19
|
-
%li.delete
|
20
|
-
= form_tag '/admin/comments/delete_many', :method => :delete do
|
21
|
-
%input#delete-selected.cancel{:type => "button", :value => ttc(".delete")}
|
22
|
-
%li.cancel
|
23
|
-
= form_tag '/admin/comments/update_many', :method => :put do
|
24
|
-
= hidden_field_tag "comment_action", "mark-spam"
|
25
|
-
%input#mark-as-spam-selected.cancel{:type => "button", :value => ttc(".mark as spam")}
|
26
|
-
|
27
|
-
#pagination.pagination.clear
|
28
|
-
- if @collection.cursor.hasPrev
|
29
|
-
.previous= link_to tt("Previous"), admin_comments_path(params.merge(:cursor => @collection.cursor.prev))
|
30
|
-
- if @collection.cursor.hasNext
|
31
|
-
.next= link_to tt("Next"), admin_comments_path(params.merge(:cursor => @collection.cursor.next))
|
32
|
-
|
33
|
-
- content_for :js do
|
34
|
-
= javascript_include_tag 'atreides/comments'
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class CreateComments < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :comments, :force => true do |t|
|
4
|
-
t.string :title, :limit => 50, :default => ""
|
5
|
-
t.text :comment, :default => ""
|
6
|
-
t.references :commentable, :polymorphic => true
|
7
|
-
t.integer :user_id
|
8
|
-
t.datetime :moderated_at
|
9
|
-
t.timestamps
|
10
|
-
end
|
11
|
-
add_index :comments, :commentable_type
|
12
|
-
add_index :comments, :commentable_id
|
13
|
-
add_index :comments, :user_id
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.down
|
17
|
-
drop_table :comments
|
18
|
-
end
|
19
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'disqussion'
|
2
|
-
|
3
|
-
Disqussion.configure do |config|
|
4
|
-
config.api_key = Settings.disqus.key
|
5
|
-
config.api_secret = Settings.disqus.secret
|
6
|
-
# config.adapter = :em_synchrony
|
7
|
-
end
|
8
|
-
|
9
|
-
Disqussion::Posts.class_eval %Q{
|
10
|
-
class << self
|
11
|
-
def columns_hash
|
12
|
-
a = {}
|
13
|
-
self.column_names.each do |key|
|
14
|
-
a.merge! key.to_sym => String
|
15
|
-
end
|
16
|
-
a
|
17
|
-
end
|
18
|
-
|
19
|
-
def column_names
|
20
|
-
["isJuliaFlagged","isFlagged","forum","parent","media","isApproved","dislikes","raw_message","isSpam","thread","points","createdAt","message","isHighlighted","ipAddress","id","isDeleted","likes","author"]
|
21
|
-
end
|
22
|
-
end
|
23
|
-
}
|
24
|
-
|
25
|
-
require 'hashie/rash'
|
26
|
-
Hashie::Rash.class_eval %Q{
|
27
|
-
def dom_id(prefix)
|
28
|
-
prefix + "_" + self.id
|
29
|
-
end
|
30
|
-
}
|