enju_leaf 1.1.0.rc16 → 1.1.0.rc17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +1 -1
  3. data/app/assets/javascripts/mobile.js +1 -1
  4. data/app/assets/stylesheets/enju.css +1 -1
  5. data/app/assets/stylesheets/mobile.css +1 -1
  6. data/app/controllers/my_accounts_controller.rb +28 -8
  7. data/app/controllers/profiles_controller.rb +48 -11
  8. data/app/controllers/roles_controller.rb +6 -1
  9. data/app/controllers/user_export_files_controller.rb +7 -2
  10. data/app/controllers/user_groups_controller.rb +13 -2
  11. data/app/controllers/user_import_files_controller.rb +9 -2
  12. data/app/controllers/user_import_results_controller.rb +7 -0
  13. data/app/models/profile.rb +3 -11
  14. data/app/models/role.rb +0 -1
  15. data/app/models/user_export_file.rb +13 -3
  16. data/app/models/user_export_file_transition.rb +1 -1
  17. data/app/models/user_group.rb +0 -6
  18. data/app/models/user_has_role.rb +0 -2
  19. data/app/models/user_import_file.rb +31 -8
  20. data/app/models/user_import_file_transition.rb +1 -1
  21. data/app/models/user_import_result.rb +0 -1
  22. data/app/views/my_accounts/show.html.erb +4 -26
  23. data/app/views/page/export.html.erb +5 -5
  24. data/app/views/profiles/index.html.erb +3 -1
  25. data/app/views/profiles/show.html.erb +10 -27
  26. data/app/views/user_export_files/index.html.erb +2 -2
  27. data/app/views/user_export_files/show.html.erb +1 -1
  28. data/app/views/user_import_files/index.html.erb +1 -1
  29. data/app/views/user_import_files/show.html.erb +1 -1
  30. data/lib/enju_leaf/calculate_stat.rb +2 -2
  31. data/lib/enju_leaf/engine.rb +11 -0
  32. data/lib/enju_leaf/export_file.rb +1 -2
  33. data/lib/enju_leaf/import_file.rb +1 -1
  34. data/lib/enju_leaf/user.rb +20 -20
  35. data/lib/enju_leaf/version.rb +1 -1
  36. data/lib/generators/enju_leaf/setup/setup_generator.rb +9 -10
  37. data/lib/generators/enju_leaf/setup/templates/Procfile +1 -1
  38. data/lib/generators/enju_leaf/setup/templates/config/application.yml +1 -0
  39. data/lib/tasks/enju_leaf_tasks.rake +5 -0
  40. data/spec/controllers/my_accounts_controller_spec.rb +11 -0
  41. data/spec/controllers/profiles_controller_spec.rb +2 -2
  42. data/spec/dummy/app/helpers/application_helper.rb +1 -0
  43. data/spec/dummy/bin/bundle +3 -0
  44. data/spec/dummy/bin/rails +4 -0
  45. data/spec/dummy/bin/rake +4 -0
  46. data/spec/dummy/bin/setup +29 -0
  47. data/spec/dummy/db/schema.rb +108 -108
  48. data/spec/fixtures/events.yml +13 -39
  49. data/spec/models/user_import_file_spec.rb +17 -6
  50. data/vendor/assets/javascripts/jquery.colorbox.js +6 -6
  51. data/vendor/assets/javascripts/jquery.cookie.js +47 -26
  52. data/vendor/assets/javascripts/{jquery.mobile-1.4.4.js → jquery.mobile-1.4.5.js} +278 -228
  53. data/vendor/assets/stylesheets/{jquery.mobile-1.4.4.css → jquery.mobile-1.4.5.css} +7 -2
  54. metadata +198 -48
  55. data/spec/dummy/script/rails +0 -6
  56. data/spec/fixtures/series_has_manifestations.yml +0 -35
@@ -3,48 +3,32 @@ event_00001:
3
3
  updated_at: 2008-01-13 02:54:43.764011 +09:00
4
4
  event_category_id: 1
5
5
  end_at: 2008-01-14 02:54:00 +09:00
6
- name: !binary |
7
- 5LuV5LqL5aeL44KB
8
-
9
- display_name: !binary |
10
- 5LuV5LqL5aeL44KB
11
-
6
+ name: 仕事始め
7
+ display_name: 仕事始め
12
8
  deleted_at:
13
9
  start_at: 2008-01-13 02:54:00 +09:00
14
10
  id: 1
15
- note: !binary |
16
- 44Gq44KT44Go44GL44GL44KT44Go44GL
17
-
11
+ note: なんとかかんとか
18
12
  library_id: 2
19
13
  created_at: 2008-01-01 16:20:54.372729 +09:00
20
14
  event_00002:
21
15
  updated_at: 2008-01-13 02:54:21.134175 +09:00
22
16
  event_category_id: 2
23
17
  end_at: 2008-01-14 02:54:00 +09:00
24
- name: !binary |
25
- 44OG44K544OI
26
-
27
- display_name: !binary |
28
- 44OG44K544OI
29
-
18
+ name: テスト
19
+ display_name: テスト
30
20
  deleted_at:
31
21
  start_at: 2008-01-13 02:54:00 +09:00
32
22
  id: 2
33
- note: !binary |
34
- 44OG44K544OI55So44Gu44Kk44OZ44Oz44OI44Gn44GZ44CC
35
-
23
+ note: テスト用のイベントです。
36
24
  library_id: 2
37
25
  created_at: 2008-01-01 20:54:25.803201 +09:00
38
26
  event_00003:
39
27
  updated_at: 2008-02-05 20:00:35.319131 +09:00
40
28
  event_category_id: 1
41
29
  end_at: 2008-02-05 00:00:00 +09:00
42
- name: !binary |
43
- 44Of44O844OG44Kj44Oz44Kw
44
-
45
- display_name: !binary |
46
- 44Of44O844OG44Kj44Oz44Kw
47
-
30
+ name: ミーティング
31
+ display_name: ミーティング
48
32
  deleted_at:
49
33
  start_at: 2008-01-13 00:00:00 +09:00
50
34
  id: 3
@@ -55,18 +39,12 @@ event_00004:
55
39
  updated_at: 2008-02-05 15:43:42.617670 +09:00
56
40
  event_category_id: 4
57
41
  end_at: 2008-02-06 00:00:00 +09:00
58
- name: !binary |
59
- 44OG44K544OI
60
-
61
- display_name: !binary |
62
- 44OG44K544OI
63
-
42
+ name: テスト
43
+ display_name: テスト
64
44
  deleted_at:
65
45
  start_at: 2008-02-05 00:00:00 +09:00
66
46
  id: 4
67
- note: !binary |
68
- 44Gq44KT44Go44GL44GL44KT44Go44GL
69
-
47
+ note: なんとかかんとか
70
48
  library_id: 3
71
49
  created_at: 2008-02-05 15:43:42.617670 +09:00
72
50
  event_00005:
@@ -85,12 +63,8 @@ event_00006:
85
63
  updated_at: 2008-02-05 23:52:06.315285 +09:00
86
64
  event_category_id: 2
87
65
  end_at: 2008-02-08 00:00:00 +09:00
88
- name: !binary |
89
- 44Gq44KT44Go44GL44GL44KT44Go44GL
90
-
91
- display_name: !binary |
92
- 44Gq44KT44Go44GL44GL44KT44Go44GL
93
-
66
+ name: なんとかかんとか
67
+ display_name: なんとかかんとか
94
68
  deleted_at:
95
69
  start_at: 2008-02-05 00:00:00 +09:00
96
70
  id: 6
@@ -13,24 +13,35 @@ describe UserImportFile do
13
13
  @file.save
14
14
  end
15
15
 
16
- it "should be imported" do
16
+ it "should be imported", solr: true do
17
17
  old_users_count = User.count
18
18
  old_import_results_count = UserImportResult.count
19
+ old_profiles_solr_count = Profile.search.total
19
20
  @file.current_state.should eq 'pending'
20
21
  @file.import_start.should eq({:user_imported => 5, :user_found => 0, :failed => 0})
21
22
  User.order('id DESC')[1].username.should eq 'user005'
22
23
  User.order('id DESC')[2].username.should eq 'user003'
23
24
  User.count.should eq old_users_count + 5
25
+ Profile.search.total.should eq old_profiles_solr_count + 5
24
26
 
25
- user002 = User.where(:username => 'user002').first
27
+ user001 = User.where(username: 'user001').first
28
+ user001.profile.keyword_list.should eq "日本史\n地理"
29
+ user001.profile.full_name.should eq '田辺 浩介'
30
+ user001.profile.full_name_transcription.should eq 'たなべ こうすけ'
31
+ user001.profile.required_role.name.should eq 'User'
32
+ user001.locked_at.should be_truthy
33
+
34
+ user002 = User.where(username: 'user002').first
26
35
  user002.profile.user_group.name.should eq 'faculty'
27
36
  user002.profile.expired_at.to_i.should eq Time.zone.parse('2013-12-01').end_of_day.to_i
28
37
  user002.valid_password?('4NsxXPLy')
29
38
  user002.profile.user_number.should eq '001002'
30
39
  user002.profile.library.name.should eq 'hachioji'
31
40
  user002.profile.locale.should eq 'en'
41
+ user002.profile.required_role.name.should eq 'Librarian'
42
+ user002.locked_at.should be_nil
32
43
 
33
- user003 = User.where(:username => 'user003').first
44
+ user003 = User.where(username: 'user003').first
34
45
  user003.profile.note.should eq 'テストユーザ'
35
46
  user003.role.name.should eq 'Librarian'
36
47
  user003.profile.user_number.should eq '001003'
@@ -40,17 +51,17 @@ describe UserImportFile do
40
51
  user003.profile.save_checkout_history.should be_truthy
41
52
  user003.profile.save_search_history.should be_falsy
42
53
  user003.profile.share_bookmarks.should be_falsy
43
- User.where(:username => 'user000').first.should be_nil
54
+ User.where(username: 'user000').first.should be_nil
44
55
  UserImportResult.count.should eq old_import_results_count + 6
45
56
 
46
- user005 = User.where(:username => 'user005').first
57
+ user005 = User.where(username: 'user005').first
47
58
  user005.role.name.should eq 'User'
48
59
  user005.profile.library.name.should eq 'hachioji'
49
60
  user005.profile.locale.should eq 'en'
50
61
  user005.profile.user_number.should eq '001005'
51
62
  user005.profile.user_group.name.should eq 'faculty'
52
63
 
53
- user006 = User.where(:username => 'user006').first
64
+ user006 = User.where(username: 'user006').first
54
65
  user006.role.name.should eq 'User'
55
66
  user006.profile.library.name.should eq 'hachioji'
56
67
  user006.profile.locale.should eq 'en'
@@ -1,8 +1,7 @@
1
1
  /*!
2
- Colorbox v1.5.13 - 2014-08-04
3
- jQuery lightbox and modal window plugin
4
- (c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox
5
- license: http://www.opensource.org/licenses/mit-license.php
2
+ Colorbox 1.5.14
3
+ license: MIT
4
+ http://www.jacklmoore.com/colorbox
6
5
  */
7
6
  (function ($, document, window) {
8
7
  var
@@ -435,7 +434,7 @@
435
434
  // Colorbox's markup needs to be added to the DOM prior to being called
436
435
  // so that the browser will go ahead and load the CSS background images.
437
436
  function appendHTML() {
438
- if (!$box && document.body) {
437
+ if (!$box) {
439
438
  init = false;
440
439
  $window = $(window);
441
440
  $box = $tag(div).attr({
@@ -479,7 +478,8 @@
479
478
  $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
480
479
 
481
480
  $groupControls = $next.add($prev).add($current).add($slideshow);
482
-
481
+ }
482
+ if (document.body && !$box.parent().length) {
483
483
  $(document.body).append($overlay, $box.append($wrap, $loadingBay));
484
484
  }
485
485
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery Cookie Plugin v1.3.1
2
+ * jQuery Cookie Plugin v1.4.1
3
3
  * https://github.com/carhartl/jquery-cookie
4
4
  *
5
5
  * Copyright 2013 Klaus Hartl
@@ -7,53 +7,65 @@
7
7
  */
8
8
  (function (factory) {
9
9
  if (typeof define === 'function' && define.amd) {
10
- // AMD. Register as anonymous module.
10
+ // AMD
11
11
  define(['jquery'], factory);
12
+ } else if (typeof exports === 'object') {
13
+ // CommonJS
14
+ factory(require('jquery'));
12
15
  } else {
13
- // Browser globals.
16
+ // Browser globals
14
17
  factory(jQuery);
15
18
  }
16
19
  }(function ($) {
17
20
 
18
21
  var pluses = /\+/g;
19
22
 
23
+ function encode(s) {
24
+ return config.raw ? s : encodeURIComponent(s);
25
+ }
26
+
20
27
  function decode(s) {
21
- if (config.raw) {
22
- return s;
23
- }
24
- return decodeURIComponent(s.replace(pluses, ' '));
28
+ return config.raw ? s : decodeURIComponent(s);
25
29
  }
26
30
 
27
- function decodeAndParse(s) {
31
+ function stringifyCookieValue(value) {
32
+ return encode(config.json ? JSON.stringify(value) : String(value));
33
+ }
34
+
35
+ function parseCookieValue(s) {
28
36
  if (s.indexOf('"') === 0) {
29
37
  // This is a quoted cookie as according to RFC2068, unescape...
30
38
  s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
31
39
  }
32
40
 
33
- s = decode(s);
34
-
35
41
  try {
42
+ // Replace server-side written pluses with spaces.
43
+ // If we can't decode the cookie, ignore it, it's unusable.
44
+ // If we can't parse the cookie, ignore it, it's unusable.
45
+ s = decodeURIComponent(s.replace(pluses, ' '));
36
46
  return config.json ? JSON.parse(s) : s;
37
47
  } catch(e) {}
38
48
  }
39
49
 
50
+ function read(s, converter) {
51
+ var value = config.raw ? s : parseCookieValue(s);
52
+ return $.isFunction(converter) ? converter(value) : value;
53
+ }
54
+
40
55
  var config = $.cookie = function (key, value, options) {
41
56
 
42
57
  // Write
43
- if (value !== undefined) {
58
+
59
+ if (value !== undefined && !$.isFunction(value)) {
44
60
  options = $.extend({}, config.defaults, options);
45
61
 
46
62
  if (typeof options.expires === 'number') {
47
63
  var days = options.expires, t = options.expires = new Date();
48
- t.setDate(t.getDate() + days);
64
+ t.setTime(+t + days * 864e+5);
49
65
  }
50
66
 
51
- value = config.json ? JSON.stringify(value) : String(value);
52
-
53
67
  return (document.cookie = [
54
- config.raw ? key : encodeURIComponent(key),
55
- '=',
56
- config.raw ? value : encodeURIComponent(value),
68
+ encode(key), '=', stringifyCookieValue(value),
57
69
  options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
58
70
  options.path ? '; path=' + options.path : '',
59
71
  options.domain ? '; domain=' + options.domain : '',
@@ -62,20 +74,28 @@
62
74
  }
63
75
 
64
76
  // Read
65
- var cookies = document.cookie.split('; ');
77
+
66
78
  var result = key ? undefined : {};
79
+
80
+ // To prevent the for loop in the first place assign an empty array
81
+ // in case there are no cookies at all. Also prevents odd result when
82
+ // calling $.cookie().
83
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
84
+
67
85
  for (var i = 0, l = cookies.length; i < l; i++) {
68
86
  var parts = cookies[i].split('=');
69
87
  var name = decode(parts.shift());
70
88
  var cookie = parts.join('=');
71
89
 
72
90
  if (key && key === name) {
73
- result = decodeAndParse(cookie);
91
+ // If second argument (value) is a function it's a converter...
92
+ result = read(cookie, value);
74
93
  break;
75
94
  }
76
95
 
77
- if (!key) {
78
- result[name] = decodeAndParse(cookie);
96
+ // Prevent storing a cookie that we couldn't decode.
97
+ if (!key && (cookie = read(cookie)) !== undefined) {
98
+ result[name] = cookie;
79
99
  }
80
100
  }
81
101
 
@@ -85,12 +105,13 @@
85
105
  config.defaults = {};
86
106
 
87
107
  $.removeCookie = function (key, options) {
88
- if ($.cookie(key) !== undefined) {
89
- // Must not alter options, thus extending a fresh object...
90
- $.cookie(key, '', $.extend({}, options, { expires: -1 }));
91
- return true;
108
+ if ($.cookie(key) === undefined) {
109
+ return false;
92
110
  }
93
- return false;
111
+
112
+ // Must not alter options, thus extending a fresh object...
113
+ $.cookie(key, '', $.extend({}, options, { expires: -1 }));
114
+ return !$.cookie(key);
94
115
  };
95
116
 
96
117
  }));