summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2011-08-31 12:47:42 +0200
committermr <mr@mrautenberg.de>2011-08-31 12:47:42 +0200
commitc6e75e0028c8e3d45a236b8d79f3c0d15092da61 (patch)
tree0ab3d7fecf6ecc365ec33b8e17fb88589cb4382f
parentaeb03ab4a64353d51830d14dbd82f5d19c7254c6 (diff)
optimize models navigation | put authorized to view model to application.rb
-rw-r--r--application.rb1
-rw-r--r--public/arrow_down.pngbin0 -> 411 bytes
-rw-r--r--public/arrow_up.pngbin0 -> 394 bytes
-rw-r--r--views/models.haml3
-rw-r--r--views/models_navigation.haml6
-rw-r--r--views/style.sass2
6 files changed, 6 insertions, 6 deletions
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
--- /dev/null
+++ b/public/arrow_down.png
Binary files differ
diff --git a/public/arrow_up.png b/public/arrow_up.png
new file mode 100644
index 0000000..70417dc
--- /dev/null
+++ b/public/arrow_up.png
Binary files 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"}= "&dArr;"
+ #up{:class => "link"}
+ %img{:src => "arrow_down.png", :alt => 'in ascending order', :title => 'in ascending order'}/
- else
- #down{:class => "link"}= "&uArr;"
+ #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