remove references to foldable_inputs and custom_input
This commit is contained in:
parent
cad1f5e68f
commit
a8d616ba6b
@ -5,12 +5,12 @@ module Locomotive
|
|||||||
|
|
||||||
def new
|
def new
|
||||||
@account = Account.new(:email => params[:email])
|
@account = Account.new(:email => params[:email])
|
||||||
|
respond_with @account
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@account = Account.create(params[:account])
|
@account = Account.create(params[:account])
|
||||||
current_site.memberships.create(:account => @account) if @account.errors.empty?
|
current_site.memberships.create(:account => @account) if @account.errors.empty?
|
||||||
|
|
||||||
respond_with @account, :location => edit_current_site_url
|
respond_with @account, :location => edit_current_site_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -4,22 +4,25 @@ module Locomotive
|
|||||||
sections 'settings'
|
sections 'settings'
|
||||||
|
|
||||||
def create
|
def create
|
||||||
resource.role = 'author' # force author by default
|
@membership = current_site.memberships.build(params[:membership])
|
||||||
|
@membership.role = 'author' # force author by default
|
||||||
|
|
||||||
case resource.process!
|
case @membership.process!
|
||||||
when :create_account
|
when :create_account
|
||||||
redirect_to new_account_url(:email => resource.email)
|
redirect_to new_account_url(:email => @membership.email)
|
||||||
when :save_it
|
when :save_it
|
||||||
respond_with resource, :location => edit_current_site_url
|
respond_with @membership, :location => edit_current_site_url
|
||||||
when :error
|
when :error
|
||||||
respond_with resource, :flash => true
|
respond_with @membership, :flash => true
|
||||||
when :already_created
|
when :already_created
|
||||||
respond_with resource, :alert => t('flash.locomotive.memberships.create.already_created'), :location => edit_current_site_url
|
respond_with @membership, :alert => t('flash.locomotive.memberships.create.already_created'), :location => edit_current_site_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
destroy! { edit_current_site_url }
|
@membership = current_site.memberships.find(params[:id])
|
||||||
|
@membership.destroy
|
||||||
|
respond_with @membership, :location => edit_current_site_url
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -5,22 +5,20 @@ module Locomotive
|
|||||||
|
|
||||||
respond_to :json, :only => :update
|
respond_to :json, :only => :update
|
||||||
|
|
||||||
|
helper 'Locomotive::Accounts'
|
||||||
|
|
||||||
skip_load_and_authorize_resource
|
skip_load_and_authorize_resource
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
@account = current_locomotive_account
|
||||||
|
respond_with @account
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
update! { edit_my_account_url }
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def resource
|
|
||||||
@account = current_locomotive_account
|
@account = current_locomotive_account
|
||||||
|
@account.update_attributes(params[:account])
|
||||||
|
respond_with @account, edit_my_account_url
|
||||||
end
|
end
|
||||||
|
|
||||||
def begin_of_association_chain; nil; end # not related directly to current_site
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,10 +9,5 @@ module Locomotive
|
|||||||
|
|
||||||
helper 'locomotive/base'
|
helper 'locomotive/base'
|
||||||
|
|
||||||
def edit
|
|
||||||
logger.debug 'I am here'
|
|
||||||
super
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -11,6 +11,7 @@ module Locomotive
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@pages = current_site.pages.published
|
@pages = current_site.pages.published
|
||||||
|
respond_with @pages
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -3,11 +3,16 @@ module Locomotive
|
|||||||
|
|
||||||
sections 'settings'
|
sections 'settings'
|
||||||
|
|
||||||
|
def new
|
||||||
|
@site = Site.new
|
||||||
|
respond_with @site
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@site = Site.new(params[:site])
|
@site = Site.new(params[:site])
|
||||||
@site.memberships.build :account => @current_locomotive_account, :role => 'admin'
|
@site.memberships.build :account => @current_locomotive_account, :role => 'admin'
|
||||||
|
@site.save
|
||||||
create! { edit_my_account_url }
|
respond_with @site, :location => edit_my_account_url
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@ -22,9 +27,5 @@ module Locomotive
|
|||||||
respond_with @site, :location => edit_my_account_url
|
respond_with @site, :location => edit_my_account_url
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def begin_of_association_chain; nil; end # not related directly to current_site
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,10 +5,31 @@ module Locomotive
|
|||||||
|
|
||||||
respond_to :json, :only => :update
|
respond_to :json, :only => :update
|
||||||
|
|
||||||
def destroy
|
def new
|
||||||
destroy! do |format|
|
@snippet = current_site.snippets.new
|
||||||
format.html { redirect_to theme_assets_url }
|
respond_with @snippet
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@snippet = current_site.snippets.create(params[:snippet])
|
||||||
|
respond_with @snippet, :location => edit_snippet_url(@snippet)
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@snippet = current_site.snippets.find(params[:id])
|
||||||
|
respond_with @snippet
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@snippet = current_site.snippets.find(params[:id])
|
||||||
|
@snippet.update_attributes(params[:id])
|
||||||
|
respond_with @snippet, :location => edit_snippet_url(@snippet)
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@snippet = current_site.snippets.find(params[:id])
|
||||||
|
@snippet.destroy
|
||||||
|
respond_with @snippet, :location => theme_assets_url
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
module Locomotive::AssetsHelper
|
|
||||||
|
|
||||||
# def vignette_tag(asset)
|
|
||||||
# if asset.image?
|
|
||||||
# html, css = image_tag(asset.vignette_url), 'image'
|
|
||||||
# else
|
|
||||||
# css = "icon #{asset.content_type}"
|
|
||||||
# html = asset.content_type.to_s == 'other' ? truncate(asset.extname, :length => 3) : asset.content_type
|
|
||||||
# html = '?' if html.blank?
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# content_tag(:div, content_tag(:div, html, :class => 'inside'), :class => css)
|
|
||||||
# end
|
|
||||||
|
|
||||||
def image_dimensions_and_size(asset)
|
|
||||||
content_tag(:small, "#{asset.width}px x #{asset.height}px | #{number_to_human_size(asset.size)}")
|
|
||||||
end
|
|
||||||
|
|
||||||
def allow_plain_text_editing?(asset)
|
|
||||||
asset.new_record? || asset.stylesheet_or_javascript?
|
|
||||||
end
|
|
||||||
|
|
||||||
def display_plain_text?(asset)
|
|
||||||
if asset.new_record?
|
|
||||||
asset.performing_plain_text?
|
|
||||||
else
|
|
||||||
asset.stylesheet_or_javascript?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
24
app/helpers/locomotive/theme_assets_helper.rb
Normal file
24
app/helpers/locomotive/theme_assets_helper.rb
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
module Locomotive::ThemeAssetsHelper
|
||||||
|
|
||||||
|
def image_dimensions_and_size(asset)
|
||||||
|
content_tag(:small, "#{asset.width}px x #{asset.height}px | #{number_to_human_size(asset.size)}")
|
||||||
|
end
|
||||||
|
|
||||||
|
def plain_text_type(asset)
|
||||||
|
asset.size && asset.size > 40000 ? 'nude' : (asset.content_type || 'stylesheet')
|
||||||
|
end
|
||||||
|
|
||||||
|
def allow_plain_text_editing?(asset)
|
||||||
|
asset.new_record? || asset.stylesheet_or_javascript?
|
||||||
|
end
|
||||||
|
|
||||||
|
def display_plain_text?(asset)
|
||||||
|
if asset.new_record?
|
||||||
|
asset.performing_plain_text?
|
||||||
|
else
|
||||||
|
asset.stylesheet_or_javascript?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
= semantic_form_for @account, :url => accounts_url do |f|
|
= semantic_form_for @account, :url => accounts_url do |f|
|
||||||
|
|
||||||
= f.foldable_inputs :name => :information do
|
= f.inputs :name => :information do
|
||||||
= f.input :name
|
= f.input :name
|
||||||
- unless f.object.respond_to?(:password)
|
- unless f.object.respond_to?(:password)
|
||||||
= f.input :email
|
= f.input :email
|
||||||
|
|
||||||
- if f.object.respond_to?(:password)
|
- if f.object.respond_to?(:password)
|
||||||
= f.foldable_inputs :name => :credentials do
|
= f.inputs :name => :credentials do
|
||||||
= f.input :email
|
= f.input :email
|
||||||
= f.input :password, :input_html => { :autocomplete => "off" }
|
= f.input :password, :input_html => { :autocomplete => "off" }
|
||||||
= f.input :password_confirmation, :input_html => { :autocomplete => "off" }
|
= f.input :password_confirmation, :input_html => { :autocomplete => "off" }
|
||||||
|
@ -38,9 +38,9 @@
|
|||||||
%em.editable= t("locomotive.memberships.roles.#{membership.role}")
|
%em.editable= t("locomotive.memberships.roles.#{membership.role}")
|
||||||
|
|
||||||
- if can?(:grant_admin, membership)
|
- if can?(:grant_admin, membership)
|
||||||
= fm.select :role, Ability::ROLES.map { |r| [t("locomotive.memberships.roles.#{r}"), r] }, :include_blank => false
|
= fm.select :role, Locomotive::Ability::ROLES.map { |r| [t("locomotive.memberships.roles.#{r}"), r] }, :include_blank => false
|
||||||
- else
|
- else
|
||||||
= fm.select :role, (Ability::ROLES - ['admin']).map { |r| [t("locomotive.memberships.roles.#{r}"), r] }, :include_blank => false
|
= fm.select :role, (Locomotive::Ability::ROLES - ['admin']).map { |r| [t("locomotive.memberships.roles.#{r}"), r] }, :include_blank => false
|
||||||
|
|
||||||
%span.actions
|
%span.actions
|
||||||
= link_to image_tag('admin/form/icons/trash.png'), membership_url(membership), :class => 'remove first', :confirm =>t('locomotive.messages.confirm'), :method => :delete
|
= link_to image_tag('admin/form/icons/trash.png'), membership_url(membership), :class => 'remove first', :confirm =>t('locomotive.messages.confirm'), :method => :delete
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
= f.inputs :name => :membership_email, :class => 'inputs email' do
|
= f.inputs :name => :membership_email, :class => 'inputs email' do
|
||||||
|
|
||||||
= f.custom_input :email, { :css => 'string full', :with_label => false } do
|
/ = f.input :email, :css => 'string full', :with_label => false } do
|
||||||
= f.text_field :email
|
= f.input :email, :label => false
|
||||||
|
|
||||||
= render 'locomotive/shared/form_actions', :back_url => edit_current_site_url, :button_label => :create
|
= render 'locomotive/shared/form_actions', :back_url => edit_current_site_url, :button_label => :create
|
@ -1,7 +1,7 @@
|
|||||||
- title link_to(@account.name.blank? ? @account.name_was : @account.name, '#', :rel => 'my_account_name', :title => t('.ask_for_name'), :class => 'editable')
|
- title link_to(@account.name.blank? ? @account.name_was : @account.name, '#', :rel => 'my_account_name', :title => t('.ask_for_name'), :class => 'editable')
|
||||||
|
|
||||||
- content_for :head do
|
- content_for :head do
|
||||||
= include_javascripts :account
|
/ = include_javascripts :account
|
||||||
|
|
||||||
- content_for :submenu do
|
- content_for :submenu do
|
||||||
= render_cell 'locomotive/settings_menu', :show
|
= render_cell 'locomotive/settings_menu', :show
|
||||||
@ -14,27 +14,27 @@
|
|||||||
|
|
||||||
= semantic_form_for @account, :as => :my_account, :url => my_account_url, :html => { :class => 'save-with-shortcut' } do |f|
|
= semantic_form_for @account, :as => :my_account, :url => my_account_url, :html => { :class => 'save-with-shortcut' } do |f|
|
||||||
|
|
||||||
= f.foldable_inputs :name => :information, :style => 'display: none' do
|
= f.inputs :name => :information do
|
||||||
= f.input :name
|
= f.input :name
|
||||||
|
|
||||||
= f.foldable_inputs :name => :credentials do
|
= f.inputs :name => :credentials do
|
||||||
= f.input :email
|
= f.input :email
|
||||||
= f.input :password, :input_html => { :autocomplete => "off" }
|
= f.input :password, :input_html => { :autocomplete => "off" }
|
||||||
= f.input :password_confirmation, :input_html => { :autocomplete => "off" }
|
= f.input :password_confirmation, :input_html => { :autocomplete => "off" }
|
||||||
|
|
||||||
- if multi_sites?
|
- if multi_sites?
|
||||||
= f.foldable_inputs :name => :sites, :class => 'sites off' do
|
= f.inputs :name => :sites, :class => 'sites' do
|
||||||
|
%ul.list
|
||||||
- @account.sites.each do |site|
|
- @account.sites.each do |site|
|
||||||
%li{ :class => 'item' }
|
%li
|
||||||
%strong= link_to site.name, site_url(site)
|
%strong= link_to site.name, site_url(site)
|
||||||
%em= site.domains.join(', ')
|
%em= site.domains.join(', ')
|
||||||
|
|
||||||
- if admin_on?(site) && site != current_site
|
- if admin_on?(site) && site != current_site
|
||||||
%span{ :class => 'actions' }
|
%span{ :class => 'actions' }
|
||||||
= link_to image_tag('admin/form/icons/trash.png'), site_url(site), :class => 'remove first', :confirm => t('locomotive.messages.confirm'), :method => :delete
|
= link_to 'x', site_url(site), :class => 'remove first', :confirm => t('locomotive.messages.confirm'), :method => :delete
|
||||||
|
|
||||||
= f.foldable_inputs :name => :language, :class => 'language' do
|
= f.inputs :name => :language, :class => 'language' do
|
||||||
= f.custom_input :language, { :css => 'full', :with_label => false } do
|
|
||||||
- Locomotive.config.locales.each do |locale|
|
- Locomotive.config.locales.each do |locale|
|
||||||
%span
|
%span
|
||||||
= f.radio_button :locale, locale
|
= f.radio_button :locale, locale
|
||||||
@ -43,5 +43,4 @@
|
|||||||
= t(".#{locale}")
|
= t(".#{locale}")
|
||||||
/
|
/
|
||||||
|
|
||||||
|
|
||||||
= render 'locomotive/shared/form_actions', :button_label => :update
|
= render 'locomotive/shared/form_actions', :button_label => :update
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
- content_for :head do
|
- content_for :head do
|
||||||
= include_javascripts :image_picker, :snippets
|
/ = include_javascripts :image_picker, :snippets
|
||||||
= include_stylesheets :fancybox
|
/ = include_stylesheets :fancybox
|
||||||
|
|
||||||
= f.inputs :name => :information do
|
= f.inputs :name => :information do
|
||||||
= f.input :name, :wrapper_html => { :class => 'highlighted' }
|
= f.input :name, :wrapper_html => { :class => 'highlighted' }
|
||||||
= f.input :slug, :required => false
|
= f.input :slug, :required => false
|
||||||
|
|
||||||
= f.inputs :name => :code do
|
= f.inputs :name => :code do
|
||||||
= f.custom_input :template, :css => 'full', :with_label => false do
|
= f.input :template, :as => :'Locomotive::Code'
|
||||||
%code{ :class => 'html' }
|
|
||||||
= f.text_area :template
|
|
||||||
.more
|
|
||||||
= link_to t('locomotive.image_picker.link'), admin_theme_assets_path, :id => 'image-picker-link', :class => 'picture'
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
- content_for :head do
|
- content_for :head do
|
||||||
= include_javascripts :image_picker, :theme_assets
|
/ = include_javascripts :image_picker, :theme_assets
|
||||||
= include_stylesheets :fancybox
|
/ = include_stylesheets :fancybox
|
||||||
|
|
||||||
= f.hidden_field :performing_plain_text
|
= f.hidden_field :performing_plain_text
|
||||||
|
|
||||||
@ -19,17 +19,12 @@
|
|||||||
- if @theme_asset.new_record?
|
- if @theme_asset.new_record?
|
||||||
= f.input :plain_text_name
|
= f.input :plain_text_name
|
||||||
|
|
||||||
= f.custom_input :plain_text_type do
|
= f.input :plain_text_type, :as => 'select', :collection => %w(stylesheet javascript)
|
||||||
= f.select :plain_text_type, %w(stylesheet javascript)
|
|
||||||
|
|
||||||
= f.custom_input :plain_text, :css => 'full', :with_label => false do
|
= f.input :plain_text, :as => :'Locomotive::Code', :type => plain_text_type(@theme_asset)
|
||||||
%code{ :class => (@theme_asset.size && @theme_asset.size > 40000 ? 'nude' : (@theme_asset.content_type || 'stylesheet')) }
|
|
||||||
= f.text_area :plain_text
|
|
||||||
.more
|
|
||||||
= link_to t('locomotive.image_picker.link'), admin_theme_assets_path, :id => 'image-picker-link', :class => 'picture'
|
|
||||||
|
|
||||||
%span.alt
|
%span.alt
|
||||||
!= t('locomotive.theme_assets.form.choose_file')
|
!= t('locomotive.theme_assets.form.choose_file')
|
||||||
|
|
||||||
= f.foldable_inputs :name => :options do
|
= f.inputs :name => :options, :class => "inputs foldable #{'folded' if inputs_folded?(@asset)}" do
|
||||||
= f.input :folder
|
= f.input :folder
|
Loading…
Reference in New Issue
Block a user