comfortable_mexican_sofa 1.12.2 → 1.12.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/comfortable_mexican_sofa/admin/application.js +1 -1
  3. data/app/assets/javascripts/comfortable_mexican_sofa/application.js.coffee +50 -57
  4. data/app/assets/javascripts/comfortable_mexican_sofa/cms/files.js.coffee +29 -0
  5. data/app/assets/javascripts/comfortable_mexican_sofa/cms/uploader.js.coffee +139 -0
  6. data/app/assets/stylesheets/comfortable_mexican_sofa/admin/application.css +1 -1
  7. data/app/assets/stylesheets/comfortable_mexican_sofa/application.css.sass +1 -0
  8. data/app/assets/stylesheets/comfortable_mexican_sofa/base.css.sass +67 -84
  9. data/app/controllers/comfy/admin/cms/base_controller.rb +11 -8
  10. data/app/controllers/comfy/admin/cms/categories_controller.rb +10 -9
  11. data/app/controllers/comfy/admin/cms/files_controller.rb +38 -69
  12. data/app/controllers/comfy/admin/cms/layouts_controller.rb +4 -3
  13. data/app/controllers/comfy/admin/cms/pages_controller.rb +17 -11
  14. data/app/controllers/comfy/admin/cms/revisions_controller.rb +10 -9
  15. data/app/controllers/comfy/admin/cms/sites_controller.rb +2 -1
  16. data/app/controllers/comfy/admin/cms/snippets_controller.rb +3 -2
  17. data/app/controllers/comfy/cms/assets_controller.rb +17 -9
  18. data/app/controllers/comfy/cms/content_controller.rb +20 -14
  19. data/app/models/comfy/cms/file.rb +16 -15
  20. data/app/models/comfy/cms/page.rb +2 -1
  21. data/app/models/comfy/cms/site.rb +5 -0
  22. data/app/views/comfy/admin/cms/files/_file.html.haml +26 -13
  23. data/app/views/comfy/admin/cms/files/_form.html.haml +8 -5
  24. data/app/views/comfy/admin/cms/files/_modal.html.haml +4 -0
  25. data/app/views/comfy/admin/cms/files/create.js.erb +1 -0
  26. data/app/views/comfy/admin/cms/files/destroy.js.coffee +2 -2
  27. data/app/views/comfy/admin/cms/files/index.html.haml +33 -31
  28. data/app/views/comfy/admin/cms/layouts/_form.html.haml +2 -5
  29. data/app/views/comfy/admin/cms/pages/_form.html.haml +7 -8
  30. data/app/views/comfy/admin/cms/pages/_form_blocks.html.haml +3 -3
  31. data/app/views/comfy/admin/cms/sites/_form.html.haml +2 -2
  32. data/app/views/comfy/admin/cms/sites/index.html.haml +1 -2
  33. data/app/views/comfy/admin/cms/snippets/_form.html.haml +5 -8
  34. data/app/views/kaminari/comfy/_paginator.html.haml +10 -11
  35. data/app/views/layouts/comfy/admin/cms.html.haml +3 -2
  36. data/app/views/layouts/comfy/admin/cms/_body.html.haml +8 -7
  37. data/app/views/layouts/comfy/admin/cms/{_center.html.haml → _flash.html.haml} +0 -3
  38. data/app/views/layouts/comfy/admin/cms/_footer_js.html.haml +0 -4
  39. data/app/views/layouts/comfy/admin/cms/_left.html.haml +10 -5
  40. data/comfortable_mexican_sofa.gemspec +9 -8
  41. data/config/cms_routes.rb +2 -2
  42. data/config/initializers/comfortable_mexican_sofa.rb +31 -13
  43. data/config/initializers/plupload.rb +9 -0
  44. data/config/locales/en.yml +18 -16
  45. data/db/upgrade_migrations/08_upgrade_to_1_12_0.rb +3 -0
  46. data/lib/comfortable_mexican_sofa.rb +6 -5
  47. data/lib/comfortable_mexican_sofa/access_control/admin_authentication.rb +20 -0
  48. data/lib/comfortable_mexican_sofa/access_control/admin_authorization.rb +8 -0
  49. data/lib/comfortable_mexican_sofa/access_control/public_authentication.rb +8 -0
  50. data/lib/comfortable_mexican_sofa/configuration.rb +11 -3
  51. data/lib/comfortable_mexican_sofa/engine.rb +1 -0
  52. data/lib/comfortable_mexican_sofa/fixture.rb +7 -5
  53. data/lib/comfortable_mexican_sofa/fixture/category.rb +10 -3
  54. data/lib/comfortable_mexican_sofa/form_builder.rb +1 -1
  55. data/lib/comfortable_mexican_sofa/routes/cms.rb +3 -0
  56. data/lib/comfortable_mexican_sofa/version.rb +1 -1
  57. data/lib/generators/comfy/cms/assets_generator.rb +15 -0
  58. data/lib/generators/comfy/cms/cms_generator.rb +19 -12
  59. data/lib/generators/comfy/cms/controllers_generator.rb +13 -0
  60. data/lib/generators/comfy/cms/models_generator.rb +13 -0
  61. data/lib/generators/comfy/cms/views_generator.rb +13 -0
  62. data/test/controllers/comfy/admin/cms/files_controller_test.rb +22 -95
  63. data/test/controllers/comfy/admin/cms/layouts_controller_test.rb +9 -10
  64. data/test/controllers/comfy/admin/cms/pages_controller_test.rb +26 -27
  65. data/test/controllers/comfy/admin/cms/snippets_controller_test.rb +7 -8
  66. data/test/controllers/comfy/cms/content_controller_test.rb +30 -4
  67. data/test/gemfiles/Gemfile.rails.4.0 +3 -2
  68. data/test/gemfiles/Gemfile.rails.4.1 +3 -2
  69. data/test/gemfiles/Gemfile.rails.master +3 -2
  70. data/test/generators/cms_assets_generator_test.rb +13 -0
  71. data/test/generators/cms_controllers_generator_test.rb +12 -0
  72. data/test/generators/cms_generator_test.rb +10 -8
  73. data/test/generators/cms_models_generator_test.rb +12 -0
  74. data/test/generators/cms_views_generator_test.rb +12 -0
  75. data/test/generators/scaffold_generator_test.rb +6 -7
  76. data/test/integration/access_control_test.rb +141 -0
  77. data/test/integration/routing_test.rb +19 -0
  78. data/test/lib/configuration_test.rb +8 -7
  79. data/test/lib/fixtures/categories_test.rb +1 -0
  80. data/test/lib/fixtures/files_test.rb +5 -0
  81. data/test/lib/fixtures/pages_test.rb +17 -1
  82. data/test/lib/fixtures/snippets_test.rb +5 -0
  83. data/test/models/page_test.rb +6 -0
  84. data/test/models/site_test.rb +9 -0
  85. data/test/test_helper.rb +28 -19
  86. metadata +82 -48
  87. data/app/views/comfy/admin/cms/files/_index.html.haml +0 -11
  88. data/lib/comfortable_mexican_sofa/authentication/dummy_auth.rb +0 -8
  89. data/lib/comfortable_mexican_sofa/authentication/http_auth.rb +0 -25
  90. data/test/integration/authentication_test.rb +0 -48
@@ -1,9 +1,6 @@
1
1
  class Comfy::Cms::ContentController < Comfy::Cms::BaseController
2
2
 
3
- # Respond with HTML by default so that requests with 'Accept: */*' get a web page (e.g. Facebook)
4
- respond_to :html, :json
5
-
6
- # Authentication module must have #authenticate method
3
+ # Authentication module must have `authenticate` method
7
4
  include ComfortableMexicanSofa.config.public_auth.to_s.constantize
8
5
 
9
6
  before_action :load_fixtures
@@ -17,8 +14,9 @@ class Comfy::Cms::ContentController < Comfy::Cms::BaseController
17
14
  if @cms_page.target_page.present?
18
15
  redirect_to @cms_page.target_page.url
19
16
  else
20
- respond_with(@cms_page) do |format|
21
- format.html { render_html }
17
+ respond_to do |format|
18
+ format.html { render_page }
19
+ format.json { render :json => @cms_page }
22
20
  end
23
21
  end
24
22
  end
@@ -29,32 +27,40 @@ class Comfy::Cms::ContentController < Comfy::Cms::BaseController
29
27
 
30
28
  protected
31
29
 
32
- def render_html(status = 200)
30
+ def render_page(status = 200)
33
31
  if @cms_layout = @cms_page.layout
34
32
  app_layout = (@cms_layout.app_layout.blank? || request.xhr?) ? false : @cms_layout.app_layout
35
- render :inline => @cms_page.content_cache, :layout => app_layout, :status => status, :content_type => 'text/html'
33
+ render :inline => @cms_page.content_cache,
34
+ :layout => app_layout,
35
+ :status => status,
36
+ :content_type => mime_type
36
37
  else
37
38
  render :text => I18n.t('comfy.cms.content.layout_not_found'), :status => 404
38
39
  end
39
40
  end
40
41
 
42
+ # it's possible to control mimetype of a page by creating a `mime_type` field
43
+ def mime_type
44
+ mime_block = @cms_page.blocks.find_by_identifier(:mime_type)
45
+ mime_block && mime_block.content || 'text/html'
46
+ end
47
+
41
48
  def load_fixtures
42
49
  return unless ComfortableMexicanSofa.config.enable_fixtures
43
50
  ComfortableMexicanSofa::Fixture::Importer.new(@cms_site.identifier).import!
44
51
  end
45
-
52
+
46
53
  def load_cms_page
47
54
  @cms_page = @cms_site.pages.published.find_by_full_path!("/#{params[:cms_path]}")
48
- end
55
+ end
49
56
 
50
57
  def page_not_found
51
58
  @cms_page = @cms_site.pages.published.find_by_full_path!('/404')
52
59
 
53
- respond_with @cms_page do |format|
54
- format.html { render_html(404) }
60
+ respond_to do |format|
61
+ format.html { render_page(404) }
55
62
  end
56
-
57
63
  rescue ActiveRecord::RecordNotFound
58
64
  raise ActionController::RoutingError.new("Page Not Found at: \"#{params[:cms_path]}\"")
59
65
  end
60
- end
66
+ end
@@ -1,12 +1,12 @@
1
1
  class Comfy::Cms::File < ActiveRecord::Base
2
2
  self.table_name = 'comfy_cms_files'
3
-
3
+
4
4
  IMAGE_MIMETYPES = %w(gif jpeg pjpeg png tiff).collect{|subtype| "image/#{subtype}"}
5
-
5
+
6
6
  cms_is_categorized
7
-
7
+
8
8
  attr_accessor :dimensions
9
-
9
+
10
10
  has_attached_file :file, ComfortableMexicanSofa.config.upload_file_options.merge(
11
11
  # dimensions accessor needs to be set before file assignment for this to work
12
12
  :styles => lambda { |f|
@@ -18,51 +18,52 @@ class Comfy::Cms::File < ActiveRecord::Base
18
18
  }
19
19
  )
20
20
  before_post_process :is_image?
21
-
21
+
22
22
  # -- Relationships --------------------------------------------------------
23
23
  belongs_to :site
24
24
  belongs_to :block
25
-
25
+
26
26
  # -- Validations ----------------------------------------------------------
27
27
  validates :site_id,
28
28
  :presence => true
29
29
  validates_attachment_presence :file
30
30
  do_not_validate_attachment_file_type :file
31
-
31
+
32
32
  validates :file_file_name,
33
33
  :uniqueness => {:scope => [:site_id, :block_id]}
34
-
34
+
35
35
  # -- Callbacks ------------------------------------------------------------
36
36
  before_save :assign_label
37
37
  before_create :assign_position
38
38
  after_save :reload_blockable_cache
39
39
  after_destroy :reload_blockable_cache
40
-
40
+
41
41
  # -- Scopes ---------------------------------------------------------------
42
42
  scope :not_page_file, -> { where(:block_id => nil)}
43
43
  scope :images, -> { where(:file_content_type => IMAGE_MIMETYPES) }
44
44
  scope :not_images, -> { where('file_content_type NOT IN (?)', IMAGE_MIMETYPES) }
45
-
45
+
46
46
  # -- Instance Methods -----------------------------------------------------
47
47
  def is_image?
48
48
  IMAGE_MIMETYPES.include?(file_content_type)
49
49
  end
50
-
50
+
51
+
51
52
  protected
52
-
53
+
53
54
  def assign_label
54
55
  self.label = self.label.blank?? self.file_file_name.gsub(/\.[^\.]*?$/, '').titleize : self.label
55
56
  end
56
-
57
+
57
58
  def assign_position
58
59
  max = Comfy::Cms::File.maximum(:position)
59
60
  self.position = max ? max + 1 : 0
60
61
  end
61
-
62
+
62
63
  def reload_blockable_cache
63
64
  return unless self.block
64
65
  b = self.block.blockable
65
66
  b.class.name.constantize.where(:id => b.id).update_all(:content_cache => nil)
66
67
  end
67
-
68
+
68
69
  end
@@ -68,7 +68,8 @@ class Comfy::Cms::Page < ActiveRecord::Base
68
68
 
69
69
  # Full url for a page
70
70
  def url
71
- "//" + "#{self.site.hostname}/#{self.site.path}/#{self.full_path}".squeeze("/")
71
+ public_cms_path = ComfortableMexicanSofa.config.public_cms_path || '/'
72
+ "//" + "#{self.site.hostname}/#{public_cms_path}/#{self.site.path}/#{self.full_path}".squeeze("/")
72
73
  end
73
74
 
74
75
  protected
@@ -49,6 +49,11 @@ class Comfy::Cms::Site < ActiveRecord::Base
49
49
  end
50
50
 
51
51
  # -- Instance Methods -----------------------------------------------------
52
+ def url
53
+ public_cms_path = ComfortableMexicanSofa.config.public_cms_path || '/'
54
+ "//" + "#{self.hostname}/#{public_cms_path}/#{self.path}".squeeze("/")
55
+ end
56
+
52
57
  # When removing entire site, let's not destroy content from other sites
53
58
  # Since before_destroy doesn't really work, this does the trick
54
59
  def destroy
@@ -1,13 +1,26 @@
1
- .file{:class => "#{dom_id(file)} #{file.is_image?? 'image' : nil}"}
2
- .file-name
3
- = link_to comfy_admin_cms_site_file_path(@site, file), :method => :delete, :remote => true, :data => {:confirm => t('.are_you_sure')}, :class => 'delete' do
4
- %i.glyphicon.glyphicon-remove-circle
5
- = link_to file.file_file_name, file.file.url, :target => '_blank', :class => 'filename'
6
-
7
- .file-info{:data => {:url => file.file.url}}
8
- .thumb
9
- = image_tag file.file.url(:cms_thumb) if file.is_image?
10
- .details
11
- %input{:type => 'text', :value => file.file.url, :readonly => 'readonly'}
12
- .file-type= file.file_content_type
13
- .file-size= number_to_human_size(file.file_file_size, :locale => :en)
1
+ %tr{:id => dom_id(file)}
2
+ %td
3
+ - if file.is_image?
4
+ - icon_style = "background: url('#{file.file.url(:cms_thumb)}') no-repeat center"
5
+ .icon{:style => icon_style}
6
+ - if !params[:category].present? && @site.files.count > 1
7
+ .dragger
8
+ %span &#8645;
9
+ %td.main
10
+ .item-title
11
+ = link_to file.label, edit_comfy_admin_cms_site_file_path(@site, file)
12
+ = render :partial => 'comfy/admin/cms/categories/categories', :object => file
13
+ .item-meta
14
+ %input.file-path{:type => 'text', :value => file.file.url, :readonly => 'readonly'}
15
+
16
+ = link_to file.file.url, :title => file.file_file_name, :target => '_blank' do
17
+ %span.glyphicon.glyphicon-link
18
+ %td
19
+ .content-type
20
+ = truncate(file.file_content_type)
21
+ .file-size
22
+ = number_to_human_size(file.file_file_size, :locale => :en)
23
+ %td
24
+ .btn-group.btn-group-sm
25
+ = link_to t('.edit'), edit_comfy_admin_cms_site_file_path(@site, file), :class => 'btn btn-default'
26
+ = link_to t('.delete'), comfy_admin_cms_site_file_path(@site, file), :method => :delete, :remote => true, :data => {:confirm => t('.are_you_sure')}, :class => 'btn btn-danger'
@@ -1,20 +1,23 @@
1
- = render 'comfy/admin/cms/partials/file_form_before', :object => form
1
+ = render 'comfy/admin/cms/partials/file_form_before', :form => form
2
2
 
3
3
  = form.text_field :label
4
- = form.file_field :file, :multiple => @file.new_record?
4
+ = form.file_field :file
5
5
 
6
6
  - unless @file.new_record?
7
7
  = form.form_group t('.current_file') do
8
8
  - if @file.is_image?
9
- .file-image= image_tag @file.file.url
9
+ .file-image
10
+ = image_tag @file.file.url
10
11
  = link_to @file.file.url, @file.file.url, :target => '_blank'
11
12
 
12
13
  = form.text_area :description
13
14
 
14
- = render :partial => 'comfy/admin/cms/categories/form', :object => form
15
+ = render 'comfy/admin/cms/categories/form', :form => form
15
16
 
16
- = render 'comfy/admin/cms/partials/file_form_after', :object => form
17
+ = render 'comfy/admin/cms/partials/file_form_after', :form => form
17
18
 
18
19
  = form.form_group :class => 'form-actions' do
19
20
  = form.submit t(@file.new_record?? '.create' : '.update'), :class => 'btn btn-primary'
21
+ - unless @file.new_record?
22
+ = link_to t('.delete'), comfy_admin_cms_site_file_path(@site, @file), :method => :delete, :data => {:confirm => t('.are_you_sure')}, :class => 'btn btn-danger'
20
23
  = link_to t('.cancel'), comfy_admin_cms_site_files_path, :class => 'btn btn-link'
@@ -0,0 +1,4 @@
1
+ .modal.fade.cms-files-modal{'aria-hidden' => 'true', 'data-iframe-src' => comfy_admin_cms_site_files_path(@site), :role => 'dialog', :tabindex => "-1"}
2
+ .modal-dialog.modal-lg
3
+ .modal-content
4
+ %iframe{:src => ''}
@@ -0,0 +1 @@
1
+ $("<%= escape_javascript(render :partial => 'file', :object => @file) %>").appendTo(".cms-uploader-filelist");
@@ -1,2 +1,2 @@
1
- $(".file.<%= dom_id(@file) %>").fadeOut 'slow', ->
2
- $(this).remove()
1
+ $("#<%= dom_id(@file) %>").fadeOut 'slow', ->
2
+ $(this).remove()
@@ -1,31 +1,33 @@
1
- .page-header
2
- = link_to t('.new_link'), new_comfy_admin_cms_site_file_path(@site), :class => 'btn btn-default pull-right'
3
- %h2= t('.title')
4
-
5
- = render 'comfy/admin/cms/partials/files_before'
6
-
7
- = render :partial => 'comfy/admin/cms/categories/index', :object => 'Comfy::Cms::File'
8
-
9
- %table.table.table-hover.table-bordered
10
- %tbody.sortable
11
- - @files.each do |file|
12
- %tr{:id => dom_id(file)}
13
- %td
14
- - if file.is_image?
15
- - icon_style = "background: url('#{file.file.url(:cms_thumb)}') no-repeat center"
16
- .icon{:style => icon_style}
17
- - if !params[:category].present? && @site.files.count > 1
18
- .dragger
19
- %span &#8645;
20
- %td.main
21
- .item-title
22
- = link_to file.label, edit_comfy_admin_cms_site_file_path(@site, file)
23
- = render :partial => 'comfy/admin/cms/categories/categories', :object => file
24
- .item-meta
25
- = link_to file.file_file_name, file.file.url, :target => '_blank'
26
- %td
27
- .btn-group.btn-group-sm
28
- = link_to t('.edit'), edit_comfy_admin_cms_site_file_path(@site, file), :class => 'btn btn-default'
29
- = link_to t('.delete'), comfy_admin_cms_site_file_path(@site, file), :method => :delete, :data => {:confirm => t('.are_you_sure')}, :class => 'btn btn-danger'
30
-
31
- = render 'comfy/admin/cms/partials/files_after'
1
+ - content_for :right_column do
2
+ = render 'comfy/admin/cms/sites/mirrors'
3
+
4
+ #cms-uploader
5
+ #cms-uploader-drag-drop-target
6
+ .page-header
7
+ = link_to t('.new_link'), new_comfy_admin_cms_site_file_path(@site), :class => 'btn btn-default pull-right', id: 'cms-uploader-browse'
8
+ %h2= t('.title')
9
+
10
+ = render 'comfy/admin/cms/partials/files_before'
11
+
12
+ = render :partial => 'comfy/admin/cms/categories/index', :object => 'Comfy::Cms::File'
13
+
14
+ = paginate @files, :theme => 'comfy'
15
+
16
+ %table.table.table-hover.table-bordered
17
+ %tbody.sortable.cms-uploader-filelist
18
+ = render :partial => 'file', :collection => @files
19
+
20
+ = render 'comfy/admin/cms/partials/files_after'
21
+
22
+ = paginate @files, :theme => 'comfy'
23
+
24
+ :javascript
25
+ $(function(){
26
+ window.CMS.uploader($("#cms-uploader"), {
27
+ url: '#{comfy_admin_cms_site_files_path(@site)}',
28
+ multipart_params: {
29
+ '#{request_forgery_protection_token}': '#{form_authenticity_token}',
30
+ '#{Rails.application.config.session_options[:key]}': '#{request.session_options[:id]}'
31
+ }
32
+ });
33
+ });
@@ -1,7 +1,4 @@
1
- - content_for :right_column do
2
- = render 'comfy/admin/cms/files/index'
3
-
4
- = render :partial => 'comfy/admin/cms/partials/layout_form_before', :object => form
1
+ = render 'comfy/admin/cms/partials/layout_form_before', :form => form
5
2
 
6
3
  = form.text_field :label, :data => {:slugify => @layout.new_record?}
7
4
  = form.text_field :identifier, :data => {:slug => true}
@@ -15,7 +12,7 @@
15
12
  = form.text_area :css, :data => {'cms-cm-mode' => 'css'}
16
13
  = form.text_area :js, :data => {'cms-cm-mode' => 'javascript'}
17
14
 
18
- = render :partial => 'comfy/admin/cms/partials/layout_form_after', :object => form
15
+ = render 'comfy/admin/cms/partials/layout_form_after', :form => form
19
16
 
20
17
  = form.form_group :class => 'form-actions' do
21
18
  = form.submit t(@layout.new_record?? '.create' : '.update'), :class => 'btn btn-primary'
@@ -4,9 +4,8 @@
4
4
  %input{:type => 'checkbox'}
5
5
  = ::Comfy::Cms::Page.human_attribute_name(:is_published)
6
6
  %button.btn.btn-sm.btn-primary.pull-right
7
- = render 'comfy/admin/cms/files/index'
8
7
 
9
- = render 'comfy/admin/cms/partials/page_form_before', :object => form
8
+ = render 'comfy/admin/cms/partials/page_form_before', :form => form
10
9
 
11
10
  = form.text_field :label, :data => {:slugify => @page.new_record?}
12
11
 
@@ -17,25 +16,25 @@
17
16
 
18
17
  - if (options = ::Comfy::Cms::Layout.options_for_select(@site)).present?
19
18
  = form.select :layout_id, options, {}, 'data-url' => form_blocks_comfy_admin_cms_site_page_path(@site, @page.id.to_i)
20
-
19
+
21
20
  - if (options = ::Comfy::Cms::Page.options_for_select(@site, @page)).present?
22
21
  = form.select :parent_id, options
23
22
 
24
23
  - if (options = ::Comfy::Cms::Page.options_for_select(@site, @page, nil, 0, false)).present?
25
24
  = form.select :target_page_id, [["---- #{t('.select_target_page')} ----", nil]] + options
26
25
 
27
- = render 'comfy/admin/cms/partials/page_form_inner', :object => form
26
+ = render 'comfy/admin/cms/partials/page_form_inner', :form => form
28
27
 
29
- = render :partial => 'comfy/admin/cms/categories/form', :object => form
28
+ = render 'comfy/admin/cms/categories/form', :form => form
30
29
 
31
- = render :partial => 'form_blocks'
30
+ = render 'form_blocks'
32
31
 
33
32
  = form.form_group :is_published do
34
33
  = form.check_box :is_published, :label => t('.is_published')
35
34
 
36
- = render 'comfy/admin/cms/partials/page_form_after', :object => form
35
+ = render 'comfy/admin/cms/partials/page_form_after', :form => form
37
36
 
38
37
  = form.form_group :class => 'form-actions' do
39
38
  = form.submit t('.preview'), :name => 'preview', :id => nil, :class => 'btn btn-default'
40
39
  = form.submit t(@page.new_record?? '.create' : '.update'), :class => 'btn btn-primary'
41
- = link_to t('.cancel'), comfy_admin_cms_site_pages_path, :class => 'btn btn-link'
40
+ = link_to t('.cancel'), comfy_admin_cms_site_pages_path, :class => 'btn btn-link'
@@ -1,6 +1,6 @@
1
1
  - namespace = { }
2
2
  - cms_object = @page || cms_object
3
- - tags = cms_object.tags(true).select{|t| t.is_cms_block?}.uniq{|t| t.identifier}
3
+ - tags = cms_object.tags(true).select{|t| t.is_cms_block?}.uniq{|t| t.identifier}
4
4
  - tags.each do |tag|
5
5
  - namespace[tag.namespace || 'default'] ||= []
6
6
  - namespace[tag.namespace || 'default'] << tag
@@ -10,10 +10,10 @@
10
10
  .no-tags
11
11
  = link_to cms_object.layout.label, edit_comfy_admin_cms_site_layout_path(@site, cms_object.layout)
12
12
  = t('.no_tags').html_safe
13
-
13
+
14
14
  - else
15
15
  = fields_for :blocks, nil, :builder => ComfortableMexicanSofa::FormBuilder, :layout => :horizontal do |cms_blocks|
16
-
16
+
17
17
  .tabbable
18
18
  - if namespace.size > 1
19
19
  %ul.nav.nav-tabs
@@ -1,4 +1,4 @@
1
- = render 'comfy/admin/cms/partials/site_form_before', :object => form
1
+ = render 'comfy/admin/cms/partials/site_form_before', :form => form
2
2
 
3
3
  = form.text_field :label, :data => {:slugify => @site.new_record?}
4
4
  = form.text_field :identifier, :data => {:slug => true}
@@ -8,7 +8,7 @@
8
8
  = form.form_group do
9
9
  = form.check_box :is_mirrored, :label => t('.is_mirrored')
10
10
 
11
- = render 'comfy/admin/cms/partials/site_form_after', :object => form
11
+ = render 'comfy/admin/cms/partials/site_form_after', :form => form
12
12
 
13
13
  = form.form_group :class => 'form-actions' do
14
14
  = form.primary t(@site.new_record?? '.create' : '.update')
@@ -17,8 +17,7 @@
17
17
  = site.identifier
18
18
  = "(#{site.locale})"
19
19
  .host
20
- - host = "http://#{site.hostname}/#{site.path}"
21
- = link_to host, host, :target => '_blank'
20
+ = link_to site.url, site.url, :target => '_blank'
22
21
  %td
23
22
  .btn-group.btn-group-sm
24
23
  = link_to t('.select'), comfy_admin_cms_site_pages_path(site), :class => 'btn btn-default'
@@ -1,16 +1,13 @@
1
- - content_for :right_column do
2
- = render 'comfy/admin/cms/files/index'
3
-
4
- = render :partial => 'comfy/admin/cms/partials/snippet_form_before', :object => form
1
+ = render 'comfy/admin/cms/partials/snippet_form_before', :form => form
5
2
 
6
3
  = form.text_field :label, :data => {:slugify => @snippet.new_record?}
7
4
  = form.text_field :identifier, :data => {:slug => true}
8
- = form.text_area :content, :data => {'cms-rich-text' => true}
5
+ = form.text_area :content, :data => {'cms-cm-mode' => 'text/html'}
9
6
 
10
- = render :partial => 'comfy/admin/cms/categories/form', :object => form
7
+ = render 'comfy/admin/cms/categories/form', :form => form
11
8
 
12
- = render :partial => 'comfy/admin/cms/partials/snippet_form_after', :object => form
9
+ = render 'comfy/admin/cms/partials/snippet_form_after', :form => form
13
10
 
14
11
  = form.form_group :class => 'form-actions' do
15
12
  = form.submit t(@snippet.new_record?? '.create' : '.update'), :class => 'btn btn-primary'
16
- = link_to t('.cancel'), comfy_admin_cms_site_snippets_path, :class => 'btn btn-link'
13
+ = link_to t('.cancel'), comfy_admin_cms_site_snippets_path, :class => 'btn btn-link'