rebuilding the editing page for the site (wip)

This commit is contained in:
did 2011-11-25 15:10:56 +01:00
parent 2a5861e8a7
commit cffe64f6be
14 changed files with 135 additions and 40 deletions

2
.gitignore vendored
View File

@ -37,3 +37,5 @@ doc/bushido
.sass-cache/
spec/dummy/tmp/
spec/dummy/log/*.log
app/assets/javascripts/old/
app/assets/stylesheets/old/

View File

@ -0,0 +1,5 @@
#= require ../shared/form_view
Locomotive.Views.CurrentSite ||= {}
class Locomotive.Views.CurrentSite.EditView extends Locomotive.Views.Shared.FormView

View File

@ -18,8 +18,6 @@ class Locomotive.Views.Pages.FormView extends Locomotive.Views.Shared.FormView
@model = new Locomotive.Models.Page(@options.page)
window.foo = @model
@filled_slug = @touched_url = false
@image_picker_view = new Locomotive.Views.ThemeAssets.ImagePickerView
collection: new Locomotive.Models.ThemeAssetsCollection()

View File

@ -193,10 +193,10 @@ body {
} // #content
#footer {
padding-top: 10px;
padding-top: 0;
p {
padding: 15px 8px 0 0;
padding: 10px 8px 0 0;
font-size: 13px;
color: #E6E6E6;

View File

@ -0,0 +1,29 @@
module Locomotive
class EmptyInput # < Formtastic::Inputs::HiddenInput
include Formtastic::Inputs::Base
def to_html
input_wrapping do
label_html
# render nothing
end
end
def error_html
""
end
def errors?
false
end
# def hint_html
# ""
# end
#
# def hint?
# false
# end
end
end

View File

@ -0,0 +1,21 @@
module Locomotive
class SubdomainInput < Formtastic::Inputs::TextInput
def wrapper_html_options
super.tap do |opts|
opts[:class] += ' path'
end
end
def to_html
domain = options.delete(:domain)
input_wrapping do
label_html <<
builder.text_field(method, input_html_options) <<
template.content_tag(:em, ".#{domain}")
end
end
end
end

View File

@ -1,10 +1,6 @@
module Locomotive
class ToggleInput < Formtastic::Inputs::BooleanInput
# def label_text_with_embedded_checkbox
# label_text #<< "" << check_box_html
# end
def to_html
input_wrapping do
hidden_field_html <<

View File

@ -49,6 +49,10 @@ module Locomotive
Locomotive::Liquid::Drops::Site.new(self)
end
def to_json
Locomotive::SitePresenter.new(self).as_json
end
protected
def create_default_pages!

View File

@ -0,0 +1,11 @@
module Locomotive
class SitePresenter < BasePresenter
delegate :name, :subdomain, :domains, :robots_txt, :seo_title, :meta_keywords, :meta_description, :domains_without_subdomain, :to => :source
def included_methods
super + %w(name subdomain domains robots_txt seo_title meta_keywords meta_description domains_without_subdomain)
end
end
end

View File

@ -0,0 +1,11 @@
%script{ :type => 'text/html', :id => 'domain_entry' }
%em
http://
= text_field_tag 'site[domains][]', '{{name}}', :class => 'string label void domain'
&nbsp;
{{#if error}}
%span.inline-errors {{error}}
{{/if}}
%span.actions
= link_to 'x', '#', :class => 'remove'

View File

@ -1,3 +1,10 @@
- content_for :head do
= render 'domain'
- content_for :backbone_view_data do
:plain
{ site: #{@site.to_json}, errors: #{@site.errors.to_json} }
= f.inputs :name => :information, :style => "#{'display: none' unless @site.new_record?}" do
= f.input :name, :required => false
@ -9,35 +16,39 @@
- if can?(:point, Locomotive::Site)
- if manage_subdomain_or_domains?
= f.inputs :name => :access_points do
= f.input :subdomain, :as => :'Locomotive::Subdomain', :domain => application_domain, :input_html => { :readonly => !manage_subdomain? }
- if manage_domains?
= f.input :domains, :as => :'Locomotive::Empty'
/ = f.custom_input :subdomain, :css => 'path' do
/ %em
/ http://
/ = f.text_field :subdomain, :readonly => !manage_subdomain?
/ = f.text_field :subdomain, :readonly =>
/ \.
/ %em
/ = application_domain
- if manage_domains?
- @site.domains_without_subdomain.each_with_index do |name, index|
%li{ :class => "item added #{'last' if index == @site.domains.size - 1}"}
%em
http://
= text_field_tag 'site[domains][]', name, :class => 'string label void domain'
&nbsp;
= error_on_domain(@site, name)
%span.actions
= link_to image_tag('admin/form/icons/trash.png'), '#', :class => 'remove first', :confirm => t('locomotive.messages.confirm')
%li.item.template
%em
http://
= text_field_tag 'label', t('formtastic.hints.site.domain_name'), :class => 'string label void domain'
&nbsp;
%span.actions
= link_to image_tag('admin/form/icons/trash.png'), '#', :class => 'remove first', :confirm => t('locomotive.messages.confirm')
%button{ :class => 'button light add', :type => 'button' }
%span!= t('locomotive.buttons.new_item')
/ - if manage_domains?
/ - @site.domains_without_subdomain.each_with_index do |name, index|
/ %li{ :class => "item added #{'last' if index == @site.domains.size - 1}"}
/ %em
/ http://
/ = text_field_tag 'site[domains][]', name, :class => 'string label void domain'
/ &nbsp;
/ = error_on_domain(@site, name)
/ %span.actions
/ = link_to image_tag('admin/form/icons/trash.png'), '#', :class => 'remove first', :confirm => t('locomotive.messages.confirm')
/
/ %li.item.template
/ %em
/ http://
/ = text_field_tag 'label', t('formtastic.hints.site.domain_name'), :class => 'string label void domain'
/ &nbsp;
/ %span.actions
/ = link_to image_tag('admin/form/icons/trash.png'), '#', :class => 'remove first', :confirm => t('locomotive.messages.confirm')
/ %button{ :class => 'button light add', :type => 'button' }
/ %span!= t('locomotive.buttons.new_item')
- if can?(:index, Locomotive::Membership)

View File

@ -0,0 +1,7 @@
- rake locomotive:upgrade:rename_collections
- locales updates (en / fr)
- theme_assets.images => theme_assets.image_picker
- assets => content_assets
- EditableXXX => Locomotive::EditableXXX (en mongodb)

View File

@ -5,16 +5,16 @@ Locomotive.configure do |config|
# your own domain name (ex: locomotivehosting.com).
#
# Ex:
# config.multi_sites do |multi_sites|
# # each new website you add will have a default entry based on a subdomain
# # and the multi_site_domain value (ex: website_1.locomotivehosting.com).
# multi_sites.domain = 'example.com' #'myhostingplatform.com'
#
# # define the reserved subdomains
# # Ex:
# multi_sites.reserved_subdomains = %w(www admin email blog webmail mail support help site sites)
# end
config.multi_sites = false
config.multi_sites do |multi_sites|
# each new website you add will have a default entry based on a subdomain
# and the multi_site_domain value (ex: website_1.locomotivehosting.com).
multi_sites.domain = 'engine.dev' #'myhostingplatform.com'
# define the reserved subdomains
# Ex:
multi_sites.reserved_subdomains = %w(www admin email blog webmail mail support help site sites)
end
# config.multi_sites = false
# configure the hosting target for the production environment. Locomotive can be installed in:
# - your own server