Skip to content
Browse files

More UX changes for view objects admin pages

  • Loading branch information...
1 parent 34edb23 commit 59ef24e330684578db4afce45e68b98072afa71d @adahmash adahmash committed
View
2 app/controllers/admin/custom_widgets_controller.rb
@@ -2,7 +2,7 @@ class Admin::CustomWidgetsController < AdminController
def index
render 'shared/admin/index_page', :layout => 'new_admin', :locals => {
- :items => Metadata.meta_type('custom_widget').paginate(:page => params[:page], :per_page => 20, :order => "created_at desc"),
+ :items => Metadata.meta_type('custom_widget').paginate(:page => params[:page], :per_page => 20, :order => "name asc"),
:model => Metadata,
:fields => [:meta_type, :key_name, :created_at],
:paginate => true
View
1 app/controllers/admin/view_objects_controller.rb
@@ -6,6 +6,7 @@ class Admin::ViewObjectsController < AdminController
#config.show_fields = [:name, :view_object_template_id]
config.actions = [:index]
config.associations = { :belongs_to => { :view_object_template => :view_object_template_id } }
+ config.order_by = "name asc"
end
def new
View
2 app/controllers/admin_controller.rb
@@ -50,6 +50,8 @@ def self.admin_scaffold(model_id = nil, &block)
@config = self.admin_scaffold_config
if @config.extra_scopes and @config.extra_scopes.any?
@items = @config.model_klass.send(@config.extra_scopes.first).paginate(:page => params[:page], :per_page => 20, :order => "created_at desc")
+ elsif !@config.order_by.blank?
+ @items = @config.model_klass.paginate(:page => params[:page], :per_page => 20, :order => @config.order_by)
else
@items = @config.model_klass.paginate(:page => params[:page], :per_page => 20, :order => "created_at desc")
end
View
6 app/helpers/admin_helper.rb
@@ -9,6 +9,8 @@ def gen_index_page(collection, model, fields, options = {})
html = []
if model.name == "ViewObject"
html << "<br /><h1>Manage Widgets</h1"
+ elsif model.name == "Metadata::CustomWidget"
+ html << "<br /><h1>Manage Custom Widgets</h1"
else
html << "<br /><h1>#{@model_list_name} List</h1"
end
@@ -44,7 +46,9 @@ def gen_show_page(item, fields, options = {})
def gen_new_link model
set_model_vars model
if model.name == "ViewObject"
- [link_to("Create New Automated Widget", new_admin_view_object_path), link_to("Create New Curated Widget", new_curated_admin_view_objects_path)].join(" | ")
+ [link_to("Create New Automated Widget", new_admin_view_object_path), link_to("Create New Curated Widget", new_curated_admin_view_objects_path), link_to("Manage Custom Widgets", admin_metadata_custom_widgets_path)].join(" | ")
+ elsif model.name == "Metadata::CustomWidget"
+ link_to "Create New Custom Widget", new_polymorphic_path([:admin, model])
elsif model.name != 'Topic'
link_to "New #{@model_name}", new_polymorphic_path([:admin, model])
end
View
2 app/views/layouts/new_admin.html.haml
@@ -68,7 +68,7 @@
%li= link_to 'Manage Widgets', admin_view_objects_path
- else
%li= link_to 'Arrange Layout', new_widgets_admin_widgets_path
- %li= link_to 'Custom Widgets', admin_metadata_custom_widgets_path
+ %li= link_to 'Custom Widgets', admin_metadata_custom_widgets_path
%li= link_to 'Flagged Items', admin_flags_path
%li= link_to 'Stories', admin_contents_path
%li= link_to 'Comments', admin_comments_path

0 comments on commit 59ef24e

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