comfortable_mexican_sofa 1.6.9 → 1.6.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,7 +23,7 @@ Add gem definition to your Gemfile:
23
23
  Then from the Rails project's root run:
24
24
 
25
25
  bundle install
26
- rails generate cms
26
+ rails generate comfy:cms
27
27
  rake db:migrate
28
28
 
29
29
  When upgrading from the older version please take a look at [Upgrading ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa/wiki/Upgrading-ComfortableMexicanSofa)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.9
1
+ 1.6.10
@@ -128,6 +128,9 @@
128
128
  height: 28px;
129
129
  background: url(/assets/comfortable_mexican_sofa/icon_regular.gif);
130
130
  }
131
+ #cms_body ul.list li .item .icon.draft {
132
+ background: url(/assets/comfortable_mexican_sofa/icon_draft.gif);
133
+ }
131
134
  #cms_body ul.list li .item .icon .dragger {
132
135
  width: 28px;
133
136
  height: 28px;
@@ -35,7 +35,7 @@
35
35
  white-space: nowrap;
36
36
  overflow: hidden;
37
37
  float: left;
38
- color: #eee;
38
+ color: #8a8a8a;
39
39
  }
40
40
  #cms_body .uploaded_files .file .file_name a.delete {
41
41
  float: right;
@@ -10,7 +10,7 @@
10
10
  font: 13px/19px 'Lucida Grande', 'Tahoma', sans-serif;
11
11
  text-shadow: #fff 1px 1px;
12
12
  padding: 0px 10px;
13
- background-color: #f1f1f1;
13
+ background-color: #f6f5f5;
14
14
  border-top-left-radius: 3px;
15
15
  border-bottom-left-radius: 3px ;
16
16
  -moz-border-radius-topleft: 3px;
@@ -38,6 +38,9 @@
38
38
  #cms_body .form_element .value textarea {
39
39
  height: 300px;
40
40
  }
41
+ #cms_body .form_element .value textarea.short {
42
+ height: 100px;
43
+ }
41
44
  #cms_body .form_element .value .CodeMirror-wrapping {
42
45
  background-color: #fff;
43
46
  }
@@ -142,7 +145,7 @@
142
145
  }
143
146
  #cms_body .form_element.submit_element .value {
144
147
  overflow: hidden;
145
- background-color: #f1f1f1;
148
+ background-color: #f6f5f5;
146
149
  border-radius: 3px;
147
150
  -moz-border-radius: 3px;
148
151
  padding: 5px;
@@ -29,29 +29,37 @@ html, body#cms_body {
29
29
  position: fixed;
30
30
  }
31
31
  #cms_body .left_column_content {
32
- padding: 25px 0px 25px 10px;
33
- width: 165px;
32
+ padding: 25px 0px;
33
+ width: 175px;
34
34
  position: fixed;
35
35
  }
36
36
  #cms_body .left_column_content ul.nav a {
37
+ position: relative;
37
38
  display: block;
38
- padding: 3px 10px;
39
- margin-bottom: 5px;
39
+ padding: 5px 15px;
40
40
  font: 15px/25px 'Lucida Grande', 'Tahoma', sans-serif;
41
- border-top-left-radius: 4px;
42
- border-bottom-left-radius: 4px;
43
- -moz-border-radius-topleft: 4px;
44
- -moz-border-radius-bottomleft: 4px;
45
- background: #2D2D2D;
46
- background: -moz-linear-gradient(left, #2D2D2D 0%, #484848 100%);
47
- background: -webkit-gradient(linear, left top, right top, color-stop(0%,#2D2D2D), color-stop(100%,#484848));
48
- color: #fff;
49
- opacity: 0.3;
41
+ color: #8a8a8a;
42
+ text-shadow: 0px 1px 0px #000;
43
+ border-bottom: 1px solid #1a1a1a;
50
44
  }
51
45
  #cms_body .left_column_content ul.nav a:hover,
52
46
  #cms_body .left_column_content ul.nav a.active {
53
- color: #fff;
54
- opacity: 1;
47
+ color: #ddd;
48
+ }
49
+ #cms_body .left_column_content ul.nav a.active {
50
+ background-color: #1f1f1f;
51
+ box-shadow: inset 0px 0px 10px #000;
52
+ }
53
+ #cms_body .left_column_content ul.nav a.active:after {
54
+ position: absolute;
55
+ top: 10px;
56
+ right: -8px;
57
+ z-index: 9999;
58
+ content: '';
59
+ display: block;
60
+ height: 16px;
61
+ width: 8px;
62
+ background: transparent url(/assets/comfortable_mexican_sofa/nav_arrow.png);
55
63
  }
56
64
  #cms_body .right_column_content h2 {
57
65
  color: #d8d8d8;
@@ -7,6 +7,7 @@ class CmsAdmin::BaseController < ApplicationController
7
7
 
8
8
  before_filter :authenticate,
9
9
  :load_admin_site,
10
+ :set_locale,
10
11
  :load_fixtures,
11
12
  :except => :jump
12
13
 
@@ -27,7 +28,11 @@ protected
27
28
  flash[:error] = I18n.t('cms.base.site_not_found')
28
29
  return redirect_to(new_cms_admin_site_path)
29
30
  end
30
- I18n.locale = ComfortableMexicanSofa.config.admin_locale || @site.locale
31
+ end
32
+
33
+ def set_locale
34
+ I18n.locale = ComfortableMexicanSofa.config.admin_locale || (@site && @site.locale)
35
+ true
31
36
  end
32
37
 
33
38
  def load_fixtures
@@ -144,6 +144,7 @@ protected
144
144
 
145
145
  def assign_position
146
146
  return unless self.parent
147
+ return if self.position.to_i > 0
147
148
  max = self.parent.children.maximum(:position)
148
149
  self.position = max ? max + 1 : 0
149
150
  end
@@ -15,7 +15,7 @@
15
15
  end
16
16
  %>
17
17
  </div>
18
- <div class='icon'>
18
+ <div class='icon <%= page.is_published?? 'published' : 'draft' %>'>
19
19
  <% if !category_view && has_siblings %>
20
20
  <div class='dragger'><span><%= t('cms.views.pages.drag') %></span></div>
21
21
  <% end %>
@@ -13,7 +13,7 @@
13
13
  <div class='center_column'>
14
14
  <%= render :partial => 'layouts/cms_admin/center' %>
15
15
  <div class='sofa'>
16
- <a href='https://github.com/comfy/comfortable-mexican-sofa' target='_blank'>ComfortableMexicanSofa</a>
16
+ <a href='https://github.com/comfy' target='_blank'>ComfortableMexicanSofa</a>
17
17
  <span class='version'><%= ComfortableMexicanSofa::VERSION %></span>
18
18
  </div>
19
19
  </div>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "comfortable_mexican_sofa"
8
- s.version = "1.6.9"
8
+ s.version = "1.6.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oleg Khabarov", "The Working Group Inc"]
12
- s.date = "2012-02-02"
12
+ s.date = "2012-02-07"
13
13
  s.description = ""
14
14
  s.email = "oleg@theworkinggroup.ca"
15
15
  s.extra_rdoc_files = [
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
50
50
  "app/assets/images/comfortable_mexican_sofa/elrte/smileys/unhappy.png",
51
51
  "app/assets/images/comfortable_mexican_sofa/elrte/smileys/waii.png",
52
52
  "app/assets/images/comfortable_mexican_sofa/elrte/smileys/wink.png",
53
+ "app/assets/images/comfortable_mexican_sofa/icon_draft.gif",
53
54
  "app/assets/images/comfortable_mexican_sofa/icon_layout.gif",
54
55
  "app/assets/images/comfortable_mexican_sofa/icon_move.gif",
55
56
  "app/assets/images/comfortable_mexican_sofa/icon_regular.gif",
@@ -68,6 +69,7 @@ Gem::Specification.new do |s|
68
69
  "app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_454545_256x240.png",
69
70
  "app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_888888_256x240.png",
70
71
  "app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_cd0a0a_256x240.png",
72
+ "app/assets/images/comfortable_mexican_sofa/nav_arrow.png",
71
73
  "app/assets/images/comfortable_mexican_sofa/x.png",
72
74
  "app/assets/javascripts/comfortable_mexican_sofa/application.js",
73
75
  "app/assets/javascripts/comfortable_mexican_sofa/codemirror/codemirror.js",
@@ -237,8 +239,8 @@ Gem::Specification.new do |s|
237
239
  "lib/comfortable_mexican_sofa/version.rb",
238
240
  "lib/comfortable_mexican_sofa/view_hooks.rb",
239
241
  "lib/comfortable_mexican_sofa/view_methods.rb",
240
- "lib/generators/README",
241
- "lib/generators/cms_generator.rb",
242
+ "lib/generators/comfy/cms/README",
243
+ "lib/generators/comfy/cms/cms_generator.rb",
242
244
  "lib/tasks/comfortable_mexican_sofa.rake",
243
245
  "rvmrc.example",
244
246
  "script/rails",
@@ -1 +1,2 @@
1
- label: Default Fixture Nested Layout
1
+ label: Default Fixture Nested Layout
2
+ position: 42
@@ -1,2 +1,3 @@
1
1
  label: Child Fixture Page
2
- layout: nested
2
+ layout: nested
3
+ position: 42
@@ -28,7 +28,8 @@ module ComfortableMexicanSofa::Fixtures
28
28
  if layout.new_record? || File.mtime(file_path) > layout.updated_at
29
29
  attributes = YAML.load_file(file_path).try(:symbolize_keys!) || { }
30
30
  layout.label = attributes[:label] || identifier.titleize
31
- layout.app_layout = attributes[:app_layout] || parent.try(:app_layout)
31
+ layout.app_layout = attributes[:app_layout] || parent.try(:app_layout)
32
+ layout.position = attributes[:position] if attributes[:position]
32
33
  end
33
34
  elsif layout.new_record?
34
35
  layout.label = identifier.titleize
@@ -101,6 +102,7 @@ module ComfortableMexicanSofa::Fixtures
101
102
  page.layout = site.layouts.find_by_identifier(attributes[:layout]) || parent.try(:layout)
102
103
  page.target_page = site.pages.find_by_full_path(attributes[:target_page])
103
104
  page.is_published = attributes[:is_published].present?? attributes[:is_published] : true
105
+ page.position = attributes[:position] if attributes[:position]
104
106
  end
105
107
  elsif page.new_record?
106
108
  page.label = slug.titleize
@@ -205,7 +207,8 @@ module ComfortableMexicanSofa::Fixtures
205
207
  f.write({
206
208
  'label' => layout.label,
207
209
  'app_layout' => layout.app_layout,
208
- 'parent' => layout.parent.try(:identifier)
210
+ 'parent' => layout.parent.try(:identifier),
211
+ 'position' => layout.position
209
212
  }.to_yaml)
210
213
  end
211
214
  open(File.join(layout_path, 'content.html'), 'w') do |f|
@@ -237,7 +240,8 @@ module ComfortableMexicanSofa::Fixtures
237
240
  'layout' => page.layout.try(:identifier),
238
241
  'parent' => page.parent && (page.parent.slug.present?? page.parent.slug : 'index'),
239
242
  'target_page' => page.target_page.try(:slug),
240
- 'is_published' => page.is_published
243
+ 'is_published' => page.is_published,
244
+ 'position' => page.position
241
245
  }.to_yaml)
242
246
  end
243
247
  page.blocks_attributes.each do |block|
File without changes
@@ -0,0 +1,64 @@
1
+ module Comfy
2
+ module Generators
3
+ class CmsGenerator < Rails::Generators::Base
4
+
5
+ require 'rails/generators/active_record'
6
+ include Rails::Generators::Migration
7
+ include Thor::Actions
8
+
9
+ source_root File.expand_path('../../../../..', __FILE__)
10
+
11
+ def generate_migration
12
+ destination = File.expand_path('db/migrate/01_create_cms.rb', self.destination_root)
13
+ migration_dir = File.dirname(destination)
14
+ destination = self.class.migration_exists?(migration_dir, 'create_cms')
15
+
16
+ if destination
17
+ puts "\e[0m\e[31mFound existing cms_create.rb migration. Remove it if you want to regenerate.\e[0m"
18
+ else
19
+ migration_template 'db/migrate/01_create_cms.rb', 'db/migrate/create_cms.rb'
20
+ end
21
+ end
22
+
23
+ def generate_initialization
24
+ copy_file 'config/initializers/comfortable_mexican_sofa.rb',
25
+ 'config/initializers/comfortable_mexican_sofa.rb'
26
+ end
27
+
28
+ def generate_public_assets
29
+ return if ComfortableMexicanSofa.asset_pipeline_enabled?
30
+ directory 'app/assets/stylesheets/comfortable_mexican_sofa',
31
+ 'public/stylesheets/comfortable_mexican_sofa'
32
+ directory 'app/assets/javascripts/comfortable_mexican_sofa',
33
+ 'public/javascripts/comfortable_mexican_sofa'
34
+ directory 'app/assets/images/comfortable_mexican_sofa',
35
+ 'public/images/comfortable_mexican_sofa'
36
+
37
+ files_to_be_changed = [
38
+ 'public/stylesheets/comfortable_mexican_sofa/content.css',
39
+ 'public/stylesheets/comfortable_mexican_sofa/widgets.css',
40
+ 'public/stylesheets/comfortable_mexican_sofa/jquery_ui.css',
41
+ 'public/stylesheets/comfortable_mexican_sofa/elrte.css',
42
+ 'public/stylesheets/comfortable_mexican_sofa/files.css'
43
+ ]
44
+
45
+ files_to_be_changed.each do |file_path|
46
+ gsub_file file_path, '/assets/comfortable_mexican_sofa/', '/images/comfortable_mexican_sofa/'
47
+ end
48
+ end
49
+
50
+ def generate_cms_seeds
51
+ directory 'db/cms_fixtures', 'db/cms_fixtures'
52
+ end
53
+
54
+ def show_readme
55
+ readme 'lib/generators/comfy/cms/README'
56
+ end
57
+
58
+ def self.next_migration_number(dirname)
59
+ ActiveRecord::Generators::Base.next_migration_number(dirname)
60
+ end
61
+
62
+ end
63
+ end
64
+ end
@@ -1,5 +1,6 @@
1
1
  default:
2
2
  site: default
3
+ block:
3
4
  label: Sample
4
5
  file_file_name: sample.jpg
5
6
  file_content_type: image/jpeg
@@ -83,10 +83,20 @@ class SitesTest < ActionDispatch::IntegrationTest
83
83
 
84
84
  def test_get_admin_with_forced_locale
85
85
  ComfortableMexicanSofa.config.admin_locale = :en
86
+
86
87
  cms_sites(:default).update_attribute(:locale, 'fr')
87
88
  http_auth :get, cms_admin_site_pages_path(cms_sites(:default))
88
89
  assert_response :success
89
90
  assert_equal :en, I18n.locale
91
+
92
+ I18n.default_locale = :fr
93
+ I18n.locale = :fr
94
+ http_auth :get, cms_admin_sites_path()
95
+ assert_response :success
96
+ assert_equal :en, I18n.locale
97
+
98
+ I18n.default_locale = :en
99
+
90
100
  end
91
101
 
92
102
  end
@@ -41,6 +41,7 @@ class FixturesTest < ActiveSupport::TestCase
41
41
  assert_equal "<html>\n <body>\n {{ cms:page:content }}\n </body>\n</html>", layout.content
42
42
  assert_equal 'body{color: red}', layout.css
43
43
  assert_equal '// default js', layout.js
44
+ assert_equal 0, layout.position
44
45
 
45
46
  nested_layout.reload
46
47
  assert_equal layout, nested_layout.parent
@@ -48,6 +49,7 @@ class FixturesTest < ActiveSupport::TestCase
48
49
  assert_equal "<div class='left'> {{ cms:page:left }} </div>\n<div class='right'> {{ cms:page:right }} </div>", nested_layout.content
49
50
  assert_equal 'div{float:left}', nested_layout.css
50
51
  assert_equal '// nested js', nested_layout.js
52
+ assert_equal 42, nested_layout.position
51
53
 
52
54
  assert_nil Cms::Layout.find_by_identifier('child')
53
55
  end
@@ -91,6 +93,7 @@ class FixturesTest < ActiveSupport::TestCase
91
93
  assert_equal layout, page.layout
92
94
  assert_equal 'index', page.slug
93
95
  assert_equal "<html>Home Page Fixture Contént\ndefault_snippet_content</html>", page.content
96
+ assert_equal 0, page.position
94
97
  assert page.is_published?
95
98
 
96
99
  assert child_page = Cms::Page.find_by_full_path('/child')
@@ -98,6 +101,7 @@ class FixturesTest < ActiveSupport::TestCase
98
101
  assert_equal nested, child_page.layout
99
102
  assert_equal 'child', child_page.slug
100
103
  assert_equal '<html>Child Page Left Fixture Content<br/>Child Page Right Fixture Content</html>', child_page.content
104
+ assert_equal 42, child_page.position
101
105
  end
102
106
  end
103
107
 
@@ -248,7 +252,8 @@ class FixturesTest < ActiveSupport::TestCase
248
252
  assert_equal ({
249
253
  'label' => 'Nested Layout',
250
254
  'app_layout' => nil,
251
- 'parent' => nil
255
+ 'parent' => nil,
256
+ 'position' => 0
252
257
  }), YAML.load_file(layout_1_attr_path)
253
258
  assert_equal cms_layouts(:nested).content, IO.read(layout_1_content_path)
254
259
  assert_equal cms_layouts(:nested).css, IO.read(layout_1_css_path)
@@ -257,7 +262,8 @@ class FixturesTest < ActiveSupport::TestCase
257
262
  assert_equal ({
258
263
  'label' => 'Child Layout',
259
264
  'app_layout' => nil,
260
- 'parent' => 'nested'
265
+ 'parent' => 'nested',
266
+ 'position' => 0
261
267
  }), YAML.load_file(layout_2_attr_path)
262
268
  assert_equal cms_layouts(:child).content, IO.read(layout_2_content_path)
263
269
  assert_equal cms_layouts(:child).css, IO.read(layout_2_css_path)
@@ -280,7 +286,8 @@ class FixturesTest < ActiveSupport::TestCase
280
286
  'layout' => 'default',
281
287
  'parent' => nil,
282
288
  'target_page' => nil,
283
- 'is_published' => true
289
+ 'is_published' => true,
290
+ 'position' => 0
284
291
  }), YAML.load_file(page_1_attr_path)
285
292
  assert_equal cms_blocks(:default_field_text).content, IO.read(page_1_block_a_path)
286
293
  assert_equal cms_blocks(:default_page_text).content, IO.read(page_1_block_b_path)
@@ -290,7 +297,8 @@ class FixturesTest < ActiveSupport::TestCase
290
297
  'layout' => 'default',
291
298
  'parent' => 'index',
292
299
  'target_page' => nil,
293
- 'is_published' => true
300
+ 'is_published' => true,
301
+ 'position' => 0
294
302
  }), YAML.load_file(page_2_attr_path)
295
303
 
296
304
  FileUtils.rm_rf(host_path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfortable_mexican_sofa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.9
4
+ version: 1.6.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-02 00:00:00.000000000Z
13
+ date: 2012-02-07 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &70228805602580 !ruby/object:Gem::Requirement
17
+ requirement: &70230617724740 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.0.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70228805602580
25
+ version_requirements: *70230617724740
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: active_link_to
28
- requirement: &70228805602000 !ruby/object:Gem::Requirement
28
+ requirement: &70230617724260 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70228805602000
36
+ version_requirements: *70230617724260
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: paperclip
39
- requirement: &70228805601460 !ruby/object:Gem::Requirement
39
+ requirement: &70230617723780 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: 2.3.0
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70228805601460
47
+ version_requirements: *70230617723780
48
48
  description: ''
49
49
  email: oleg@theworkinggroup.ca
50
50
  executables: []
@@ -86,6 +86,7 @@ files:
86
86
  - app/assets/images/comfortable_mexican_sofa/elrte/smileys/unhappy.png
87
87
  - app/assets/images/comfortable_mexican_sofa/elrte/smileys/waii.png
88
88
  - app/assets/images/comfortable_mexican_sofa/elrte/smileys/wink.png
89
+ - app/assets/images/comfortable_mexican_sofa/icon_draft.gif
89
90
  - app/assets/images/comfortable_mexican_sofa/icon_layout.gif
90
91
  - app/assets/images/comfortable_mexican_sofa/icon_move.gif
91
92
  - app/assets/images/comfortable_mexican_sofa/icon_regular.gif
@@ -104,6 +105,7 @@ files:
104
105
  - app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_454545_256x240.png
105
106
  - app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_888888_256x240.png
106
107
  - app/assets/images/comfortable_mexican_sofa/jquery_ui/ui-icons_cd0a0a_256x240.png
108
+ - app/assets/images/comfortable_mexican_sofa/nav_arrow.png
107
109
  - app/assets/images/comfortable_mexican_sofa/x.png
108
110
  - app/assets/javascripts/comfortable_mexican_sofa/application.js
109
111
  - app/assets/javascripts/comfortable_mexican_sofa/codemirror/codemirror.js
@@ -273,8 +275,8 @@ files:
273
275
  - lib/comfortable_mexican_sofa/version.rb
274
276
  - lib/comfortable_mexican_sofa/view_hooks.rb
275
277
  - lib/comfortable_mexican_sofa/view_methods.rb
276
- - lib/generators/README
277
- - lib/generators/cms_generator.rb
278
+ - lib/generators/comfy/cms/README
279
+ - lib/generators/comfy/cms/cms_generator.rb
278
280
  - lib/tasks/comfortable_mexican_sofa.rake
279
281
  - rvmrc.example
280
282
  - script/rails
@@ -362,7 +364,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
362
364
  version: '0'
363
365
  segments:
364
366
  - 0
365
- hash: -1140535759846498867
367
+ hash: 1450113347744328574
366
368
  required_rubygems_version: !ruby/object:Gem::Requirement
367
369
  none: false
368
370
  requirements:
@@ -1,56 +0,0 @@
1
- class CmsGenerator < Rails::Generators::Base
2
-
3
- require 'rails/generators/active_record'
4
- include Rails::Generators::Migration
5
- include Thor::Actions
6
-
7
- source_root File.expand_path('../../..', __FILE__)
8
-
9
- def generate_migration
10
- destination = File.expand_path('db/migrate/01_create_cms.rb', self.destination_root)
11
- migration_dir = File.dirname(destination)
12
- destination = self.class.migration_exists?(migration_dir, 'create_cms')
13
-
14
- if destination
15
- puts "\e[0m\e[31mFound existing cms_create.rb migration. Remove it if you want to regenerate.\e[0m"
16
- else
17
- migration_template 'db/migrate/01_create_cms.rb', 'db/migrate/create_cms.rb'
18
- end
19
- end
20
-
21
- def generate_initialization
22
- copy_file 'config/initializers/comfortable_mexican_sofa.rb', 'config/initializers/comfortable_mexican_sofa.rb'
23
- end
24
-
25
- def generate_public_assets
26
- return if ComfortableMexicanSofa.asset_pipeline_enabled?
27
- directory 'app/assets/stylesheets/comfortable_mexican_sofa', 'public/stylesheets/comfortable_mexican_sofa'
28
- directory 'app/assets/javascripts/comfortable_mexican_sofa', 'public/javascripts/comfortable_mexican_sofa'
29
- directory 'app/assets/images/comfortable_mexican_sofa', 'public/images/comfortable_mexican_sofa'
30
-
31
- files_to_be_changed = [
32
- 'public/stylesheets/comfortable_mexican_sofa/content.css',
33
- 'public/stylesheets/comfortable_mexican_sofa/widgets.css',
34
- 'public/stylesheets/comfortable_mexican_sofa/jquery_ui.css',
35
- 'public/stylesheets/comfortable_mexican_sofa/elrte.css',
36
- 'public/stylesheets/comfortable_mexican_sofa/files.css'
37
- ]
38
-
39
- files_to_be_changed.each do |file_path|
40
- gsub_file file_path, '/assets/comfortable_mexican_sofa/', '/images/comfortable_mexican_sofa/'
41
- end
42
- end
43
-
44
- def generate_cms_seeds
45
- directory 'db/cms_fixtures', 'db/cms_fixtures'
46
- end
47
-
48
- def show_readme
49
- readme 'lib/generators/README'
50
- end
51
-
52
- def self.next_migration_number(dirname)
53
- ActiveRecord::Generators::Base.next_migration_number(dirname)
54
- end
55
-
56
- end