adjusting generator and some minor css stuff
Oleg
committed Feb 07, 2012
commit 9a208b6dcb4a32763aed25f27d7edd8e6ca843d4
Showing 13
changed files with
112 additions
and 93 deletions
README.md
+1
-1
| @@ | @@ -23,7 +23,7 @@ Add gem definition to your Gemfile: |
| Then from the Rails project's root run: | |
| bundle install | |
| - | rails generate cms |
| + | rails generate comfy:cms |
| rake db:migrate | |
| When upgrading from the older version please take a look at [Upgrading ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa/wiki/Upgrading-ComfortableMexicanSofa) | |
app/assets/images/comfortable_mexican_sofa/icon_draft.gif
+0
-0
app/assets/images/comfortable_mexican_sofa/nav_arrow.png
+0
-0
app/assets/stylesheets/comfortable_mexican_sofa/content.css
+3
-0
| @@ | @@ -128,6 +128,9 @@ |
| height: 28px; | |
| background: url(/assets/comfortable_mexican_sofa/icon_regular.gif); | |
| } | |
| + | #cms_body ul.list li .item .icon.draft { |
| + | background: url(/assets/comfortable_mexican_sofa/icon_draft.gif); |
| + | } |
| #cms_body ul.list li .item .icon .dragger { | |
| width: 28px; | |
| height: 28px; | |
app/assets/stylesheets/comfortable_mexican_sofa/files.css
+1
-1
| @@ | @@ -35,7 +35,7 @@ |
| white-space: nowrap; | |
| overflow: hidden; | |
| float: left; | |
| - | color: #eee; |
| + | color: #8a8a8a; |
| } | |
| #cms_body .uploaded_files .file .file_name a.delete { | |
| float: right; | |
app/assets/stylesheets/comfortable_mexican_sofa/form.css
+5
-2
| @@ | @@ -10,7 +10,7 @@ |
| font: 13px/19px 'Lucida Grande', 'Tahoma', sans-serif; | |
| text-shadow: #fff 1px 1px; | |
| padding: 0px 10px; | |
| - | background-color: #f1f1f1; |
| + | background-color: #f6f5f5; |
| border-top-left-radius: 3px; | |
| border-bottom-left-radius: 3px ; | |
| -moz-border-radius-topleft: 3px; | |
| @@ | @@ -38,6 +38,9 @@ |
| #cms_body .form_element .value textarea { | |
| height: 300px; | |
| } | |
| + | #cms_body .form_element .value textarea.short { |
| + | height: 100px; |
| + | } |
| #cms_body .form_element .value .CodeMirror-wrapping { | |
| background-color: #fff; | |
| } | |
| @@ | @@ -142,7 +145,7 @@ |
| } | |
| #cms_body .form_element.submit_element .value { | |
| overflow: hidden; | |
| - | background-color: #f1f1f1; |
| + | background-color: #f6f5f5; |
| border-radius: 3px; | |
| -moz-border-radius: 3px; | |
| padding: 5px; | |
app/assets/stylesheets/comfortable_mexican_sofa/structure.css
+23
-15
| @@ | @@ -29,29 +29,37 @@ html, body#cms_body { |
| position: fixed; | |
| } | |
| #cms_body .left_column_content { | |
| - | padding: 25px 0px 25px 10px; |
| - | width: 165px; |
| + | padding: 25px 0px; |
| + | width: 175px; |
| position: fixed; | |
| } | |
| #cms_body .left_column_content ul.nav a { | |
| + | position: relative; |
| display: block; | |
| - | padding: 3px 10px; |
| - | margin-bottom: 5px; |
| + | padding: 5px 15px; |
| font: 15px/25px 'Lucida Grande', 'Tahoma', sans-serif; | |
| - | border-top-left-radius: 4px; |
| - | border-bottom-left-radius: 4px; |
| - | -moz-border-radius-topleft: 4px; |
| - | -moz-border-radius-bottomleft: 4px; |
| - | background: #2D2D2D; |
| - | background: -moz-linear-gradient(left, #2D2D2D 0%, #484848 100%); |
| - | background: -webkit-gradient(linear, left top, right top, color-stop(0%,#2D2D2D), color-stop(100%,#484848)); |
| - | color: #fff; |
| - | opacity: 0.3; |
| + | color: #8a8a8a; |
| + | text-shadow: 0px 1px 0px #000; |
| + | border-bottom: 1px solid #1a1a1a; |
| } | |
| #cms_body .left_column_content ul.nav a:hover, | |
| #cms_body .left_column_content ul.nav a.active { | |
| - | color: #fff; |
| - | opacity: 1; |
| + | color: #ddd; |
| + | } |
| + | #cms_body .left_column_content ul.nav a.active { |
| + | background-color: #1f1f1f; |
| + | box-shadow: inset 0px 0px 10px #000; |
| + | } |
| + | #cms_body .left_column_content ul.nav a.active:after { |
| + | position: absolute; |
| + | top: 10px; |
| + | right: -8px; |
| + | z-index: 9999; |
| + | content: ''; |
| + | display: block; |
| + | height: 16px; |
| + | width: 8px; |
| + | background: transparent url(/assets/comfortable_mexican_sofa/nav_arrow.png); |
| } | |
| #cms_body .right_column_content h2 { | |
| color: #d8d8d8; | |
app/views/cms_admin/pages/_index_branch.html.erb
+1
-1
| @@ | @@ -15,7 +15,7 @@ |
| end | |
| %> | |
| </div> | |
| - | <div class='icon'> |
| + | <div class='icon <%= page.is_published?? 'published' : 'draft' %>'> |
| <% if !category_view && has_siblings %> | |
| <div class='dragger'><span><%= t('cms.views.pages.drag') %></span></div> | |
| <% end %> | |
generators/README b/lib/generators/README
+0
-17
| @@ | @@ -1,17 +0,0 @@ |
| - | ____ __ _ _ _ |
| - | / ___|___ _ __ ___ / _| ___ _ __| |_ __ _| |__ | | ___ |
| - | | | / _ \| '_ ` _ \| |_ / _ \| '__| __/ _` | '_ \| |/ _ \ |
| - | | |__| (_) | | | | | | _| (_) | | | || (_| | |_) | | __/ |
| - | \____\___/|_| |_| |_|_| \___/|_| \__\__,_|_.__/|_|\___| |
| - | __ __ _ ____ __ |
| - | | \/ | _____ _(_) ___ __ _ _ __ / ___| ___ / _| __ _ |
| - | | |\/| |/ _ \ \/ / |/ __/ _` | '_ \ \___ \ / _ \| |_ / _` | |
| - | | | | | __/> <| | (_| (_| | | | | ___) | (_) | _| (_| | |
| - | |_| |_|\___/_/\_\_|\___\__,_|_| |_| |____/ \___/|_| \__,_| |
| - | |
| - | Hey! Everything is almost done. Please don't forget to |
| - | |
| - | * run migrations -> `rake db:migrate` |
| - | |
| - | After that go to http://your-awesome-app/cms-admin to start populating content. |
| - | Default username and password are: username // password |
generators/cms_generator.rb b/lib/generators/cms_generator.rb
+0
-56
| @@ | @@ -1,56 +0,0 @@ |
| - | class CmsGenerator < Rails::Generators::Base |
| - | |
| - | require 'rails/generators/active_record' |
| - | include Rails::Generators::Migration |
| - | include Thor::Actions |
| - | |
| - | source_root File.expand_path('../../..', __FILE__) |
| - | |
| - | def generate_migration |
| - | destination = File.expand_path('db/migrate/01_create_cms.rb', self.destination_root) |
| - | migration_dir = File.dirname(destination) |
| - | destination = self.class.migration_exists?(migration_dir, 'create_cms') |
| - | |
| - | if destination |
| - | puts "\e[0m\e[31mFound existing cms_create.rb migration. Remove it if you want to regenerate.\e[0m" |
| - | else |
| - | migration_template 'db/migrate/01_create_cms.rb', 'db/migrate/create_cms.rb' |
| - | end |
| - | end |
| - | |
| - | def generate_initialization |
| - | copy_file 'config/initializers/comfortable_mexican_sofa.rb', 'config/initializers/comfortable_mexican_sofa.rb' |
| - | end |
| - | |
| - | def generate_public_assets |
| - | return if ComfortableMexicanSofa.asset_pipeline_enabled? |
| - | directory 'app/assets/stylesheets/comfortable_mexican_sofa', 'public/stylesheets/comfortable_mexican_sofa' |
| - | directory 'app/assets/javascripts/comfortable_mexican_sofa', 'public/javascripts/comfortable_mexican_sofa' |
| - | directory 'app/assets/images/comfortable_mexican_sofa', 'public/images/comfortable_mexican_sofa' |
| - | |
| - | files_to_be_changed = [ |
| - | 'public/stylesheets/comfortable_mexican_sofa/content.css', |
| - | 'public/stylesheets/comfortable_mexican_sofa/widgets.css', |
| - | 'public/stylesheets/comfortable_mexican_sofa/jquery_ui.css', |
| - | 'public/stylesheets/comfortable_mexican_sofa/elrte.css', |
| - | 'public/stylesheets/comfortable_mexican_sofa/files.css' |
| - | ] |
| - | |
| - | files_to_be_changed.each do |file_path| |
| - | gsub_file file_path, '/assets/comfortable_mexican_sofa/', '/images/comfortable_mexican_sofa/' |
| - | end |
| - | end |
| - | |
| - | def generate_cms_seeds |
| - | directory 'db/cms_fixtures', 'db/cms_fixtures' |
| - | end |
| - | |
| - | def show_readme |
| - | readme 'lib/generators/README' |
| - | end |
| - | |
| - | def self.next_migration_number(dirname) |
| - | ActiveRecord::Generators::Base.next_migration_number(dirname) |
| - | end |
| - | |
| - | end |
| \ No newline at end of file | |
generators/comfy/cms/README b/lib/generators/comfy/cms/README
+17
-0
| @@ | @@ -0,0 +1,17 @@ |
| + | ____ __ _ _ _ |
| + | / ___|___ _ __ ___ / _| ___ _ __| |_ __ _| |__ | | ___ |
| + | | | / _ \| '_ ` _ \| |_ / _ \| '__| __/ _` | '_ \| |/ _ \ |
| + | | |__| (_) | | | | | | _| (_) | | | || (_| | |_) | | __/ |
| + | \____\___/|_| |_| |_|_| \___/|_| \__\__,_|_.__/|_|\___| |
| + | __ __ _ ____ __ |
| + | | \/ | _____ _(_) ___ __ _ _ __ / ___| ___ / _| __ _ |
| + | | |\/| |/ _ \ \/ / |/ __/ _` | '_ \ \___ \ / _ \| |_ / _` | |
| + | | | | | __/> <| | (_| (_| | | | | ___) | (_) | _| (_| | |
| + | |_| |_|\___/_/\_\_|\___\__,_|_| |_| |____/ \___/|_| \__,_| |
| + | |
| + | Hey! Everything is almost done. Please don't forget to |
| + | |
| + | * run migrations -> `rake db:migrate` |
| + | |
| + | After that go to http://your-awesome-app/cms-admin to start populating content. |
| + | Default username and password are: username // password |
generators/comfy/cms/cms_generator.rb b/lib/generators/comfy/cms/cms_generator.rb
+60
-0
| @@ | @@ -0,0 +1,60 @@ |
| + | class CmsGenerator < Rails::Generators::Base |
| + | |
| + | require 'rails/generators/active_record' |
| + | include Rails::Generators::Migration |
| + | include Thor::Actions |
| + | |
| + | source_root File.expand_path('../../../../..', __FILE__) |
| + | |
| + | def generate_migration |
| + | destination = File.expand_path('db/migrate/01_create_cms.rb', self.destination_root) |
| + | migration_dir = File.dirname(destination) |
| + | destination = self.class.migration_exists?(migration_dir, 'create_cms') |
| + | |
| + | if destination |
| + | puts "\e[0m\e[31mFound existing cms_create.rb migration. Remove it if you want to regenerate.\e[0m" |
| + | else |
| + | migration_template 'db/migrate/01_create_cms.rb', 'db/migrate/create_cms.rb' |
| + | end |
| + | end |
| + | |
| + | def generate_initialization |
| + | copy_file 'config/initializers/comfortable_mexican_sofa.rb', |
| + | 'config/initializers/comfortable_mexican_sofa.rb' |
| + | end |
| + | |
| + | def generate_public_assets |
| + | return if ComfortableMexicanSofa.asset_pipeline_enabled? |
| + | directory 'app/assets/stylesheets/comfortable_mexican_sofa', |
| + | 'public/stylesheets/comfortable_mexican_sofa' |
| + | directory 'app/assets/javascripts/comfortable_mexican_sofa', |
| + | 'public/javascripts/comfortable_mexican_sofa' |
| + | directory 'app/assets/images/comfortable_mexican_sofa', |
| + | 'public/images/comfortable_mexican_sofa' |
| + | |
| + | files_to_be_changed = [ |
| + | 'public/stylesheets/comfortable_mexican_sofa/content.css', |
| + | 'public/stylesheets/comfortable_mexican_sofa/widgets.css', |
| + | 'public/stylesheets/comfortable_mexican_sofa/jquery_ui.css', |
| + | 'public/stylesheets/comfortable_mexican_sofa/elrte.css', |
| + | 'public/stylesheets/comfortable_mexican_sofa/files.css' |
| + | ] |
| + | |
| + | files_to_be_changed.each do |file_path| |
| + | gsub_file file_path, '/assets/comfortable_mexican_sofa/', '/images/comfortable_mexican_sofa/' |
| + | end |
| + | end |
| + | |
| + | def generate_cms_seeds |
| + | directory 'db/cms_fixtures', 'db/cms_fixtures' |
| + | end |
| + | |
| + | def show_readme |
| + | readme 'lib/generators/comfy/cms/README' |
| + | end |
| + | |
| + | def self.next_migration_number(dirname) |
| + | ActiveRecord::Generators::Base.next_migration_number(dirname) |
| + | end |
| + | |
| + | end |
| \ No newline at end of file | |
test/fixtures/cms/files.yml
+1
-0
| @@ | @@ -1,5 +1,6 @@ |
| default: | |
| site: default | |
| + | block: |
| label: Sample | |
| file_file_name: sample.jpg | |
| file_content_type: image/jpeg | |