files wip

Oleg committed Aug 08, 2011
commit b555c2364b1bd8b631f9c89fe3a92626dac5cd52
Showing 8 changed files with 53 additions and 3 deletions
app/assets/stylesheets/comfortable_mexican_sofa/content.css +4 -2
@@ @@ -2,7 +2,6 @@
#mirrors.box select {
width: 100%;
}
-
/* -- Page saving widget ------------------------------------------------- */
#page_save button {
float: right;
@@ @@ -125,7 +124,10 @@
#cms_body ul.list li .item:hover {
background-color: #fff;
}
-
+ /* -- Missing Translations ---------------------------------------------- */
+ #cms_body .translation_missing {
+ text-decoration: blink;
+ }
/* -- Page Specific stuff ------------------------------------------------ */
.c_cms_admin_sites.a_index ul.list li .item .label,
.c_cms_admin_layouts.a_index ul.list li .item .label,
app/controllers/cms_admin/files_controller.rb +10 -1
@@ @@ -2,9 +2,14 @@ class CmsAdmin::FilesController < CmsAdmin::BaseController
skip_before_filter :load_fixtures
- before_filter :load_file, :only => :destroy
+ before_filter :build_file, :only => [:new, :create]
+ before_filter :load_file, :only => [:edit, :update, :destroy]
def index
+ @files = @site.files
+ end
+
+ def new
render
end
@@ @@ -20,6 +25,10 @@ class CmsAdmin::FilesController < CmsAdmin::BaseController
end
protected
+
+ def build_file
+ @file = @site.files.new(params[:file])
+ end
def load_file
@file = @site.files.find(params[:id])
app/views/cms_admin/files/_form.html.erb +5 -0
@@ @@ -0,0 +1,5 @@
+
+
+ <%= form.simple_field nil, nil, :class => 'submit_element' do %>
+ <%= form.submit t(@file.new_record?? '.create' : '.update'), :disable_builder => true %>
+ <% end %>
app/views/cms_admin/files/edit.html.erb +5 -0
@@ @@ -0,0 +1,5 @@
+ <h1><%= t('.title')%></h1>
+
+ <%= cms_form_for @file, :as => :file, :url => {:action => :update} do |form| %>
+ <%= render :partial => 'form', :object => form %>
+ <% end %>
\ No newline at end of file
app/views/cms_admin/files/index.html.erb +22 -0
@@ @@ -0,0 +1,22 @@
+ <%= link_to span_tag(t('.new_link')), new_cms_admin_site_file_path(@site), :class => 'big button' %>
+ <h1><%= t('.title')%></h1>
+
+ <ul class='list'>
+ <% @files.each do |file| %>
+ <li id='<%= dom_id(file) %>'>
+ <div class='item'>
+ <div class='icon'></div>
+ <div class='action_links'>
+ <%= link_to t('.edit'), edit_cms_admin_site_file_path(@site, file) %>
+ <%= link_to t('.delete'), cms_admin_site_file_path(@site, file), :method => :delete, :confirm => t('.are_you_sure') %>
+ </div>
+ <div class='label'>
+ <%= link_to file.file_file_name, edit_cms_admin_site_file_path(@site, file) %>
+ <div class='sublabel'>
+ <%= link_to file.file_file_name, edit_cms_admin_site_file_path(@site, file) %>
+ </div>
+ </div>
+ </div>
+ </li>
+ <% end %>
+ </ul>
app/views/cms_admin/files/new.html.erb +5 -0
@@ @@ -0,0 +1,5 @@
+ <h1><%= t('.title') %></h1>
+
+ <%= cms_form_for @file, :as => :file, :url => {:action => :create} do |form| %>
+ <%= render :partial => 'form', :object => form %>
+ <% end %>
app/views/layouts/cms_admin/_left.html.erb +1 -0
@@ @@ -4,6 +4,7 @@
<li><%= active_link_to t('cms_admin.base.layouts'), cms_admin_site_layouts_path(@site) %></li>
<li><%= active_link_to t('cms_admin.base.pages'), cms_admin_site_pages_path(@site) %></li>
<li><%= active_link_to t('cms_admin.base.snippets'), cms_admin_site_snippets_path(@site) %></li>
+ <li><%= active_link_to t('cms_admin.base.files'), cms_admin_site_files_path(@site) %></li>
<% end %>
<%= cms_hook :navigation %>
</ul>
config/locales/en.yml +1 -0
@@ @@ -89,6 +89,7 @@ en:
layouts: Layouts
pages: Pages
snippets: Snippets
+ files: Files
sites:
index: