Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplified admin views

  • Loading branch information...
commit 66cab3adb8aec77be46b3f9e0bbbb9abed5852e0 1 parent 2eb39d7
@wlodars wlodars authored
View
2  app/controllers/sessions_controller.rb
@@ -15,7 +15,7 @@ def create
redirect_to admin_url
else
flash[:error] = "Invalid login or password!"
- render :action => :new
+ redirect_to login_url
end
end
View
32 app/helpers/admin/categories_helper.rb
@@ -6,4 +6,36 @@ def admin_category_nav_item(category)
def show_save_category(category_id)
"Element.show('saveCategory#{category_id}')"
end
+
+ def link_to_delete_category(category_id)
+ link_to_remote(image_tag("icon-delete.png", :alt => 'Delete') + " Delete", {
+ :url => admin_category_url(category_id),
+ :confirm => 'Are you sure you want to delete this category?',
+ :method => :delete },
+ { :class => 'deleteCategory'})
+ end
+
+ def link_to_save_category(category_id)
+ link_to_remote(image_tag("disk.png", :alt => 'Save') + " Save", {
+ :url => admin_category_url(category_id),
+ :method => :put,
+ :with => "'name='+$F('name[#{category_id}]')+'&url='+$F('url[#{category_id}]')" },
+ { :id => "saveCategory#{category_id}",
+ :class => 'saveCategory', :style => 'display:none;' })
+ end
+
+ def sortable_element_categories_container
+ sortable_element "categoriesContainer",
+ :url => saveorder_admin_categories_path,
+ :tag => "div",
+ :complete => visual_effect(:highlight, 'categoriesContainer')
+ end
+
+ def link_to_add_category
+ link_to_remote image_tag("add.png", :alt => 'Add') + " Add new category",
+ :url => admin_categories_path,
+ :method => :post,
+ :loading => "Element.show('overlay')",
+ :complete => "Element.hide('overlay');"
+ end
end
View
26 app/helpers/admin/jobs_helper.rb
@@ -4,6 +4,30 @@ def activation_image_tag(job)
unless job.is_active
activate = "de" + activate
end
- image_tag("icon_#{activate}.gif", :alt => activate.capitalize, :id => "activate_#{job.id}")
+ image_tag("icon_#{activate}.gif",
+ :alt => activate.capitalize,
+ :id => "activate_#{job.id}")
+ end
+
+ def link_to_activate_deactivate_job(job)
+ link_to_remote(activation_image_tag(job), {
+ :url => admin_job_url(job.id),
+ :method => :put,
+ :loading => "Element.hide('activ_butt_#{job.id}');Element.show('loading_#{job.id}')",
+ :complete => "Element.hide('loading_#{job.id}');Element.show('activ_butt_#{job.id}')"},
+ { :id => "activ_butt_#{job.id}"} )
+ end
+
+ def link_to_delete_job(job_id)
+ link_to_remote(image_tag("icon-delete.png", :alt => 'Delete'),
+ :url => admin_job_url(job_id),
+ :confirm => 'Are you sure you want to delete this post?',
+ :method => :delete)
+ end
+
+ def saving_job_image_tag(job_id)
+ image_tag("ajax-loader.gif", :alt => "Saving...",
+ :style => 'display:none',
+ :id => "loading_#{job_id}")
end
end
View
4 app/views/admin/categories/_category.html.haml
@@ -2,8 +2,8 @@
.categoryHandle
.categoryWrapper
.categoryManagement{:style => 'float:right;width:10%;'}
- = link_to_remote(image_tag("icon-delete.png", :alt => 'Delete') + " Delete", {:url => admin_category_url(category.id), :confirm => 'Are you sure you want to delete this category?', :method => :delete}, {:class => 'deleteCategory'})
- = link_to_remote(image_tag("disk.png", :alt => 'Save') + " Save", {:url => admin_category_url(category.id), :method => :put, :with => "'name='+$F('name[#{category.id}]')+'&url='+$F('url[#{category.id}]')"}, {:id => "saveCategory#{category.id}", :class => 'saveCategory', :style => 'display:none;'})
+ = link_to_delete_category(category.id)
+ = link_to_save_category(category.id)
%label
%span Name:
= text_field_tag "name[#{category.id}]", category.name, :size => 60
View
3  app/views/admin/categories/create.js.rjs
@@ -1,5 +1,6 @@
page.insert_html :bottom, 'categoriesContainer', :partial => 'admin/categories/category'
-page.sortable 'categoriesContainer', :tag => 'div', :url => saveorder_admin_categories_path
+page.sortable 'categoriesContainer', :tag => 'div', :url => saveorder_admin_categories_path,
+ :complete => visual_effect(:highlight, 'categoriesContainer')
@category = nil
page.replace_html "categories", :partial => 'admin/categories/list'
page.display_notice
View
4 app/views/admin/categories/index.html.haml
@@ -3,9 +3,9 @@
#categoriesContainer
= partial @categories
-= sortable_element "categoriesContainer", :url => saveorder_admin_categories_path, :tag => "div", :complete => visual_effect(:highlight, 'categoriesContainer')
+= sortable_element_categories_container
#overlay{:style => "display: none; top: 145px; left: 157px;height: 72px;"}
= image_tag("ajax-loader.gif", :alt => "Loading...")
%p
- = link_to_remote image_tag("add.png", :alt => 'Add') + " Add new category", :url => admin_categories_path, :method => :post, :loading => "Element.show('overlay')", :complete => "Element.hide('overlay');"
+ = link_to_add_category
View
6 app/views/admin/jobs/_jobs_table.html.haml
@@ -16,10 +16,10 @@
%td{:style => 'text-align:left;width:15%'}
-# activate/deactivate link
- = link_to_remote(activation_image_tag(job), {:url => admin_job_url(job.id), :method => :put, :loading => "Element.hide('activ_butt_#{job.id}');Element.show('loading_#{job.id}')", :complete => "Element.hide('loading_#{job.id}');Element.show('activ_butt_#{job.id}')"}, {:id => "activ_butt_#{job.id}"})
- = image_tag("ajax-loader.gif", :alt => "Saving...", :style => 'display:none', :id => "loading_#{job.id}")
+ = link_to_activate_deactivate_job(job)
+ = saving_job_image_tag(job.id)
-# delete link
- = link_to_remote(image_tag("icon-delete.png", :alt => 'Delete'), :url => admin_job_url(job.id), :confirm => 'Are you sure you want to delete this post?', :method => :delete)
+ = link_to_delete_job(job.id)
- else
#no-ads No jobs, yet.

0 comments on commit 66cab3a

Please sign in to comment.
Something went wrong with that request. Please try again.