ad_space 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6552473161a7eceadac915dd6897683768efff30c2148c2c40c0d2d39fcc61c3
4
- data.tar.gz: 8a2c9e2c6e90076284ec470ffbeb2a4ced4fe3b5dea072402a05b593464feea3
3
+ metadata.gz: f5fd64d01bfc45cc173f1e95fbaea9b6ac23291e37feb5c072f7f9477bb651ce
4
+ data.tar.gz: 21c7b3e8506219e0bf6f6ad2c979b1ee2de5d71cb56d4804b8948cfebc958d64
5
5
  SHA512:
6
- metadata.gz: 04eb5e4c04072d15f59146b9db38f8adececbfbf542cd6759443b0f3b962384bf723e184b362c38e3a0ac9ee0e76e457e3c6e9cc611d2e4bf0e5aab11ce10e91
7
- data.tar.gz: f28da1ba96cffa665b9a10220a9cb491f45555919e9f2e418312efb74c252cb46259d5213e09a2aa4f022fcb50c5fec0fb56a758cd15a3c2b4f410086eafdc06
6
+ metadata.gz: c8e5f37efeaf85765b65ae4c5d487fec4df002bbcc5074edaa1501fe88c80daf2c30092ec2b44265473dc1b6b8bdafb723539321e4c85afa2f304cfd52d9665b
7
+ data.tar.gz: 5bb47c04044cf966c4a7b6f65a98213a9e61cb61ad2bffd2ac689f67f726f8f69bec23cf3c591babcc7c2f9622bc6a60684674cf14461cf9fb0a234a07dfa93a
data/Gemfile CHANGED
@@ -19,4 +19,6 @@ gem 'stimulus-rails'
19
19
 
20
20
  group :development do
21
21
  gem "pg"
22
+
23
+ gem "i18n-tasks"
22
24
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ad_space (0.1.4)
4
+ ad_space (0.1.6)
5
5
  active_model_serializers
6
6
  dotenv-rails
7
7
  rails (>= 7.1.1)
@@ -88,7 +88,15 @@ GEM
88
88
  minitest (>= 5.1)
89
89
  mutex_m
90
90
  tzinfo (~> 2.0)
91
+ ast (2.4.2)
91
92
  base64 (0.1.1)
93
+ better_html (2.0.2)
94
+ actionview (>= 6.0)
95
+ activesupport (>= 6.0)
96
+ ast (~> 2.0)
97
+ erubi (~> 1.4)
98
+ parser (>= 2.4)
99
+ smart_properties
92
100
  bigdecimal (3.1.4)
93
101
  builder (3.2.4)
94
102
  case_transform (0.2)
@@ -111,8 +119,20 @@ GEM
111
119
  erubi (1.12.0)
112
120
  globalid (1.2.1)
113
121
  activesupport (>= 6.1)
122
+ highline (2.1.0)
114
123
  i18n (1.14.1)
115
124
  concurrent-ruby (~> 1.0)
125
+ i18n-tasks (1.0.13)
126
+ activesupport (>= 4.0.2)
127
+ ast (>= 2.1.0)
128
+ better_html (>= 1.0, < 3.0)
129
+ erubi
130
+ highline (>= 2.0.0)
131
+ i18n
132
+ parser (>= 3.2.2.1)
133
+ rails-i18n
134
+ rainbow (>= 2.2.2, < 4.0)
135
+ terminal-table (>= 1.5.1)
116
136
  io-console (0.6.0)
117
137
  irb (1.8.3)
118
138
  rdoc
@@ -146,6 +166,9 @@ GEM
146
166
  racc (~> 1.4)
147
167
  nokogiri (1.15.4-x86_64-linux)
148
168
  racc (~> 1.4)
169
+ parser (3.2.2.4)
170
+ ast (~> 2.4.1)
171
+ racc
149
172
  pg (1.5.4)
150
173
  psych (5.1.1.1)
151
174
  stringio
@@ -181,6 +204,9 @@ GEM
181
204
  rails-html-sanitizer (1.6.0)
182
205
  loofah (~> 2.21)
183
206
  nokogiri (~> 1.14)
207
+ rails-i18n (7.0.8)
208
+ i18n (>= 0.7, < 2)
209
+ railties (>= 6.0.0, < 8)
184
210
  railties (7.1.1)
185
211
  actionpack (= 7.1.1)
186
212
  activesupport (= 7.1.1)
@@ -189,12 +215,14 @@ GEM
189
215
  rake (>= 12.2)
190
216
  thor (~> 1.0, >= 1.2.2)
191
217
  zeitwerk (~> 2.6)
218
+ rainbow (3.1.1)
192
219
  rake (13.0.6)
193
220
  rdoc (6.5.0)
194
221
  psych (>= 4.0.0)
195
222
  reline (0.3.9)
196
223
  io-console (~> 0.5)
197
224
  ruby2_keywords (0.0.5)
225
+ smart_properties (1.17.0)
198
226
  sprockets (4.2.1)
199
227
  concurrent-ruby (~> 1.0)
200
228
  rack (>= 2.2.4, < 4)
@@ -207,6 +235,8 @@ GEM
207
235
  stimulus-rails (1.3.0)
208
236
  railties (>= 6.0.0)
209
237
  stringio (3.0.8)
238
+ terminal-table (3.0.2)
239
+ unicode-display_width (>= 1.1.1, < 3)
210
240
  thor (1.3.0)
211
241
  timeout (0.4.0)
212
242
  turbo-rails (1.5.0)
@@ -215,6 +245,7 @@ GEM
215
245
  railties (>= 6.0.0)
216
246
  tzinfo (2.0.6)
217
247
  concurrent-ruby (~> 1.0)
248
+ unicode-display_width (2.5.0)
218
249
  webrick (1.8.1)
219
250
  websocket-driver (0.7.6)
220
251
  websocket-extensions (>= 0.1.0)
@@ -229,6 +260,7 @@ DEPENDENCIES
229
260
  ad_space!
230
261
  cssbundling-rails
231
262
  debug (>= 1.0.0)
263
+ i18n-tasks
232
264
  jsbundling-rails
233
265
  pg
234
266
  puma
data/ad_space.gemspec CHANGED
@@ -14,9 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.metadata["source_code_uri"] = spec.homepage
15
15
  spec.metadata["changelog_uri"] = spec.homepage
16
16
 
17
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
- Dir["{app,config,db,lib, public}/**/*", "MIT-LICENSE", "Rakefile", "README.md", "Gemfile", "Gemfile.lock", "ad_space.gemspec"]
19
- end
17
+ spec.files = Dir["{bin,app,config,db,lib,public}/**/*", "MIT-LICENSE", "Rakefile", "README.md", "ad_space.gemspec", "Gemfile", "Gemfile.lock"]
20
18
 
21
19
  spec.add_dependency "rails", ">= 7.1.1"
22
20
  spec.add_dependency "active_model_serializers"
@@ -6,22 +6,25 @@ module AdSpace
6
6
  def index
7
7
  @advertisements = Advertisement.all
8
8
 
9
- add_breadcrumb("Home", root_path)
9
+ add_breadcrumb(t("home"), root_path)
10
10
  end
11
11
 
12
12
  # GET /advertisements/1
13
13
  def show
14
- add_breadcrumb("Home", root_path)
15
- add_breadcrumb("Advertisements", advertisements_path)
14
+ add_breadcrumb(t("home"), root_path)
15
+ add_breadcrumb(t("advertisements"), advertisements_path)
16
16
  end
17
17
 
18
18
  # GET /advertisements/new
19
19
  def new
20
20
  @advertisement = Advertisement.new
21
+
22
+ add_breadcrumb(t("home"), root_path)
21
23
  end
22
24
 
23
25
  # GET /advertisements/1/edit
24
26
  def edit
27
+ add_breadcrumb(t("home"), root_path)
25
28
  end
26
29
 
27
30
  # POST /advertisements
@@ -2,6 +2,27 @@ class AdSpace::Api::V1::AdvertisementsController < ActionController::API
2
2
  # before_action :prepare_params!, only: %w[index]
3
3
 
4
4
  def index
5
+ builder = AdSpace::Advertisement.includes(:slot).where(platform: params[:platform])
6
+ builder = builder.published.unexpired
7
+ builder = builder.where(slot_id: params[:slot_ids].split(",")) unless params[:slot_ids].blank?
8
+
9
+ # TODO: 动态可配置,不同项目可以自定义特殊的查询条件,基于builder
10
+ # 0. 判断是否有配置动态用户信息,proc
11
+ # 1. 通过token获取用户信息 proc
12
+ # 2. 通过用户信息判断用户是否为会员
13
+ # 3. 如果是会员,则不展示广告位为“开屏广告”的广告
14
+ # 4. 如果不是会员,则展示所有广告
15
+ # 5. 如果没有配置动态用户信息,则展示所有广告
16
+ # has_paid 开屏逻辑、member 逻辑
17
+ # token = ApiKey.get_token(params[:token])
18
+ # if token.present?
19
+ # current_user = token.user
20
+ # if current_user && current_user&.paid?
21
+ # # 写死 slot_id
22
+ # builder = builder.where.not(position_code: '10003')
23
+ # end
24
+ # end
25
+
5
26
  width = params[:screen_width].to_f
6
27
  height = params[:screen_height].to_f
7
28
  screen_ratio = width.zero? ? 0 : height / width
@@ -13,15 +34,6 @@ class AdSpace::Api::V1::AdvertisementsController < ActionController::API
13
34
  "large"
14
35
  end
15
36
 
16
- builder = AdSpace::Advertisement.includes(:slot).where(platform: params[:platform])
17
- builder = builder.published.unexpired
18
- builder = builder.where(slot_id: params[:slot_ids].split(",")) unless params[:slot_ids].blank?
19
-
20
- # TODO: 动态可配置,不同项目可以自定义特殊的查询条件,基于builder
21
- # if current_user && current_user&.is_member?
22
- # builder = builder.where.not(position_code: '10003')
23
- # end
24
-
25
37
  unless params[:version_code].blank?
26
38
  array = [0]
27
39
  array.push(params[:version_code].to_i)
@@ -1,6 +1,7 @@
1
1
  module AdSpace
2
2
  class ApplicationController < ActionController::Base
3
3
  helper_method :_current_user
4
+ around_action :use_ad_space_locale
4
5
 
5
6
  before_action :init_app
6
7
 
@@ -26,5 +27,38 @@ module AdSpace
26
27
  def add_breadcrumb(name, path = nil)
27
28
  breadcrumbs << AdSpace::Breadcrumb.new(name, path)
28
29
  end
30
+
31
+ private
32
+
33
+ def default_url_options(options = {})
34
+ { locale: I18n.locale }.merge(options)
35
+ end
36
+
37
+ def use_ad_space_locale(&action)
38
+ @original_i18n_config = I18n.config
39
+ I18n.config = ::AdSpace::I18nConfig.new
40
+ I18n.with_locale(current_locale, &action)
41
+ ensure
42
+ I18n.config = @original_i18n_config
43
+ @original_i18n_config = nil
44
+ end
45
+
46
+ def use_original_locale
47
+ prev_config = I18n.config
48
+ I18n.config = @original_i18n_config if @original_i18n_config
49
+ yield
50
+ ensure
51
+ I18n.config = prev_config
52
+ end
53
+
54
+ def current_locale
55
+ if request.GET['locale']
56
+ request.GET['locale']
57
+ elsif params[:locale]
58
+ params[:locale]
59
+ else
60
+ I18n.default_locale
61
+ end
62
+ end
29
63
  end
30
64
  end
@@ -6,22 +6,25 @@ module AdSpace
6
6
  def index
7
7
  @slots = Slot.all
8
8
 
9
- add_breadcrumb("Home", root_path)
9
+ add_breadcrumb(t("home"), root_path)
10
10
  end
11
11
 
12
12
  # GET /slots/1
13
13
  def show
14
- add_breadcrumb("Home", root_path)
15
- add_breadcrumb("Slots", slots_path)
14
+ add_breadcrumb(t("home"), root_path)
15
+ add_breadcrumb(t("slots"), slots_path)
16
16
  end
17
17
 
18
18
  # GET /slots/new
19
19
  def new
20
20
  @slot = Slot.new
21
+
22
+ add_breadcrumb(t("home"), root_path)
21
23
  end
22
24
 
23
25
  # GET /slots/1/edit
24
26
  def edit
27
+ add_breadcrumb(t("home"), root_path)
25
28
  end
26
29
 
27
30
  # POST /slots
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AdSpace
4
+ class I18nConfig < ::I18n::Config
5
+ BACKEND = I18n::Backend::Simple.new
6
+ AVAILABLE_LOCALES = AdSpace::Engine.root.join("config/locales").glob("*.yml").map { |path| File.basename(path, ".yml").to_sym }.uniq
7
+ AVAILABLE_LOCALES_SET = AVAILABLE_LOCALES.inject(Set.new) { |set, locale| set << locale.to_s << locale.to_sym }
8
+
9
+ def backend
10
+ BACKEND
11
+ end
12
+
13
+ def available_locales
14
+ AVAILABLE_LOCALES
15
+ end
16
+
17
+ def available_locales_set
18
+ AVAILABLE_LOCALES_SET
19
+ end
20
+
21
+ def default_locale
22
+ AdSpace.configuration.dashboard_default_locale
23
+ end
24
+ end
25
+ end
@@ -55,21 +55,6 @@
55
55
  <%= advertisement.remark %>
56
56
  </p>
57
57
 
58
- <p>
59
- <strong>Pv count:</strong>
60
- <%= advertisement.pv_count %>
61
- </p>
62
-
63
- <p>
64
- <strong>Uv count:</strong>
65
- <%= advertisement.uv_count %>
66
- </p>
67
-
68
- <p>
69
- <strong>Click count:</strong>
70
- <%= advertisement.click_count %>
71
- </p>
72
-
73
58
  <% if advertisement.cover_sm.attached? %>
74
59
  <p>
75
60
  <strong>Small Cover Image:</strong>
@@ -13,7 +13,7 @@
13
13
 
14
14
  <div>
15
15
  <%= form.label :platform, style: "display: block" %>
16
- <%= form.select :platform, AdSpace::Advertisement.platforms.keys.map { |platform| [platform.capitalize, platform] } %>
16
+ <%= form.select :platform, AdSpace::Advertisement.platforms.keys.map { |platform| [t("activerecord.enums.ad_space/advertisement.platform.#{platform}"), platform] } %>
17
17
  </div>
18
18
 
19
19
  <div>
@@ -22,7 +22,7 @@
22
22
  </div>
23
23
 
24
24
  <div>
25
- <%= form.label :slot_id, "Slot", style: "display: block" %>
25
+ <%= form.label :slot_id, style: "display: block" %>
26
26
  <%= form.select :slot_id, options_for_select(
27
27
  AdSpace::Slot.all.map { |s| [s.name, s.id, data: { is_splash: s.splash? }] },
28
28
  advertisement.slot_id,
@@ -31,7 +31,7 @@
31
31
 
32
32
  <div>
33
33
  <%= form.label :visibility, style: "display: block" %>
34
- <%= form.select :visibility, AdSpace::Advertisement.visibilities.keys.map { |key| [key.humanize, key] } %>
34
+ <%= form.select :visibility, AdSpace::Advertisement.visibilities.keys.map { |key| [t("activerecord.enums.ad_space/advertisement.visibility.#{key}"), key] } %>
35
35
  </div>
36
36
 
37
37
  <div>
@@ -52,7 +52,7 @@
52
52
  <div>
53
53
  <%= form.label :ad_type, style: "display: block" %>
54
54
  <%= form.select :ad_type,
55
- AdSpace::Advertisement.ad_types.keys.map { |key| [key.humanize, key] },
55
+ AdSpace::Advertisement.ad_types.keys.map { |key| [t("activerecord.enums.ad_space/advertisement.ad_type.#{key}"), key] },
56
56
  {},
57
57
  data: { hello_target: "adType", action: "hello#handleAdTypeChnage" }
58
58
  %>
@@ -60,7 +60,7 @@
60
60
 
61
61
  <div>
62
62
  <%= form.label :dsp_type, style: "display: block" %>
63
- <%= form.select :dsp_type, AdSpace::Advertisement.dsp_types.keys.map { |key| [key.humanize, key] } %>
63
+ <%= form.select :dsp_type, AdSpace::Advertisement.dsp_types.keys.map { |key| [t("activerecord.enums.ad_space/advertisement.dsp_type.#{key}"), key] } %>
64
64
  </div>
65
65
 
66
66
  <div data-hello-target="schemeUrl">
@@ -88,7 +88,7 @@
88
88
 
89
89
  <div data-hello-target="splashUiType">
90
90
  <%= form.label :splash_ui_type, style: "display: block" %>
91
- <%= form.select :splash_ui_type, AdSpace::Advertisement.splash_ui_types.keys.map { |key| [key.humanize, key] } %>
91
+ <%= form.select :splash_ui_type, AdSpace::Advertisement.splash_ui_types.keys.map { |key| [t("activerecord.enums.ad_space/advertisement.splash_ui_type.#{key}"), key] } %>
92
92
  </div>
93
93
 
94
94
  <div data-hello-target="smCover" data-controller="image-upload", data-image-upload-url-value=<%= !advertisement.persisted? ? '' : remove_cover_advertisement_path(advertisement, size: "sm")%>>
@@ -1,10 +1,10 @@
1
- <h1>Editing advertisement</h1>
1
+ <h1><%= t("edit") %></h1>
2
2
 
3
3
  <%= render "form", advertisement: @advertisement %>
4
4
 
5
5
  <br>
6
6
 
7
7
  <div>
8
- <%= link_to "Show this advertisement", @advertisement %> |
9
- <%= link_to "Back to advertisements", advertisements_path %>
8
+ <%= link_to t("show"), @advertisement %> |
9
+ <%= link_to t("back_to"), advertisements_path %>
10
10
  </div>
@@ -1,15 +1,15 @@
1
1
  <p style="color: green"><%= notice %></p>
2
2
 
3
- <h1>Advertisements</h1>
3
+ <h1><%= t("advertisements") %></h1>
4
4
 
5
5
  <div id="advertisements">
6
6
  <% @advertisements.each do |advertisement| %>
7
7
  <%= render advertisement %>
8
8
  <p>
9
- <%= link_to "Show this advertisement", advertisement %>
9
+ <%= link_to t("show"), advertisement %>
10
10
  </p>
11
11
 
12
12
  <% end %>
13
13
  </div>
14
14
 
15
- <%= link_to "New advertisement", new_advertisement_path %>
15
+ <%= link_to t("new"), new_advertisement_path %>
@@ -1,9 +1,9 @@
1
- <h1>New advertisement</h1>
1
+ <h1><%= t("new") %></h1>
2
2
 
3
3
  <%= render "form", advertisement: @advertisement %>
4
4
 
5
5
  <br>
6
6
 
7
7
  <div>
8
- <%= link_to "Back to advertisements", advertisements_path %>
8
+ <%= link_to t("back_to"), advertisements_path %>
9
9
  </div>
@@ -3,11 +3,11 @@
3
3
  <%= render @advertisement %>
4
4
 
5
5
  <div>
6
- <%= link_to "Edit this advertisement", edit_advertisement_path(@advertisement) %> |
7
- <%= link_to "Back to advertisements", advertisements_path %>
8
- <%= button_to "#{@advertisement.published? ? 'Unpublish' : 'Publish'} this advertisement", publish_advertisement_path(@advertisement) %>
9
- <%= button_to "#{@advertisement.archived? ? 'Unarchive' : 'Archive'} this advertisement", archive_advertisement_path(@advertisement) %>
6
+ <%= link_to t("edit"), edit_advertisement_path(@advertisement) %> |
7
+ <%= link_to t("back_to"), advertisements_path %>
8
+ <%= button_to "#{@advertisement.published? ? t("unpublish") : t("publish")}", publish_advertisement_path(@advertisement) %>
9
+ <%= button_to "#{@advertisement.archived? ? t("unarchive") : t("archive")}", archive_advertisement_path(@advertisement) %>
10
10
 
11
11
  <br/>
12
- <%= button_to "Destroy this advertisement", @advertisement, method: :delete %>
12
+ <%= button_to t("destroy"), @advertisement, method: :delete %>
13
13
  </div>
@@ -1,7 +1,7 @@
1
1
  <h1>📺 AdSpace</h1>
2
2
  <ul>
3
- <li><%= link_to "广告", advertisements_path %></li>
4
- <li><%= link_to "位置", slots_path %></li>
5
- <li><%= link_to "Github", "https://github.com/42up/ad_space" %></li>
6
- <li><%= link_to "Doc", "https://github.com/42up/ad_space/blob/main/README.md" %></li>
3
+ <li><%= link_to t("slots"), slots_path %></li>
4
+ <li><%= link_to t("advertisements"), advertisements_path %></li>
5
+ <li><%= link_to t("github"), "https://github.com/42up/ad_space" %></li>
6
+ <li><%= link_to t("doc"), "https://github.com/42up/ad_space/blob/main/README.md" %></li>
7
7
  </ul>
@@ -22,19 +22,19 @@
22
22
  </div>
23
23
 
24
24
  <div data-controller="image-upload", data-image-upload-url-value=<%= !slot.persisted? ? '' : remove_demo_slot_path(slot) %>>
25
- <%= form.label :demo, "Demo", style: "display: block" %>
25
+ <%= form.label :demo, style: "display: block" %>
26
26
  <%= form.file_field :demo, data: {image_upload_target: "input"} %>
27
27
  <% if slot.demo.attached? %>
28
28
  <%= image_tag slot.demo.url, style: "max-width: 200px; height: auto;", data: {image_upload_target: "preview"} %>
29
- <button type="button" data-image-upload-target="removeButton">移除图片</button>
29
+ <button type="button" data-image-upload-target="removeButton"><%= t("remove_image") %></button>
30
30
  <% else %>
31
31
  <img data-image-upload-target="preview" style="max-width: 200px; height: auto;">
32
- <button type="button" data-image-upload-target="removeButton" style="display: none;">移除图片</button>
32
+ <button type="button" data-image-upload-target="removeButton" style="display: none;"><%= t("remove_image") %></button>
33
33
  <% end %>
34
34
  </div>
35
35
 
36
36
  <div>
37
- <%= form.label :is_splash, "Is Splash" %>
37
+ <%= form.label :is_splash %>
38
38
  <%= form.check_box :is_splash, { checked: form.object.is_splash } %>
39
39
  </div>
40
40
 
@@ -1,27 +1,27 @@
1
1
  <div id="<%= dom_id slot %>">
2
2
  <p>
3
- <strong>Name:</strong>
3
+ <strong><%= AdSpace::Slot.human_attribute_name(:name) %>:</strong>
4
4
  <%= slot.name %>
5
5
  </p>
6
6
 
7
7
  <p>
8
- <strong>Uuid:</strong>
8
+ <strong><%= AdSpace::Slot.human_attribute_name(:uuid) %>:</strong>
9
9
  <%= slot.uuid %>
10
10
  </p>
11
11
 
12
12
  <p>
13
- <strong>Remark:</strong>
13
+ <strong><%= AdSpace::Slot.human_attribute_name(:remark) %>:</strong>
14
14
  <%= slot.remark %>
15
15
  </p>
16
16
 
17
17
  <p>
18
- <strong>Is Splash:</strong>
18
+ <strong><%= AdSpace::Slot.human_attribute_name(:is_splash) %>:</strong>
19
19
  <%= slot.is_splash %>
20
20
  </p>
21
21
 
22
22
  <% if slot.demo.attached? %>
23
23
  <p>
24
- <strong>Demo:</strong>
24
+ <strong><%= AdSpace::Slot.human_attribute_name(:demo) %>:</strong>
25
25
  <%= image_tag slot.demo.url, style: "max-width: 200px; height: auto;" %>
26
26
  </p>
27
27
  <% end %>
@@ -1,10 +1,10 @@
1
- <h1>Editing slot</h1>
1
+ <h1><%= t("edit") %></h1>
2
2
 
3
3
  <%= render "form", slot: @slot %>
4
4
 
5
5
  <br>
6
6
 
7
7
  <div>
8
- <%= link_to "Show this slot", @slot %> |
9
- <%= link_to "Back to slots", slots_path %>
8
+ <%= link_to t("show"), @slot %> |
9
+ <%= link_to t("back_to"), slots_path %>
10
10
  </div>
@@ -1,14 +1,14 @@
1
1
  <p style="color: green"><%= notice %></p>
2
2
 
3
- <h1>Slots</h1>
3
+ <h1><%= t("slots") %></h1>
4
4
 
5
5
  <div id="slots">
6
6
  <% @slots.each do |slot| %>
7
7
  <%= render slot %>
8
8
  <p>
9
- <%= link_to "Show this slot", slot %>
9
+ <%= link_to t("show"), slot %>
10
10
  </p>
11
11
  <% end %>
12
12
  </div>
13
13
 
14
- <%= link_to "New slot", new_slot_path %>
14
+ <%= link_to t("new"), new_slot_path %>
@@ -1,9 +1,9 @@
1
- <h1>New slot</h1>
1
+ <h1><%= t("new") %></h1>
2
2
 
3
3
  <%= render "form", slot: @slot %>
4
4
 
5
5
  <br>
6
6
 
7
7
  <div>
8
- <%= link_to "Back to slots", slots_path %>
8
+ <%= link_to t("back_to"), slots_path %>
9
9
  </div>
@@ -3,8 +3,8 @@
3
3
  <%= render @slot %>
4
4
 
5
5
  <div>
6
- <%= link_to "Edit this slot", edit_slot_path(@slot) %> |
7
- <%= link_to "Back to slots", slots_path %>
6
+ <%= link_to t("edit"), edit_slot_path(@slot) %> |
7
+ <%= link_to t("back_to"), slots_path %>
8
8
 
9
- <%= button_to "Destroy this slot", @slot, method: :delete %>
9
+ <%= button_to t("destroy"), @slot, method: :delete %>
10
10
  </div>
data/bin/rails ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path("..", __dir__)
6
+ ENGINE_PATH = File.expand_path("../lib/ad_space/engine", __dir__)
7
+ APP_PATH = File.expand_path("../test/dummy/config/application", __dir__)
8
+
9
+ # Set up gems listed in the Gemfile.
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
11
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
12
+
13
+ require "rails/all"
14
+ require "rails/engine/commands"