fixed jrails, fixed deprecation warnings
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -4,7 +4,7 @@ group :test do
|
|||||||
gem "shoulda"
|
gem "shoulda"
|
||||||
gem "factory_girl"
|
gem "factory_girl"
|
||||||
gem "mocha"
|
gem "mocha"
|
||||||
gem "faker"
|
gem "ffaker", :git => "http://github.com/EmmanuelOga/ffaker.git"
|
||||||
end
|
end
|
||||||
|
|
||||||
gem "rails", "3.0.0"
|
gem "rails", "3.0.0"
|
||||||
|
|||||||
22
Gemfile.lock
22
Gemfile.lock
@@ -1,3 +1,9 @@
|
|||||||
|
GIT
|
||||||
|
remote: http://github.com/EmmanuelOga/ffaker.git
|
||||||
|
revision: cbe849d
|
||||||
|
specs:
|
||||||
|
ffaker (0.4.0)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: http://github.com/mislav/will_paginate.git
|
remote: http://github.com/mislav/will_paginate.git
|
||||||
revision: b1a5bee
|
revision: b1a5bee
|
||||||
@@ -44,17 +50,17 @@ GEM
|
|||||||
erubis (2.6.6)
|
erubis (2.6.6)
|
||||||
abstract (>= 1.0.0)
|
abstract (>= 1.0.0)
|
||||||
factory_girl (1.3.2)
|
factory_girl (1.3.2)
|
||||||
faker (0.3.1)
|
haml (3.0.22)
|
||||||
haml (3.0.21)
|
i18n (0.4.2)
|
||||||
i18n (0.4.1)
|
|
||||||
imagesize (0.1.1)
|
imagesize (0.1.1)
|
||||||
mail (2.2.7)
|
mail (2.2.9)
|
||||||
activesupport (>= 2.3.6)
|
activesupport (>= 2.3.6)
|
||||||
mime-types
|
i18n (~> 0.4.1)
|
||||||
treetop (>= 1.4.5)
|
mime-types (~> 1.16)
|
||||||
|
treetop (~> 1.4.8)
|
||||||
memcache-client (1.8.5)
|
memcache-client (1.8.5)
|
||||||
mime-types (1.16)
|
mime-types (1.16)
|
||||||
mocha (0.9.8)
|
mocha (0.9.9)
|
||||||
rake
|
rake
|
||||||
pg (0.9.0)
|
pg (0.9.0)
|
||||||
polyglot (0.3.1)
|
polyglot (0.3.1)
|
||||||
@@ -93,7 +99,7 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
delayed_job
|
delayed_job
|
||||||
factory_girl
|
factory_girl
|
||||||
faker
|
ffaker!
|
||||||
haml
|
haml
|
||||||
imagesize
|
imagesize
|
||||||
memcache-client
|
memcache-client
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class PixivProxy
|
|||||||
mech = WWW::Mechanize.new
|
mech = WWW::Mechanize.new
|
||||||
|
|
||||||
mech.get("http://www.pixiv.net") do |page|
|
mech.get("http://www.pixiv.net") do |page|
|
||||||
page.form_with(:action => "index.php") do |form|
|
page.form_with(:action => "login.php") do |form|
|
||||||
form.pixiv_id = "uroobnad"
|
form.pixiv_id = "uroobnad"
|
||||||
form.pass = "uroobnad556"
|
form.pass = "uroobnad556"
|
||||||
end.click_button
|
end.click_button
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
%div{:class => "comments"}
|
%div{:class => "comments"}
|
||||||
%div{:class => "index"}
|
%div{:class => "index"}
|
||||||
- @posts.each do |post|
|
- @posts.each do |post|
|
||||||
%div{:class => "preview"}
|
%div{:class => "post"}
|
||||||
= image_tag(post.medium_file_url)
|
%div{:class => "preview"}
|
||||||
= render :partial => "comments/partials/index/list", :locals => {:post => post, :comments => post.comments}
|
= image_tag(post.preview_file_url)
|
||||||
%div{:class => "clearfix"}
|
= render :partial => "comments/partials/index/list", :locals => {:post => post, :comments => post.comments.recent.reverse}
|
||||||
|
%div{:class => "clearfix"}
|
||||||
43
app/views/comments/partials/index/_header.html.haml
Normal file
43
app/views/comments/partials/index/_header.html.haml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
%div{:class => "header"}
|
||||||
|
%div{:class => "row"}
|
||||||
|
%span{:class => "info"}
|
||||||
|
%time Date
|
||||||
|
= compact_time(post.created_at)
|
||||||
|
%span{:class => "info"}
|
||||||
|
%strong User
|
||||||
|
= link_to(post.uploader_name, user_path(post.uploader_id))
|
||||||
|
%span{:class => "info"}
|
||||||
|
%strong Rating
|
||||||
|
= post.rating
|
||||||
|
%span{:class => "info"}
|
||||||
|
%strong Score
|
||||||
|
%span{:id => "score-for-post-#{post.id}"}
|
||||||
|
= post.score
|
||||||
|
|
||||||
|
|
||||||
|
<div class="header">
|
||||||
|
<div>
|
||||||
|
<span class="info"><strong>Date</strong> <%= compact_time(post.created_at) %></span>
|
||||||
|
<span class="info"><strong>User</strong> <%= fast_link_to h(post.author), :controller => "user", :action => "show", :id => post.user_id %></span>
|
||||||
|
<span class="info"><strong>Rating</strong> <%= post.pretty_rating %></span>
|
||||||
|
<span class="info">
|
||||||
|
<strong>Score</strong> <span id="post-score-<%= post.id %>"><%= post.score %></span>
|
||||||
|
<% if @current_user.is_privileged_or_higher? %>
|
||||||
|
(vote <%= link_to_function "up", "Post.vote(1, #{post.id})" %>/<%= link_to_function "down", "Post.vote(-1, #{post.id})" %>)
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="tags">
|
||||||
|
<strong>Tags</strong>
|
||||||
|
<% post.cached_tags.split(/ /).each do |name| %>
|
||||||
|
<span class="tag-type-<%= Tag.type_name(name) %>">
|
||||||
|
<%= fast_link_to h(name.tr("_", " ")), :controller => "post", :action => "index", :tags => name %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 1em;">
|
||||||
|
<% if post.comments.count > 6 %>
|
||||||
|
<span class="info" id="hidden-comments-notice-for-<%= post.id %>"><%= link_to_remote "#{pluralize post.comments.size - 6, 'comment'} hidden", :url => {:controller => "comment", :action => "index_hidden", :post_id => post.id} %>.</span>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= render :partial => "threshold_notice", :locals => {:post => post} %>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
%div{:class => "comments-for-post", "data-post-id" => post.id}
|
%div{:class => "comments-for-post", "data-post-id" => post.id}
|
||||||
%div{:class => "list-of-comments"}
|
%div{:class => "list-of-comments"}
|
||||||
= render :partial => "comments/partials/show/comment", :collection => comments
|
= render :partial => "comments/partials/show/comment", :collection => comments
|
||||||
|
%div{:class => "clearfix"}
|
||||||
%div{:class => "new-comment"}
|
%div{:class => "new-comment"}
|
||||||
%p= link_to "Post comment", new_comment_path, :class => "expand-comment-response"
|
%p= link_to "Post comment", new_comment_path, :class => "expand-comment-response"
|
||||||
= render :partial => "comments/partials/new/form", :locals => {:post => post}
|
= render :partial => "comments/partials/new/form", :locals => {:post => post}
|
||||||
|
|||||||
3
app/views/comments/partials/index/_threshold.html.haml
Normal file
3
app/views/comments/partials/index/_threshold.html.haml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<% if post.hidden_comment_count(@current_user) > 0 %>
|
||||||
|
<span class="info" id="threshold-comments-notice-for-<%= post.id %>"><%= link_to_remote "#{pluralize post.hidden_comment_count(@current_user), 'comment'} below threshold", :url => {:controller => "comment", :action => "index_all", :post_id => post.id} %>.</span>
|
||||||
|
<% end %>
|
||||||
@@ -223,6 +223,7 @@ CREATE TABLE artists (
|
|||||||
name character varying(255) NOT NULL,
|
name character varying(255) NOT NULL,
|
||||||
creator_id integer NOT NULL,
|
creator_id integer NOT NULL,
|
||||||
is_active boolean DEFAULT true NOT NULL,
|
is_active boolean DEFAULT true NOT NULL,
|
||||||
|
is_banned boolean DEFAULT false NOT NULL,
|
||||||
other_names text,
|
other_names text,
|
||||||
other_names_index tsvector,
|
other_names_index tsvector,
|
||||||
group_name character varying(255),
|
group_name character varying(255),
|
||||||
@@ -864,41 +865,6 @@ CREATE SEQUENCE janitor_trials_id_seq
|
|||||||
ALTER SEQUENCE janitor_trials_id_seq OWNED BY janitor_trials.id;
|
ALTER SEQUENCE janitor_trials_id_seq OWNED BY janitor_trials.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: jobs; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE jobs (
|
|
||||||
id integer NOT NULL,
|
|
||||||
category character varying(255) NOT NULL,
|
|
||||||
status character varying(255) NOT NULL,
|
|
||||||
message text NOT NULL,
|
|
||||||
data_as_json text NOT NULL,
|
|
||||||
repeat_count integer NOT NULL,
|
|
||||||
created_at timestamp without time zone,
|
|
||||||
updated_at timestamp without time zone
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE SEQUENCE jobs_id_seq
|
|
||||||
START WITH 1
|
|
||||||
INCREMENT BY 1
|
|
||||||
NO MAXVALUE
|
|
||||||
NO MINVALUE
|
|
||||||
CACHE 1;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER SEQUENCE jobs_id_seq OWNED BY jobs.id;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: note_versions; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: note_versions; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -1283,7 +1249,7 @@ CREATE TABLE tag_aliases (
|
|||||||
antecedent_name character varying(255) NOT NULL,
|
antecedent_name character varying(255) NOT NULL,
|
||||||
consequent_name character varying(255) NOT NULL,
|
consequent_name character varying(255) NOT NULL,
|
||||||
creator_id integer NOT NULL,
|
creator_id integer NOT NULL,
|
||||||
request_ids character varying(255),
|
forum_topic_id integer,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone
|
||||||
);
|
);
|
||||||
@@ -1318,7 +1284,7 @@ CREATE TABLE tag_implications (
|
|||||||
consequent_name character varying(255) NOT NULL,
|
consequent_name character varying(255) NOT NULL,
|
||||||
descendant_names text NOT NULL,
|
descendant_names text NOT NULL,
|
||||||
creator_id integer NOT NULL,
|
creator_id integer NOT NULL,
|
||||||
request_ids character varying(255),
|
forum_topic_id integer,
|
||||||
created_at timestamp without time zone,
|
created_at timestamp without time zone,
|
||||||
updated_at timestamp without time zone
|
updated_at timestamp without time zone
|
||||||
);
|
);
|
||||||
@@ -1813,13 +1779,6 @@ ALTER TABLE ip_bans ALTER COLUMN id SET DEFAULT nextval('ip_bans_id_seq'::regcla
|
|||||||
ALTER TABLE janitor_trials ALTER COLUMN id SET DEFAULT nextval('janitor_trials_id_seq'::regclass);
|
ALTER TABLE janitor_trials ALTER COLUMN id SET DEFAULT nextval('janitor_trials_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE jobs ALTER COLUMN id SET DEFAULT nextval('jobs_id_seq'::regclass);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@@ -2145,14 +2104,6 @@ ALTER TABLE ONLY janitor_trials
|
|||||||
ADD CONSTRAINT janitor_trials_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT janitor_trials_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE ONLY jobs
|
|
||||||
ADD CONSTRAINT jobs_pkey PRIMARY KEY (id);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: note_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: note_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
@@ -3205,8 +3156,6 @@ INSERT INTO schema_migrations (version) VALUES ('20100221003655');
|
|||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20100221005812');
|
INSERT INTO schema_migrations (version) VALUES ('20100221005812');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20100221012656');
|
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20100223001012');
|
INSERT INTO schema_migrations (version) VALUES ('20100223001012');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20100224171915');
|
INSERT INTO schema_migrations (version) VALUES ('20100224171915');
|
||||||
|
|||||||
@@ -225,10 +225,14 @@ div.comments-for-post div.comment-preview {
|
|||||||
|
|
||||||
div.comments div.index div.preview {
|
div.comments div.index div.preview {
|
||||||
float: left;
|
float: left;
|
||||||
width: 420px; }
|
width: 180px; }
|
||||||
div.comments div.index div.list-of-comments {
|
div.comments div.index div.post {
|
||||||
float: left;
|
margin-bottom: 4em; }
|
||||||
width: 55em; }
|
div.comments div.index div.post div.comments-for-post {
|
||||||
|
float: left;
|
||||||
|
width: 55em; }
|
||||||
|
div.comments div.index div.post div.comments-for-post h1 {
|
||||||
|
font-size: 1.2em; }
|
||||||
|
|
||||||
/*** Posts ***/
|
/*** Posts ***/
|
||||||
div.posts h1 {
|
div.posts h1 {
|
||||||
|
|||||||
@@ -324,12 +324,20 @@ div.comments {
|
|||||||
div.index {
|
div.index {
|
||||||
div.preview {
|
div.preview {
|
||||||
float: left;
|
float: left;
|
||||||
width: 420px;
|
width: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.list-of-comments {
|
div.post {
|
||||||
float: left;
|
margin-bottom: 4em;
|
||||||
width: 55em;
|
|
||||||
|
div.comments-for-post {
|
||||||
|
float: left;
|
||||||
|
width: 55em;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
ENV["RAILS_ENV"] = "test"
|
ENV["RAILS_ENV"] = "test"
|
||||||
|
|
||||||
require 'factory_girl'
|
|
||||||
require 'shoulda'
|
|
||||||
require 'mocha'
|
|
||||||
require 'faker'
|
|
||||||
require File.expand_path('../../config/environment', __FILE__)
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
require 'rails/test_help'
|
require 'rails/test_help'
|
||||||
|
|
||||||
|
|||||||
23
test/unit/pixiv_proxy_test.rb
Normal file
23
test/unit/pixiv_proxy_test.rb
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
require_relative '../test_helper'
|
||||||
|
|
||||||
|
class PixivProxyTest < ActiveSupport::TestCase
|
||||||
|
context "The proxy" do
|
||||||
|
should "get the profile" do
|
||||||
|
results = PixivProxy.get_profile("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=9646484")
|
||||||
|
assert_equal("シビレ\347\275\240", results[:artist])
|
||||||
|
assert_equal("/member_illust.php?id=9646484", results[:listing_url])
|
||||||
|
end
|
||||||
|
|
||||||
|
should "get a single post" do
|
||||||
|
results = PixivProxy.get_single("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=9646484")
|
||||||
|
assert_equal("/member.php?id=4015", results[:profile_url])
|
||||||
|
assert(results[:jp_tags].size > 0)
|
||||||
|
first_tag = results[:jp_tags][0]
|
||||||
|
assert_equal(2, first_tag.size)
|
||||||
|
assert(first_tag[0] =~ /./)
|
||||||
|
assert(first_tag[1] =~ /tags\.php\?tag=/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
2
vendor/plugins/jrails/VERSION.yml
vendored
2
vendor/plugins/jrails/VERSION.yml
vendored
@@ -2,4 +2,4 @@
|
|||||||
:patch: 0
|
:patch: 0
|
||||||
:build:
|
:build:
|
||||||
:major: 0
|
:major: 0
|
||||||
:minor: 7
|
:minor: 8
|
||||||
|
|||||||
4
vendor/plugins/jrails/lib/jrails.rb
vendored
4
vendor/plugins/jrails/lib/jrails.rb
vendored
@@ -1,3 +1,5 @@
|
|||||||
|
$: << File.expand_path("..", __FILE__)
|
||||||
|
|
||||||
require 'jrails/jrails'
|
require 'jrails/jrails'
|
||||||
require 'jrails/asset_tag_ext'
|
require 'jrails/asset_tag_ext'
|
||||||
require 'jrails/jquery_selector_assertions' if Rails.env == 'test'
|
require 'jrails/jquery_selector_assertions' if Rails.env == 'test'
|
||||||
|
|||||||
2
vendor/plugins/jrails/lib/jrails/jrails.rb
vendored
2
vendor/plugins/jrails/lib/jrails/jrails.rb
vendored
@@ -1,4 +1,4 @@
|
|||||||
class JRails
|
module JRails
|
||||||
@@config = {
|
@@config = {
|
||||||
:google => false,
|
:google => false,
|
||||||
:jquery_version => "1.4.2",
|
:jquery_version => "1.4.2",
|
||||||
|
|||||||
16
vendor/plugins/jrails/rails/init.rb
vendored
16
vendor/plugins/jrails/rails/init.rb
vendored
@@ -1,16 +0,0 @@
|
|||||||
# The following options can be changed by creating an initializer in config/initializers/jrails.rb
|
|
||||||
|
|
||||||
# jRails uses jQuery.noConflict() by default
|
|
||||||
# to use the default jQuery variable, use:
|
|
||||||
# ActionView::Helpers::PrototypeHelper::JQUERY_VAR = '$'
|
|
||||||
|
|
||||||
# ActionView::Helpers::PrototypeHelper:: DISABLE_JQUERY_FORGERY_PROTECTION
|
|
||||||
# Set this to disable forgery protection in ajax calls
|
|
||||||
# This is handy if you want to use caching with ajax by injecting the forgery token via another means
|
|
||||||
# for an example, see http://henrik.nyh.se/2008/05/rails-authenticity-token-with-jquery
|
|
||||||
# ActionView::Helpers::PrototypeHelper::DISABLE_JQUERY_FORGERY_PROTECTION = true
|
|
||||||
|
|
||||||
#ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = ['jquery','jquery-ui','jrails']
|
|
||||||
#ActionView::Helpers::AssetTagHelper::reset_javascript_include_default
|
|
||||||
require 'jrails'
|
|
||||||
require 'jquery_selector_assertions' if Rails.env.test?
|
|
||||||
Reference in New Issue
Block a user