haml always in ugly mode + refactor theme files section in admin
This commit is contained in:
parent
28ade83ab9
commit
1e1c3bd97b
2
Gemfile
2
Gemfile
@ -24,6 +24,8 @@ gem 'RedCloth'
|
|||||||
gem 'inherited_resources', '1.1.2'
|
gem 'inherited_resources', '1.1.2'
|
||||||
gem 'custom_fields', :git => 'git://github.com/locomotivecms/custom_fields.git'
|
gem 'custom_fields', :git => 'git://github.com/locomotivecms/custom_fields.git'
|
||||||
gem 'jeweler'
|
gem 'jeweler'
|
||||||
|
gem 'delayed_job', '2.1.0.pre2'
|
||||||
|
gem 'delayed_job_mongoid', '1.0.0.rc'
|
||||||
|
|
||||||
# Development environment
|
# Development environment
|
||||||
group :development do
|
group :development do
|
||||||
|
29
Gemfile.lock
29
Gemfile.lock
@ -63,7 +63,7 @@ GEM
|
|||||||
arel (1.0.1)
|
arel (1.0.1)
|
||||||
activesupport (~> 3.0.0)
|
activesupport (~> 3.0.0)
|
||||||
autotest (4.3.2)
|
autotest (4.3.2)
|
||||||
aws (2.3.20)
|
aws (2.3.21)
|
||||||
http_connection
|
http_connection
|
||||||
uuidtools
|
uuidtools
|
||||||
xml-simple
|
xml-simple
|
||||||
@ -84,17 +84,23 @@ GEM
|
|||||||
columnize (0.3.1)
|
columnize (0.3.1)
|
||||||
configuration (1.1.0)
|
configuration (1.1.0)
|
||||||
crack (0.1.8)
|
crack (0.1.8)
|
||||||
cucumber (0.8.5)
|
cucumber (0.9.0)
|
||||||
builder (~> 2.1.2)
|
builder (~> 2.1.2)
|
||||||
diff-lcs (~> 1.1.2)
|
diff-lcs (~> 1.1.2)
|
||||||
gherkin (~> 2.1.4)
|
gherkin (~> 2.2.2)
|
||||||
json_pure (~> 1.4.3)
|
json (~> 1.4.6)
|
||||||
term-ansicolor (~> 1.0.4)
|
term-ansicolor (~> 1.0.5)
|
||||||
cucumber-rails (0.3.2)
|
cucumber-rails (0.3.2)
|
||||||
cucumber (>= 0.8.0)
|
cucumber (>= 0.8.0)
|
||||||
culerity (0.2.12)
|
culerity (0.2.12)
|
||||||
daemons (1.1.0)
|
daemons (1.1.0)
|
||||||
database_cleaner (0.5.2)
|
database_cleaner (0.5.2)
|
||||||
|
delayed_job (2.1.0.pre2)
|
||||||
|
activesupport (~> 3.0)
|
||||||
|
daemons
|
||||||
|
delayed_job_mongoid (1.0.0.rc)
|
||||||
|
delayed_job (~> 2.1)
|
||||||
|
mongoid (~> 2.0)
|
||||||
devise (1.1.2)
|
devise (1.1.2)
|
||||||
bcrypt-ruby (~> 2.1.2)
|
bcrypt-ruby (~> 2.1.2)
|
||||||
warden (~> 0.10.7)
|
warden (~> 0.10.7)
|
||||||
@ -113,17 +119,19 @@ GEM
|
|||||||
activesupport (>= 3.0.0beta3)
|
activesupport (>= 3.0.0beta3)
|
||||||
gem_plugin (0.2.3)
|
gem_plugin (0.2.3)
|
||||||
gemcutter (0.6.1)
|
gemcutter (0.6.1)
|
||||||
gherkin (2.1.5)
|
gherkin (2.2.3)
|
||||||
|
json (~> 1.4.6)
|
||||||
|
term-ansicolor (~> 1.0.5)
|
||||||
trollop (~> 1.16.2)
|
trollop (~> 1.16.2)
|
||||||
git (1.2.5)
|
git (1.2.5)
|
||||||
growl-glue (1.0.7)
|
growl-glue (1.0.7)
|
||||||
haml (3.0.18)
|
haml (3.0.18)
|
||||||
has_scope (0.5.0)
|
has_scope (0.5.0)
|
||||||
heroku (1.10.2)
|
heroku (1.10.5)
|
||||||
json_pure (>= 1.2.0, < 1.5.0)
|
json_pure (>= 1.2.0, < 1.5.0)
|
||||||
launchy (~> 0.3.2)
|
launchy (~> 0.3.2)
|
||||||
rest-client (~> 1.4.0)
|
rest-client (~> 1.4.0)
|
||||||
http_connection (1.3.0)
|
http_connection (1.3.1)
|
||||||
httparty (0.6.1)
|
httparty (0.6.1)
|
||||||
crack (= 0.1.8)
|
crack (= 0.1.8)
|
||||||
i18n (0.4.1)
|
i18n (0.4.1)
|
||||||
@ -134,6 +142,7 @@ GEM
|
|||||||
gemcutter (>= 0.1.0)
|
gemcutter (>= 0.1.0)
|
||||||
git (>= 1.2.5)
|
git (>= 1.2.5)
|
||||||
rubyforge (>= 2.0.0)
|
rubyforge (>= 2.0.0)
|
||||||
|
json (1.4.6)
|
||||||
json_pure (1.4.6)
|
json_pure (1.4.6)
|
||||||
launchy (0.3.7)
|
launchy (0.3.7)
|
||||||
configuration (>= 0.0.5)
|
configuration (>= 0.0.5)
|
||||||
@ -216,7 +225,7 @@ GEM
|
|||||||
rubyzip
|
rubyzip
|
||||||
spork (0.8.4)
|
spork (0.8.4)
|
||||||
term-ansicolor (1.0.5)
|
term-ansicolor (1.0.5)
|
||||||
thor (0.14.0)
|
thor (0.14.1)
|
||||||
treetop (1.4.8)
|
treetop (1.4.8)
|
||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
trollop (1.16.2)
|
trollop (1.16.2)
|
||||||
@ -248,6 +257,8 @@ DEPENDENCIES
|
|||||||
cucumber-rails
|
cucumber-rails
|
||||||
custom_fields!
|
custom_fields!
|
||||||
database_cleaner
|
database_cleaner
|
||||||
|
delayed_job (= 2.1.0.pre2)
|
||||||
|
delayed_job_mongoid (= 1.0.0.rc)
|
||||||
devise (= 1.1.2)
|
devise (= 1.1.2)
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
fastthread
|
fastthread
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
module Admin
|
module Admin
|
||||||
class SnippetsController < BaseController
|
class SnippetsController < BaseController
|
||||||
|
|
||||||
sections 'settings'
|
sections 'settings', 'theme_assets'
|
||||||
|
|
||||||
respond_to :json, :only => :update
|
respond_to :json, :only => :update
|
||||||
|
|
||||||
def index
|
def destroy
|
||||||
@snippets = current_site.snippets.order_by([[:name, :asc]])
|
destroy! do |format|
|
||||||
|
format.html { redirect_to admin_theme_assets_url }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -10,13 +10,15 @@ module Admin
|
|||||||
respond_to :json, :only => [:create, :update]
|
respond_to :json, :only => [:create, :update]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
assets = current_site.theme_assets.all
|
assets = current_site.theme_assets.all.to_a
|
||||||
@non_image_assets = assets.find_all { |a| a.stylesheet? || a.javascript? }
|
@non_image_assets = assets.find_all { |a| a.stylesheet? || a.javascript? }
|
||||||
@image_assets = assets.find_all { |a| a.image? }
|
@image_assets = assets.find_all { |a| a.image? }
|
||||||
@flash_assets = assets.find_all { |a| a.movie? }
|
@flash_assets = assets.find_all { |a| a.movie? }
|
||||||
|
|
||||||
if request.xhr?
|
if request.xhr?
|
||||||
render :action => 'images', :layout => false and return
|
render :action => 'images', :layout => false and return
|
||||||
|
else
|
||||||
|
@snippets = current_site.snippets.order_by([[:name, :asc]]).all.to_a
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
%ul
|
%ul
|
||||||
= admin_submenu_item 'site', edit_admin_current_site_url
|
= admin_submenu_item 'site', edit_admin_current_site_url
|
||||||
= admin_submenu_item 'snippets', admin_snippets_url
|
/ = admin_submenu_item 'snippets', admin_snippets_url
|
||||||
= admin_submenu_item 'theme_assets', admin_theme_assets_url
|
= admin_submenu_item 'theme_assets', admin_theme_assets_url
|
||||||
= admin_submenu_item 'account', edit_admin_my_account_url
|
= admin_submenu_item 'account', edit_admin_my_account_url
|
@ -1,4 +1,16 @@
|
|||||||
|
/ - per_row = local_assigns[:per_row] || 6
|
||||||
|
/ - snippet_counter = local_assigns[:snippet_counter] || 0
|
||||||
|
/
|
||||||
|
/ %li{ :class => "asset #{'last' if (snippet_counter + 1) % per_row == 0}"}
|
||||||
|
/ %h4= link_to truncate(snippet.slug, :length => 18), edit_admin_snippet_path(snippet)
|
||||||
|
/ .image
|
||||||
|
/ .inside
|
||||||
|
/ / = vignette_tag(asset)
|
||||||
|
/ .actions
|
||||||
|
/ = link_to image_tag('admin/list/icons/cross.png'), admin_snippet_path(snippet), :class => 'remove', :confirm => t('admin.messages.confirm'), :method => :delete
|
||||||
|
|
||||||
%li
|
%li
|
||||||
|
%em
|
||||||
%strong= link_to snippet.name, edit_admin_snippet_path(snippet)
|
%strong= link_to snippet.name, edit_admin_snippet_path(snippet)
|
||||||
.more
|
.more
|
||||||
%span!= t('.updated_at')
|
%span!= t('.updated_at')
|
||||||
|
@ -12,4 +12,4 @@
|
|||||||
|
|
||||||
= render 'form', :f => form
|
= render 'form', :f => form
|
||||||
|
|
||||||
= render 'admin/shared/form_actions', :back_url => admin_snippets_url, :button_label => :update
|
= render 'admin/shared/form_actions', :back_url => admin_theme_assets_url, :button_label => :update
|
@ -9,4 +9,4 @@
|
|||||||
|
|
||||||
= render 'form', :f => form
|
= render 'form', :f => form
|
||||||
|
|
||||||
= render 'admin/shared/form_actions', :back_url => admin_snippets_url, :button_label => :create
|
= render 'admin/shared/form_actions', :back_url => admin_theme_assets_url, :button_label => :create
|
@ -4,10 +4,20 @@
|
|||||||
= render 'admin/shared/menu/settings'
|
= render 'admin/shared/menu/settings'
|
||||||
|
|
||||||
- content_for :buttons do
|
- content_for :buttons do
|
||||||
|
= admin_button_tag t('admin.snippets.index.new'), new_admin_snippet_url, :class => 'new'
|
||||||
= admin_button_tag :new, new_admin_theme_asset_url, :class => 'new'
|
= admin_button_tag :new, new_admin_theme_asset_url, :class => 'new'
|
||||||
|
|
||||||
%p!= t('.help')
|
%p!= t('.help')
|
||||||
|
|
||||||
|
%h3!= t('.snippets')
|
||||||
|
- if @snippets.empty?
|
||||||
|
%p.no-items!= t('.no_items', :url => new_admin_snippet_url)
|
||||||
|
- else
|
||||||
|
%ul#snippets-list.list
|
||||||
|
= render @snippets
|
||||||
|
|
||||||
|
%br
|
||||||
|
|
||||||
%h3!= t('.css_and_js')
|
%h3!= t('.css_and_js')
|
||||||
- if @non_image_assets.empty?
|
- if @non_image_assets.empty?
|
||||||
%p.no-items!= t('.no_items', :url => new_admin_theme_asset_url)
|
%p.no-items!= t('.no_items', :url => new_admin_theme_asset_url)
|
||||||
|
1
config/initializers/haml.rb
Normal file
1
config/initializers/haml.rb
Normal file
@ -0,0 +1 @@
|
|||||||
|
Haml::Template.options[:ugly] = true # improve performance in dev
|
@ -156,8 +156,9 @@ en:
|
|||||||
theme_assets:
|
theme_assets:
|
||||||
index:
|
index:
|
||||||
title: Listing theme files
|
title: Listing theme files
|
||||||
help: "Theme assets represent files needed by layouts and snippets. If you need to manage an image gallery, go to the Assets section instead."
|
help: "The theme files section is the place where you manage the files needed by your layout, ...etc. If you need to manage an image gallery, go to the Assets section instead."
|
||||||
new: new file
|
new: new file
|
||||||
|
snippets: Snippets
|
||||||
css_and_js: Style and javascript
|
css_and_js: Style and javascript
|
||||||
fonts: Fonts
|
fonts: Fonts
|
||||||
images: Images
|
images: Images
|
||||||
|
@ -156,8 +156,9 @@ fr:
|
|||||||
theme_assets:
|
theme_assets:
|
||||||
index:
|
index:
|
||||||
title: Liste des fichiers du thème
|
title: Liste des fichiers du thème
|
||||||
help: "Les fichiers du thème sont utilisés par les gabarits et les snippets. Si vous avez besoin d'une galerie d'images, la section Média est plus adéquate."
|
help: "Les fichiers du thème sont utilisés pour construire le gabarit de vos pages. Si vous avez besoin d'une galerie d'images, la section Média est plus adéquate."
|
||||||
new: nouveau fichier
|
new: nouveau fichier
|
||||||
|
snippets: Snippets
|
||||||
css_and_js: Style et javascript
|
css_and_js: Style et javascript
|
||||||
images: Images
|
images: Images
|
||||||
flashes: Flash
|
flashes: Flash
|
||||||
|
@ -120,6 +120,22 @@ div#uploadAssetsInputQueue { display: none; }
|
|||||||
background: transparent url(/images/admin/list/item-right.png) no-repeat right 0;
|
background: transparent url(/images/admin/list/item-right.png) no-repeat right 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ___ snippets ___ */
|
||||||
|
|
||||||
|
#snippets-list { margin-left: 40px; }
|
||||||
|
|
||||||
|
#snippets-list li { background: none; }
|
||||||
|
|
||||||
|
#snippets-list li em {
|
||||||
|
background-position: left 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#snippets-list li strong {
|
||||||
|
margin-left: 18px;
|
||||||
|
display: block;
|
||||||
|
height: 31px;
|
||||||
|
background: transparent url(/images/admin/list/item-right.png) no-repeat right 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* ___ pages ___ */
|
/* ___ pages ___ */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user