From c6e75e0028c8e3d45a236b8d79f3c0d15092da61 Mon Sep 17 00:00:00 2001 From: mr Date: Wed, 31 Aug 2011 12:47:42 +0200 Subject: optimize models navigation | put authorized to view model to application.rb --- application.rb | 1 + public/arrow_down.png | Bin 0 -> 411 bytes public/arrow_up.png | Bin 0 -> 394 bytes views/models.haml | 3 +-- views/models_navigation.haml | 6 ++++-- views/style.sass | 2 -- 6 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 public/arrow_down.png create mode 100644 public/arrow_up.png diff --git a/application.rb b/application.rb index 13bc02d..12784f0 100644 --- a/application.rb +++ b/application.rb @@ -107,6 +107,7 @@ get '/models/?' do @models = ToxCreateModel.all.sort(:order => "DESC") unless @models @models.each{|m| raise "internal redis error: model is nil" unless m} + @models.delete_if{|m| !is_authorized(m.web_uri, "GET")} haml :models, :locals=>{:models=>@models} end diff --git a/public/arrow_down.png b/public/arrow_down.png new file mode 100644 index 0000000..d298656 Binary files /dev/null and b/public/arrow_down.png differ diff --git a/public/arrow_up.png b/public/arrow_up.png new file mode 100644 index 0000000..70417dc Binary files /dev/null and b/public/arrow_up.png differ diff --git a/views/models.haml b/views/models.haml index 6a181df..1419e37 100644 --- a/views/models.haml +++ b/views/models.haml @@ -17,11 +17,10 @@ = haml :regression, :layout => false = haml :similarity, :layout => false = haml :significant_fragments, :layout => false --# - if is_authorized(model.web_uri, "GET") - first = 5*@page - last = first+4 -= models_navigation += models_navigation if @models.size > 1 - if @models[first..last] - @models[first..last].each do |model| = haml :model, :locals=>{:model=>model}, :layout => false diff --git a/views/models_navigation.haml b/views/models_navigation.haml index fa5bd31..d324fce 100644 --- a/views/models_navigation.haml +++ b/views/models_navigation.haml @@ -13,9 +13,11 @@ %div{:id => idname, :class => "active"} %span="#{idname}" - if params[:order] == "ASC" - #up{:class => "link"}= "⇓" + #up{:class => "link"} + %img{:src => "arrow_down.png", :alt => 'in ascending order', :title => 'in ascending order'}/ - else - #down{:class => "link"}= "⇑" + #down{:class => "link"} + %img{:src => "arrow_up.png", :alt => 'in descending order', :title => 'in descending order'}/ - else %div{:id => idname, :class => "link"}="#{idname}" | diff --git a/views/style.sass b/views/style.sass index 9f055e4..56eee02 100644 --- a/views/style.sass +++ b/views/style.sass @@ -288,5 +288,3 @@ dl padding: 0 1px .thin font-weight: 100 - span - text-decoration: underline -- cgit v1.2.3