enju_library 0.1.0.pre36 → 0.1.0.pre37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/accepts_controller.rb +3 -3
- data/app/controllers/libraries_controller.rb +5 -4
- data/app/controllers/library_groups_controller.rb +0 -1
- data/app/controllers/shelves_controller.rb +4 -4
- data/app/helpers/shelves_helper.rb +3 -4
- data/app/models/accept.rb +1 -1
- data/app/models/basket.rb +2 -2
- data/app/models/bookstore.rb +2 -2
- data/app/models/budget_type.rb +7 -1
- data/app/models/color.rb +22 -0
- data/app/models/enju_library/ability.rb +3 -3
- data/app/models/library.rb +20 -17
- data/app/models/library_group.rb +10 -4
- data/app/models/request_status_type.rb +7 -1
- data/app/models/request_type.rb +7 -1
- data/app/models/search_engine.rb +7 -7
- data/app/models/shelf.rb +5 -5
- data/app/models/subscription.rb +1 -1
- data/app/views/baskets/show.html.erb +2 -2
- data/app/views/libraries/_calendar.html.erb +6 -2
- data/app/views/libraries/show.html.erb +4 -4
- data/app/views/libraries/show.js.erb +1 -0
- data/app/views/library_groups/_form.html.erb +14 -5
- data/app/views/library_groups/show.html.erb +13 -0
- data/app/views/search_engines/index.html.erb +0 -1
- data/config/locales/translation_en.yml +1 -0
- data/config/locales/translation_ja.yml +1 -0
- data/db/migrate/20140821151023_create_colors.rb +14 -0
- data/lib/enju_library.rb +1 -1
- data/lib/enju_library/engine.rb +1 -0
- data/lib/enju_library/item.rb +3 -3
- data/lib/enju_library/version.rb +1 -1
- data/lib/generators/enju_library/setup/setup_generator.rb +2 -0
- data/lib/generators/enju_library/setup/templates/db/fixtures/colors.yml +25 -0
- data/lib/generators/enju_library/setup/templates/db/fixtures/request_types.yml +2 -0
- data/lib/tasks/color.rb +12 -0
- data/lib/tasks/enju_library_tasks.rake +10 -0
- data/spec/controllers/search_engines_controller_spec.rb +2 -2
- data/spec/controllers/subscribes_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/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/005_create_manifestations.rb +0 -1
- data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +1 -1
- data/spec/dummy/db/migrate/20140813182425_add_publication_place_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20140822114527_add_error_message_to_resource_import_result.rb +5 -0
- data/spec/dummy/db/migrate/20140823083524_add_extent_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20140823094847_add_dimensions_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20140823095740_rename_manifestation_periodical_to_serial.rb +9 -0
- data/spec/dummy/db/schema.rb +18 -4
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/default/data/index/_21e.fdt +0 -0
- data/spec/dummy/solr/default/data/index/{_1we.fdx → _21e.fdx} +0 -0
- data/spec/dummy/solr/default/data/index/{_1we.fnm → _21e.fnm} +0 -0
- data/spec/dummy/solr/default/data/index/{_1we.nvd → _21e.nvd} +0 -0
- data/spec/dummy/solr/default/data/index/{_1we.nvm → _21e.nvm} +0 -0
- data/spec/dummy/solr/default/data/index/{_1we.si → _21e.si} +0 -0
- data/spec/dummy/solr/default/data/index/{_1we_Lucene41_0.doc → _21e_Lucene41_0.doc} +0 -0
- data/spec/dummy/solr/default/data/index/{_1we_Lucene41_0.pos → _21e_Lucene41_0.pos} +0 -0
- data/spec/dummy/solr/default/data/index/_21e_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/default/data/index/{_1we_Lucene41_0.tip → _21e_Lucene41_0.tip} +0 -0
- data/spec/dummy/solr/default/data/index/segments.gen +0 -0
- data/spec/dummy/solr/default/data/index/segments_3j2 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004563 +0 -0
- data/spec/dummy/solr/default/data/tlog/{tlog.0000000000000004156 → tlog.0000000000000004564} +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004565 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004566 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004567 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004568 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004569 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004570 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004571 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004572 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/116f3db2d9d60864a0e9bf0e9eea12c1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1f84f73be56154eba5c29f8ef2ac2177 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9858160e3e612357dced457d860640d7 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b561c7bed91703077a14b29a73432edc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ebc83b1f2325c61a70d933aa7a17df5a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f10609df7ed708c7c5c0efb7f12402f8 +0 -0
- data/spec/fixtures/colors.yml +38 -0
- data/spec/fixtures/manifestations.yml +0 -1
- data/spec/fixtures/users.yml +1 -1
- data/spec/support/vcr.rb +3 -3
- metadata +90 -73
- data/spec/dummy/solr/default/data/index/_1we.fdt +0 -0
- data/spec/dummy/solr/default/data/index/_1we_Lucene41_0.tim +0 -0
- data/spec/dummy/solr/default/data/index/segments_37q +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004155 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004157 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004158 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004159 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004160 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004161 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004162 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004163 +0 -0
- data/spec/dummy/solr/default/data/tlog/tlog.0000000000000004164 +0 -0
data/app/models/subscription.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
<p>
|
7
7
|
<strong><%= t('activerecord.models.user') -%>:</strong>
|
8
|
-
<%= @basket.user.username -%>
|
8
|
+
<%= @basket.user.try(:username) -%>
|
9
9
|
</p>
|
10
10
|
|
11
11
|
<p>
|
@@ -18,6 +18,6 @@
|
|
18
18
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
19
19
|
<ul>
|
20
20
|
<li><%= link_to t('page.edit'), edit_basket_path(@basket) -%></li>
|
21
|
-
<li><%= link_to t('page.back'),
|
21
|
+
<li><%= link_to t('page.back'), baskets_path(user_id: @basket.user_id) -%></li>
|
22
22
|
</ul>
|
23
23
|
</div>
|
@@ -1,10 +1,14 @@
|
|
1
1
|
<div id="event_list">
|
2
|
-
(<%= link_to t('page.calendar'),
|
2
|
+
(<%= link_to t('page.calendar'), events_path(library_id: @library.name, mode: 'calendar') -%>)
|
3
3
|
<ul>
|
4
4
|
<%- @events.each do |event| -%>
|
5
5
|
<li>
|
6
6
|
<%= link_to event.display_name.localize, event -%>
|
7
|
-
|
7
|
+
<% if event.all_day? %>
|
8
|
+
(<%= l(event.start_at, format: :only_date) -%> - <%= l(event.end_at, format: :only_date) -%>)
|
9
|
+
<% else %>
|
10
|
+
(<%= l(event.start_at) -%> - <%= l(event.end_at) -%>)
|
11
|
+
<% end %>
|
8
12
|
</li>
|
9
13
|
<%- end -%>
|
10
14
|
</ul>
|
@@ -42,11 +42,11 @@
|
|
42
42
|
<%= render 'libraries/map', library: @library if @library.latitude and @library.longitude -%>
|
43
43
|
</div>
|
44
44
|
<div id="tab2">
|
45
|
-
<%- if @library.
|
45
|
+
<%- if @library.profiles.librarians.exists? -%>
|
46
46
|
<ul>
|
47
|
-
<%- @library.
|
47
|
+
<%- @library.profiles.librarians.each do |librarian| -%>
|
48
48
|
<li>
|
49
|
-
<%= link_to librarian.username, librarian
|
49
|
+
<%= link_to librarian.user.username, librarian -%>
|
50
50
|
<%- unless librarian.note.blank? -%>
|
51
51
|
<br />
|
52
52
|
<%= librarian.note -%>
|
@@ -86,7 +86,7 @@
|
|
86
86
|
|
87
87
|
<% if defined?(EnjuEvent) %>
|
88
88
|
<div id="tab4">
|
89
|
-
<h3><%= link_to t('activerecord.models.event'),
|
89
|
+
<h3><%= link_to t('activerecord.models.event'), events_path(library_id: @library.name) -%></h3>
|
90
90
|
<div id="library_calendar" style="text-align:left">
|
91
91
|
<%= render 'calendar' -%>
|
92
92
|
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
$("#library_calendar").html("<%= escape_javascript(render("calendar")) %>");
|
@@ -26,6 +26,20 @@
|
|
26
26
|
<%= f.text_area :login_banner -%>
|
27
27
|
</div>
|
28
28
|
|
29
|
+
<div class="field">
|
30
|
+
<%= f.label :color -%><br />
|
31
|
+
<%= f.fields_for :colors do |color_form| %>
|
32
|
+
<%= color_form.text_field :property, disabled: true %>
|
33
|
+
<%= color_form.text_field :code %>
|
34
|
+
<br />
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="field">
|
39
|
+
<%= f.label t('activerecord.models.country') -%><br />
|
40
|
+
<%= f.select(:country_id, @countries.collect{|c| [c.display_name.localize, c.id]}) -%>
|
41
|
+
</div>
|
42
|
+
|
29
43
|
<% if defined?(EnjuBookmark) %>
|
30
44
|
<div class="field">
|
31
45
|
<%= f.label :allow_bookmark_external_url -%>
|
@@ -48,11 +62,6 @@
|
|
48
62
|
<%= f.text_area :note -%>
|
49
63
|
</div>
|
50
64
|
|
51
|
-
<div class="field">
|
52
|
-
<%= f.label t('activerecord.models.country') -%><br />
|
53
|
-
<%= f.select(:country_id, @countries.collect{|c| [c.display_name.localize, c.id]}) -%>
|
54
|
-
</div>
|
55
|
-
|
56
65
|
<div class="actions">
|
57
66
|
<%= f.submit %>
|
58
67
|
</div>
|
@@ -28,6 +28,19 @@
|
|
28
28
|
<%= markdown_helper(@library_group.login_banner) -%>
|
29
29
|
</div>
|
30
30
|
|
31
|
+
<div>
|
32
|
+
<strong><%= t('activerecord.attributes.library_group.color') -%>:</strong>
|
33
|
+
<ul>
|
34
|
+
<% @library_group.colors.each do |color| %>
|
35
|
+
<li>
|
36
|
+
<%= color.property %>:
|
37
|
+
<span style="color: transparent; background-color: #<%= color.code %>">sample</span>
|
38
|
+
( <%= color.code %> )
|
39
|
+
</li>
|
40
|
+
<% end %>
|
41
|
+
</ul>
|
42
|
+
</div>
|
43
|
+
|
31
44
|
<% if defined?(EnjuBookmark) %>
|
32
45
|
<p>
|
33
46
|
<strong><%= t('activerecord.attributes.library_group.allow_bookmark_external_url') -%>:</strong>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateColors < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :colors do |t|
|
4
|
+
t.integer :library_group_id
|
5
|
+
t.string :property
|
6
|
+
t.string :code
|
7
|
+
t.integer :position
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
|
12
|
+
add_index :colors, :library_group_id
|
13
|
+
end
|
14
|
+
end
|
data/lib/enju_library.rb
CHANGED
data/lib/enju_library/engine.rb
CHANGED
data/lib/enju_library/item.rb
CHANGED
@@ -10,7 +10,7 @@ module EnjuLibrary
|
|
10
10
|
has_one :accept
|
11
11
|
scope :accepted_between, lambda{|from, to| includes(:accept).where('items.created_at BETWEEN ? AND ?', Time.zone.parse(from).beginning_of_day, Time.zone.parse(to).end_of_day)}
|
12
12
|
|
13
|
-
belongs_to :shelf, :
|
13
|
+
belongs_to :shelf, counter_cache: true, validate: true
|
14
14
|
validates_associated :shelf
|
15
15
|
|
16
16
|
searchable do
|
@@ -27,12 +27,12 @@ module EnjuLibrary
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def hold?(library)
|
30
|
-
return true if
|
30
|
+
return true if shelf.library == library
|
31
31
|
false
|
32
32
|
end
|
33
33
|
|
34
34
|
def library_url
|
35
|
-
"#{LibraryGroup.site_config.url}libraries/#{
|
35
|
+
"#{LibraryGroup.site_config.url}libraries/#{shelf.library.name}"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/enju_library/version.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
class EnjuLibrary::SetupGenerator < Rails::Generators::Base
|
2
2
|
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
argument :file, :type => :string, :default => "all"
|
3
4
|
|
4
5
|
def copy_setup_files
|
5
6
|
directory("db/fixtures", "db/fixtures/enju_library")
|
7
|
+
return if file == 'fixture'
|
6
8
|
rake("enju_library_engine:install:migrations")
|
7
9
|
end
|
8
10
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
color_00001:
|
3
|
+
property: header_title
|
4
|
+
code: "5970B2"
|
5
|
+
id: 1
|
6
|
+
position: 1
|
7
|
+
library_group_id: 1
|
8
|
+
color_00002:
|
9
|
+
property: table_line0
|
10
|
+
code: "d7ebf9"
|
11
|
+
id: 2
|
12
|
+
position: 2
|
13
|
+
library_group_id: 1
|
14
|
+
color_00003:
|
15
|
+
property: table_line1
|
16
|
+
code: "ffffff"
|
17
|
+
id: 3
|
18
|
+
position: 3
|
19
|
+
library_group_id: 1
|
20
|
+
color_00004:
|
21
|
+
property: table_border
|
22
|
+
code: "2779aa"
|
23
|
+
id: 4
|
24
|
+
position: 4
|
25
|
+
library_group_id: 1
|
@@ -14,11 +14,13 @@ request_type_00002:
|
|
14
14
|
request_type_00003:
|
15
15
|
name: Loan
|
16
16
|
display_name: Loan
|
17
|
+
id: 3
|
17
18
|
position: 3
|
18
19
|
note: ""
|
19
20
|
request_type_00004:
|
20
21
|
name: Non-Returnable Copy
|
21
22
|
display_name: Non-Returnable Copy
|
23
|
+
id: 4
|
22
24
|
position: 4
|
23
25
|
note: ""
|
24
26
|
request_type_00005:
|
data/lib/tasks/color.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
def update_color
|
2
|
+
colors = YAML.load(open('db/fixtures/enju_library/colors.yml').read)
|
3
|
+
library_group = LibraryGroup.site_config
|
4
|
+
colors.each do |line|
|
5
|
+
l = line[1].select!{|k, v| %w(property code).include?(k)}
|
6
|
+
color = Color.where(property: l["property"]).first
|
7
|
+
unless color
|
8
|
+
color = Color.create!(l)
|
9
|
+
library_group.colors << color
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'active_record/fixtures'
|
2
|
+
require 'tasks/color'
|
3
|
+
|
2
4
|
desc "create initial records for enju_library"
|
3
5
|
namespace :enju_library do
|
4
6
|
task :setup => :environment do
|
@@ -6,4 +8,12 @@ namespace :enju_library do
|
|
6
8
|
ActiveRecord::Fixtures.create_fixtures('db/fixtures/enju_library', File.basename(file, '.*'))
|
7
9
|
end
|
8
10
|
end
|
11
|
+
|
12
|
+
desc "upgrade enju_library"
|
13
|
+
task :upgrade => :environment do
|
14
|
+
LibraryGroup.transaction do
|
15
|
+
update_color
|
16
|
+
end
|
17
|
+
puts 'enju_library: The upgrade completed successfully.'
|
18
|
+
end
|
9
19
|
end
|
@@ -19,7 +19,7 @@ describe SearchEnginesController do
|
|
19
19
|
|
20
20
|
it "assigns all search_engines as @search_engines" do
|
21
21
|
get :index
|
22
|
-
assigns(:search_engines).should eq(SearchEngine.
|
22
|
+
assigns(:search_engines).should eq(SearchEngine.all)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -28,7 +28,7 @@ describe SearchEnginesController do
|
|
28
28
|
|
29
29
|
it "assigns all search_engines as @search_engines" do
|
30
30
|
get :index
|
31
|
-
assigns(:search_engines).should eq(SearchEngine.
|
31
|
+
assigns(:search_engines).should eq(SearchEngine.all)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -17,7 +17,7 @@ describe SubscribesController do
|
|
17
17
|
|
18
18
|
it "assigns all subscribes as @subscribes" do
|
19
19
|
get :index
|
20
|
-
assigns(:subscribes).should eq(Subscribe.
|
20
|
+
assigns(:subscribes).should eq(Subscribe.page(1))
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -26,7 +26,7 @@ describe SubscribesController do
|
|
26
26
|
|
27
27
|
it "assigns all subscribes as @subscribes" do
|
28
28
|
get :index
|
29
|
-
assigns(:subscribes).should eq(Subscribe.
|
29
|
+
assigns(:subscribes).should eq(Subscribe.page(1))
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
|
2
|
+
gemfile = ENV['BUNDLE_GEMFILE'] || File.expand_path('../../../../Gemfile', __FILE__)
|
3
3
|
|
4
4
|
if File.exist?(gemfile)
|
5
5
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
@@ -7,4 +7,4 @@ if File.exist?(gemfile)
|
|
7
7
|
Bundler.setup
|
8
8
|
end
|
9
9
|
|
10
|
-
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
10
|
+
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# FriendlyId Global Configuration
|
2
|
+
#
|
3
|
+
# Use this to set up shared configuration options for your entire application.
|
4
|
+
# Any of the configuration options shown here can also be applied to single
|
5
|
+
# models by passing arguments to the `friendly_id` class method or defining
|
6
|
+
# methods in your model.
|
7
|
+
#
|
8
|
+
# To learn more, check out the guide:
|
9
|
+
#
|
10
|
+
# http://norman.github.io/friendly_id/file.Guide.html
|
11
|
+
|
12
|
+
if Rails::VERSION::MAJOR == 4
|
13
|
+
FriendlyId.defaults do |config|
|
14
|
+
# ## Reserved Words
|
15
|
+
#
|
16
|
+
# Some words could conflict with Rails's routes when used as slugs, or are
|
17
|
+
# undesirable to allow as slugs. Edit this list as needed for your app.
|
18
|
+
config.use :reserved
|
19
|
+
|
20
|
+
config.reserved_words = %w(new edit index session login logout users admin
|
21
|
+
stylesheets assets javascripts images)
|
22
|
+
|
23
|
+
# ## Friendly Finders
|
24
|
+
#
|
25
|
+
# Uncomment this to use friendly finders in all models. By default, if
|
26
|
+
# you wish to find a record by its friendly id, you must do:
|
27
|
+
#
|
28
|
+
# MyModel.friendly.find('foo')
|
29
|
+
#
|
30
|
+
# If you uncomment this, you can do:
|
31
|
+
#
|
32
|
+
# MyModel.find('foo')
|
33
|
+
#
|
34
|
+
# This is significantly more convenient but may not be appropriate for
|
35
|
+
# all applications, so you must explicity opt-in to this behavior. You can
|
36
|
+
# always also configure it on a per-model basis if you prefer.
|
37
|
+
#
|
38
|
+
# Something else to consider is that using the :finders addon boosts
|
39
|
+
# performance because it will avoid Rails-internal code that makes runtime
|
40
|
+
# calls to `Module.extend`.
|
41
|
+
#
|
42
|
+
config.use :finders
|
43
|
+
#
|
44
|
+
# ## Slugs
|
45
|
+
#
|
46
|
+
# Most applications will use the :slugged module everywhere. If you wish
|
47
|
+
# to do so, uncomment the following line.
|
48
|
+
#
|
49
|
+
# config.use :slugged
|
50
|
+
#
|
51
|
+
# By default, FriendlyId's :slugged addon expects the slug column to be named
|
52
|
+
# 'slug', but you can change it if you wish.
|
53
|
+
#
|
54
|
+
# config.slug_column = 'slug'
|
55
|
+
#
|
56
|
+
# When FriendlyId can not generate a unique ID from your base method, it appends
|
57
|
+
# a UUID, separated by a single dash. You can configure the character used as the
|
58
|
+
# separator. If you're upgrading from FriendlyId 4, you may wish to replace this
|
59
|
+
# with two dashes.
|
60
|
+
#
|
61
|
+
# config.sequence_separator = '-'
|
62
|
+
#
|
63
|
+
# ## Tips and Tricks
|
64
|
+
#
|
65
|
+
# ### Controlling when slugs are generated
|
66
|
+
#
|
67
|
+
# As of FriendlyId 5.0, new slugs are generated only when the slug field is
|
68
|
+
# nil, but if you're using a column as your base method can change this
|
69
|
+
# behavior by overriding the `should_generate_new_friendly_id` method that
|
70
|
+
# FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
|
71
|
+
# more like 4.0.
|
72
|
+
#
|
73
|
+
# config.use Module.new {
|
74
|
+
# def should_generate_new_friendly_id?
|
75
|
+
# slug.blank? || <your_column_name_here>_changed?
|
76
|
+
# end
|
77
|
+
# }
|
78
|
+
#
|
79
|
+
# FriendlyId uses Rails's `parameterize` method to generate slugs, but for
|
80
|
+
# languages that don't use the Roman alphabet, that's not usually suffient. Here
|
81
|
+
# we use the Babosa library to transliterate Russian Cyrillic slugs to ASCII. If
|
82
|
+
# you use this, don't forget to add "babosa" to your Gemfile.
|
83
|
+
#
|
84
|
+
# config.use Module.new {
|
85
|
+
# def normalize_friendly_id(text)
|
86
|
+
# text.to_slug.normalize! :transliterations => [:russian, :latin]
|
87
|
+
# end
|
88
|
+
# }
|
89
|
+
end
|
90
|
+
end
|
Binary file
|