acts_as_published 1.0.3 → 1.1.0

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
  SHA1:
3
- metadata.gz: 77c2d421f850b038b31f10010af132ff3f5a6fd0
4
- data.tar.gz: af439293b8cf430c1c22f5627ecda9a9e3320b13
3
+ metadata.gz: 79012d379177f6118654a974f3a6efdb557f7bf4
4
+ data.tar.gz: 53167e5ab288d0d75826476416343698923e997b
5
5
  SHA512:
6
- metadata.gz: 03bcafdc29b3398ff4f9c181e8a77ae8ab105eb32a3630b053a5b3364e7f200ebc54d728b98e9ff426580adc2ba0e97759538faf09e4b2894faf079dfa15a136
7
- data.tar.gz: 9ed8385d02b7439956d1b2491385e2be986d9c54c538fe128129241b43107bcad70816c2663304ace3203d9e7ad5c5ebe48caf5ffb9e2f1e16ec55ec45ca7db7
6
+ metadata.gz: 6d5084f3197a75020588f45fa30f26ffbcbd789cd874addd6dbb9ccee80ad3f4b310a09c14e08789a517fbeba2bc9e0ccf95daf320d54cb0ba1753b246aea76a
7
+ data.tar.gz: 6dee3bda9e388b4058b3e97d9a716f8b5cdb60f6a4b1986190735a418caf5594a8fbe3ebe56e3e4dd172f97ae6866abe1e1366ab6136832cd157261365879db6
@@ -0,0 +1,24 @@
1
+ de:
2
+ active_admin:
3
+ scopes:
4
+ all: Alle
5
+ published: Veröffentlich
6
+ unpublished: Unveröffentlicht
7
+ component:
8
+ table:
9
+ header_cells:
10
+ batch_actions:
11
+ publish: Veröffentlichen
12
+ unpublish: Zurückziehen
13
+ acts_as_published:
14
+ actions:
15
+ publish: Veröffentlichen
16
+ unpublish: Zurückziehen
17
+ notices:
18
+ published: "%{name} ist ab jetzt öffentlich sichtbar."
19
+ published_many: "%{names} sind ab jetzt öffentlich sichtbar."
20
+ unpublished: "%{name} ist ab jetzt nicht mehr öffentlich sichtbar."
21
+ unpublished_many: "%{names} sind ab jetzt nicht mehr öffentlich sichtbar."
22
+ 'true': Ja
23
+ 'false': Nein
24
+
@@ -4,12 +4,20 @@ en:
4
4
  all: All
5
5
  published: Published
6
6
  unpublished: Not published
7
+ component:
8
+ table:
9
+ header_cells:
10
+ batch_actions:
11
+ publish: Publish
12
+ unpublish: Unpublish
7
13
  acts_as_published:
8
14
  actions:
9
15
  publish: Publish
10
16
  unpublish: Unpublish
11
17
  notices:
12
18
  published: "%{name} has been published."
19
+ published_many: "%{names} have been published."
13
20
  unpublished: "%{name} has been unpublished."
21
+ unpublished_many: "%{names} have been unpublished."
14
22
  'true': yes
15
23
  'false': no
@@ -9,7 +9,7 @@ module ActsAsPublished
9
9
 
10
10
  module ClassMethods
11
11
  def acts_as_published
12
- attr_accessible :published if Rails.version < '4'
12
+ attr_accessible :published, :published_at if Rails.version < '4'
13
13
 
14
14
  def published
15
15
  t = self.arel_table
@@ -30,11 +30,19 @@ module ActsAsPublished
30
30
  alias :published? :published
31
31
 
32
32
  def published=(published)
33
- if Rails.version < '4.2'
34
- boolean_published = ::ActiveRecord::ConnectionAdapters::Column.value_to_boolean(published)
35
- else
36
- boolean_published = ::ActiveRecord::Type::Boolean.new.type_cast_for_schema(published)
37
- end
33
+ boolean_published = case
34
+ when Rails.version < '4.2'
35
+ ::ActiveRecord::ConnectionAdapters::Column.value_to_boolean(published)
36
+ when Rails.version < '5.0'
37
+ ::ActiveRecord::Type::Boolean.new.type_cast_for_schema(published)
38
+ else
39
+ ::ActiveRecord::Type::Boolean.new.cast(published)
40
+ end
41
+ # if Rails.version < '4.2'
42
+ # boolean_published = ::ActiveRecord::ConnectionAdapters::Column.value_to_boolean(published)
43
+ # else
44
+ # boolean_published = ::ActiveRecord::Type::Boolean.new.type_cast_for_schema(published)
45
+ # end
38
46
  self.published_at = boolean_published ? Time.zone.now : nil
39
47
  end
40
48
 
@@ -58,6 +66,16 @@ module ActsAsPublished
58
66
  def unpublish
59
67
  self.published = false
60
68
  end
69
+
70
+ def publish!
71
+ publish
72
+ save!
73
+ end
74
+
75
+ def unpublish!
76
+ unpublish
77
+ save!
78
+ end
61
79
  end
62
80
  end
63
81
  end
@@ -1,3 +1,3 @@
1
1
  module ActsAsPublished
2
- VERSION = '1.0.3'
2
+ VERSION = '1.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_published
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-29 00:00:00.000000000 Z
11
+ date: 2018-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activeadmin
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: sass-rails
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,20 @@ dependencies:
108
122
  - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-rails
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: capybara
113
141
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +164,20 @@ dependencies:
136
164
  - - ">="
137
165
  - !ruby/object:Gem::Version
138
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: test-unit
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
139
181
  - !ruby/object:Gem::Dependency
140
182
  name: factory_girl_rails
141
183
  requirement: !ruby/object:Gem::Requirement
@@ -216,8 +258,8 @@ files:
216
258
  - MIT-LICENSE
217
259
  - README.rdoc
218
260
  - Rakefile
219
- - config/locales/acts_as_published.de.yml
220
- - config/locales/acts_as_published.en.yml
261
+ - config/locales/de.yml
262
+ - config/locales/en.yml
221
263
  - lib/acts_as_published.rb
222
264
  - lib/acts_as_published/active_admin_helper.rb
223
265
  - lib/acts_as_published/active_record.rb
@@ -242,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
284
  version: '0'
243
285
  requirements: []
244
286
  rubyforge_project:
245
- rubygems_version: 2.4.8
287
+ rubygems_version: 2.5.1
246
288
  signing_key:
247
289
  specification_version: 4
248
290
  summary: Acts as published beahviour for active record models.
@@ -1,16 +0,0 @@
1
- de:
2
- active_admin:
3
- scopes:
4
- all: Alle
5
- published: Veröffentlicht
6
- unpublished: Nicht veröffentlicht
7
- acts_as_published:
8
- actions:
9
- publish: Veröffentlichen
10
- unpublish: Zurückziehen
11
- notices:
12
- published: "%{name} ist ab jetzt öffentlich sichtbar."
13
- unpublished: "%{name} ist ab jetzt nicht mehr öffentlich sichtbar."
14
- 'true': Ja
15
- 'false': Nein
16
-