enju_question 0.1.0.pre12 → 0.1.0.pre13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/answer.rb +1 -1
- data/app/models/question.rb +5 -5
- data/app/views/questions/_crd.html.erb +4 -4
- data/app/views/questions/_solved_facet.html.erb +1 -1
- data/app/views/questions/index.rss.builder +5 -5
- data/lib/enju_question/version.rb +1 -1
- data/spec/cassette_library/Question/test_should_get_crd_search.yml +486 -406
- data/spec/cassette_library/QuestionsController/GET_index/When_not_logged_in/should_get_index_with_query.yml +524 -444
- data/spec/cassette_library/QuestionsController/GET_index/When_not_logged_in/should_render_crd_xml_template.yml +524 -444
- data/spec/controllers/questions_controller_spec.rb +2 -2
- data/spec/dummy/config/boot.rb +2 -2
- data/spec/dummy/config/initializers/friendly_id.rb +90 -0
- data/spec/dummy/db/migrate/133_create_agent_merges.rb +15 -0
- data/spec/dummy/db/migrate/134_create_agent_merge_lists.rb +13 -0
- data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +1 -1
- data/spec/dummy/db/schema.rb +444 -428
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/default/data/index/segments.gen +0 -0
- data/spec/dummy/solr/default/data/index/segments_1km +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002027 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002028 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002029 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002030 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002031 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002032 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002033 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002034 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002035 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000002036 +0 -0
- data/spec/fixtures/users.yml +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/views/questions/index.rss.builder_spec.rb +22 -0
- metadata +43 -35
- data/spec/dummy/solr/default/data/index/segments_1c8 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001725 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001726 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001727 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001728 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001729 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001730 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001731 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001732 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001733 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001734 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6ecc1065776585a67c92f3f44b8b16ab961eb0f
|
4
|
+
data.tar.gz: d70e615307eaeb402b0f6d02f80ccf45a55de491
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fcef2da47cd00ea941882ec3a383726af4e93cd12f6722896b632436e01d0faef6911c2d7179e0527b13a42cde138d4a4722142be15ae870ab27dcfa4ba0c4c
|
7
|
+
data.tar.gz: d160eb04967edc55516b8735ed7bd64d2a7f02b6564126575a7ddb207c45987ad5aacc1a7b8e2be0b1ae09a4daa9e57d08106256bb4741717d297f3fb1481c5e
|
data/app/models/answer.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
class Answer < ActiveRecord::Base
|
3
3
|
attr_accessible :question_id, :body, :item_identifier_list, :url_list
|
4
|
-
default_scope order
|
4
|
+
default_scope { order('answers.id ASC') }
|
5
5
|
#scope :public_answers, where(:shared => true)
|
6
6
|
#scope :private_answers, where(:shared => false)
|
7
7
|
belongs_to :user, validate: true
|
data/app/models/question.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
class Question < ActiveRecord::Base
|
3
3
|
attr_accessible :body, :shared, :solved, :note
|
4
|
-
default_scope order
|
5
|
-
scope :public_questions, where(:
|
6
|
-
scope :private_questions, where(:
|
7
|
-
scope :solved, where(:
|
8
|
-
scope :unsolved, where(:
|
4
|
+
default_scope { order('id DESC') }
|
5
|
+
scope :public_questions, -> {where(shared: true)}
|
6
|
+
scope :private_questions, -> {where(shared: false)}
|
7
|
+
scope :solved, -> {where(solved: true)}
|
8
|
+
scope :unsolved, -> {where(solved: false)}
|
9
9
|
belongs_to :user, validate: true
|
10
10
|
has_many :answers, dependent: :destroy
|
11
11
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<div id="crd">
|
2
2
|
<%- if @crd_results -%>
|
3
|
-
<h4><%= link_to t('question.crd'), "
|
4
|
-
<p><%= t('question.number_of_search_results', :
|
3
|
+
<h4><%= link_to t('question.crd'), "https://crd.ndl.go.jp/" -%></h4>
|
4
|
+
<p><%= t('question.number_of_search_results', count: @crd_results.total_count) -%><br />
|
5
5
|
<ul>
|
6
6
|
<%- @crd_results.each do |result| -%>
|
7
7
|
<li><%= link_to h(truncate(result[:question])), result[:url] -%></li>
|
8
8
|
<%- end -%>
|
9
9
|
</ul>
|
10
|
-
<%= paginate(@crd_results, param_name: :crd_page, remote: true, :
|
10
|
+
<%= paginate(@crd_results, param_name: :crd_page, remote: true, window: 1) -%>
|
11
11
|
<%- else -%>
|
12
|
-
<p><%= link_to t('question.you_can_search_crd'), "
|
12
|
+
<p><%= link_to t('question.you_can_search_crd'), "https://crd.ndl.go.jp/" -%></p>
|
13
13
|
<%- end -%>
|
14
14
|
</div>
|
@@ -10,6 +10,6 @@
|
|
10
10
|
</li>
|
11
11
|
<%- end -%>
|
12
12
|
<%- if @solved -%>
|
13
|
-
<li><%= link_to t('page.remove_this_facet'), url_for(params.merge(:
|
13
|
+
<li><%= link_to t('page.remove_this_facet'), url_for(params.merge(solved: nil, page: nil, view: nil, only_path: true)) -%></li>
|
14
14
|
<%- end -%>
|
15
15
|
</ul>
|
@@ -4,8 +4,8 @@ xml.rss('version' => "2.0",
|
|
4
4
|
'xmlns:atom' => "http://www.w3.org/2005/Atom"){
|
5
5
|
xml.channel{
|
6
6
|
if @user
|
7
|
-
xml.title t('question.user_question', :
|
8
|
-
xml.link
|
7
|
+
xml.title t('question.user_question', login_name: @user.username)
|
8
|
+
xml.link questions_url(user_id: @user.username)
|
9
9
|
else
|
10
10
|
xml.title t('question.library_group_question', library_group_name: @library_group.display_name.localize)
|
11
11
|
xml.link questions_url
|
@@ -14,13 +14,13 @@ xml.rss('version' => "2.0",
|
|
14
14
|
xml.language @locale.to_s
|
15
15
|
xml.ttl "60"
|
16
16
|
if @user
|
17
|
-
xml.tag! "atom:link", rel: 'self', href:
|
18
|
-
xml.tag! "atom:link", rel: 'alternate', href:
|
17
|
+
xml.tag! "atom:link", rel: 'self', href: questions_url(user_id: @user.username, format: :rss)
|
18
|
+
xml.tag! "atom:link", rel: 'alternate', href: questions_url(user_id: @user.username)
|
19
19
|
else
|
20
20
|
xml.tag! "atom:link", rel: 'self', href: questions_url(format: :rss)
|
21
21
|
xml.tag! "atom:link", rel: 'alternate', href: questions_url
|
22
22
|
end
|
23
|
-
#xml.tag! "atom:link", rel: 'search', :type => 'application/opensearchdescription+xml', href:
|
23
|
+
#xml.tag! "atom:link", rel: 'search', :type => 'application/opensearchdescription+xml', href: page_opensearch_url(format: :xml)
|
24
24
|
unless params[:query].blank?
|
25
25
|
xml.tag! "opensearch:totalResults", @count[:query_result]
|
26
26
|
xml.tag! "opensearch:startIndex", @questions.offset + 1
|