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.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/app/assets/javascripts/mobile.js +1 -1
- data/app/assets/stylesheets/enju.css +1 -1
- data/app/assets/stylesheets/mobile.css +1 -1
- data/app/controllers/my_accounts_controller.rb +28 -8
- data/app/controllers/profiles_controller.rb +48 -11
- data/app/controllers/roles_controller.rb +6 -1
- data/app/controllers/user_export_files_controller.rb +7 -2
- data/app/controllers/user_groups_controller.rb +13 -2
- data/app/controllers/user_import_files_controller.rb +9 -2
- data/app/controllers/user_import_results_controller.rb +7 -0
- data/app/models/profile.rb +3 -11
- data/app/models/role.rb +0 -1
- data/app/models/user_export_file.rb +13 -3
- data/app/models/user_export_file_transition.rb +1 -1
- data/app/models/user_group.rb +0 -6
- data/app/models/user_has_role.rb +0 -2
- data/app/models/user_import_file.rb +31 -8
- data/app/models/user_import_file_transition.rb +1 -1
- data/app/models/user_import_result.rb +0 -1
- data/app/views/my_accounts/show.html.erb +4 -26
- data/app/views/page/export.html.erb +5 -5
- data/app/views/profiles/index.html.erb +3 -1
- data/app/views/profiles/show.html.erb +10 -27
- data/app/views/user_export_files/index.html.erb +2 -2
- data/app/views/user_export_files/show.html.erb +1 -1
- data/app/views/user_import_files/index.html.erb +1 -1
- data/app/views/user_import_files/show.html.erb +1 -1
- data/lib/enju_leaf/calculate_stat.rb +2 -2
- data/lib/enju_leaf/engine.rb +11 -0
- data/lib/enju_leaf/export_file.rb +1 -2
- data/lib/enju_leaf/import_file.rb +1 -1
- data/lib/enju_leaf/user.rb +20 -20
- data/lib/enju_leaf/version.rb +1 -1
- data/lib/generators/enju_leaf/setup/setup_generator.rb +9 -10
- data/lib/generators/enju_leaf/setup/templates/Procfile +1 -1
- data/lib/generators/enju_leaf/setup/templates/config/application.yml +1 -0
- data/lib/tasks/enju_leaf_tasks.rake +5 -0
- data/spec/controllers/my_accounts_controller_spec.rb +11 -0
- data/spec/controllers/profiles_controller_spec.rb +2 -2
- data/spec/dummy/app/helpers/application_helper.rb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/db/schema.rb +108 -108
- data/spec/fixtures/events.yml +13 -39
- data/spec/models/user_import_file_spec.rb +17 -6
- data/vendor/assets/javascripts/jquery.colorbox.js +6 -6
- data/vendor/assets/javascripts/jquery.cookie.js +47 -26
- data/vendor/assets/javascripts/{jquery.mobile-1.4.4.js → jquery.mobile-1.4.5.js} +278 -228
- data/vendor/assets/stylesheets/{jquery.mobile-1.4.4.css → jquery.mobile-1.4.5.css} +7 -2
- metadata +198 -48
- data/spec/dummy/script/rails +0 -6
- data/spec/fixtures/series_has_manifestations.yml +0 -35
@@ -6,7 +6,7 @@
|
|
6
6
|
<h2 class="resource_title">
|
7
7
|
[U]
|
8
8
|
<%= @profile.user.username -%>
|
9
|
-
<% if @profile.full_name %>
|
9
|
+
<% if @profile.full_name? %>
|
10
10
|
(<%= @profile.full_name %>)
|
11
11
|
<% end %>
|
12
12
|
</h2>
|
@@ -18,32 +18,15 @@
|
|
18
18
|
<%- end -%>
|
19
19
|
|
20
20
|
<% if defined?(EnjuCirculation) %>
|
21
|
-
<h2
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<td>
|
31
|
-
<%= link_to checkout.item.item_identifier, checkout.item %><br />
|
32
|
-
(<%= link_to checkout.item.manifestation.original_title, checkout.item.manifestation %>)
|
33
|
-
</td>
|
34
|
-
<td>
|
35
|
-
<%=l checkout.due_date, formats: :only_date %>
|
36
|
-
<br />
|
37
|
-
<%- if can? :update, checkout -%>
|
38
|
-
<% unless checkout.checkin %>
|
39
|
-
(<%= link_to t('checkout.extend'), edit_checkout_path(checkout) -%>)
|
40
|
-
<% end %>
|
41
|
-
<%- end -%>
|
42
|
-
</td>
|
43
|
-
</tr>
|
44
|
-
<% end %>
|
45
|
-
<% end %>
|
46
|
-
</table>
|
21
|
+
<h2>
|
22
|
+
<%= t('activerecord.models.checkout') %>
|
23
|
+
<%= link_to image_tag('icons/date.png', size: '16x16', alt: 'iCalendar', class: 'icon'), checkouts_path(icalendar_token: current_user.profile.checkout_icalendar_token, format: :ics) if current_user.profile.checkout_icalendar_token? %>
|
24
|
+
<%= link_to image_tag('icons/feed.png', size: '16x16', alt: 'RSS', class: 'icon'), checkouts_path(user_id: current_user.username, format: :rss) %>
|
25
|
+
<%= link_to image_tag('icons/page_white_excel.png', size: '16x16', alt: 'TSV', class: 'icon'), checkouts_path(user_id: current_user.username, format: :txt) %>
|
26
|
+
</h2>
|
27
|
+
<% if @profile.user %>
|
28
|
+
<%= render 'checkouts/list', checkouts: @profile.user.checkouts.page(params[:page]) %>
|
29
|
+
<% end %>
|
47
30
|
<% end %>
|
48
31
|
</div>
|
49
32
|
</div>
|
@@ -19,13 +19,13 @@
|
|
19
19
|
<td><%= link_to user_export_file.id, user_export_file %></td>
|
20
20
|
<td><%= user_export_file.user.try(:username) %></td>
|
21
21
|
<td>
|
22
|
-
<%= link_to user_export_file.user_export_file_name, user_export_file
|
22
|
+
<%= link_to user_export_file.user_export_file_name, user_export_file_path(user_export_file, format: :download) if user_export_file.user_export_file_name %>
|
23
23
|
<br />
|
24
24
|
<%= user_export_file.created_at %>
|
25
25
|
</td>
|
26
26
|
<td><%= localized_state(user_export_file.current_state) -%></td>
|
27
27
|
<td>
|
28
|
-
<%= link_to t('page.destroy'), user_export_file,
|
28
|
+
<%= link_to t('page.destroy'), user_export_file, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
|
29
29
|
</td>
|
30
30
|
</tr>
|
31
31
|
<% end %>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
<p>
|
12
12
|
<strong><%= t('activerecord.attributes.user_export_file.user_export_file_name') -%></strong>
|
13
|
-
<%= link_to @user_export_file.user_export_file_name, @user_export_file
|
13
|
+
<%= link_to @user_export_file.user_export_file_name, user_export_file_path(@user_export_file, format: :download) if @user_export_file.user_export_file_name %>
|
14
14
|
</p>
|
15
15
|
|
16
16
|
<p>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<tr class="line<%= cycle("0", "1") -%>">
|
20
20
|
<td><%= link_to (user_import_file.id), user_import_file -%></td>
|
21
21
|
<td>
|
22
|
-
<%= link_to user_import_file.user_import_file_name, user_import_file
|
22
|
+
<%= link_to user_import_file.user_import_file_name, user_import_file_path(user_import_file, format: :download) if user_import_file.user_import_file_name %>
|
23
23
|
<br />
|
24
24
|
<%= t('activerecord.models.user') -%>: <%= link_to user_import_file.user.username, user_import_file.user.profile if user_import_file.user.try(:profile) -%></td>
|
25
25
|
<td><%= user_import_file.edit_mode -%></td>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
<p>
|
12
12
|
<strong><%= t('activerecord.attributes.user_import_file.user_import_file_name') -%>:</strong>
|
13
|
-
<%= link_to @user_import_file.user_import_file_name, user_import_file_path(@user_import_file, format: :download)
|
13
|
+
<%= link_to @user_import_file.user_import_file_name, user_import_file_path(@user_import_file, format: :download) if @user_import_file.user_import_file_name %>
|
14
14
|
</p>
|
15
15
|
|
16
16
|
<p>
|
@@ -28,10 +28,10 @@ module CalculateStat
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def send_message
|
31
|
-
sender = User.find(1)
|
31
|
+
sender = User.find(1) # system
|
32
32
|
message_template = MessageTemplate.localized_template('counting_completed', user.profile.locale)
|
33
33
|
request = MessageRequest.new
|
34
|
-
request.assign_attributes({:sender => sender, :receiver => user, :message_template => message_template}
|
34
|
+
request.assign_attributes({:sender => sender, :receiver => user, :message_template => message_template})
|
35
35
|
request.save_message_body
|
36
36
|
request.transition_to!(:sent)
|
37
37
|
end
|
data/lib/enju_leaf/engine.rb
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
require 'kaminari'
|
2
|
+
require 'devise'
|
3
|
+
require 'cancancan'
|
4
|
+
require 'acts_as_list'
|
5
|
+
require 'attribute_normalizer'
|
6
|
+
require 'friendly_id'
|
7
|
+
require 'addressable/uri'
|
8
|
+
require 'sunspot_rails'
|
9
|
+
require 'resque/server'
|
10
|
+
require 'settingslogic'
|
11
|
+
require 'nested_form'
|
1
12
|
require 'enju_biblio'
|
2
13
|
require 'enju_library'
|
3
14
|
require 'enju_manifestation_viewer'
|
@@ -8,7 +8,6 @@ module ExportFile
|
|
8
8
|
include InstanceMethods
|
9
9
|
belongs_to :user
|
10
10
|
validates :user, presence: true
|
11
|
-
attr_accessible :mode
|
12
11
|
attr_accessor :mode
|
13
12
|
end
|
14
13
|
end
|
@@ -18,7 +17,7 @@ module ExportFile
|
|
18
17
|
sender = User.find(1)
|
19
18
|
message_template = MessageTemplate.localized_template('export_completed', user.profile.locale)
|
20
19
|
request = MessageRequest.new
|
21
|
-
request.assign_attributes({:sender => sender, :receiver => user, :message_template => message_template}
|
20
|
+
request.assign_attributes({:sender => sender, :receiver => user, :message_template => message_template})
|
22
21
|
request.save_message_body
|
23
22
|
request.transition_to!(:sent)
|
24
23
|
end
|
@@ -53,7 +53,7 @@ module ImportFile
|
|
53
53
|
sender = User.find(1)
|
54
54
|
message_template = MessageTemplate.localized_template('import_completed', user.profile.locale)
|
55
55
|
request = MessageRequest.new
|
56
|
-
request.assign_attributes({:
|
56
|
+
request.assign_attributes({sender: sender, receiver: user, message_template: message_template})
|
57
57
|
request.save_message_body
|
58
58
|
request.transition_to!(:sent)
|
59
59
|
end
|
data/lib/enju_leaf/user.rb
CHANGED
@@ -9,22 +9,22 @@ module EnjuLeaf
|
|
9
9
|
include InstanceMethods
|
10
10
|
|
11
11
|
# Setup accessible (or protected) attributes for your model
|
12
|
-
attr_accessible :email, :password, :password_confirmation, :current_password,
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
attr_accessible :email, :password, :password_confirmation, :username,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
#attr_accessible :email, :password, :password_confirmation, :current_password,
|
13
|
+
# :remember_me, :email_confirmation,
|
14
|
+
# :auto_generated_password,
|
15
|
+
# :profile_attributes
|
16
|
+
#attr_accessible :email, :password, :password_confirmation, :username,
|
17
|
+
# :current_password, :remember_me,
|
18
|
+
# :email_confirmation,
|
19
|
+
# :expired_at, :locked, :role_id,
|
20
|
+
# :user_has_role_attributes, :auto_generated_password,
|
21
|
+
# :profile_attributes,
|
22
|
+
# :as => :admin
|
23
23
|
|
24
24
|
scope :administrators, -> { joins(:role).where('roles.name = ?', 'Administrator') }
|
25
25
|
scope :librarians, -> { joins(:role).where('roles.name = ? OR roles.name = ?', 'Administrator', 'Librarian') }
|
26
26
|
scope :suspended, -> { where('locked_at IS NOT NULL') }
|
27
|
-
has_one :profile
|
27
|
+
has_one :profile
|
28
28
|
if defined?(EnjuBiblio)
|
29
29
|
has_many :import_requests
|
30
30
|
has_many :picture_files, :as => :picture_attachable, :dependent => :destroy
|
@@ -98,19 +98,19 @@ module EnjuLeaf
|
|
98
98
|
lines = []
|
99
99
|
lines << u.username
|
100
100
|
lines << u.email
|
101
|
-
lines << u.profile.user_number
|
101
|
+
lines << u.try(:profile).try(:user_number)
|
102
102
|
lines << u.role.name
|
103
|
-
lines << u.profile.user_group.try(:name)
|
104
|
-
lines << u.profile.library.try(:name)
|
105
|
-
lines << u.profile.locale
|
103
|
+
lines << u.try(:profile).try(:user_group).try(:name)
|
104
|
+
lines << u.try(:profile).try(:library).try(:name)
|
105
|
+
lines << u.try(:profile).try(:locale)
|
106
106
|
lines << u.created_at
|
107
107
|
lines << u.updated_at
|
108
108
|
lines << u.expired_at
|
109
|
-
lines << u.profile.keyword_list.try(:split).try(:join, "//")
|
110
|
-
lines << u.profile.note
|
109
|
+
lines << u.try(:profile).try(:keyword_list).try(:split).try(:join, "//")
|
110
|
+
lines << u.try(:profile).try(:note)
|
111
111
|
if defined?(EnjuCirculation)
|
112
|
-
lines << u.profile.try(:checkout_icalendar_token)
|
113
|
-
lines << u.profile.try(:save_checkout_history)
|
112
|
+
lines << u.try(:profile).try(:checkout_icalendar_token)
|
113
|
+
lines << u.try(:profile).try(:save_checkout_history)
|
114
114
|
else
|
115
115
|
lines << nil
|
116
116
|
end
|
data/lib/enju_leaf/version.rb
CHANGED
@@ -22,15 +22,15 @@ EOS
|
|
22
22
|
append_to_file("Rakefile", "require 'resque/tasks'\n")
|
23
23
|
append_to_file("Rakefile", "require 'resque/scheduler/tasks'")
|
24
24
|
append_to_file("db/seeds.rb", File.open(File.expand_path('../templates', __FILE__) + '/db/seeds.rb').read)
|
25
|
-
|
26
|
-
"
|
27
|
-
|
28
|
-
|
29
|
-
"
|
30
|
-
|
31
|
-
|
32
|
-
"
|
33
|
-
|
25
|
+
application(nil, env: "development") do
|
26
|
+
"config.action_mailer.default_url_options = {host: 'localhost:3000'}\n"
|
27
|
+
end
|
28
|
+
application(nil, env: "test") do
|
29
|
+
"config.action_mailer.default_url_options = {host: 'localhost:3000'}\n"
|
30
|
+
end
|
31
|
+
application(nil, env: "production") do
|
32
|
+
"config.action_mailer.default_url_options = {host: 'localhost:3000'}\n"
|
33
|
+
end
|
34
34
|
generate("devise:install")
|
35
35
|
generate("devise", "User")
|
36
36
|
if Rails::VERSION::MAJOR >= 4
|
@@ -57,7 +57,6 @@ EOS
|
|
57
57
|
, :trackable, #:validatable,
|
58
58
|
:lockable, :lock_strategy => :none, :unlock_strategy => :none
|
59
59
|
enju_leaf_user_model
|
60
|
-
attr_accessible :username
|
61
60
|
EOS
|
62
61
|
inject_into_class "app/controllers/application_controller.rb", ApplicationController do
|
63
62
|
<<"EOS"
|
@@ -37,4 +37,9 @@ namespace :enju_leaf do
|
|
37
37
|
Rails::Engine.subclasses.each{|engine| engine.instance.eager_load!}
|
38
38
|
Rake::Task['sunspot:reindex'].execute(args)
|
39
39
|
end
|
40
|
+
|
41
|
+
desc 'Export items'
|
42
|
+
task :item => :environment do
|
43
|
+
puts Manifestation.export(format: :txt)
|
44
|
+
end
|
40
45
|
end
|
@@ -82,6 +82,7 @@ describe MyAccountsController do
|
|
82
82
|
before(:each) do
|
83
83
|
@attrs = {:user_attributes => {:email => 'newaddress@example.jp', :current_password => 'password'}, :locale => 'en'}
|
84
84
|
@invalid_attrs = {:user_attributes => {:username => ''}, :user_number => '日本語'}
|
85
|
+
@invalid_passwd_attrs = {:user_attributes => {:current_password=> ''}}
|
85
86
|
end
|
86
87
|
|
87
88
|
describe "When logged in as Administrator" do
|
@@ -123,6 +124,12 @@ describe MyAccountsController do
|
|
123
124
|
expect(response).to render_template("edit")
|
124
125
|
end
|
125
126
|
end
|
127
|
+
describe "with invalid password params" do
|
128
|
+
it "assigns the requested user as @user" do
|
129
|
+
put :update, profile: @invalid_passwd_attrs
|
130
|
+
expect(assigns(:profile).errors).not_to be_blank
|
131
|
+
end
|
132
|
+
end
|
126
133
|
end
|
127
134
|
|
128
135
|
describe "When logged in as Librarian" do
|
@@ -135,10 +142,12 @@ describe MyAccountsController do
|
|
135
142
|
|
136
143
|
describe "with valid params" do
|
137
144
|
it "updates the requested user" do
|
145
|
+
@attrs[:user_attributes][:id] = @user.id
|
138
146
|
put :update, profile: @attrs
|
139
147
|
end
|
140
148
|
|
141
149
|
it "assigns the requested user as @user" do
|
150
|
+
@attrs[:user_attributes][:id] = @user.id
|
142
151
|
put :update, profile: @attrs
|
143
152
|
expect(assigns(:profile)).to eq(@user.profile)
|
144
153
|
end
|
@@ -176,10 +185,12 @@ describe MyAccountsController do
|
|
176
185
|
|
177
186
|
describe "with valid params" do
|
178
187
|
it "updates the requested user" do
|
188
|
+
@attrs[:user_attributes][:id] = @user.id
|
179
189
|
put :update, profile: @attrs
|
180
190
|
end
|
181
191
|
|
182
192
|
it "assigns the requested user as @user" do
|
193
|
+
@attrs[:user_attributes][:id] = @user.id
|
183
194
|
put :update, profile: @attrs
|
184
195
|
expect(assigns(:profile)).to eq(@user.profile)
|
185
196
|
expect(response).to redirect_to(my_account_url)
|
@@ -394,7 +394,7 @@ describe ProfilesController do
|
|
394
394
|
end
|
395
395
|
|
396
396
|
it "should update myself" do
|
397
|
-
put :update, id: profiles(:user1).id, profile: { }
|
397
|
+
put :update, id: profiles(:user1).id, profile: {keyword_list: 'test'}
|
398
398
|
response.should redirect_to profile_url(assigns(:profile))
|
399
399
|
end
|
400
400
|
|
@@ -407,7 +407,7 @@ describe ProfilesController do
|
|
407
407
|
it "should not update my user_group" do
|
408
408
|
put :update, id: profiles(:user1).id, profile: {:user_group_id => 3, :library_id => 3}
|
409
409
|
response.should redirect_to profile_url(assigns(:profile))
|
410
|
-
assigns(:profile).
|
410
|
+
assigns(:profile).user_group_id.should eq 1
|
411
411
|
end
|
412
412
|
|
413
413
|
it "should not update my note" do
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|