scrivito_rich_snippet_widget 0.1.3 → 0.1.4

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: dba9f674fd4415f7e8ac8b397a1d4b06ced4d342
4
- data.tar.gz: 37f6c7c82e7155d0ef3fa6a47f60c28c6d97e742
3
+ metadata.gz: eecc8926a4887eafc59d52eb7b39b1d9a2a2a2f7
4
+ data.tar.gz: dc3850e3151774e156f98a5bb6c6e1cf21e40386
5
5
  SHA512:
6
- metadata.gz: cded57475b87265260c77e627a61c4712fc23fb6ba4fbf8978ee4817c0c2041e80de0b02fb3a717ee0556d4318460df83a6dd983f65de72b3435164c3aa4e90d
7
- data.tar.gz: c993a9fab68c337f07342ac234a63c5606c2fccc847b9dff7bdb3a1d19d7a3ba925a6a9e112ba9d182326c492f9ef05916ace2b533ebb594b154091bfd4877d5
6
+ metadata.gz: 1c5f388eb53d3d8fd9cc338db852f024fa488e43fb9c3a66d8e32cad32ff3bc9eef3c09520ee93d7d6a0c3b418b31a757700601357e3b213b7f928f8808b7dc2
7
+ data.tar.gz: 911c92df0a975fbdea4353aeec8dfa56420703ccb1ab073befb7054990a6aff3015fc24b826808900383dd8df44d60463eadb23c3df919395fbcc26a50146179
data/README.md CHANGED
@@ -24,21 +24,19 @@ Add this to your filters:
24
24
  ```js
25
25
  scrivito.content_browser.filters(filter) {
26
26
  if(filter.rich_snippet_filter) {
27
- _obj_class: {
28
- field: '_obj_class'
29
- options: { rich_snippet_filter(filter.rich_snippet_filter) }
27
+ '_obj_class': {
28
+ 'field': '_obj_class'
29
+ 'options': { rich_snippet_filter(filter.rich_snippet_filter) }
30
30
  }
31
31
  } else if (your filters) {
32
32
  // ... add your special filters here
33
33
  } else {
34
34
  '_obj_class': {
35
- options: {
35
+ 'options': {
36
36
  // ... add your standard filters here
37
37
  rich_snippets: {
38
38
  title: 'Rich Snippets',
39
- options: {
40
- rich_snippet_filter('all')
41
- }
39
+ 'options': { rich_snippet_filter('all') }
42
40
  }
43
41
  }
44
42
  }
@@ -120,18 +118,18 @@ In your contentbrowser filters, add the new types by using:
120
118
  ```js
121
119
  scrivito.content_browser.filters(filter) {
122
120
  if(filter.rich_snippet_filter) {
123
- rich_snippet_filter(filter.rich_snippet_filter, ['NewType'])
121
+ '_obj_class': {
122
+ 'field': '_obj_class'
123
+ 'options': { rich_snippet_filter(filter.rich_snippet_filter, ['NewType']) }
124
124
  } else if (your filters) {
125
- // ... add your filters here
125
+ // ... add your special filters here
126
126
  } else {
127
127
  '_obj_class': {
128
- options: {
129
- // ... add your type defs here
130
- rich_snippets: {
131
- title: 'Rich Snippets',
132
- options: {
133
- rich_snippet_filter(undefined, ['NewType'])
134
- }
128
+ 'options': {
129
+ // ... add your standard filters here
130
+ 'rich_snippets': {
131
+ 'title': 'Rich Snippets',
132
+ 'options': { rich_snippet_filter('all', ['NewType']) }
135
133
  }
136
134
  }
137
135
  }
@@ -1,6 +1,6 @@
1
1
  module RichSnippet
2
2
  class CreativeWork < Thing
3
- attribute :work_type, :enum, values: ['Book','Game','Movie','Photograph','Painting','Serie','WebPage','MusicComposition','SoftwareSourceCode']
3
+ attribute :work_type, :enum, values: ['Book','Game','Movie','Photograph','Painting','Serie','WebPage','MusicComposition','SoftwareSourceCode', 'Review', 'ClaimReview']
4
4
  attribute :about, :string
5
5
  attribute :author, :reference
6
6
  attribute :contributor, :reference
@@ -41,6 +41,11 @@ module RichSnippet
41
41
  attribute :lyricist, :reference
42
42
  attribute :lyrics, :string
43
43
 
44
+ #ClaimReview
45
+ attribute :claim_reviewed, :string
46
+ attribute :item_reviewed, :reference
47
+ attribute :review_body, :string
48
+
44
49
  def to_json(render_childs = false)
45
50
  json = {
46
51
  "@context": "http://schema.org",
@@ -87,6 +92,13 @@ module RichSnippet
87
92
  json[:codeRepository]= code_repository
88
93
  json[:programmingLanguage]= programming_language
89
94
  json[:runtimePlatform]= runtime_platform
95
+ elsif work_type == 'Review'
96
+ json[:itemReviewed]= item_reviewed ? item_reviewed.to_json : nil
97
+ json[:reviewBody]= review_body
98
+ elsif work_type == 'ClaimReview'
99
+ json[:claimReviewed]= claim_reviewed
100
+ json[:itemReviewed]= item_reviewed ? item_reviewed.to_json : nil
101
+ json[:reviewBody]= review_body
90
102
  end
91
103
 
92
104
  return json.delete_if { |k, v| !v.present? }
@@ -3,7 +3,7 @@ module RichSnippet
3
3
  attribute :base_salary, :integer
4
4
  attribute :date_posted, :date
5
5
  attribute :education_requirements, :string
6
- attribute :employment_type, :enum, values: %w(full-time part-time contract temporary seasonal internship)
6
+ attribute :employment_type, :enum, values: ['full-time', 'part-time', 'contract', 'temporary', 'seasonal', 'internship']
7
7
  attribute :experience_requirements, :string
8
8
  attribute :hiring_organization, :reference
9
9
  attribute :job_benefits, :string
@@ -149,4 +149,22 @@
149
149
  <% end %>
150
150
  <% end %>
151
151
 
152
+ <% if obj.work_type == 'Review' || obj.work_type == 'ClaimReview' %>
153
+ <%= scrivito_details_for "Review attributes" do %>
154
+ <% if obj.work_type == 'ClaimReview' %>
155
+ <%= scrivito_details_for 'Claim reviewed' do %>
156
+ <%= scrivito_tag :div, obj, :claim_reviewed %>
157
+ <% end %>
158
+ <% end %>
159
+
160
+ <%= scrivito_details_for 'Item reviewed' do %>
161
+ <%= scrivito_tag :div, obj, :item_reviewed, data: {scrivito_editors_filter_context: {rich_snippet_filter: 'all'}} %>
162
+ <% end %>
163
+
164
+ <%= scrivito_details_for 'Review body' do %>
165
+ <%= scrivito_tag :div, obj, :review_body %>
166
+ <% end %>
167
+ <% end %>
168
+ <% end %>
169
+
152
170
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module ScrivitoRichSnippetWidget
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_rich_snippet_widget
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gert Geidel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-07 00:00:00.000000000 Z
11
+ date: 2017-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: scrivito