Skip to content

Commit

Permalink
Add Documents Section to Theme Assets
Browse files Browse the repository at this point in the history
  • Loading branch information
rpmessner committed Dec 11, 2012
1 parent 155ac40 commit 72d4cfa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Expand Up @@ -22,6 +22,8 @@ class Locomotive.Views.ThemeAssets.IndexView extends Backbone.View

@render_media()

@render_documents()

return @

build_uploader: ->
Expand Down Expand Up @@ -65,6 +67,9 @@ class Locomotive.Views.ThemeAssets.IndexView extends Backbone.View
render_media: ->
@render_list 'media', @options.media, Locomotive.Views.ThemeAssets.ListView, ich.media_list

render_documents: ->
@render_list 'documents', @options.documents, Locomotive.Views.ThemeAssets.ListView, ich.documents_list

render_list: (type, collection, view_klass, template) ->
return if @$("##{type}-anchor").size() == 0

Expand Down
2 changes: 1 addition & 1 deletion app/uploaders/locomotive/theme_asset_uploader.rb
Expand Up @@ -10,7 +10,7 @@ def store_dir
end

def extension_white_list
%w(jpg jpeg gif png css scss js coffee swf flv eot svg ttf woff otf ico htc)
%w(jpg jpeg gif pdf doc docx png css scss js coffee swf flv eot svg ttf woff otf ico htc)
end

def self.url_for(site, path)
Expand Down
5 changes: 4 additions & 1 deletion app/views/locomotive/theme_assets/index.html.haml
Expand Up @@ -13,12 +13,14 @@
- if can?(:manage, Locomotive::ThemeAsset)
= render 'list', :name => 'js_and_css', :title => t('.css_and_js'), :empty_message => t('.no_items', :url => new_theme_asset_url)
= render 'list', :name => 'fonts', :title => t('.fonts'), :empty_message => t('.no_items', :url => new_theme_asset_url)
= render 'list', :name => 'documents', :title => t('.documents'), :empty_message => t('.no_items', :url => new_theme_asset_url)

- content_for :backbone_view_data do
:plain
snippets: #{j can?(:manage, Locomotive::Snippet) ? @snippets.map { |snippet| snippet.to_presenter.as_json_for_html_view }.to_json.html_safe : 'null'},
images: #{j theme_assets_to_json(@assets[:images]).html_safe},
media: #{j theme_assets_to_json(@assets[:media]).html_safe},
documents: #{j can?(:manage, Locomotive::ThemeAsset) ? theme_assets_to_json(@assets[:pdfs]).html_safe : 'null'},
js_and_css_assets: #{j can?(:manage, Locomotive::ThemeAsset) ? theme_assets_to_json(@js_and_css_assets).html_safe : 'null'},
fonts: #{j can?(:manage, Locomotive::ThemeAsset) ? theme_assets_to_json(@assets[:fonts]).html_safe : 'null'}

Expand Down Expand Up @@ -46,5 +48,6 @@

- if can?(:manage, Locomotive::ThemeAsset)
#fonts-anchor


#documents-anchor
#media-anchor

0 comments on commit 72d4cfa

Please sign in to comment.