redde_seo 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c8909fb8c57f9490335d8200f06c1ff3c425a9c
4
- data.tar.gz: 5bd6cd94f8addb7ad42a2c77bd7fce2cbbe3e20c
3
+ metadata.gz: 82feb666ddd524614696ca376160cc7875aa48a2
4
+ data.tar.gz: ec3c5d8403b46879a87c90471152a4e00098a0df
5
5
  SHA512:
6
- metadata.gz: bb61431a46bb6aa0af98e756e1ea1605dc7d7eee657216144a5008fe2c6b27794d06b4b342a009334c9c3ac74b74b0e4da839e56703f2576ce6df7963c7e00d4
7
- data.tar.gz: b98cbdc081f5f5fe6116d4587491caa89e03b3ecf9675e63e062b58a33291297e035ab4373f100d43ccc5ac280c9f2b3d47eafcad286fba827b3ef5a3938bc03
6
+ metadata.gz: f3bd6fbb0d421082a086b0397db50aba047717dbe8e4421817b58a1a20493ebac8343c2d93a6ff60e07efab2befbcdfbabaff3c4562501fe060f5650c68079dc
7
+ data.tar.gz: d23baa4ab2188924f18b1af2c622fd0f030d0973e645491920c5f9e35ed6b3e0ec75ae98ba4393d3f85e97d2083b3cfcd67e34d59224478f5d3e47c091ad8818
@@ -0,0 +1,28 @@
1
+ module Redde::Seo::SeosHelper
2
+ def seo_link_for_url(seo)
3
+ link_to seo_url_for(seo), [:edit, :admin, seo], alt: seo.url, title: seo.url
4
+ end
5
+
6
+ def seo_url_for(seo)
7
+ title = truncate(seo.url, length: 17)
8
+ title.present? ? title : 'НЕ ЗАПОЛНЕНО'
9
+ end
10
+
11
+ def seo_link_for_object(seo)
12
+ link_to seo_object_for(seo), [:edit, :admin, seo], alt: seo.url, title: seo.url
13
+ end
14
+
15
+ def seo_object_for(seo)
16
+ return '' unless seo.seoable
17
+ "#{seo.seoable.class.model_name.human}##{seo.seoable_id}"
18
+ end
19
+
20
+ def seo_title_for(seo)
21
+ title = seo.title.present? ? seo.title : 'НЕ ЗАПОЛНЕНО'
22
+ link_to title, [:edit, :admin, seo], alt: seo.url, title: seo.url
23
+ end
24
+
25
+ def seo_empty_for(seo)
26
+ seo.empty? ? '✘' : '✔'
27
+ end
28
+ end
@@ -11,10 +11,10 @@
11
11
  %table
12
12
  - if @seo.url.present?
13
13
  %tr
14
- %th{colspan: 2}= "#{@seo.url}"
14
+ %th{colspan: 2}= seo_url_for(@seo)
15
15
  - if @seo.seoable_type.present? && @seo.seoable_id.present?
16
16
  %tr
17
- %th{colspan: 2}= "#{@seo.seoable_type}@#{@seo.seoable_id}"
17
+ %th{colspan: 2}= seo_object_for(@seo)
18
18
  = render 'form', f: f
19
19
  .actions
20
20
  = f.submit 'Сохранить'
@@ -10,22 +10,19 @@
10
10
  %col
11
11
  %col
12
12
  %col
13
- %col
14
13
  %col.w1
15
14
  %thead
16
15
  %tr
17
16
  %th Url
18
17
  %th Объект
19
18
  %th Тайтл
20
- %th Кейвордс
21
- %th Дескрипшен
19
+ %th Заполнено?
22
20
  %th
23
21
  - @seos.each do |seo|
24
22
  %tr
25
- %td= link_to "#{seo.url}" || 'НЕ ЗАПОЛНЕНО', [:edit, :admin, seo]
26
- %td= link_to "#{seo.seoable_type}@#{seo.seoable_id}" || 'НЕ ЗАПОЛНЕНО', [:edit, :admin, seo]
27
- %td= link_to seo.title || 'НЕ ЗАПОЛНЕНО', [:edit, :admin, seo]
28
- %td= link_to seo.keywords || 'НЕ ЗАПОЛНЕНО', [:edit, :admin, seo]
29
- %td= link_to seo.description || 'НЕ ЗАПОЛНЕНО', [:edit, :admin, seo]
23
+ %td= seo_link_for_url(seo)
24
+ %td= seo_link_for_object(seo)
25
+ %td= seo_title_for(seo)
26
+ %td= seo_empty_for(seo)
30
27
  %td= link_to 'Удалить', [:admin, seo], method: :delete, data: { confirm: 'Удалить?' }, class: :del
31
28
 
@@ -1,4 +1,9 @@
1
1
  module ReddeSeo
2
2
  class Engine < ::Rails::Engine
3
+ initializer 'redde_seo.action_controller' do |_app|
4
+ ActiveSupport.on_load :action_controller do
5
+ helper Redde::Seo::SeosHelper
6
+ end
7
+ end
3
8
  end
4
9
  end
@@ -1,3 +1,3 @@
1
1
  module ReddeSeo
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redde_seo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Bovykin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-24 00:00:00.000000000 Z
11
+ date: 2014-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -203,6 +203,7 @@ files:
203
203
  - Rakefile
204
204
  - app/controllers/admin/seos_controller.rb
205
205
  - app/controllers/concerns/with_seo_ctrl.rb
206
+ - app/helpers/redde/seo/seos_helper.rb
206
207
  - app/models/concerns/with_seo.rb
207
208
  - app/models/redde/seo.rb
208
209
  - app/models/redde/seo/custom_class_names.rb