enju_leaf 1.1.4 → 1.2.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -3
  3. data/app/assets/javascripts/autocomplete_agent.js +30 -0
  4. data/app/assets/javascripts/{menu.enju.js → enju.menu.js} +5 -0
  5. data/app/assets/javascripts/enju_leaf.js +3 -3
  6. data/app/assets/javascripts/portlets.js +2 -2
  7. data/app/assets/stylesheets/enju.css +52 -18
  8. data/app/assets/stylesheets/enju_leaf.css +2 -0
  9. data/app/controllers/concerns/enju_leaf/controller.rb +225 -0
  10. data/app/controllers/my_accounts_controller.rb +9 -7
  11. data/app/controllers/names_controller.rb +60 -0
  12. data/app/controllers/page_controller.rb +5 -4
  13. data/app/controllers/profiles_controller.rb +13 -4
  14. data/app/controllers/roles_controller.rb +11 -2
  15. data/app/controllers/user_export_files_controller.rb +13 -3
  16. data/app/controllers/user_groups_controller.rb +12 -3
  17. data/app/controllers/user_import_files_controller.rb +14 -4
  18. data/app/controllers/user_import_results_controller.rb +11 -1
  19. data/app/jobs/user_export_file_job.rb +7 -0
  20. data/app/jobs/user_import_file_job.rb +7 -0
  21. data/app/mailers/notifier.rb +0 -2
  22. data/app/models/concerns/calculate_stat.rb +35 -0
  23. data/app/models/concerns/enju_leaf/enju_user.rb +309 -0
  24. data/app/models/concerns/export_file.rb +19 -0
  25. data/app/models/concerns/import_file.rb +89 -0
  26. data/app/models/concerns/master_model.rb +38 -0
  27. data/app/models/profile.rb +2 -2
  28. data/app/models/user_export_file.rb +0 -2
  29. data/app/models/user_group.rb +0 -3
  30. data/app/models/user_import_file.rb +0 -1
  31. data/app/policies/application_policy.rb +53 -0
  32. data/app/policies/name_policy.rb +21 -0
  33. data/app/policies/profile_policy.rb +55 -0
  34. data/app/policies/role_policy.rb +21 -0
  35. data/app/policies/user_export_file_policy.rb +21 -0
  36. data/app/policies/user_group_policy.rb +22 -0
  37. data/app/policies/user_import_file_policy.rb +21 -0
  38. data/app/policies/user_import_result_policy.rb +21 -0
  39. data/app/views/devise/sessions/{new.mobile.erb → new.html+phone.erb} +0 -0
  40. data/app/views/layouts/{application.mobile.erb → application.html+phone.erb} +0 -0
  41. data/app/views/layouts/application.html.erb +2 -2
  42. data/app/views/layouts/devise/{passwords.mobile.erb → passwords.html+phone.erb} +0 -0
  43. data/app/views/layouts/devise/{sessions.mobile.erb → sessions.html+phone.erb} +0 -0
  44. data/app/views/my_accounts/{show.mobile.erb → show.html+phone.erb} +0 -0
  45. data/app/views/my_accounts/show.html.erb +3 -3
  46. data/app/views/names/_form.html.erb +41 -0
  47. data/app/views/names/edit.html.erb +6 -0
  48. data/app/views/names/index.html.erb +37 -0
  49. data/app/views/names/new.html.erb +5 -0
  50. data/app/views/names/show.html.erb +34 -0
  51. data/app/views/page/{403.mobile.erb → 403.html+phone.erb} +0 -0
  52. data/app/views/page/{404.mobile.erb → 404.html+phone.erb} +0 -0
  53. data/app/views/page/{500.mobile.erb → 500.html+phone.erb} +0 -0
  54. data/app/views/page/_footer.html+phone.erb +3 -0
  55. data/app/views/page/_footer.html.erb +3 -10
  56. data/app/views/page/{_index.mobile.erb → _index.html+phone.erb} +0 -0
  57. data/app/views/page/_menu.html.erb +1 -1
  58. data/app/views/page/{_mobile.mobile.erb → _mobile.html+phone.erb} +0 -0
  59. data/app/views/page/{_search_form.mobile.erb → _search_form.html+phone.erb} +0 -0
  60. data/app/views/page/_select_locale.html.erb +1 -1
  61. data/app/views/page/configuration.html.erb +1 -1
  62. data/app/views/page/{index.mobile.erb → index.html+phone.erb} +0 -0
  63. data/app/views/profiles/edit.html.erb +1 -1
  64. data/app/views/profiles/index.html.erb +5 -5
  65. data/app/views/profiles/{show.mobile.erb → show.html+phone.erb} +0 -0
  66. data/app/views/profiles/show.html.erb +9 -4
  67. data/app/views/roles/index.html.erb +2 -2
  68. data/app/views/roles/show.html.erb +1 -1
  69. data/app/views/user_groups/_form.html.erb +1 -1
  70. data/app/views/user_groups/index.html.erb +4 -4
  71. data/app/views/user_groups/show.html.erb +2 -2
  72. data/config/locales/translation_ja.yml +2 -2
  73. data/config/routes.rb +1 -4
  74. data/db/migrate/20151126005552_add_provider_to_identity.rb +5 -0
  75. data/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
  76. data/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
  77. data/lib/enju_leaf/engine.rb +4 -8
  78. data/lib/enju_leaf/helper.rb +1 -1
  79. data/lib/enju_leaf/version.rb +1 -1
  80. data/lib/enju_leaf.rb +0 -249
  81. data/lib/generators/enju_leaf/setup/setup_generator.rb +19 -26
  82. data/lib/generators/enju_leaf/setup/templates/config/initializers/enju_leaf.rb +1 -0
  83. data/lib/tasks/enju_leaf_tasks.rake +2 -2
  84. data/spec/controllers/profiles_controller_spec.rb +22 -12
  85. data/spec/controllers/user_export_files_controller_spec.rb +9 -10
  86. data/spec/controllers/user_groups_controller_spec.rb +9 -9
  87. data/spec/controllers/user_import_files_controller_spec.rb +6 -6
  88. data/spec/controllers/user_import_results_controller_spec.rb +3 -3
  89. data/spec/dummy/app/controllers/application_controller.rb +6 -7
  90. data/spec/dummy/app/models/user.rb +4 -5
  91. data/spec/dummy/config/application.rb +6 -38
  92. data/spec/dummy/config/environments/development.rb +22 -18
  93. data/spec/dummy/config/environments/production.rb +46 -34
  94. data/spec/dummy/config/environments/test.rb +19 -14
  95. data/spec/dummy/config/initializers/enju_leaf.rb +2 -0
  96. data/spec/dummy/config/routes.rb +5 -1
  97. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  98. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  99. data/spec/dummy/db/schema.rb +15 -0
  100. data/spec/factories/profile.rb +6 -6
  101. data/spec/models/user_export_file_spec.rb +1 -1
  102. data/spec/models/user_import_file_spec.rb +5 -5
  103. data/spec/rails_helper.rb +4 -11
  104. data/spec/routing/users_spec.rb +14 -0
  105. data/spec/spec_helper.rb +1 -1
  106. data/spec/support/devise.rb +2 -2
  107. data/spec/views/my_accounts/show.html.erb_spec.rb +43 -0
  108. data/spec/views/page/about.html.erb_spec.rb +0 -3
  109. data/spec/views/page/advanced_search.html.erb_spec.rb +1 -4
  110. data/spec/views/page/configuration.html.erb_spec.rb +0 -3
  111. data/spec/views/page/export.html.erb_spec.rb +0 -3
  112. data/spec/views/page/import.html.erb_spec.rb +0 -3
  113. data/spec/views/page/index.html.erb_spec.rb +1 -4
  114. data/spec/views/page/opensearch.xml.builder_spec.rb +1 -4
  115. data/spec/views/page/statistics.html.erb_spec.rb +0 -3
  116. data/spec/views/profiles/edit.html.erb_spec.rb +11 -14
  117. data/spec/views/profiles/index.html.erb_spec.rb +3 -4
  118. data/spec/views/profiles/show.html.erb_spec.rb +3 -8
  119. data/spec/views/user_import_results/index.html.erb_spec.rb +0 -3
  120. data/vendor/assets/javascripts/jquery.highlight.js +97 -56
  121. metadata +114 -288
  122. data/app/assets/javascripts/tab_view.js +0 -4
  123. data/app/models/enju_leaf/ability.rb +0 -102
  124. data/app/views/page/_footer.mobile.erb +0 -3
  125. data/app/workers/user_export_file_queue.rb +0 -7
  126. data/app/workers/user_import_file_queue.rb +0 -7
  127. data/config/initializers/resque.rb +0 -1
  128. data/lib/enju_leaf/calculate_stat.rb +0 -42
  129. data/lib/enju_leaf/controller.rb +0 -24
  130. data/lib/enju_leaf/export_file.rb +0 -26
  131. data/lib/enju_leaf/import_file.rb +0 -99
  132. data/lib/enju_leaf/master_model.rb +0 -42
  133. data/lib/enju_leaf/user.rb +0 -317
  134. data/lib/plugins/ext/mobylette/resolvers/chained_fallback_resolver.rb +0 -73
  135. data/lib/plugins/ext/mobylette.rb +0 -2
  136. data/lib/plugins/ext/sunspot/abstract_search.rb +0 -12
  137. data/lib/plugins/ext/sunspot/dismax.rb +0 -41
  138. data/lib/plugins/ext/sunspot/start_record.rb +0 -55
  139. data/lib/plugins/ext/sunspot.rb +0 -3
  140. data/lib/plugins/ext.rb +0 -2
  141. data/lib/plugins.rb +0 -2
  142. data/spec/dummy/config/application.yml +0 -47
  143. data/spec/routing/accounts_spec.rb +0 -14
@@ -1,73 +0,0 @@
1
- module Mobylette
2
- module Resolvers
3
- class ChainedFallbackResolver < ::ActionView::FileSystemResolver
4
- #DEFAULT_PATTERN = "{:path}/:prefix/:action{.:locale,}{.:formats,}{.:handlers,}"
5
-
6
- # Initializes the fallback resolver with a default
7
- # mobile format.
8
- #
9
- def initialize(formats = {}, view_paths = ['app/views'])
10
- @fallback_formats = formats
11
- @paths = view_paths.map { |view_path| File.expand_path(view_path)}
12
- super(@paths.first, DEFAULT_PATTERN)
13
- end
14
-
15
- # Updates the fallback resolver replacing the
16
- # fallback format hash.
17
- #
18
- # formats - hash of fallbacks, example:
19
- #
20
- # formats = {
21
- # mobile: [:mobile, :html],
22
- # iphone: [:iphone, :ios, :mobile, :html],
23
- # android: [:android, :mobile],
24
- # ...
25
- # }
26
- #
27
- # It will add the fallback chain array of the
28
- # request.format to the resolver.
29
- #
30
- # If the format.request is not defined in formats,
31
- # it will behave as a normal FileSystemResovler.
32
- #
33
- def replace_fallback_formats_chain(formats)
34
- @fallback_formats = formats
35
- end
36
-
37
- private
38
-
39
- # Private: finds the right template on the filesystem,
40
- # using fallback if needed
41
- #
42
- def find_templates(name, prefix, partial, details, other = false)
43
- # checks if the format has a fallback chain
44
- if @fallback_formats.has_key?(details[:formats].first)
45
- details = details.dup
46
- details[:formats] = Array.wrap(@fallback_formats[details[:formats].first])
47
- end
48
- if other
49
- super(name, prefix, partial, details, other)
50
- else
51
- super(name, prefix, partial, details)
52
- end
53
- end
54
-
55
- # Helper for building query glob string based on resolver's pattern.
56
- def build_query(path, details)
57
- query = @pattern.dup
58
-
59
- prefix = path.prefix.empty? ? "" : "#{escape_entry(path.prefix)}\\1"
60
- query.gsub!(/\:prefix(\/)?/, prefix)
61
-
62
- partial = escape_entry(path.partial? ? "_#{path.name}" : path.name)
63
- query.gsub!(/\:action/, partial)
64
-
65
- details.each do |ext, variants|
66
- query.gsub!(/\:#{ext}/, "{#{variants.compact.uniq.join(',')}}")
67
- end
68
-
69
- query.gsub!(/\:path/, "#{@paths.compact.uniq.join(',')}")
70
- end
71
- end
72
- end
73
- end
@@ -1,2 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), 'mobylette', 'resolvers/chained_fallback_resolver'))
2
-
@@ -1,12 +0,0 @@
1
- module Sunspot
2
- module Search #:nodoc:
3
- class AbstractSearch
4
- def execute
5
- reset
6
- params = @query.to_params
7
- @solr_result = @connection.post "#{request_handler}", :data => params, :headers => {'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8'}
8
- self
9
- end
10
- end
11
- end
12
- end
@@ -1,41 +0,0 @@
1
- module Sunspot
2
- module Query
3
- class Dismax
4
- def to_params
5
- params = { :q => @keywords }
6
- params[:fl] = '* score'
7
- params[:qf] = @fulltext_fields.values.map { |field| field.to_boosted_field }.join(' ')
8
- params[:defType] = 'edismax'
9
- if @phrase_fields
10
- params[:pf] = @phrase_fields.map { |field| field.to_boosted_field }.join(' ')
11
- end
12
- unless @boost_queries.empty?
13
- params[:bq] = @boost_queries.map do |boost_query|
14
- boost_query.to_boolean_phrase
15
- end
16
- end
17
- unless @boost_functions.empty?
18
- params[:bf] = @boost_functions.map do |boost_function|
19
- boost_function.to_s
20
- end
21
- end
22
- if @minimum_match
23
- params[:mm] = @minimum_match
24
- end
25
- if @phrase_slop
26
- params[:ps] = @phrase_slop
27
- end
28
- if @query_phrase_slop
29
- params[:qs] = @query_phrase_slop
30
- end
31
- if @tie
32
- params[:tie] = @tie
33
- end
34
- @highlights.each do |highlight|
35
- Sunspot::Util.deep_merge!(params, highlight.to_params)
36
- end
37
- params
38
- end
39
- end
40
- end
41
- end
@@ -1,55 +0,0 @@
1
- module Sunspot
2
- module Query
3
- class StartRecord #:nodoc:
4
- attr_reader :start_record, :maximum_record
5
-
6
- def initialize(start_record = nil, maximum_record = nil)
7
- self.start_record, self.maximum_record = start_record, maximum_record
8
- end
9
-
10
- def to_params
11
- { :start => start, :rows => rows }
12
- end
13
-
14
- def start_record=(start_record)
15
- @start_record = start_record.to_i - 1 if start_record
16
- end
17
-
18
- def maximum_record=(maximum_record)
19
- @maximum_record = maximum_record.to_i if maximum_record
20
- end
21
-
22
- private
23
-
24
- def start
25
- @start_record
26
- end
27
-
28
- def rows
29
- @maximum_record
30
- end
31
- end
32
-
33
- class CommonQuery
34
- def start_record(start, maximum)
35
- if @start_record
36
- @start_record.start = start
37
- @start_record.maximum = maximum
38
- else
39
- @components << @start_record = StartRecord.new(start, maximum)
40
- end
41
- end
42
- end
43
- end
44
-
45
- module DSL #:nodoc:
46
- class Query < FieldQuery
47
- def start_record(options = {})
48
- start = options.delete(:start)
49
- maximum = options.delete(:maximum)
50
- raise ArgumentError, "unknown argument #{options.keys.first.inspect} passed to paginate" unless options.empty?
51
- @query.start_record(start, maximum)
52
- end
53
- end
54
- end
55
- end
@@ -1,3 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), 'sunspot', 'dismax'))
2
- require File.expand_path(File.join(File.dirname(__FILE__), 'sunspot', 'start_record'))
3
- require File.expand_path(File.join(File.dirname(__FILE__), 'sunspot', 'abstract_search'))
data/lib/plugins/ext.rb DELETED
@@ -1,2 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), 'ext', 'sunspot'))
2
- require File.expand_path(File.join(File.dirname(__FILE__), 'ext', 'mobylette'))
data/lib/plugins.rb DELETED
@@ -1,2 +0,0 @@
1
- # http://railspress.matake.jp/extend-plugin-gem-library-in-rails-project
2
- require File.expand_path(File.join(File.dirname(__FILE__), 'plugins', 'ext'))
@@ -1,47 +0,0 @@
1
- defaults: &defaults
2
- enju:
3
- erms_url:
4
- skip_mobile_agents:
5
- - ipad
6
-
7
- family_name_first: true
8
- max_number_of_results: 500
9
- write_search_log_to_file: true
10
- csv_charset_conversion: true
11
-
12
- # Choose a locale from 'ca', 'de', 'fr', 'jp', 'uk', 'us'
13
- #AMAZON_AWS_HOSTNAME = 'ecs.amazonaws.com'
14
- amazon:
15
- aws_hostname: ecs.amazonaws.jp
16
- hostname: www.amazon.co.jp
17
- access_key: REPLACE_WITH_YOUR_AMAZON_ACCESS_KEY
18
- secret_access_key: REPLACE_WITH_YOUR_AMAZON_SECRET_ACCESS_KEY
19
-
20
- # :google, :amazon
21
- book_jacket:
22
- source: :google
23
- unknown_resource:
24
-
25
- # :mozshot, :simpleapi, :heartrails, :thumbalizr
26
- screenshot:
27
- generator: :mozshot
28
-
29
- uploaded_file:
30
- storage: :local
31
-
32
- manifestation:
33
- facet:
34
- pub_year_range_interval: 10
35
-
36
- news_post:
37
- number:
38
- top_page: 3
39
-
40
- development:
41
- <<: *defaults
42
-
43
- test:
44
- <<: *defaults
45
-
46
- production:
47
- <<: *defaults
@@ -1,14 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe ProfilesController do
4
- describe "routing" do
5
-
6
- it "recognizes and generates #new" do
7
- { get: "/accounts/sign_in" }.should route_to(controller: "devise/sessions", action: "new")
8
- end
9
-
10
- it "recognizes and generates #destroy" do
11
- { delete: "/accounts/sign_out" }.should route_to(controller: "devise/sessions", action: "destroy")
12
- end
13
- end
14
- end