i think ui is pretty good now
Oleg
committed Aug 24, 2011
commit 24576c0c1d45da7c0a73538dd40f6961cd834d55
Showing 10
changed files with
115 additions
and 23 deletions
app/assets/stylesheets/comfortable_mexican_sofa/content.css
+43
-9
| @@ | @@ -73,18 +73,15 @@ |
| #cms_body .categories_widget { | |
| margin-bottom: 10px; | |
| background-color: #252525; | |
| - | padding: 5px 5px 5px 10px; |
| + | padding: 5px 5px 0px 10px; |
| border-radius: 5px; | |
| color: #fff; | |
| } | |
| #cms_body .categories_widget .label { | |
| float: left; | |
| + | font: 12px 'Lucida Grande', Tahoma, sans-serif; |
| width: 100px; | |
| } | |
| - | #cms_body .categories_widget .label span { |
| - | float: left; |
| - | font: 12px 'Lucida Grande','Tahoma', sans-serif; |
| - | } |
| #cms_body .categories_widget a.action_link.edit { | |
| float: right; | |
| margin-left: 10px; | |
| @@ | @@ -98,19 +95,56 @@ |
| } | |
| #cms_body .categories_widget .category { | |
| float: left; | |
| + | overflow: hidden; |
| background-color: #484848; | |
| border-radius: 3px; | |
| color: #fff; | |
| + | height: 9px; |
| padding: 3px 5px; | |
| - | margin: 0px 3px 0px 3px; |
| + | margin: 0px 5px 5px 0px; |
| } | |
| #cms_body .categories_widget .category a { | |
| - | display: block; |
| + | float: left; |
| color: #a3a3a3; | |
| - | font: 9px/9px 'Arial', serif; |
| + | font: 9px/9px Arial, serif; |
| text-transform: uppercase; | |
| } | |
| - | |
| + | #cms_body .categories_widget .category a:hover { |
| + | color: #fff; |
| + | } |
| + | #cms_body .categories_widget .category a.delete { |
| + | float: right; |
| + | margin-left: 5px; |
| + | background-color: #b7b7b7; |
| + | color: #000; |
| + | font: bold 7px/7px Arial, sans-serif; |
| + | padding: 1px 3px; |
| + | border-radius: 4px; |
| + | } |
| + | #cms_body .categories_widget .category a.delete:hover { |
| + | background-color: #fff; |
| + | } |
| + | #cms_body .categories_widget .category.new, |
| + | #cms_body .categories_widget .category.edit { |
| + | height: 15px; |
| + | padding: 0px; |
| + | } |
| + | #cms_body .categories_widget form input[type='text'] { |
| + | float: left; |
| + | width: 120px; |
| + | border: 0px; |
| + | padding: 1px 2px; |
| + | font: 11px/11px Arial, serif; |
| + | border-radius: 2px; |
| + | } |
| + | #cms_body .categories_widget form input[type='submit'] { |
| + | float: right; |
| + | font: 9px Arial, sans-serif; |
| + | padding: 1px 2px; |
| + | border: 0px; |
| + | border-radius: 2px; |
| + | margin-left: 5px; |
| + | } |
| /* -- Listings ----------------------------------------------------------- */ | |
| #cms_body ul.list li .item { | |
| overflow: hidden; | |
app/controllers/cms_admin/categories_controller.rb
+33
-0
| @@ | @@ -0,0 +1,33 @@ |
| + | class CmsAdmin::CategoriesController < CmsAdmin::BaseController |
| + | |
| + | before_filter :load_category, :only => [:edit, :update, :destroy] |
| + | |
| + | def edit |
| + | render |
| + | end |
| + | |
| + | def create |
| + | @category = Cms::Category.create!(params[:category]) |
| + | rescue |
| + | render :nothing => true |
| + | end |
| + | |
| + | def update |
| + | @category.update_attributes!(params[:category]) |
| + | rescue |
| + | render :nothing => true |
| + | end |
| + | |
| + | def destroy |
| + | @category.destroy |
| + | end |
| + | |
| + | protected |
| + | |
| + | def load_category |
| + | @category = Cms::Category.find(params[:id]) |
| + | rescue ActiveRecord::RecordNotFound |
| + | render :nothing => true |
| + | end |
| + | |
| + | end |
| \ No newline at end of file | |
app/views/cms_admin/categories/_edit.html.erb
+7
-0
| @@ | @@ -0,0 +1,7 @@ |
| + | <% category ||= edit %> |
| + | <div class='category edit' id='<%= dom_id(category) %>'> |
| + | <%= form_for @category, :as => :category, :url => cms_admin_site_category_path(@site, category), :remote => true do |form| %> |
| + | <%= form.text_field :label %> |
| + | <%= form.submit t('.save') %> |
| + | <% end %> |
| + | </div> |
| \ No newline at end of file | |
app/views/cms_admin/categories/_index.html.erb
+9
-14
| @@ | @@ -2,10 +2,7 @@ |
| <div class='categories_widget'> | |
| - | <div class='label'> |
| - | <span><%= t('.label') %></span> |
| - | </div> |
| - | |
| + | <div class='label'><%= t('.label') %></div> |
| <%= link_to t('.edit'), '#', :class => 'action_link edit' %> | |
| <div class='categories'> | |
| @@ | @@ -13,16 +10,14 @@ |
| <%= link_to t('.all'), '' %> | |
| </div> | |
| <% Cms::Category.of_type(type).each do |category| %> | |
| - | <div class='category' id="<%= dom_id(category)%>"> |
| - | <%= link_to category.label, '' %> |
| - | </div> |
| - | <% end %> |
| - | <!-- > |
| - | <%= form_for :category, :url => cms_admin_site_categories_path(@site), :remote => true do |form| %> |
| - | <%= form.text_field :label %> |
| - | <%= form.submit t('.add') %> |
| + | <%= render :partial => 'cms_admin/categories/show', :object => category %> |
| <% end %> | |
| - | < --> |
| + | <div class='category new'> |
| + | <%= form_for :category, :url => cms_admin_site_categories_path(@site), :remote => true do |form| %> |
| + | <%= form.hidden_field :categorized_type, :value => type %> |
| + | <%= form.text_field :label %> |
| + | <%= form.submit t('.add') %> |
| + | <% end %> |
| + | </div> |
| </div> | |
| - | |
| </div> | |
| \ No newline at end of file | |
app/views/cms_admin/categories/_show.html.erb
+5
-0
| @@ | @@ -0,0 +1,5 @@ |
| + | <% category ||= show %> |
| + | <div class='category' id="<%= dom_id(category)%>"> |
| + | <%= link_to category.label, edit_cms_admin_site_category_path(@site, category), :remote => true %> |
| + | <%= link_to 'x', cms_admin_site_category_path(@site, category), :method => :delete, :remote => true, :confirm => t('.are_you_sure'), :class => 'delete' %> |
| + | </div> |
| \ No newline at end of file | |
app/views/cms_admin/categories/create.js.erb
+4
-0
| @@ | @@ -0,0 +1,4 @@ |
| + | $('.categories_widget .category.new').before( |
| + | '<%= escape_javascript(render :partial => "show", :object => @category ) %>' |
| + | ); |
| + | $('.categories_widget .category.new form input#category_label').val(''); |
| \ No newline at end of file | |
app/views/cms_admin/categories/destroy.js.erb
+3
-0
| @@ | @@ -0,0 +1,3 @@ |
| + | $('.category#<%= dom_id(@category) %>').fadeOut('slow', function(){ |
| + | $(this).remove() |
| + | }) |
| \ No newline at end of file | |
app/views/cms_admin/categories/edit.js.erb
+3
-0
| @@ | @@ -0,0 +1,3 @@ |
| + | $('.category#<%= dom_id(@category) %>').replaceWith( |
| + | '<%= escape_javascript(render :partial => "edit", :object => @category ) %>' |
| + | ); |
| \ No newline at end of file | |
app/views/cms_admin/categories/update.js.erb
+3
-0
| @@ | @@ -0,0 +1,3 @@ |
| + | $('.category#<%= dom_id(@category) %>').replaceWith( |
| + | '<%= escape_javascript(render :partial => "show", :object => @category ) %>' |
| + | ); |
| \ No newline at end of file | |
config/locales/en.yml
+5
-0
| @@ | @@ -202,6 +202,11 @@ en: |
| label: Categories | |
| edit: Edit | |
| all: All | |
| + | add: add |
| + | show: |
| + | are_you_sure: Are you sure? |
| + | edit: |
| + | save: Save |
| form: | |
| label: Categories | |
| \ No newline at end of file | |