Skip to content

Commit

Permalink
HAMLized tags directory
Browse files Browse the repository at this point in the history
git-svn-id: file:///data/subversion/eol/trunk@2035 78829999-583a-0410-bd01-8a9b849fd409
  • Loading branch information
pleary committed Jun 9, 2010
1 parent 0843308 commit 6a14bbf
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 0 deletions.
File renamed without changes.
48 changes: 48 additions & 0 deletions app/views/tags/_private.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#private_data_object_tags_container
%input{ :type => "hidden", :name => "tagging_data_object", :value => @data_object.id }
- div_style = visible ? '' : 'display: none;'
#private_data_object_tags.data_object_tagging{ :style => div_style }
#my_data_object_tags
%h1
= image_tag 'icons/ProfileTag.gif'
My Tags
.clear_both
- if logged_in?
- unless tags.empty?
- for key in tag_keys(tags)
.data_object_tag_key_values.values
- for value in tag_values_for_key(key, tags)
= render :partial => 'tag_key_value', :locals => { :key => key, :value => value, :can_delete => true }
- else
%h2
You have not tagged this image yet.
- elsif $ALLOW_USER_LOGINS
%h2
You must be
= link_to 'logged in', login_path(:params => { :return_to => request.env["HTTP_REFERER"].blank? ? root_url : URI.parse(request.env["HTTP_REFERER"]).path })
to add your own tags.

- if logged_in?
#add_data_object_tags{ :style => "" }
%h1
= image_tag 'icons/plusIcon.gif'
Add Image Tags
%h2
Separate tags with spaces; category is optional
#add_data_object_tags_fields.clear_both
- form_tag data_object_tags_path(data_object.id) do
.label
%span
Category
.values
%div
= text_field_tag 'tag[key]', nil, :class => 'autocomplete', 'autocomplete_url' => autocomplete_for_tag_key_data_object_tags_path(@data_object.id)
%br
.label
%span
Add Tag
.values
%div
= text_field_tag 'tag[value]', nil, :class => 'autocomplete', 'autocomplete_url' => autocomplete_for_tag_value_data_object_tag_path(@data_object.id,'TAG_KEY_GOES_HERE')
%br
= submit_tag 'Add this tag',:class=>'tag-submit',:onclick=>'showPopupAjaxIndicator();'
File renamed without changes.
22 changes: 22 additions & 0 deletions app/views/tags/_public.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#public_data_object_tags_container
- div_style = visible ? '' : 'display: none;'
#public_data_object_tags.data_object_tagging{ :style => div_style }
#data_object_tags
%h1
= image_tag 'icons/tag.gif'
Public Image Tags
- unless tags.empty?
- for key in tag_keys(tags)
.clear_both
.data_object_tag_key_values.values
- for value in tag_values_for_key(key, tags)
= render :partial => 'tag_key_value', :locals => { :key => key, :value => value, :can_delete => false }
- else
%h2
This image has no public tags.
- if !logged_in? && $ALLOW_USER_LOGINS
%br
%h2
You must be
= link_to('logged in', login_path(:params => { :return_to => request.env["HTTP_REFERER"].blank? ? root_url : URI.parse(request.env["HTTP_REFERER"]).path}), {:class => "login_link"})
to add your own tags.
File renamed without changes.
16 changes: 16 additions & 0 deletions app/views/tags/_tag_key_value.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- # this renders a single, tag_key_value ... eg:
- # key: [tag_key_value] [tag_key_value]
- # key: [tag_key_value]
- # key: [tag_key_value] [tag_key_value]
- # [tag_key_value]

- data_object = @data_object if @data_object # ...
- tag_string = key != 'none' ? key + ":" + value : value
- escaped_tag=CGI.escape(key + ':' + value)

%span.data_object_tag_key_value
= link_to tag_string, "#{data_object_tags_path(data_object.id)}/#{escaped_tag}"
- # the above URL doesn't work *YET* %>
- unless can_delete == false
- form_tag "#{data_object_tags_path(data_object.id)}/#{escaped_tag}", :method => 'delete' do
= submit_tag '', :class => 'destroy-x',:onclick=>'showPopupAjaxIndicator();'
File renamed without changes.
7 changes: 7 additions & 0 deletions app/views/tags/public_or_private.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#public_and_private_data_object_tags
%span#ajax-indicator-popup{ :style => "display:none;", :class => "pop-up-ajax-indicator" }
= image_tag('indicator_arrows_black.gif')
- if @public_tags
= render :partial => "public", :locals => { :data_object => @data_object, :tags => @public_tags, :visible => true }
- if logged_in? && $ALLOW_USER_LOGINS
= render :partial => "private", :locals => { :data_object => @data_object, :tags => @private_tags, :visible => true }
59 changes: 59 additions & 0 deletions app/views/tags/search.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
%style{ :type => "text/css", :media => "screen" }
:plain
#tag-search-results {
margin: 15px;
}
#tag-search-results form {
margin-bottom: 15px;
}
#tag-search-results h1 {
font-size: 1.2em;
padding-bottom: 10px;
}
#tag-search-results>ul {
padding-left: 10px;
}
#tag-search-results>ul>li {
height: 60px;
padding: 5px;
}
.thumbnail {
background-color:#F4F4F4;
display:block;
float: left;
height:48px;
margin:2px 0 0 2px;
padding:2px 2px 2px 0;
width:68px;
}

#tag-search-results
- form_tag search_tags_path, :method => 'get' do
= text_field_tag :q, params[:q]
= submit_tag 'Search by Tag'
= clade_selector :text => 'filter by clade', :value => params['selected-clade-id']
%ul
- unless @data_objects.nil? or @data_objects.empty?
%h1
Search results for
= params[:q]
- for data_object in @data_objects
%li
%img.thumbnail{ :src => data_object.thumbnail_cache_url, :alt => "Image #{data_object.id}" }
.data_object_tagging{ :style => "float: left; width: 200px; height: 60px;" }
- for key in tag_keys(data_object.tags)
.clear_both
.data_object_tag_key.label
%span
= key
.data_object_tag_key_values.values
- for value in tag_values_for_key(key, data_object.tags)
= render :partial => 'tag_key_value', :locals => { :key => key, :value => value, :can_delete => false, :data_object => data_object }
%div{ :style => "float: left; width: 650px; height: 60px; overflow: auto;" }
- for taxon_concept in data_object.taxon_concepts
= link_to taxon_concept.name[0,40], taxon_path(taxon_concept)
- else
- if params[:q]
%p
No objects found tagged with
= params[:q]

0 comments on commit 6a14bbf

Please sign in to comment.