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
|
||||
@account = Account.new(:email => params[:email])
|
||||
respond_with @account
|
||||
end
|
||||
|
||||
def create
|
||||
@account = Account.create(params[:account])
|
||||
current_site.memberships.create(:account => @account) if @account.errors.empty?
|
||||
|
||||
respond_with @account, :location => edit_current_site_url
|
||||
end
|
||||
|
||||
|
@ -4,22 +4,25 @@ module Locomotive
|
||||
sections 'settings'
|
||||
|
||||
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
|
||||
redirect_to new_account_url(:email => resource.email)
|
||||
redirect_to new_account_url(:email => @membership.email)
|
||||
when :save_it
|
||||
respond_with resource, :location => edit_current_site_url
|
||||
respond_with @membership, :location => edit_current_site_url
|
||||
when :error
|
||||
respond_with resource, :flash => true
|
||||
respond_with @membership, :flash => true
|
||||
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
|
||||
|
||||
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
|
||||
|
@ -5,22 +5,20 @@ module Locomotive
|
||||
|
||||
respond_to :json, :only => :update
|
||||
|
||||
helper 'Locomotive::Accounts'
|
||||
|
||||
skip_load_and_authorize_resource
|
||||
|
||||
def edit
|
||||
@account = current_locomotive_account
|
||||
respond_with @account
|
||||
end
|
||||
|
||||
def update
|
||||
update! { edit_my_account_url }
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def resource
|
||||
@account = current_locomotive_account
|
||||
@account.update_attributes(params[:account])
|
||||
respond_with @account, edit_my_account_url
|
||||
end
|
||||
|
||||
def begin_of_association_chain; nil; end # not related directly to current_site
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -9,10 +9,5 @@ module Locomotive
|
||||
|
||||
helper 'locomotive/base'
|
||||
|
||||
def edit
|
||||
logger.debug 'I am here'
|
||||
super
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -11,6 +11,7 @@ module Locomotive
|
||||
|
||||
def show
|
||||
@pages = current_site.pages.published
|
||||
respond_with @pages
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -3,11 +3,16 @@ module Locomotive
|
||||
|
||||
sections 'settings'
|
||||
|
||||
def new
|
||||
@site = Site.new
|
||||
respond_with @site
|
||||
end
|
||||
|
||||
def create
|
||||
@site = Site.new(params[:site])
|
||||
@site.memberships.build :account => @current_locomotive_account, :role => 'admin'
|
||||
|
||||
create! { edit_my_account_url }
|
||||
@site.save
|
||||
respond_with @site, :location => edit_my_account_url
|
||||
end
|
||||
|
||||
def destroy
|
||||
@ -22,9 +27,5 @@ module Locomotive
|
||||
respond_with @site, :location => edit_my_account_url
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def begin_of_association_chain; nil; end # not related directly to current_site
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -5,10 +5,31 @@ module Locomotive
|
||||
|
||||
respond_to :json, :only => :update
|
||||
|
||||
def destroy
|
||||
destroy! do |format|
|
||||
format.html { redirect_to theme_assets_url }
|
||||
def new
|
||||
@snippet = current_site.snippets.new
|
||||
respond_with @snippet
|
||||
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
|
||||
|
@ -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|
|
||||
|
||||
= f.foldable_inputs :name => :information do
|
||||
= f.inputs :name => :information do
|
||||
= f.input :name
|
||||
- unless f.object.respond_to?(:password)
|
||||
= f.input :email
|
||||
|
||||
- if f.object.respond_to?(:password)
|
||||
= f.foldable_inputs :name => :credentials do
|
||||
= f.inputs :name => :credentials do
|
||||
= f.input :email
|
||||
= f.input :password, :input_html => { :autocomplete => "off" }
|
||||
= f.input :password_confirmation, :input_html => { :autocomplete => "off" }
|
||||
|
@ -38,9 +38,9 @@
|
||||
%em.editable= t("locomotive.memberships.roles.#{membership.role}")
|
||||
|
||||
- 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
|
||||
= 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
|
||||
= 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.custom_input :email, { :css => 'string full', :with_label => false } do
|
||||
= f.text_field :email
|
||||
/ = f.input :email, :css => 'string full', :with_label => false } do
|
||||
= f.input :email, :label => false
|
||||
|
||||
= 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')
|
||||
|
||||
- content_for :head do
|
||||
= include_javascripts :account
|
||||
/ = include_javascripts :account
|
||||
|
||||
- content_for :submenu do
|
||||
= 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|
|
||||
|
||||
= f.foldable_inputs :name => :information, :style => 'display: none' do
|
||||
= f.inputs :name => :information do
|
||||
= f.input :name
|
||||
|
||||
= f.foldable_inputs :name => :credentials do
|
||||
= f.inputs :name => :credentials do
|
||||
= f.input :email
|
||||
= f.input :password, :input_html => { :autocomplete => "off" }
|
||||
= f.input :password_confirmation, :input_html => { :autocomplete => "off" }
|
||||
|
||||
- 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|
|
||||
%li{ :class => 'item' }
|
||||
%li
|
||||
%strong= link_to site.name, site_url(site)
|
||||
%em= site.domains.join(', ')
|
||||
|
||||
- if admin_on?(site) && site != current_site
|
||||
%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.custom_input :language, { :css => 'full', :with_label => false } do
|
||||
= f.inputs :name => :language, :class => 'language' do
|
||||
- Locomotive.config.locales.each do |locale|
|
||||
%span
|
||||
= f.radio_button :locale, locale
|
||||
@ -43,5 +43,4 @@
|
||||
= t(".#{locale}")
|
||||
/
|
||||
|
||||
|
||||
= render 'locomotive/shared/form_actions', :button_label => :update
|
||||
|
@ -1,14 +1,10 @@
|
||||
- content_for :head do
|
||||
= include_javascripts :image_picker, :snippets
|
||||
= include_stylesheets :fancybox
|
||||
/ = include_javascripts :image_picker, :snippets
|
||||
/ = include_stylesheets :fancybox
|
||||
|
||||
= f.inputs :name => :information do
|
||||
= f.input :name, :wrapper_html => { :class => 'highlighted' }
|
||||
= f.input :slug, :required => false
|
||||
|
||||
= f.inputs :name => :code do
|
||||
= f.custom_input :template, :css => 'full', :with_label => false do
|
||||
%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'
|
||||
= f.input :template, :as => :'Locomotive::Code'
|
||||
|
@ -1,6 +1,6 @@
|
||||
- content_for :head do
|
||||
= include_javascripts :image_picker, :theme_assets
|
||||
= include_stylesheets :fancybox
|
||||
/ = include_javascripts :image_picker, :theme_assets
|
||||
/ = include_stylesheets :fancybox
|
||||
|
||||
= f.hidden_field :performing_plain_text
|
||||
|
||||
@ -19,17 +19,12 @@
|
||||
- if @theme_asset.new_record?
|
||||
= f.input :plain_text_name
|
||||
|
||||
= f.custom_input :plain_text_type do
|
||||
= f.select :plain_text_type, %w(stylesheet javascript)
|
||||
= f.input :plain_text_type, :as => 'select', :collection => %w(stylesheet javascript)
|
||||
|
||||
= f.custom_input :plain_text, :css => 'full', :with_label => false do
|
||||
%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'
|
||||
= f.input :plain_text, :as => :'Locomotive::Code', :type => plain_text_type(@theme_asset)
|
||||
|
||||
%span.alt
|
||||
!= 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
|
Loading…
Reference in New Issue
Block a user