spud_blog 0.8.6 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -69,6 +69,24 @@ class SpudPost < ActiveRecord::Base
69
69
  end
70
70
  end
71
71
 
72
+ def self.months_with_public_news_posts
73
+ records = SpudPost.select('Extract(Month from published_at) as published_month, Extract(Year from published_at) as published_year').where('visible = ? AND published_at < ? AND is_news = ?', true, DateTime.now, true).group('published_month, published_year').order('published_year desc, published_month desc')
74
+ begin
75
+ return records.collect{ |r| Date.new(r[:published_year].to_i, r[:published_month].to_i) }
76
+ rescue Exception => e
77
+ logger.fatal "Exception occurred while fetching post archive dates:\n #{e.to_s}"
78
+ end
79
+ end
80
+
81
+ def self.months_with_public_blog_posts
82
+ records = SpudPost.select('Extract(Month from published_at) as published_month, Extract(Year from published_at) as published_year').where('visible = ? AND published_at < ? AND is_news = ?', true, DateTime.now, false).group('published_month, published_year').order('published_year desc, published_month desc')
83
+ begin
84
+ return records.collect{ |r| Date.new(r[:published_year].to_i, r[:published_month].to_i) }
85
+ rescue Exception => e
86
+ logger.fatal "Exception occurred while fetching post archive dates:\n #{e.to_s}"
87
+ end
88
+ end
89
+
72
90
  def display_date
73
91
  return published_at.strftime("%b %d, %Y")
74
92
  end
@@ -2,11 +2,8 @@
2
2
 
3
3
  <fieldset>
4
4
  <div class="control-group">
5
-
6
- <%=f.label :title, :required=>true,:style =>"display:none;", :class=>"control-label"%>
7
-
8
- <%=f.text_field :title, :class => "full-width",:placeholder=>"Enter title here"%>
9
-
5
+ <%=f.label :title, :required=>true,:style =>"display:none;", :class=>"control-label"%>
6
+ <%=f.text_field :title, :class => "full-width",:placeholder=>"Enter title here"%>
10
7
  </div>
11
8
  </fieldset>
12
9
 
@@ -45,7 +42,6 @@
45
42
  <%=f.select :spud_user_id,options_for_select(SpudUser.order(:first_name,:last_name,:login).all.collect{|user| [user.full_name,user.id]},f.object.spud_user_id)%>
46
43
  </div>
47
44
  </div>
48
-
49
45
  <%else%>
50
46
  <%= f.hidden_field :spud_user_id %>
51
47
  <%end%>
@@ -82,8 +78,8 @@
82
78
  <%= f.hidden_field :is_news %>
83
79
 
84
80
  <div class="form-actions">
85
- <%=f.submit "Save Post", :class=>"btn btn-primary form-btn","data-loading-text"=>"Saving..."%> or <%=link_to "cancel",request.referer,:class => "btn"%>
86
- </div>
81
+ <%=f.submit "Save Post", :class=>"btn btn-primary form-btn","data-loading-text"=>"Saving..."%> or <%=link_to "cancel",request.referer, :class => "btn"%>
82
+ </div>
87
83
 
88
84
 
89
85
  <script type="text/javascript">
@@ -2,6 +2,15 @@ require 'spud_core'
2
2
  module Spud
3
3
  module Blog
4
4
  class Engine < Rails::Engine
5
+
6
+ def self.require_model(model_name)
7
+ require "#{root}/app/models/#{model_name}"
8
+ end
9
+
10
+ def self.require_controller(controller_name)
11
+ require "#{root}/app/controllers/#{controller_name}"
12
+ end
13
+
5
14
  engine_name :spud_blog
6
15
  initializer :admin do
7
16
  Spud::Core.config.admin_applications += [{
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Blog
3
- VERSION = "0.8.6"
3
+ VERSION = "0.8.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spud_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.8.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-30 00:00:00.000000000 Z
12
+ date: 2012-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70142759883580 !ruby/object:Gem::Requirement
16
+ requirement: &70203864381060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70142759883580
24
+ version_requirements: *70203864381060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: spud_core
27
- requirement: &70142759881400 !ruby/object:Gem::Requirement
27
+ requirement: &70203864380320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: 0.9.0
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *70142759881400
38
+ version_requirements: *70203864380320
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: spud_permalinks
41
- requirement: &70142759904920 !ruby/object:Gem::Requirement
41
+ requirement: &70203864379540 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ~>
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: 0.0.1
47
47
  type: :runtime
48
48
  prerelease: false
49
- version_requirements: *70142759904920
49
+ version_requirements: *70203864379540
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: mysql2
52
- requirement: &70142759902100 !ruby/object:Gem::Requirement
52
+ requirement: &70203864379140 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ! '>='
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: '0'
58
58
  type: :development
59
59
  prerelease: false
60
- version_requirements: *70142759902100
60
+ version_requirements: *70203864379140
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rspec
63
- requirement: &70142759928780 !ruby/object:Gem::Requirement
63
+ requirement: &70203864378460 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ! '>='
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: '0'
69
69
  type: :development
70
70
  prerelease: false
71
- version_requirements: *70142759928780
71
+ version_requirements: *70203864378460
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: rspec-rails
74
- requirement: &70142759927800 !ruby/object:Gem::Requirement
74
+ requirement: &70203864378000 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ! '>='
@@ -79,10 +79,10 @@ dependencies:
79
79
  version: '0'
80
80
  type: :development
81
81
  prerelease: false
82
- version_requirements: *70142759927800
82
+ version_requirements: *70203864378000
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: factory_girl
85
- requirement: &70142759926820 !ruby/object:Gem::Requirement
85
+ requirement: &70203864377460 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - =
@@ -90,10 +90,10 @@ dependencies:
90
90
  version: 2.5.0
91
91
  type: :development
92
92
  prerelease: false
93
- version_requirements: *70142759926820
93
+ version_requirements: *70203864377460
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: mocha
96
- requirement: &70142759925880 !ruby/object:Gem::Requirement
96
+ requirement: &70203864376740 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - =
@@ -101,10 +101,10 @@ dependencies:
101
101
  version: 0.10.3
102
102
  type: :development
103
103
  prerelease: false
104
- version_requirements: *70142759925880
104
+ version_requirements: *70203864376740
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: database_cleaner
107
- requirement: &70142759924280 !ruby/object:Gem::Requirement
107
+ requirement: &70203864376240 !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
110
110
  - - =
@@ -112,7 +112,7 @@ dependencies:
112
112
  version: 0.7.1
113
113
  type: :development
114
114
  prerelease: false
115
- version_requirements: *70142759924280
115
+ version_requirements: *70203864376240
116
116
  description: Spud blogging/news and rss engine.
117
117
  email:
118
118
  - greg@westlakedesign.com
@@ -239,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
239
  version: '0'
240
240
  segments:
241
241
  - 0
242
- hash: 3489128495976700013
242
+ hash: 4023632794416678270
243
243
  required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  none: false
245
245
  requirements:
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  segments:
250
250
  - 0
251
- hash: 3489128495976700013
251
+ hash: 4023632794416678270
252
252
  requirements: []
253
253
  rubyforge_project:
254
254
  rubygems_version: 1.8.10