knitkit 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  # Methods added to this helper will be available to all templates in the application.
2
+ =begin
2
3
  module ApplicationHelper
3
4
  def theme_stylesheet_path(theme, source)
4
5
  theme = @controller.website.themes.find_by_theme_id(theme) unless theme.is_a?(Theme)
@@ -130,3 +131,4 @@ module ApplicationHelper
130
131
  end
131
132
  end
132
133
  end
134
+ =end
@@ -8,16 +8,18 @@ class PublishedWebsite < ActiveRecord::Base
8
8
  end
9
9
 
10
10
  def self.activate(website, version, current_user)
11
- published_websites = self.where('website_id = ?', website.id).all
11
+ #deactivate
12
+ published_websites = self.where(:website_id => website.id).where(:active => true).all
12
13
  published_websites.each do |published_website|
13
- if published_website.version == version
14
- published_website.active = true
15
- published_website.published_by = current_user
16
- else
17
- published_website.active = false
18
- end
14
+ published_website.active = false
19
15
  published_website.save
20
16
  end
17
+
18
+ #activate
19
+ published_website = self.where(:website_id => website.id).where(:version => version).first
20
+ published_website.active = true
21
+ published_website.published_by = current_user
22
+ published_website.save
21
23
  end
22
24
 
23
25
  def publish(comment, current_user)
data/app/models/theme.rb CHANGED
@@ -2,10 +2,11 @@ require 'yaml'
2
2
  require 'fileutils'
3
3
 
4
4
  class Theme < ActiveRecord::Base
5
- @@theme_structure = ['stylesheets', 'javascripts', 'images', 'templates']
6
- @@base_layouts_views_path = "#{Knitkit::Engine.root.to_s}/app/views"
7
- @@knitkit_website_stylesheets_path = "#{Knitkit::Engine.root.to_s}/public/stylesheets/knitkit"
8
- @@knitkit_website_images_path = "#{Knitkit::Engine.root.to_s}/public/images/knitkit"
5
+ THEME_STRUCTURE = ['stylesheets', 'javascripts', 'images', 'templates']
6
+ class << self; attr_accessor :base_layouts_views_path, :knitkit_website_stylesheets_path, :knitkit_website_images_path end
7
+ @base_layouts_views_path = "#{Knitkit::Engine.root.to_s}/app/views"
8
+ @knitkit_website_stylesheets_path = "#{Knitkit::Engine.root.to_s}/public/stylesheets/knitkit"
9
+ @knitkit_website_images_path = "#{Knitkit::Engine.root.to_s}/public/images/knitkit"
9
10
 
10
11
  has_file_assets
11
12
 
@@ -39,7 +40,7 @@ class Theme < ActiveRecord::Base
39
40
  Zip::ZipFile.open(file.path) do |zip|
40
41
  zip.sort.each do |entry|
41
42
  entry.name.split('/').each do |file|
42
- valid = true if @@theme_structure.include?(file)
43
+ valid = true if THEME_STRUCTURE.include?(file)
43
44
  end
44
45
  end
45
46
  end
@@ -183,7 +184,7 @@ class Theme < ActiveRecord::Base
183
184
  root_found = false
184
185
  theme_root = ''
185
186
  path.split('/').each do |piece|
186
- if piece == 'about.yml' || @@theme_structure.include?(piece)
187
+ if piece == 'about.yml' || THEME_STRUCTURE.include?(piece)
187
188
  root_found = true
188
189
  else
189
190
  theme_root += piece + '/' if !piece.match('\.') && !root_found
@@ -204,9 +205,9 @@ class Theme < ActiveRecord::Base
204
205
 
205
206
  def create_theme_files!
206
207
  file_support = ErpTechSvcs::FileSupport::Base.new
207
- create_theme_files_for_directory_node(file_support.build_tree(@@base_layouts_views_path, :preload => true), :templates, :path_to_replace => @@base_layouts_views_path)
208
- create_theme_files_for_directory_node(file_support.build_tree(@@knitkit_website_stylesheets_path, :preload => true), :stylesheets, :path_to_replace => @@knitkit_website_stylesheets_path)
209
- create_theme_files_for_directory_node(file_support.build_tree(@@knitkit_website_images_path, :preload => true), :images, :path_to_replace => @@knitkit_website_images_path)
208
+ create_theme_files_for_directory_node(file_support.build_tree(Theme.base_layouts_views_path, :preload => true), :templates, :path_to_replace => Theme.base_layouts_views_path)
209
+ create_theme_files_for_directory_node(file_support.build_tree(Theme.knitkit_website_stylesheets_path, :preload => true), :stylesheets, :path_to_replace => Theme.knitkit_website_stylesheets_path)
210
+ create_theme_files_for_directory_node(file_support.build_tree(Theme.knitkit_website_images_path, :preload => true), :images, :path_to_replace => Theme.knitkit_website_images_path)
210
211
  end
211
212
 
212
213
  private
@@ -24,19 +24,20 @@ module ActionView
24
24
  cache = options.delete("cache")
25
25
  recursive = options.delete("recursive")
26
26
 
27
- if ActionController::Base.perform_caching && cache
28
- joined_javascript_name = (cache == true ? "all" : cache) + ".js"
29
- joined_javascript_path = File.join(theme.path + '/javascripts', joined_javascript_name)
30
-
31
- paths = theme_compute_javascript_paths(theme, sources, recursive)
32
- theme_write_asset_file_contents(theme, joined_javascript_path, paths) unless File.exists?(joined_javascript_path)
33
- raw theme_javascript_src_tag(theme, joined_javascript_name, options)
34
- else
27
+ # this caching appears to be deprecated, commenting out
28
+ # if ActionController::Base.perform_caching && cache
29
+ # joined_javascript_name = (cache == true ? "all" : cache) + ".js"
30
+ # joined_javascript_path = File.join(theme.path + '/javascripts', joined_javascript_name)
31
+
32
+ # paths = theme_compute_javascript_paths(theme, sources, recursive)
33
+ # theme_write_asset_file_contents(theme, joined_javascript_path, paths) unless File.exists?(joined_javascript_path)
34
+ # raw theme_javascript_src_tag(theme, joined_javascript_name, options)
35
+ # else
35
36
  sources = theme_expand_javascript_sources(theme, sources, recursive).collect do |source|
36
37
  theme_javascript_src_tag(theme, source, options)
37
38
  end.join("\n")
38
39
  raw sources
39
- end
40
+ #end
40
41
  end
41
42
 
42
43
  def theme_stylesheet_path(theme, source)
@@ -54,19 +55,20 @@ module ActionView
54
55
  cache = options.delete("cache")
55
56
  recursive = options.delete("recursive")
56
57
 
57
- if ActionController::Base.perform_caching && cache
58
- joined_stylesheet_name = (cache == true ? "all" : cache) + ".css"
59
- joined_stylesheet_path = File.join(theme.path + '/stylesheets', joined_stylesheet_name)
58
+ # this caching appears to be deprecated, commenting out
59
+ # if ActionController::Base.perform_caching && cache
60
+ # joined_stylesheet_name = (cache == true ? "all" : cache) + ".css"
61
+ # joined_stylesheet_path = File.join(theme.path + '/stylesheets', joined_stylesheet_name)
60
62
 
61
- paths = theme_compute_stylesheet_paths(theme, sources, recursive)
62
- theme_write_asset_file_contents(theme, joined_stylesheet_path, paths) unless File.exists?(joined_stylesheet_path)
63
- raw theme_stylesheet_tag(theme, joined_stylesheet_name, options)
64
- else
63
+ # paths = theme_compute_stylesheet_paths(theme, sources, recursive)
64
+ # theme_write_asset_file_contents(theme, joined_stylesheet_path, paths) unless File.exists?(joined_stylesheet_path)
65
+ # raw theme_stylesheet_tag(theme, joined_stylesheet_name, options)
66
+ # else
65
67
  sources = theme_expand_stylesheet_sources(theme, sources, recursive).collect do |source|
66
68
  theme_stylesheet_tag(theme, source, options)
67
69
  end.join("\n")
68
70
  raw sources
69
- end
71
+ #end
70
72
  end
71
73
 
72
74
  def theme_image_path(theme, source)
@@ -2,7 +2,7 @@ module Knitkit
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 0
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knitkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
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-05-25 00:00:00.000000000 Z
12
+ date: 2012-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erp_forms
16
- requirement: &2161814820 !ruby/object:Gem::Requirement
16
+ requirement: &2156037480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2161814820
24
+ version_requirements: *2156037480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: erp_dev_svcs
27
- requirement: &2161814320 !ruby/object:Gem::Requirement
27
+ requirement: &2156036640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2161814320
35
+ version_requirements: *2156036640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: routing-filter
38
- requirement: &2161836280 !ruby/object:Gem::Requirement
38
+ requirement: &2156035960 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.2.4
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2161836280
46
+ version_requirements: *2156035960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: nokogiri
49
- requirement: &2161835700 !ruby/object:Gem::Requirement
49
+ requirement: &2156034880 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - =
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.5.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2161835700
57
+ version_requirements: *2156034880
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rubyzip
60
- requirement: &2161834660 !ruby/object:Gem::Requirement
60
+ requirement: &2156034420 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - =
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.9.4
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2161834660
68
+ version_requirements: *2156034420
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: permalink_fu
71
- requirement: &2161833840 !ruby/object:Gem::Requirement
71
+ requirement: &2156033900 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - =
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.0
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2161833840
79
+ version_requirements: *2156033900
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: railties
82
- requirement: &2161833380 !ruby/object:Gem::Requirement
82
+ requirement: &2156033180 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 3.1.0
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *2161833380
90
+ version_requirements: *2156033180
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: actionmailer
93
- requirement: &2161832860 !ruby/object:Gem::Requirement
93
+ requirement: &2156433200 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 3.1.0
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *2161832860
101
+ version_requirements: *2156433200
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: actionpack
104
- requirement: &2161832160 !ruby/object:Gem::Requirement
104
+ requirement: &2156432740 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 3.1.0
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *2161832160
112
+ version_requirements: *2156432740
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: activerecord
115
- requirement: &2161831500 !ruby/object:Gem::Requirement
115
+ requirement: &2156432260 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: 3.1.0
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *2161831500
123
+ version_requirements: *2156432260
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: activeresource
126
- requirement: &2161830780 !ruby/object:Gem::Requirement
126
+ requirement: &2156431780 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 3.1.0
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *2161830780
134
+ version_requirements: *2156431780
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: activesupport
137
- requirement: &2161830320 !ruby/object:Gem::Requirement
137
+ requirement: &2156431320 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: 3.1.0
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *2161830320
145
+ version_requirements: *2156431320
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: rails
148
- requirement: &2161829860 !ruby/object:Gem::Requirement
148
+ requirement: &2156430860 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ~>
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: 3.1.0
154
154
  type: :runtime
155
155
  prerelease: false
156
- version_requirements: *2161829860
156
+ version_requirements: *2156430860
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: acts-as-taggable-on
159
- requirement: &2161829400 !ruby/object:Gem::Requirement
159
+ requirement: &2156430400 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - =
@@ -164,7 +164,7 @@ dependencies:
164
164
  version: 2.1.1
165
165
  type: :runtime
166
166
  prerelease: false
167
- version_requirements: *2161829400
167
+ version_requirements: *2156430400
168
168
  description: Knitkit is CompassAE's content and digital asset management application.
169
169
  It is based on ideas and code adapted from Mephisto and adva_cms, with significant
170
170
  changes to integrate with the CompassAE object-relational layer and to harmonize